diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/charset/wide.h | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/charset/wide.h')
-rw-r--r-- | util/charset/wide.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/util/charset/wide.h b/util/charset/wide.h index 6470fd0172..04e6928aab 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "recode_result.h" #include "unidata.h" @@ -298,7 +298,7 @@ namespace NDetail { void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept; } -//! @return len if robust and position where encoding stopped if not +//! @return len if robust and position where encoding stopped if not template <bool robust, typename TCharType> inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) noexcept { const unsigned char* cur = reinterpret_cast<const unsigned char*>(text); @@ -309,7 +309,7 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size ::NDetail::UTF8ToWideImplSSE41(cur, last, p); } #endif - + ::NDetail::UTF8ToWideImplScalar<robust>(cur, last, p); written = p - dest; return cur - reinterpret_cast<const unsigned char*>(text); @@ -317,9 +317,9 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size template <typename TCharType> inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) { - return UTF8ToWideImpl<false>(text, len, dest, written); -} - + return UTF8ToWideImpl<false>(text, len, dest, written); +} + template <bool robust> inline TUtf16String UTF8ToWide(const char* text, size_t len) { TUtf16String w = TUtf16String::Uninitialized(len); @@ -334,19 +334,19 @@ inline TUtf16String UTF8ToWide(const char* text, size_t len) { template <bool robust, typename TCharType> inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept { - return UTF8ToWideImpl<robust>(text, len, dest, written) == len; -} - + return UTF8ToWideImpl<robust>(text, len, dest, written) == len; +} + //! converts text from UTF8 to unicode, stops immediately it UTF8 byte sequence is wrong //! @attention destination buffer must be long enough to fit all characters of the text, //! conversion stops if a broken symbol is met //! @return @c true if all the text converted successfully, @c false - a broken symbol was found template <typename TCharType> inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept { - return UTF8ToWide<false>(text, len, dest, written); + return UTF8ToWide<false>(text, len, dest, written); } -template <bool robust> +template <bool robust> inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { dst.ReserveAndResize(src.size()); size_t written = 0; @@ -367,17 +367,17 @@ inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) { inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { return UTF8ToWide<false>(src, dst); -} - +} + inline TUtf16String UTF8ToWide(const char* text, size_t len) { return UTF8ToWide<false>(text, len); } -template <bool robust> +template <bool robust> inline TUtf16String UTF8ToWide(const TStringBuf s) { return UTF8ToWide<robust>(s.data(), s.size()); -} - +} + template <bool robust> inline TUtf32String UTF8ToUTF32(const TStringBuf s) { TUtf32String r; |