diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
commit | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch) | |
tree | 506dac10f5df94fab310584ee51b24fc5a081c22 /util/generic/string.cpp | |
parent | 2d37894b1b037cf24231090eda8589bbb44fb6fc (diff) | |
download | ydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/string.cpp')
-rw-r--r-- | util/generic/string.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/util/generic/string.cpp b/util/generic/string.cpp index 3c655f1f66..b8d3af544c 100644 --- a/util/generic/string.cpp +++ b/util/generic/string.cpp @@ -14,10 +14,10 @@ std::ostream& operator<<(std::ostream& os, const TString& s) { return os.write(s.data(), s.size()); } -std::istream& operator>>(std::istream& is, TString& s) { +std::istream& operator>>(std::istream& is, TString& s) { return is >> s.MutRef(); -} - +} + template <> bool TBasicString<char, std::char_traits<char>>::to_lower(size_t pos, size_t n) { return Transform([](size_t, char c) { return AsciiToLower(c); }, pos, n); @@ -38,7 +38,7 @@ bool TBasicString<char, std::char_traits<char>>::to_title(size_t pos, size_t n) } template <> -TUtf16String& +TUtf16String& TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf& s) { ReserveAndResize(size() + s.size()); @@ -48,53 +48,53 @@ TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf *dst = static_cast<wchar16>(*src); } - return *this; + return *this; } template <> -TUtf16String& +TUtf16String& TBasicString<wchar16, std::char_traits<wchar16>>::AppendUtf8(const ::TStringBuf& s) { - size_t oldSize = size(); + size_t oldSize = size(); ReserveAndResize(size() + s.size() * 4); - size_t written = 0; + size_t written = 0; size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written); if (pos != s.size()) { ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size()); } resize(oldSize + written); - - return *this; -} - + + return *this; +} + template <> bool TBasicString<wchar16, std::char_traits<wchar16>>::to_lower(size_t pos, size_t n) { - return ToLower(*this, pos, n); + return ToLower(*this, pos, n); } template <> bool TBasicString<wchar16, std::char_traits<wchar16>>::to_upper(size_t pos, size_t n) { - return ToUpper(*this, pos, n); + return ToUpper(*this, pos, n); } template <> bool TBasicString<wchar16, std::char_traits<wchar16>>::to_title(size_t pos, size_t n) { - return ToTitle(*this, pos, n); + return ToTitle(*this, pos, n); } template <> -TUtf32String& +TUtf32String& TBasicString<wchar32, std::char_traits<wchar32>>::AppendAscii(const ::TStringBuf& s) { ReserveAndResize(size() + s.size()); - + auto dst = begin() + size() - s.size(); - + for (const char* src = s.data(); dst != end(); ++dst, ++src) { - *dst = static_cast<wchar32>(*src); - } - - return *this; -} - + *dst = static_cast<wchar32>(*src); + } + + return *this; +} + template <> TBasicString<char, std::char_traits<char>>& TBasicString<char, std::char_traits<char>>::AppendUtf16(const ::TWtringBuf& s) { @@ -110,7 +110,7 @@ TBasicString<char, std::char_traits<char>>::AppendUtf16(const ::TWtringBuf& s) { } template <> -TUtf32String& +TUtf32String& TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf& s) { size_t oldSize = size(); ReserveAndResize(size() + s.size() * 4); @@ -120,12 +120,12 @@ TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf& ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size()); } resize(oldSize + written); - - return *this; + + return *this; } template <> -TUtf32String& +TUtf32String& TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf16(const ::TWtringBuf& s) { size_t oldSize = size(); ReserveAndResize(size() + s.size() * 2); @@ -137,20 +137,20 @@ TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf16(const ::TWtringBuf resize(oldSize + written); - return *this; + return *this; } template <> bool TBasicString<wchar32, std::char_traits<wchar32>>::to_lower(size_t pos, size_t n) { - return ToLower(*this, pos, n); + return ToLower(*this, pos, n); } template <> bool TBasicString<wchar32, std::char_traits<wchar32>>::to_upper(size_t pos, size_t n) { - return ToUpper(*this, pos, n); + return ToUpper(*this, pos, n); } template <> bool TBasicString<wchar32, std::char_traits<wchar32>>::to_title(size_t pos, size_t n) { - return ToTitle(*this, pos, n); + return ToTitle(*this, pos, n); } |