diff options
author | max42 <max42@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
commit | 884333bd8b9068bc6b852b948e9d8f23fd393ab7 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/yt/string | |
parent | 9988f7c537b40605e1a0aaae2977d5f540425b83 (diff) | |
download | ydb-884333bd8b9068bc6b852b948e9d8f23fd393ab7.tar.gz |
Restoring authorship annotation for <max42@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/string')
-rw-r--r-- | library/cpp/yt/string/format-inl.h | 42 | ||||
-rw-r--r-- | library/cpp/yt/string/string.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/string/string.h | 10 | ||||
-rw-r--r-- | library/cpp/yt/string/string_builder.h | 4 |
4 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h index 2e97c600497..5484d4a216c 100644 --- a/library/cpp/yt/string/format-inl.h +++ b/library/cpp/yt/string/format-inl.h @@ -85,11 +85,11 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu if (singleQuotes || doubleQuotes) { for (const char* valueCurrent = value.begin(); valueCurrent < value.end(); ++valueCurrent) { char ch = *valueCurrent; - if (ch == '\n') { - builder->AppendString("\\n"); - } else if (ch == '\t') { - builder->AppendString("\\t"); - } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) { + if (ch == '\n') { + builder->AppendString("\\n"); + } else if (ch == '\t') { + builder->AppendString("\\t"); + } else if (ch < PrintableASCIILow || ch > PrintableASCIIHigh) { builder->AppendString("\\x"); builder->AppendChar(Int2Hex[static_cast<ui8>(ch) >> 4]); builder->AppendChar(Int2Hex[static_cast<ui8>(ch) & 0xf]); @@ -288,10 +288,10 @@ struct TValueFormatter<TFormatterWrapper<TFormatter>> }; // std::vector -template <class T, class TAllocator> -struct TValueFormatter<std::vector<T, TAllocator>> +template <class T, class TAllocator> +struct TValueFormatter<std::vector<T, TAllocator>> { - static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/) + static void Do(TStringBuilderBase* builder, const std::vector<T, TAllocator>& collection, TStringBuf /*format*/) { FormatRange(builder, collection, TDefaultFormatter()); } @@ -398,20 +398,20 @@ struct TValueFormatter<TEnumIndexedVector<E, T>> } }; -// std::pair -template <class T1, class T2> -struct TValueFormatter<std::pair<T1, T2>> -{ - static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format) - { - builder->AppendChar('{'); - FormatValue(builder, value.first, format); +// std::pair +template <class T1, class T2> +struct TValueFormatter<std::pair<T1, T2>> +{ + static void Do(TStringBuilderBase* builder, const std::pair<T1, T2>& value, TStringBuf format) + { + builder->AppendChar('{'); + FormatValue(builder, value.first, format); builder->AppendString(TStringBuf(", ")); - FormatValue(builder, value.second, format); - builder->AppendChar('}'); - } -}; - + FormatValue(builder, value.second, format); + builder->AppendChar('}'); + } +}; + // std::optional inline void FormatValue(TStringBuilderBase* builder, std::nullopt_t, TStringBuf /*format*/) { diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index e3734288e88..7440ac3fdd1 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -130,7 +130,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min) // The negative value handling code below works incorrectly for min values. if (value == std::numeric_limits<T>::min()) { ptr -= min.length(); - ::memcpy(ptr, min.begin(), min.length()); + ::memcpy(ptr, min.begin(), min.length()); return ptr; } @@ -144,7 +144,7 @@ char* WriteSignedIntToBufferBackwardsImpl(char* ptr, T value, TStringBuf min) i64 rem = value % 100; i64 quot = value / 100; ptr -= 2; - ::memcpy(ptr, &DecimalDigits2[rem], 2); + ::memcpy(ptr, &DecimalDigits2[rem], 2); value = quot; } @@ -174,7 +174,7 @@ char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value) i64 rem = value % 100; i64 quot = value / 100; ptr -= 2; - ::memcpy(ptr, &DecimalDigits2[rem], 2); + ::memcpy(ptr, &DecimalDigits2[rem], 2); value = quot; } diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h index 84dcc899fce..ae6c99caab0 100644 --- a/library/cpp/yt/string/string.h +++ b/library/cpp/yt/string/string.h @@ -33,11 +33,11 @@ static constexpr TStringBuf DefaultJoinToStringDelimiter = ", "; static constexpr TStringBuf DefaultKeyValueDelimiter = ": "; static constexpr TStringBuf DefaultRangeEllipsisFormat = "..."; -// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable. -static constexpr char PrintableASCIILow = 0x20; -static constexpr char PrintableASCIIHigh = 0x7e; -static constexpr TStringBuf Int2Hex = "0123456789abcdef"; - +// ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable. +static constexpr char PrintableASCIILow = 0x20; +static constexpr char PrintableASCIIHigh = 0x7e; +static constexpr TStringBuf Int2Hex = "0123456789abcdef"; + //! Joins a range of items into a string intermixing them with the delimiter. /*! * \param builder String builder where the output goes. diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h index 92a6959eefd..0e13e709045 100644 --- a/library/cpp/yt/string/string_builder.h +++ b/library/cpp/yt/string/string_builder.h @@ -68,8 +68,8 @@ public: protected: TString Buffer_; - void DoReset() override; - void DoPreallocate(size_t size) override; + void DoReset() override; + void DoPreallocate(size_t size) override; }; //////////////////////////////////////////////////////////////////////////////// |