aboutsummaryrefslogtreecommitdiffstats
path: root/util/string
diff options
context:
space:
mode:
authorfippo <fippo@yandex-team.ru>2022-02-10 16:50:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:08 +0300
commit3e57c324d47a3a202cb3c5a9648d2f92103d5213 (patch)
tree6913479b0d0b22ec99bbba7c96f2f930d9095600 /util/string
parentbebbbda5c5ff4ec70d301ac897eb8d6c8da7a9a4 (diff)
downloadydb-3e57c324d47a3a202cb3c5a9648d2f92103d5213.tar.gz
Restoring authorship annotation for <fippo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string')
-rw-r--r--util/string/split.h26
-rw-r--r--util/string/split_ut.cpp12
2 files changed, 19 insertions, 19 deletions
diff --git a/util/string/split.h b/util/string/split.h
index bc46d9e64c..3d7c6d1a95 100644
--- a/util/string/split.h
+++ b/util/string/split.h
@@ -423,14 +423,14 @@ inline size_t Split(const TStringBuf s, const TSetDelimiter<const char>& delim,
SplitString(s.data(), s.data() + s.size(), delim, consumer);
return res.size();
}
-
+
template <class P, class D>
-void GetNext(TStringBuf& s, D delim, P& param) {
- TStringBuf next = s.NextTok(delim);
+void GetNext(TStringBuf& s, D delim, P& param) {
+ TStringBuf next = s.NextTok(delim);
Y_ENSURE(next.IsInited(), TStringBuf("Split: number of fields less than number of Split output arguments"));
- param = FromString<P>(next);
-}
-
+ param = FromString<P>(next);
+}
+
template <class P, class D>
void GetNext(TStringBuf& s, D delim, TMaybe<P>& param) {
TStringBuf next = s.NextTok(delim);
@@ -444,17 +444,17 @@ void GetNext(TStringBuf& s, D delim, TMaybe<P>& param) {
// example:
// Split(TStringBuf("Sherlock,2014,36.6"), ',', name, year, temperature);
template <class D, class P1, class P2>
-void Split(TStringBuf s, D delim, P1& p1, P2& p2) {
- GetNext(s, delim, p1);
- GetNext(s, delim, p2);
+void Split(TStringBuf s, D delim, P1& p1, P2& p2) {
+ GetNext(s, delim, p1);
+ GetNext(s, delim, p2);
Y_ENSURE(!s.IsInited(), TStringBuf("Split: number of fields more than number of Split output arguments"));
-}
-
+}
+
template <class D, class P1, class P2, class... Other>
void Split(TStringBuf s, D delim, P1& p1, P2& p2, Other&... other) {
- GetNext(s, delim, p1);
+ GetNext(s, delim, p1);
Split(s, delim, p2, other...);
-}
+}
/**
* \fn auto StringSplitter(...)
diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp
index 43e59f2d75..e027d1ac7d 100644
--- a/util/string/split_ut.cpp
+++ b/util/string/split_ut.cpp
@@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) {
UNIT_ASSERT_VALUES_EQUAL(num1, 22);
UNIT_ASSERT_VALUES_EQUAL(num2, 33.5);
UNIT_ASSERT_VALUES_EQUAL(strBuf, "xyz");
- }
+ }
Y_UNIT_TEST(ConvenientSplitTestWithMaybe) {
TString data("abc 42");
@@ -280,11 +280,11 @@ Y_UNIT_TEST_SUITE(SplitStringTest) {
Y_UNIT_TEST(ConvenientSplitTestExceptions) {
TString data("abc 22 33");
TString s1, s2, s3, s4;
-
- UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2), yexception);
- UNIT_ASSERT_NO_EXCEPTION(Split(data, ' ', s1, s2, s3));
- UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2, s3, s4), yexception);
- }
+
+ UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2), yexception);
+ UNIT_ASSERT_NO_EXCEPTION(Split(data, ' ', s1, s2, s3));
+ UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2, s3, s4), yexception);
+ }
Y_UNIT_TEST(ConvenientSplitTestMaybeExceptions) {
TString data("abc 22 33");