aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvkap <vkap@yandex-team.ru>2022-02-10 16:52:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:52:03 +0300
commit2293cfbde84d06fd05df2d8b5e84a0f58c6b827e (patch)
treea6bcfcb3e625cd4eef7032ce2645f0a8486b482a
parent578d2b4e4ceeab5fd36f435815a15f2359bf21a0 (diff)
downloadydb-2293cfbde84d06fd05df2d8b5e84a0f58c6b827e.tar.gz
Restoring authorship annotation for <vkap@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--util/stream/fwd.h2
-rw-r--r--util/string/strip.h100
-rw-r--r--util/string/strip_ut.cpp26
3 files changed, 64 insertions, 64 deletions
diff --git a/util/stream/fwd.h b/util/stream/fwd.h
index 307676c6a7..8e9b5faf9a 100644
--- a/util/stream/fwd.h
+++ b/util/stream/fwd.h
@@ -57,7 +57,7 @@ namespace ZLib {
enum StreamType: ui8;
}
-class TZLibDecompress;
+class TZLibDecompress;
class TZLibCompress;
class TBufferedZLibDecompress;
diff --git a/util/string/strip.h b/util/string/strip.h
index d5ef6da96d..4085d25d08 100644
--- a/util/string/strip.h
+++ b/util/string/strip.h
@@ -6,62 +6,62 @@
#include <util/generic/strbuf.h>
#include <utility>
-template <class It>
-struct TIsAsciiSpaceAdapter {
+template <class It>
+struct TIsAsciiSpaceAdapter {
bool operator()(const It& it) const noexcept {
- return IsAsciiSpace(*it);
- }
-};
-
-template <class It>
-TIsAsciiSpaceAdapter<It> IsAsciiSpaceAdapter(It) {
+ return IsAsciiSpace(*it);
+ }
+};
+
+template <class It>
+TIsAsciiSpaceAdapter<It> IsAsciiSpaceAdapter(It) {
return {};
-}
-
-template <class TChar>
-struct TEqualsStripAdapter {
- TEqualsStripAdapter(TChar ch)
- : Ch(ch)
- {
- }
-
- template <class It>
+}
+
+template <class TChar>
+struct TEqualsStripAdapter {
+ TEqualsStripAdapter(TChar ch)
+ : Ch(ch)
+ {
+ }
+
+ template <class It>
bool operator()(const It& it) const noexcept {
- return *it == Ch;
- }
-
+ return *it == Ch;
+ }
+
const TChar Ch;
-};
-
-template <class TChar>
-TEqualsStripAdapter<TChar> EqualsStripAdapter(TChar ch) {
+};
+
+template <class TChar>
+TEqualsStripAdapter<TChar> EqualsStripAdapter(TChar ch) {
return {ch};
-}
-
+}
+
template <class It, class TStripCriterion>
inline void StripRangeBegin(It& b, const It& e, TStripCriterion&& criterion) noexcept {
- while (b < e && criterion(b)) {
+ while (b < e && criterion(b)) {
++b;
}
}
template <class It>
inline void StripRangeBegin(It& b, const It& e) noexcept {
- StripRangeBegin(b, e, IsAsciiSpaceAdapter(b));
-}
-
+ StripRangeBegin(b, e, IsAsciiSpaceAdapter(b));
+}
+
template <class It, class TStripCriterion>
inline void StripRangeEnd(const It& b, It& e, TStripCriterion&& criterion) noexcept {
- while (b < e && criterion(e - 1)) {
+ while (b < e && criterion(e - 1)) {
--e;
}
}
template <class It>
inline void StripRangeEnd(const It& b, It& e) noexcept {
- StripRangeEnd(b, e, IsAsciiSpaceAdapter(b));
-}
-
+ StripRangeEnd(b, e, IsAsciiSpaceAdapter(b));
+}
+
template <bool stripBeg, bool stripEnd>
struct TStripImpl {
template <class It, class TStripCriterion>
@@ -116,9 +116,9 @@ inline bool StripRange(It& b, It& e, TStripCriterion&& criterion) noexcept {
template <class It>
inline bool StripRange(It& b, It& e) noexcept {
- return StripRange(b, e, IsAsciiSpaceAdapter(b));
-}
-
+ return StripRange(b, e, IsAsciiSpaceAdapter(b));
+}
+
template <class It, class TStripCriterion>
inline bool Strip(It& b, size_t& len, TStripCriterion&& criterion) noexcept {
It e = b + len;
@@ -132,31 +132,31 @@ inline bool Strip(It& b, size_t& len, TStripCriterion&& criterion) noexcept {
return false;
}
-template <class It>
+template <class It>
inline bool Strip(It& b, size_t& len) noexcept {
- return Strip(b, len, IsAsciiSpaceAdapter(b));
-}
-
+ return Strip(b, len, IsAsciiSpaceAdapter(b));
+}
+
template <class T, class TStripCriterion>
static inline bool StripString(const T& from, T& to, TStripCriterion&& criterion) {
return TStripImpl<true, true>::StripString(from, to, criterion);
}
template <class T>
-static inline bool StripString(const T& from, T& to) {
- return StripString(from, to, IsAsciiSpaceAdapter(from.begin()));
-}
-
+static inline bool StripString(const T& from, T& to) {
+ return StripString(from, to, IsAsciiSpaceAdapter(from.begin()));
+}
+
template <class T, class TStripCriterion>
static inline T StripString(const T& from, TStripCriterion&& criterion) {
return TStripImpl<true, true>::StripString(from, criterion);
}
-template <class T>
-static inline T StripString(const T& from) {
+template <class T>
+static inline T StripString(const T& from) {
return TStripImpl<true, true>::StripString(from);
-}
-
+}
+
template <class T>
static inline T StripStringLeft(const T& from) {
return TStripImpl<true, false>::StripString(from);
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index d1029d1498..bfc3c7c80a 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -46,8 +46,8 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
Y_UNIT_TEST(TestCustomStrip) {
struct TTest {
- const char* Str;
- const char* Result;
+ const char* Str;
+ const char* Result;
};
static const TTest tests[] = {
{"//012//", "012"},
@@ -55,14 +55,14 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
{"012", "012"},
{"012//", "012"},
};
-
+
for (auto test : tests) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
StripString(TString(test.Str), EqualsStripAdapter('/')),
test.Result);
- };
- }
-
+ };
+ }
+
Y_UNIT_TEST(TestCustomStripLeftRight) {
struct TTest {
const char* Str;
@@ -88,11 +88,11 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
Y_UNIT_TEST(TestNullStringStrip) {
TStringBuf nullString(nullptr, nullptr);
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
StripString(nullString),
TString());
- }
-
+ }
+
Y_UNIT_TEST(TestWtrokaStrip) {
UNIT_ASSERT_EQUAL(StripString(TWtringBuf(u" abc ")), u"abc");
UNIT_ASSERT_EQUAL(StripStringLeft(TWtringBuf(u" abc ")), u"abc ");
@@ -100,13 +100,13 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
}
Y_UNIT_TEST(TestWtrokaCustomStrip) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
StripString(
TWtringBuf(u"/abc/"),
EqualsStripAdapter(u'/')),
u"abc");
- }
-
+ }
+
Y_UNIT_TEST(TestCollapse) {
TString s;
Collapse(TString(" 123 456 "), s);