diff options
author | stanly <stanly@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:49 +0300 |
commit | cde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch) | |
tree | d3349caea4095825a55b5ba24fe758067b29ce6f /library/cpp/deprecated | |
parent | 9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff) | |
download | ydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz |
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/deprecated')
-rw-r--r-- | library/cpp/deprecated/kmp/kmp.h | 2 | ||||
-rw-r--r-- | library/cpp/deprecated/kmp/kmp_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/deprecated/split/delim_string_iter.h | 60 | ||||
-rw-r--r-- | library/cpp/deprecated/split/delim_string_iter_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/deprecated/ya.make | 2 |
5 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h index a7f72eece6..48df76df18 100644 --- a/library/cpp/deprecated/kmp/kmp.h +++ b/library/cpp/deprecated/kmp/kmp.h @@ -86,7 +86,7 @@ public: ComputePrefixFunction(patternBegin, patternEnd, &pf); PrefixFunction.Reset(pf); } - + void Push(const T& symbol) { while ((State >= 0) && (Pattern[State] != symbol)) { Y_ASSERT(State <= (ssize_t) Pattern.size()); diff --git a/library/cpp/deprecated/kmp/kmp_ut.cpp b/library/cpp/deprecated/kmp/kmp_ut.cpp index c2eda83c57..3fa94c02d8 100644 --- a/library/cpp/deprecated/kmp/kmp_ut.cpp +++ b/library/cpp/deprecated/kmp/kmp_ut.cpp @@ -27,11 +27,11 @@ public: void Test() { TVector<int> ans = {0, 2}; UNIT_ASSERT_EQUAL(FindAll("a", "aba"), ans); - ans = {0}; + ans = {0}; UNIT_ASSERT_EQUAL(FindAll("aba", "aba"), ans); ans.clear(); UNIT_ASSERT_EQUAL(FindAll("abad", "aba"), ans); - ans = {0, 2}; + ans = {0, 2}; UNIT_ASSERT_EQUAL(FindAll("ab", "abab"), ans); } diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h index 8e4ca171a0..bcfe07abc6 100644 --- a/library/cpp/deprecated/split/delim_string_iter.h +++ b/library/cpp/deprecated/split/delim_string_iter.h @@ -1,8 +1,8 @@ #pragma once -#include <util/generic/algorithm.h> -#include <util/generic/strbuf.h> -#include <util/generic/yexception.h> +#include <util/generic/algorithm.h> +#include <util/generic/strbuf.h> +#include <util/generic/yexception.h> #include <util/string/cast.h> #include <util/system/yassert.h> @@ -35,9 +35,9 @@ public: } inline explicit operator bool() const { - return IsValid; - } - + return IsValid; + } + // NOTE: this is a potentially unsafe operation (no overrun check) inline TDelimStringIter& operator++() { if (Current.end() != Str.end()) { @@ -51,7 +51,7 @@ public: return *this; } - inline void operator+=(size_t n) { + inline void operator+=(size_t n) { for (; n > 0; --n) { ++(*this); } @@ -65,17 +65,17 @@ public: return !(*this == rhs); } - inline TStringBuf operator*() const { + inline TStringBuf operator*() const { return Current; } - inline const TStringBuf* operator->() const { + inline const TStringBuf* operator->() const { return &Current; } - // Get & advance + // Get & advance template <class T> - inline bool TryNext(T& t) { + inline bool TryNext(T& t) { if (IsValid) { t = FromString<T>(Current); operator++(); @@ -94,46 +94,46 @@ public: } template <class T> - inline T GetNext() { + inline T GetNext() { T res; Next(res); return res; } - inline const char* GetBegin() const { + inline const char* GetBegin() const { return Current.begin(); } - inline const char* GetEnd() const { + inline const char* GetEnd() const { return Current.end(); } - inline bool Valid() const { + inline bool Valid() const { return IsValid; } // contents from next token to the end of string - inline TStringBuf Cdr() const { + inline TStringBuf Cdr() const { return Str.SubStr(Current.length() + Delim.length()); } inline TDelimStringIter IterEnd() const { return TDelimStringIter(); } - -private: - inline void UpdateCurrent() { - // it is much faster than TStringBuf::find + +private: + inline void UpdateCurrent() { + // it is much faster than TStringBuf::find size_t pos = std::search(Str.begin(), Str.end(), Delim.begin(), Delim.end()) - Str.begin(); - Current = Str.Head(pos); - } - -private: - bool IsValid; - - TStringBuf Str; - TStringBuf Current; - TStringBuf Delim; + Current = Str.Head(pos); + } + +private: + bool IsValid; + + TStringBuf Str; + TStringBuf Current; + TStringBuf Delim; }; //example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... } @@ -141,7 +141,7 @@ struct TDelimStroka { TStringBuf S; TStringBuf Delim; - inline TDelimStroka(TStringBuf s, TStringBuf delim) + inline TDelimStroka(TStringBuf s, TStringBuf delim) : S(s) , Delim(delim) { diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp index 18a8b2a160..da0ab5c0fd 100644 --- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp +++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp @@ -9,7 +9,7 @@ static void AssertStringSplit(const TString& str, const TString& delim, const TV // test iterator invariants for (const auto& expectedString : expected) { UNIT_ASSERT(it.Valid()); - UNIT_ASSERT(bool(it)); + UNIT_ASSERT(bool(it)); UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString); ++it; } diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make index 6c753f68a9..04bff040c6 100644 --- a/library/cpp/deprecated/ya.make +++ b/library/cpp/deprecated/ya.make @@ -4,7 +4,7 @@ RECURSE( accessors accessors/ut autoarray - base64 + base64 datafile dater_old dater_old/ut |