diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/charset | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset')
-rw-r--r-- | library/cpp/charset/codepage.h | 2 | ||||
-rw-r--r-- | library/cpp/charset/doccodes.h | 2 | ||||
-rw-r--r-- | library/cpp/charset/recyr.hh | 2 | ||||
-rw-r--r-- | library/cpp/charset/recyr_int.hh | 2 | ||||
-rw-r--r-- | library/cpp/charset/wide.h | 38 |
5 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h index 30a02a4610..c8b44a2f29 100644 --- a/library/cpp/charset/codepage.h +++ b/library/cpp/charset/codepage.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "doccodes.h" diff --git a/library/cpp/charset/doccodes.h b/library/cpp/charset/doccodes.h index 75c87adf9e..e53026411c 100644 --- a/library/cpp/charset/doccodes.h +++ b/library/cpp/charset/doccodes.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once enum ECharset { CODES_UNSUPPORTED = -2, // valid but unsupported encoding diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh index 5ec8734bcf..233cd9bcc0 100644 --- a/library/cpp/charset/recyr.hh +++ b/library/cpp/charset/recyr.hh @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <cstdlib> diff --git a/library/cpp/charset/recyr_int.hh b/library/cpp/charset/recyr_int.hh index 353af53305..ac4fc9eed9 100644 --- a/library/cpp/charset/recyr_int.hh +++ b/library/cpp/charset/recyr_int.hh @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/charset/recode_result.h> #include <util/charset/utf8.h> diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index 32d30e849e..7e8b979e80 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "codepage.h" #include "iconv.h" @@ -182,21 +182,21 @@ namespace NDetail { return TBasicStringBuf<TCharTo>(dstbuf, dstFinalSize); } - // special implementation for robust utf8 functions - template <typename TResult> + // special implementation for robust utf8 functions + template <typename TResult> TWtringBuf RecodeUTF8Robust(const TStringBuf src, TResult& dst) { - // make enough room for re-coded string + // make enough room for re-coded string wchar16* dstbuf = TRecodeResultOps<TResult>::Reserve(dst, src.size() * TRecodeTraits<wchar16>::ReserveSize); - - // do re-coding - size_t written = 0; + + // do re-coding + size_t written = 0; UTF8ToWide<true>(src.data(), src.size(), dstbuf, written); - - // truncate result back to proper size - TRecodeResultOps<TResult>::Truncate(dst, written); - return TWtringBuf(dstbuf, written); - } - + + // truncate result back to proper size + TRecodeResultOps<TResult>::Truncate(dst, written); + return TWtringBuf(dstbuf, written); + } + template <typename TCharFrom> inline typename TRecodeTraits<TCharFrom>::TStringTo Recode(const TBasicStringBuf<TCharFrom> src, ECharset encoding) { typename TRecodeTraits<TCharFrom>::TStringTo res; @@ -207,17 +207,17 @@ namespace NDetail { // Write result into @dst. Return string-buffer pointing to re-coded content of @dst. -template <bool robust> +template <bool robust> inline TWtringBuf CharToWide(const TStringBuf src, TUtf16String& dst, ECharset encoding) { - if (robust && CODES_UTF8 == encoding) + if (robust && CODES_UTF8 == encoding) return ::NDetail::RecodeUTF8Robust(src, dst); return ::NDetail::Recode<char>(src, dst, encoding); } inline TWtringBuf CharToWide(const TStringBuf src, TUtf16String& dst, ECharset encoding) { return ::NDetail::Recode<char>(src, dst, encoding); -} - +} + inline TStringBuf WideToChar(const TWtringBuf src, TString& dst, ECharset encoding) { return ::NDetail::Recode<wchar16>(src, dst, encoding); } @@ -251,11 +251,11 @@ inline TUtf16String CharToWide(const char* text, size_t len, const CodePage& cp) } //! calls either to @c UTF8ToWide or @c CharToWide depending on the encoding type -template <bool robust> +template <bool robust> inline TUtf16String CharToWide(const char* text, size_t len, ECharset enc) { if (NCodepagePrivate::NativeCodepage(enc)) { if (enc == CODES_UTF8) - return UTF8ToWide<robust>(text, len); + return UTF8ToWide<robust>(text, len); return CharToWide(text, len, *CodePageByCharset(enc)); } |