diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/charset/wide.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/charset/wide.h')
-rw-r--r-- | library/cpp/charset/wide.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index b7a391f0a5..32d30e849e 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -1,15 +1,15 @@ #pragma once #include "codepage.h" -#include "iconv.h" - +#include "iconv.h" + #include <util/charset/recode_result.h> #include <util/charset/unidata.h> #include <util/charset/utf8.h> #include <util/charset/wide.h> #include <util/generic/string.h> #include <util/generic/algorithm.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/memory/tempbuf.h> #include <util/system/yassert.h> @@ -19,7 +19,7 @@ template <typename TCharType> inline size_t WideToChar(const TCharType* text, size_t len, char* dest, ECharset enc) { Y_ASSERT(SingleByteCodepage(enc)); - + const char* start = dest; const Encoder* const encoder = &EncoderByCharset(enc); @@ -114,7 +114,7 @@ namespace NDetail { return RecodeMultiByteChar(src, dst, encoding); } - } + } template <typename TCharFrom> struct TRecodeTraits; @@ -124,8 +124,8 @@ namespace NDetail { using TCharTo = wchar16; using TStringBufTo = TWtringBuf; using TStringTo = TUtf16String; - enum { ReserveSize = 4 }; // How many TCharFrom characters we should reserve for one TCharTo character in worst case - // Here an unicode character can be converted up to 4 bytes of UTF8 + enum { ReserveSize = 4 }; // How many TCharFrom characters we should reserve for one TCharTo character in worst case + // Here an unicode character can be converted up to 4 bytes of UTF8 }; template <> @@ -133,7 +133,7 @@ namespace NDetail { using TCharTo = char; using TStringBufTo = TStringBuf; using TStringTo = TString; - enum { ReserveSize = 2 }; // possible surrogate pairs ? + enum { ReserveSize = 2 }; // possible surrogate pairs ? }; // Operations with destination buffer where recoded string will be written @@ -203,7 +203,7 @@ namespace NDetail { Recode<TCharFrom>(src, res, encoding); return res; } -} +} // Write result into @dst. Return string-buffer pointing to re-coded content of @dst. @@ -291,7 +291,7 @@ inline TString WideToChar(const TWtringBuf w, ECharset enc) { inline TUtf16String CharToWide(const TStringBuf s, ECharset enc) { return CharToWide<false>(s.data(), s.size(), enc); } - + template <bool robust> inline TUtf16String CharToWide(const TStringBuf s, ECharset enc) { return CharToWide<robust>(s.data(), s.size(), enc); |