aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/charset/ci_string.cpp
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/charset/ci_string.cpp
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/charset/ci_string.cpp')
-rw-r--r--library/cpp/charset/ci_string.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/charset/ci_string.cpp b/library/cpp/charset/ci_string.cpp
index 9efa3e21cd..6097e40131 100644
--- a/library/cpp/charset/ci_string.cpp
+++ b/library/cpp/charset/ci_string.cpp
@@ -1,41 +1,41 @@
-#include "ci_string.h"
-
-int TCiString::compare(const TCiString& s1, const TCiString& s2, const CodePage& cp) {
+#include "ci_string.h"
+
+int TCiString::compare(const TCiString& s1, const TCiString& s2, const CodePage& cp) {
return cp.stricmp(s1.data(), s2.data());
-}
-
-int TCiString::compare(const char* p, const TCiString& s2, const CodePage& cp) {
+}
+
+int TCiString::compare(const char* p, const TCiString& s2, const CodePage& cp) {
return cp.stricmp(p, s2.data());
-}
-
-int TCiString::compare(const TCiString& s1, const char* p, const CodePage& cp) {
+}
+
+int TCiString::compare(const TCiString& s1, const char* p, const CodePage& cp) {
return cp.stricmp(s1.data(), p);
-}
-
+}
+
int TCiString::compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp) {
int rv = cp.strnicmp(p1.data(), p2.data(), Min(p1.size(), p2.size()));
return rv ? rv : p1.size() < p2.size() ? -1 : p1.size() == p2.size() ? 0 : 1;
-}
-
+}
+
bool TCiString::is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
size_t len = what.size();
return len <= of.size() && cp.strnicmp(what.data(), of.data(), len) == 0;
-}
-
+}
+
bool TCiString::is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
size_t len = what.size();
size_t slen = of.size();
return (len <= slen) && (0 == cp.strnicmp(what.data(), of.data() + slen - len, len));
-}
-
-size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) {
- size_t h = len;
- for (; /* (*s) && */ len--; ++s)
- h = 5 * h + cp.ToLower(*s);
- return h;
-}
-
-template <>
+}
+
+size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) {
+ size_t h = len;
+ for (; /* (*s) && */ len--; ++s)
+ h = 5 * h + cp.ToLower(*s);
+ return h;
+}
+
+template <>
void Out<TCiString>(IOutputStream& o, const TCiString& p) {
o.Write(p.data(), p.size());
-}
+}