diff options
author | mowgli <mowgli@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
commit | 56c39b3cf908e7202b1f7551a1653681e8015607 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/charset | |
parent | 89afbbe4ca0e02e386dd4df08f7945f190dc1b84 (diff) | |
download | ydb-56c39b3cf908e7202b1f7551a1653681e8015607.tar.gz |
Restoring authorship annotation for <mowgli@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/charset')
-rw-r--r-- | util/charset/unidata.h | 28 | ||||
-rw-r--r-- | util/charset/wide.h | 16 | ||||
-rw-r--r-- | util/charset/wide_ut.cpp | 2 |
3 files changed, 23 insertions, 23 deletions
diff --git a/util/charset/unidata.h b/util/charset/unidata.h index 4cef3b0039..400d314186 100644 --- a/util/charset/unidata.h +++ b/util/charset/unidata.h @@ -200,13 +200,13 @@ inline bool IsQuotation(wchar32 ch) { SHIFT(Pf_QUOTE) | SHIFT(Po_SINGLE_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) | SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE)); } - -inline bool IsSingleQuotation(wchar32 ch) { - return NUnicode::CharHasType(ch, + +inline bool IsSingleQuotation(wchar32 ch) { + return NUnicode::CharHasType(ch, SHIFT(Po_SINGLE_QUOTE) | SHIFT(Ps_SINGLE_QUOTE) | SHIFT(Pe_SINGLE_QUOTE) | SHIFT(Pi_SINGLE_QUOTE) | SHIFT(Pf_SINGLE_QUOTE)); -} - +} + inline bool IsTerminal(wchar32 ch) { return NUnicode::CharHasType(ch, SHIFT(Po_TERMINAL)); } @@ -381,15 +381,15 @@ inline bool IsXdigit(wchar32 ch) { inline bool IsDigit(wchar32 ch) { return IsDecdigit(ch); } - -inline bool IsCommonDigit(wchar32 ch) { - // IsDigit returns true for some exotic symbols like "VAI DIGIT TWO" (U+A622) - // and cannot be used safely with FromString() convertors - const wchar32 ZERO = '0'; - const wchar32 NINE = '9'; - return ch >= ZERO && ch <= NINE; -} - + +inline bool IsCommonDigit(wchar32 ch) { + // IsDigit returns true for some exotic symbols like "VAI DIGIT TWO" (U+A622) + // and cannot be used safely with FromString() convertors + const wchar32 ZERO = '0'; + const wchar32 NINE = '9'; + return ch >= ZERO && ch <= NINE; +} + inline bool IsGraph(wchar32 ch) { return IsAlnum(ch) || IsPunct(ch) || IsSymbol(ch); } diff --git a/util/charset/wide.h b/util/charset/wide.h index 86433fbef1..04e6928aab 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -353,8 +353,8 @@ inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written); dst.resize(written); return dst; -} - +} + //! if not robust will stop at first error position template <bool robust> inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) { @@ -371,8 +371,8 @@ inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { inline TUtf16String UTF8ToWide(const char* text, size_t len) { return UTF8ToWide<false>(text, len); -} - +} + template <bool robust> inline TUtf16String UTF8ToWide(const TStringBuf s) { return UTF8ToWide<robust>(s.data(), s.size()); @@ -387,8 +387,8 @@ inline TUtf32String UTF8ToUTF32(const TStringBuf s) { inline TUtf16String UTF8ToWide(const TStringBuf s) { return UTF8ToWide<false>(s.data(), s.size()); -} - +} + //! converts text from unicode to UTF8 //! @attention destination buffer must be long enough to fit all characters of the text, //! @c WriteUTF8Char converts @c wchar32 into maximum 4 bytes of UTF8 so @@ -417,8 +417,8 @@ inline TStringBuf WideToUTF8(const TWtringBuf src, TString& dst) { Y_ASSERT(dst.size() >= written); dst.remove(written); return dst; -} - +} + inline TString WideToUTF8(const wchar16* text, size_t len) { TString s = TString::Uninitialized(WideToUTF8BufferSize(len)); size_t written = 0; diff --git a/util/charset/wide_ut.cpp b/util/charset/wide_ut.cpp index f7aaa64049..d8f3233e73 100644 --- a/util/charset/wide_ut.cpp +++ b/util/charset/wide_ut.cpp @@ -6,7 +6,7 @@ #include <util/string/reverse.h> #include <algorithm> - + namespace { //! three UTF8 encoded russian letters (A, B, V) const char utext[] = "\xd0\x90\xd0\x91\xd0\x92"; |