aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/deprecated
diff options
context:
space:
mode:
authordiver <diver@yandex-team.ru>2022-02-10 16:48:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:07 +0300
commit7629e1f9ef7f9d2a3c345c97e6a4e5a4b32ee786 (patch)
treec3371bfa47641a52244267b63009d16e4e7054ff /library/cpp/deprecated
parentcc573d2716c99ba22afc98753971cd97fd5283e0 (diff)
downloadydb-7629e1f9ef7f9d2a3c345c97e6a4e5a4b32ee786.tar.gz
Restoring authorship annotation for <diver@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/deprecated')
-rw-r--r--library/cpp/deprecated/split/delim_string_iter.h50
-rw-r--r--library/cpp/deprecated/split/delim_string_iter_ut.cpp14
2 files changed, 32 insertions, 32 deletions
diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h
index 8e4ca171a0..ccdcbb5b45 100644
--- a/library/cpp/deprecated/split/delim_string_iter.h
+++ b/library/cpp/deprecated/split/delim_string_iter.h
@@ -9,7 +9,7 @@
#include <iterator>
class TDelimStringIter {
-public:
+public:
using value_type = TStringBuf;
using difference_type = ptrdiff_t;
using pointer = const TStringBuf*;
@@ -23,14 +23,14 @@ public:
inline TDelimStringIter(TStringBuf str, TStringBuf delim)
: IsValid(true)
- , Str(str)
+ , Str(str)
, Delim(delim)
{
- UpdateCurrent();
+ UpdateCurrent();
}
inline TDelimStringIter()
- : IsValid(false)
+ : IsValid(false)
{
}
@@ -40,12 +40,12 @@ public:
// NOTE: this is a potentially unsafe operation (no overrun check)
inline TDelimStringIter& operator++() {
- if (Current.end() != Str.end()) {
- Str.Skip(Current.length() + Delim.length());
- UpdateCurrent();
+ if (Current.end() != Str.end()) {
+ Str.Skip(Current.length() + Delim.length());
+ UpdateCurrent();
} else {
- Str.Clear();
- Current.Clear();
+ Str.Clear();
+ Current.Clear();
IsValid = false;
}
return *this;
@@ -58,26 +58,26 @@ public:
}
inline bool operator==(const TDelimStringIter& rhs) const {
- return (IsValid == rhs.IsValid) && (!IsValid || (Current.begin() == rhs.Current.begin()));
+ return (IsValid == rhs.IsValid) && (!IsValid || (Current.begin() == rhs.Current.begin()));
}
inline bool operator!=(const TDelimStringIter& rhs) const {
- return !(*this == rhs);
+ return !(*this == rhs);
}
inline TStringBuf operator*() const {
- return Current;
+ return Current;
}
inline const TStringBuf* operator->() const {
- return &Current;
- }
-
+ return &Current;
+ }
+
// Get & advance
template <class T>
inline bool TryNext(T& t) {
if (IsValid) {
- t = FromString<T>(Current);
+ t = FromString<T>(Current);
operator++();
return true;
} else {
@@ -95,26 +95,26 @@ public:
template <class T>
inline T GetNext() {
- T res;
- Next(res);
- return res;
- }
-
+ T res;
+ Next(res);
+ return res;
+ }
+
inline const char* GetBegin() const {
- return Current.begin();
+ return Current.begin();
}
inline const char* GetEnd() const {
- return Current.end();
+ return Current.end();
}
inline bool Valid() const {
return IsValid;
}
- // contents from next token to the end of string
+ // contents from next token to the end of string
inline TStringBuf Cdr() const {
- return Str.SubStr(Current.length() + Delim.length());
+ return Str.SubStr(Current.length() + Delim.length());
}
inline TDelimStringIter IterEnd() const {
diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
index 18a8b2a160..fece177f4d 100644
--- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp
+++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
@@ -10,7 +10,7 @@ static void AssertStringSplit(const TString& str, const TString& delim, const TV
for (const auto& expectedString : expected) {
UNIT_ASSERT(it.Valid());
UNIT_ASSERT(bool(it));
- UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString);
+ UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString);
++it;
}
UNIT_ASSERT(!it.Valid());
@@ -30,14 +30,14 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) {
Y_UNIT_TEST(NoDelimitersPresent) {
AssertStringSplit("This string could be yours", "\t", {"This string could be yours"});
}
-
+
Y_UNIT_TEST(Cdr) {
TDelimStringIter it("a\tc\t", "\t");
- UNIT_ASSERT_STRINGS_EQUAL(*it, "a");
- UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "c\t");
- ++it;
- UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "");
- }
+ UNIT_ASSERT_STRINGS_EQUAL(*it, "a");
+ UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "c\t");
+ ++it;
+ UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "");
+ }
Y_UNIT_TEST(ForIter) {
TVector<TStringBuf> expected = {"1", "", "3@4", ""};