diff options
author | kimkim <kimkim@yandex-team.ru> | 2022-02-10 16:49:28 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:28 +0300 |
commit | 10807864acf73d00f425a23b442aac2cf34403a8 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/string | |
parent | 13f84424ed9975f6827d9786087c6fe6ea265cda (diff) | |
download | ydb-10807864acf73d00f425a23b442aac2cf34403a8.tar.gz |
Restoring authorship annotation for <kimkim@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string')
-rw-r--r-- | util/string/cast.cpp | 6 | ||||
-rw-r--r-- | util/string/cast.h | 2 | ||||
-rw-r--r-- | util/string/split.h | 2 | ||||
-rw-r--r-- | util/string/util.h | 2 | ||||
-rw-r--r-- | util/string/vector.cpp | 94 | ||||
-rw-r--r-- | util/string/vector.h | 12 |
6 files changed, 59 insertions, 59 deletions
diff --git a/util/string/cast.cpp b/util/string/cast.cpp index 9a840c11c3..aa1e65a8e9 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -1,4 +1,4 @@ -#include <util/system/defaults.h> +#include <util/system/defaults.h> #if defined(_freebsd_) && !defined(__LONG_LONG_SUPPORTED) #define __LONG_LONG_SUPPORTED @@ -15,8 +15,8 @@ #include <contrib/libs/double-conversion/double-conversion.h> #include <util/generic/string.h> -#include <util/system/yassert.h> -#include <util/generic/yexception.h> +#include <util/system/yassert.h> +#include <util/generic/yexception.h> #include <util/generic/typetraits.h> #include <util/generic/ylimits.h> #include <util/generic/singleton.h> diff --git a/util/string/cast.h b/util/string/cast.h index acef6d3235..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/stream/str.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> diff --git a/util/string/split.h b/util/string/split.h index 6b5de0dc20..bc46d9e64c 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -12,7 +12,7 @@ #include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/system/compat.h> #include <util/system/defaults.h> diff --git a/util/string/util.h b/util/string/util.h index ee6dacdd29..0d77a5042b 100644 --- a/util/string/util.h +++ b/util/string/util.h @@ -6,7 +6,7 @@ #include <cstdarg> #include <algorithm> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> diff --git a/util/string/vector.cpp b/util/string/vector.cpp index 897061d42a..9ba401f0a2 100644 --- a/util/string/vector.cpp +++ b/util/string/vector.cpp @@ -1,80 +1,80 @@ -#include "util.h" -#include "split.h" +#include "util.h" +#include "split.h" #include "vector.h" #include <util/system/defaults.h> -template <class TConsumer, class TDelim, typename TChr> +template <class TConsumer, class TDelim, typename TChr> static inline void DoSplit2(TConsumer& c, TDelim& d, const TBasicStringBuf<TChr> str, int) { SplitString(str.data(), str.data() + str.size(), d, c); -} - -template <class TConsumer, class TDelim, typename TChr> +} + +template <class TConsumer, class TDelim, typename TChr> static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr> str, int opts) { if (opts & KEEP_EMPTY_TOKENS) { DoSplit2(cc, d, str, opts); - } else { - TSkipEmptyTokens<TConsumer> sc(&cc); - + } else { + TSkipEmptyTokens<TConsumer> sc(&cc); + DoSplit2(sc, d, str, opts); - } -} - -template <class C, class TDelim, typename TChr> + } +} + +template <class C, class TDelim, typename TChr> static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, size_t maxFields, int options) { using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>; - res->clear(); - + res->clear(); + if (!str.data()) { - return; - } - + return; + } + using TConsumer = TContainerConsumer<C>; - TConsumer cc(res); - - if (maxFields) { - TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc); - + TConsumer cc(res); + + if (maxFields) { + TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc); + DoSplit1(lc, d, str, options); - - if (lc.Last) { + + if (lc.Last) { res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last)); - } - } else { + } + } else { DoSplit1(cc, d, str, options); - } -} - -template <typename TChr> + } +} + +template <typename TChr> static void SplitStringImplT(TVector<std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>>* res, const TBasicStringBuf<TChr> str, const TChr* delim, size_t maxFields, int options) { - if (!*delim) { - return; - } - - if (*(delim + 1)) { + if (!*delim) { + return; + } + + if (*(delim + 1)) { TStringDelimiter<const TChr> d(delim, std::char_traits<TChr>::length(delim)); - + DoSplit0(res, str, d, maxFields, options); - } else { - TCharDelimiter<const TChr> d(*delim); - + } else { + TCharDelimiter<const TChr> d(*delim); + DoSplit0(res, str, d, maxFields, options); - } -} - + } +} + void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, const char* delim, size_t maxFields, int options) { return SplitStringImplT<char>(res, TStringBuf(ptr), delim, maxFields, options); -} - +} + void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, size_t len, const char* delim, size_t maxFields, int options) { return SplitStringImplT<char>(res, TStringBuf(ptr, len), delim, maxFields, options); } void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, const wchar16* delimiter, size_t maxFields, int options) { return SplitStringImplT<wchar16>(res, TWtringBuf(ptr), delimiter, maxFields, options); -} - +} + void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, size_t len, const wchar16* delimiter, size_t maxFields, int options) { return SplitStringImplT<wchar16>(res, TWtringBuf(ptr, len), delimiter, maxFields, options); } diff --git a/util/string/vector.h b/util/string/vector.h index 9d486e2356..e36c348bbe 100644 --- a/util/string/vector.h +++ b/util/string/vector.h @@ -3,15 +3,15 @@ #include "cast.h" #include "split.h" -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/string/cast.h> #include <util/system/yassert.h> #define KEEP_EMPTY_TOKENS 0x01 - + // // NOTE: Check StringSplitter below to get more convenient split string interface. @@ -47,9 +47,9 @@ SplitString(const C* ptr, const C* delimiter, size_t maxFields = 0, int options = 0) { TVector<typename ::NPrivate::TStringDeducer<C>::type> res; ::NPrivate::SplitStringImpl(&res, ptr, delimiter, maxFields, options); - return res; -} - + return res; +} + template <typename C> TVector<typename ::NPrivate::TStringDeducer<C>::type> SplitString(const C* ptr, size_t len, const C* delimiter, |