diff options
author | spacelord <spacelord@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
commit | a0c6d9ad0cf6b94c527a15da147eb24335281b6d (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/string | |
parent | 16747e4f77455cca4932df21eb76f12cb0a97a5c (diff) | |
download | ydb-a0c6d9ad0cf6b94c527a15da147eb24335281b6d.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string')
-rw-r--r-- | util/string/builder.cpp | 12 | ||||
-rw-r--r-- | util/string/builder.h | 14 | ||||
-rw-r--r-- | util/string/builder_ut.cpp | 62 | ||||
-rw-r--r-- | util/string/cast.h | 2 | ||||
-rw-r--r-- | util/string/escape.cpp | 2 | ||||
-rw-r--r-- | util/string/strspn.h | 2 | ||||
-rw-r--r-- | util/string/vector.cpp | 2 |
7 files changed, 48 insertions, 48 deletions
diff --git a/util/string/builder.cpp b/util/string/builder.cpp index 532b56de5d..a3821d3399 100644 --- a/util/string/builder.cpp +++ b/util/string/builder.cpp @@ -1,8 +1,8 @@ -#include "builder.h" - -#include <util/stream/output.h> - -template <> +#include "builder.h" + +#include <util/stream/output.h> + +template <> void Out<TStringBuilder>(IOutputStream& os, const TStringBuilder& sb) { os << static_cast<const TString&>(sb); -} +} diff --git a/util/string/builder.h b/util/string/builder.h index 1f0a34787f..7b54821151 100644 --- a/util/string/builder.h +++ b/util/string/builder.h @@ -1,9 +1,9 @@ -#pragma once - -#include <util/stream/str.h> +#pragma once + +#include <util/stream/str.h> #include <utility> #include <util/generic/string.h> - + namespace NPrivateStringBuilder { class TStringBuilder: public TString { public: @@ -20,14 +20,14 @@ namespace NPrivateStringBuilder { TStringOutput Out; }; - + template <class T> static inline TStringBuilder& operator<<(TStringBuilder& builder, const T& t) { builder.Out << t; - + return builder; } - + template <class T> static inline TStringBuilder&& operator<<(TStringBuilder&& builder, const T& t) { builder.Out << t; diff --git a/util/string/builder_ut.cpp b/util/string/builder_ut.cpp index 59270ba2e0..22def683ec 100644 --- a/util/string/builder_ut.cpp +++ b/util/string/builder_ut.cpp @@ -1,42 +1,42 @@ -#include "builder.h" - +#include "builder.h" + #include <library/cpp/testing/unittest/registar.h> - + static void TestEquals(const TString& expected, const TString& actual) { - UNIT_ASSERT_VALUES_EQUAL(expected, actual); -} - -struct TClassWithStreamOperator { - ui32 Id; + UNIT_ASSERT_VALUES_EQUAL(expected, actual); +} + +struct TClassWithStreamOperator { + ui32 Id; TString Name; - + TClassWithStreamOperator(ui32 id, const TString& name) - : Id(id) - , Name(name) - { - } -}; - + : Id(id) + , Name(name) + { + } +}; + IOutputStream& operator<<(IOutputStream& out, const TClassWithStreamOperator& value) { - return out << value.Id << " " << value.Name; -} - + return out << value.Id << " " << value.Name; +} + Y_UNIT_TEST_SUITE(TStringBuilderTest) { Y_UNIT_TEST(TestStringBuilder) { - TestEquals("", TStringBuilder()); - TestEquals("a", TStringBuilder() << "a"); - TestEquals("a1", TStringBuilder() << "a" << 1); - TestEquals("value: 123 name", TStringBuilder() << "value: " << TClassWithStreamOperator(123, "name")); - } - + TestEquals("", TStringBuilder()); + TestEquals("a", TStringBuilder() << "a"); + TestEquals("a1", TStringBuilder() << "a" << 1); + TestEquals("value: 123 name", TStringBuilder() << "value: " << TClassWithStreamOperator(123, "name")); + } + Y_UNIT_TEST(TestStringBuilderOut) { TString s; - TStringOutput out(s); - TStringBuilder sb; - sb << "a"; - out << sb; - TestEquals("a", s); - } + TStringOutput out(s); + TStringBuilder sb; + sb << "a"; + out << sb; + TestEquals("a", s); + } Y_UNIT_TEST(TestStringBuilderRValue) { struct TRValueAcceptTester { @@ -60,4 +60,4 @@ Y_UNIT_TEST_SUITE(TStringBuilderTest) { UNIT_ASSERT(TRValueAcceptTester::IsRValue(TStringBuilder() << b2)); UNIT_ASSERT_VALUES_EQUAL("a1a", TStringBuilder() << b2); } -} +} diff --git a/util/string/cast.h b/util/string/cast.h index 6962d6db0f..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -21,7 +21,7 @@ size_t ToStringImpl(T t, char* buf, size_t len); */ template <class T> inline size_t ToString(const T& t, char* buf, size_t len) { - using TParam = typename TTypeTraits<T>::TFuncParam; + using TParam = typename TTypeTraits<T>::TFuncParam; return ToStringImpl<TParam>(t, buf, len); } diff --git a/util/string/escape.cpp b/util/string/escape.cpp index 05b44d47de..cd09a7dbd0 100644 --- a/util/string/escape.cpp +++ b/util/string/escape.cpp @@ -150,7 +150,7 @@ namespace { template <class TChar> TBasicString<TChar>& EscapeCImpl(const TChar* str, size_t len, TBasicString<TChar>& r) { - using TEscapeUtil = ::TEscapeUtil<TChar>; + using TEscapeUtil = ::TEscapeUtil<TChar>; TChar buffer[TEscapeUtil::ESCAPE_C_BUFFER_SIZE]; diff --git a/util/string/strspn.h b/util/string/strspn.h index c641173836..8229e74a9c 100644 --- a/util/string/strspn.h +++ b/util/string/strspn.h @@ -62,4 +62,4 @@ private: TSetType S_; }; -using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; +using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; diff --git a/util/string/vector.cpp b/util/string/vector.cpp index e83189e821..9ba401f0a2 100644 --- a/util/string/vector.cpp +++ b/util/string/vector.cpp @@ -29,7 +29,7 @@ static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, return; } - using TConsumer = TContainerConsumer<C>; + using TConsumer = TContainerConsumer<C>; TConsumer cc(res); if (maxFields) { |