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 | 16747e4f77455cca4932df21eb76f12cb0a97a5c (patch) | |
tree | 4dd6da4102d99d0d69dec53c1050d290a850a9f2 /util/string | |
parent | a817f5de12611ec73085eba17f8ec7740a46bdb7 (diff) | |
download | ydb-16747e4f77455cca4932df21eb76f12cb0a97a5c.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 1 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 a3821d3399..532b56de5d 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 7b54821151..1f0a34787f 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 22def683ec..59270ba2e0 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 90e925c194..6962d6db0f 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 cd09a7dbd0..05b44d47de 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 8229e74a9c..c641173836 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 9ba401f0a2..e83189e821 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) { |