aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/deprecated
diff options
context:
space:
mode:
authordobrokot <dobrokot@yandex-team.ru>2022-02-10 16:49:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:07 +0300
commit25d83bf841d8b3ce3886525078f1964ac3c293c5 (patch)
treebd52fa16c8dd727890b2ef9d87d1a402bd0d3a9a /library/cpp/deprecated
parent1d2e8a8e9976488ea69a7e4763aa749244f82612 (diff)
downloadydb-25d83bf841d8b3ce3886525078f1964ac3c293c5.tar.gz
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/deprecated')
-rw-r--r--library/cpp/deprecated/accessors/accessors.h74
-rw-r--r--library/cpp/deprecated/accessors/accessors_impl.h396
-rw-r--r--library/cpp/deprecated/accessors/accessors_ut.cpp62
-rw-r--r--library/cpp/deprecated/split/delim_string_iter.h24
-rw-r--r--library/cpp/deprecated/split/delim_string_iter_ut.cpp14
5 files changed, 285 insertions, 285 deletions
diff --git a/library/cpp/deprecated/accessors/accessors.h b/library/cpp/deprecated/accessors/accessors.h
index 6d4b1da3ad..ab7c0cfb83 100644
--- a/library/cpp/deprecated/accessors/accessors.h
+++ b/library/cpp/deprecated/accessors/accessors.h
@@ -37,44 +37,44 @@ namespace NAccessors {
inline size_t Size(const T& t) {
return End(t) - Begin(t);
}
-
- /**
- * This gives some unification in terms of memory manipulation.
- */
-
- template <typename T>
- inline void Reserve(T& t, size_t sz) {
- NPrivate::TReserve<T>::Do(t, sz);
- }
-
- template <typename T>
- inline void Resize(T& t, size_t sz) {
- NPrivate::TResize<T>::Do(t, sz);
- }
-
- template <typename T>
- inline void Clear(T& t) {
- NPrivate::TClear<T, false>::Do(t);
- }
-
- template <typename T>
- inline void Init(T& t) {
- NPrivate::TClear<T, true>::Do(t);
- }
-
- template <typename T>
- inline void Append(T& t, const typename TMemoryTraits<T>::TElementType& v) {
- NPrivate::TAppend<T>::Do(t, v);
- }
-
- template <typename T>
- inline void Append(T& t,
- const typename TMemoryTraits<T>::TElementType* beg,
- const typename TMemoryTraits<T>::TElementType* end) {
- NPrivate::TAppendRegion<T>::Do(t, beg, end);
- }
-
+
+ /**
+ * This gives some unification in terms of memory manipulation.
+ */
+
template <typename T>
+ inline void Reserve(T& t, size_t sz) {
+ NPrivate::TReserve<T>::Do(t, sz);
+ }
+
+ template <typename T>
+ inline void Resize(T& t, size_t sz) {
+ NPrivate::TResize<T>::Do(t, sz);
+ }
+
+ template <typename T>
+ inline void Clear(T& t) {
+ NPrivate::TClear<T, false>::Do(t);
+ }
+
+ template <typename T>
+ inline void Init(T& t) {
+ NPrivate::TClear<T, true>::Do(t);
+ }
+
+ template <typename T>
+ inline void Append(T& t, const typename TMemoryTraits<T>::TElementType& v) {
+ NPrivate::TAppend<T>::Do(t, v);
+ }
+
+ template <typename T>
+ inline void Append(T& t,
+ const typename TMemoryTraits<T>::TElementType* beg,
+ const typename TMemoryTraits<T>::TElementType* end) {
+ NPrivate::TAppendRegion<T>::Do(t, beg, end);
+ }
+
+ template <typename T>
inline void Assign(T& t,
const typename TMemoryTraits<T>::TElementType* beg,
const typename TMemoryTraits<T>::TElementType* end) {
diff --git a/library/cpp/deprecated/accessors/accessors_impl.h b/library/cpp/deprecated/accessors/accessors_impl.h
index 6b2b987351..61d1956a1f 100644
--- a/library/cpp/deprecated/accessors/accessors_impl.h
+++ b/library/cpp/deprecated/accessors/accessors_impl.h
@@ -113,236 +113,236 @@ namespace NAccessors {
return TGet::Get(b);
}
};
-
- template <typename Ta, bool Init>
- struct TClear: public TMemoryAccessorBase<Ta> {
- template <typename Tb>
- struct TNoMemoryIndirectionClear {
- static void Do(Tb& b) {
- Zero(b);
- }
- };
-
- template <typename Tb>
- struct TIndirectMemoryRegionClear {
+
+ template <typename Ta, bool Init>
+ struct TClear: public TMemoryAccessorBase<Ta> {
+ template <typename Tb>
+ struct TNoMemoryIndirectionClear {
+ static void Do(Tb& b) {
+ Zero(b);
+ }
+ };
+
+ template <typename Tb>
+ struct TIndirectMemoryRegionClear {
Y_HAS_MEMBER(Clear);
Y_HAS_MEMBER(clear);
-
- template <typename Tc>
- struct TByClear {
- static void Do(Tc& b) {
- b.Clear();
- }
- };
-
- template <typename Tc>
- struct TByclear {
- static void Do(Tc& b) {
- b.clear();
- }
- };
-
- template <typename Tc>
- struct TByNone {
- static void Do(Tc& b) {
- if (!Init)
- b = Tc();
- }
- };
-
+
+ template <typename Tc>
+ struct TByClear {
+ static void Do(Tc& b) {
+ b.Clear();
+ }
+ };
+
+ template <typename Tc>
+ struct TByclear {
+ static void Do(Tc& b) {
+ b.clear();
+ }
+ };
+
+ template <typename Tc>
+ struct TByNone {
+ static void Do(Tc& b) {
+ if (!Init)
+ b = Tc();
+ }
+ };
+
using TDo = std::conditional_t<
THasClear<Tb>::value,
- TByClear<Tb>,
+ TByClear<Tb>,
std::conditional_t<
THasclear<Tb>::value,
- TByclear<Tb>,
- TByNone<Tb>>>;
-
- static void Do(Tb& b) {
- TDo::Do(b);
- }
- };
-
+ TByclear<Tb>,
+ TByNone<Tb>>>;
+
+ static void Do(Tb& b) {
+ TDo::Do(b);
+ }
+ };
+
using TDo = std::conditional_t<TMemoryAccessorBase<Ta>::SimpleMemory, TNoMemoryIndirectionClear<Ta>, TIndirectMemoryRegionClear<Ta>>;
-
- static void Do(Ta& b) {
- TDo::Do(b);
- }
- };
-
- template <typename Tb>
- struct TReserve {
+
+ static void Do(Ta& b) {
+ TDo::Do(b);
+ }
+ };
+
+ template <typename Tb>
+ struct TReserve {
Y_HAS_MEMBER(Reserve);
Y_HAS_MEMBER(reserve);
-
- template <typename Tc>
- struct TByReserve {
- static void Do(Tc& b, size_t sz) {
- b.Reserve(sz);
- }
- };
-
- template <typename Tc>
- struct TByreserve {
- static void Do(Tc& b, size_t sz) {
- b.reserve(sz);
- }
- };
-
- template <typename Tc>
- struct TByNone {
- static void Do(Tc&, size_t) {
- }
- };
-
+
+ template <typename Tc>
+ struct TByReserve {
+ static void Do(Tc& b, size_t sz) {
+ b.Reserve(sz);
+ }
+ };
+
+ template <typename Tc>
+ struct TByreserve {
+ static void Do(Tc& b, size_t sz) {
+ b.reserve(sz);
+ }
+ };
+
+ template <typename Tc>
+ struct TByNone {
+ static void Do(Tc&, size_t) {
+ }
+ };
+
using TDo = std::conditional_t<
THasReserve<Tb>::value,
- TByReserve<Tb>,
+ TByReserve<Tb>,
std::conditional_t<
THasreserve<Tb>::value,
- TByreserve<Tb>,
- TByNone<Tb>>>;
-
- static void Do(Tb& b, size_t sz) {
- TDo::Do(b, sz);
- }
- };
-
- template <typename Tb>
- struct TResize {
+ TByreserve<Tb>,
+ TByNone<Tb>>>;
+
+ static void Do(Tb& b, size_t sz) {
+ TDo::Do(b, sz);
+ }
+ };
+
+ template <typename Tb>
+ struct TResize {
Y_HAS_MEMBER(Resize);
Y_HAS_MEMBER(resize);
-
- template <typename Tc>
- struct TByResize {
- static void Do(Tc& b, size_t sz) {
- b.Resize(sz);
- }
- };
-
- template <typename Tc>
- struct TByresize {
- static void Do(Tc& b, size_t sz) {
- b.resize(sz);
- }
- };
-
+
+ template <typename Tc>
+ struct TByResize {
+ static void Do(Tc& b, size_t sz) {
+ b.Resize(sz);
+ }
+ };
+
+ template <typename Tc>
+ struct TByresize {
+ static void Do(Tc& b, size_t sz) {
+ b.resize(sz);
+ }
+ };
+
using TDo = std::conditional_t<THasResize<Tb>::value, TByResize<Tb>, TByresize<Tb>>;
-
- static void Do(Tb& b, size_t sz) {
- TDo::Do(b, sz);
- }
- };
-
- template <typename Tb>
- struct TAppend {
+
+ static void Do(Tb& b, size_t sz) {
+ TDo::Do(b, sz);
+ }
+ };
+
+ template <typename Tb>
+ struct TAppend {
Y_HAS_MEMBER(Append);
Y_HAS_MEMBER(append);
Y_HAS_MEMBER(push_back);
-
- template <typename Tc>
- struct TByAppend {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType& val) {
- b.Append(val);
- }
- };
-
- template <typename Tc>
- struct TByappend {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType& val) {
- b.append(val);
- }
- };
-
- template <typename Tc>
- struct TBypush_back {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType& val) {
- b.push_back(val);
- }
- };
-
+
+ template <typename Tc>
+ struct TByAppend {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType& val) {
+ b.Append(val);
+ }
+ };
+
+ template <typename Tc>
+ struct TByappend {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType& val) {
+ b.append(val);
+ }
+ };
+
+ template <typename Tc>
+ struct TBypush_back {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType& val) {
+ b.push_back(val);
+ }
+ };
+
using TDo = std::conditional_t<
THasAppend<Tb>::value,
- TByAppend<Tb>,
+ TByAppend<Tb>,
std::conditional_t<
THasappend<Tb>::value,
- TByappend<Tb>,
- TBypush_back<Tb>>>;
-
- using TElementType = typename TMemoryTraits<Tb>::TElementType;
-
- static void Do(Tb& b, const TElementType& val) {
- TDo::Do(b, val);
- }
- };
-
- template <typename Tb>
- struct TAppendRegion {
+ TByappend<Tb>,
+ TBypush_back<Tb>>>;
+
+ using TElementType = typename TMemoryTraits<Tb>::TElementType;
+
+ static void Do(Tb& b, const TElementType& val) {
+ TDo::Do(b, val);
+ }
+ };
+
+ template <typename Tb>
+ struct TAppendRegion {
Y_HAS_MEMBER(Append);
Y_HAS_MEMBER(append);
Y_HAS_MEMBER(insert);
-
- template <typename Tc>
- struct TByAppend {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
- b.Append(beg, end);
- }
- };
-
- template <typename Tc>
- struct TByappend {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
- b.append(beg, end);
- }
- };
-
- template <typename Tc>
- struct TByinsert {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
- b.insert(b.end(), beg, end);
- }
- };
-
- template <typename Tc>
- struct TByNone {
- using TElementType = typename TMemoryTraits<Tc>::TElementType;
-
- static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
- for (const TElementType* it = beg; it != end; ++it)
- TAppend<Tc>::Do(b, *it);
- }
- };
-
+
+ template <typename Tc>
+ struct TByAppend {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
+ b.Append(beg, end);
+ }
+ };
+
+ template <typename Tc>
+ struct TByappend {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
+ b.append(beg, end);
+ }
+ };
+
+ template <typename Tc>
+ struct TByinsert {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
+ b.insert(b.end(), beg, end);
+ }
+ };
+
+ template <typename Tc>
+ struct TByNone {
+ using TElementType = typename TMemoryTraits<Tc>::TElementType;
+
+ static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
+ for (const TElementType* it = beg; it != end; ++it)
+ TAppend<Tc>::Do(b, *it);
+ }
+ };
+
using TDo = std::conditional_t<
THasAppend<Tb>::value,
- TByAppend<Tb>,
+ TByAppend<Tb>,
std::conditional_t<
THasappend<Tb>::value,
- TByappend<Tb>,
+ TByappend<Tb>,
std::conditional_t<
THasinsert<Tb>::value,
- TByinsert<Tb>,
- TByNone<Tb>>>>;
-
- using TElementType = typename TMemoryTraits<Tb>::TElementType;
-
- static void Do(Tb& b, const TElementType* beg, const TElementType* end) {
- TDo::Do(b, beg, end);
- }
- };
-
+ TByinsert<Tb>,
+ TByNone<Tb>>>>;
+
+ using TElementType = typename TMemoryTraits<Tb>::TElementType;
+
+ static void Do(Tb& b, const TElementType* beg, const TElementType* end) {
+ TDo::Do(b, beg, end);
+ }
+ };
+
template <typename Ta>
struct TAssign: public TMemoryAccessorBase<Ta> {
using TElementType = typename TMemoryTraits<Ta>::TElementType;
diff --git a/library/cpp/deprecated/accessors/accessors_ut.cpp b/library/cpp/deprecated/accessors/accessors_ut.cpp
index a9bdc9fcc4..794efbf25a 100644
--- a/library/cpp/deprecated/accessors/accessors_ut.cpp
+++ b/library/cpp/deprecated/accessors/accessors_ut.cpp
@@ -22,30 +22,30 @@ private:
UNIT_ASSERT_VALUES_EQUAL_C(end - beg, sz, comm);
}
- template <typename T>
- void TestWrite(const char* comm) {
- typename TMemoryTraits<T>::TElementType val[4] = {'t', 'e', 's', 't'};
- T t;
- NAccessors::Init(t);
- NAccessors::Reserve(t, 6);
-
- size_t sz = NAccessors::Size(t);
- UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm);
-
- NAccessors::Append(t, 'a');
- sz = NAccessors::Size(t);
- UNIT_ASSERT_VALUES_EQUAL_C(1u, sz, comm);
-
- NAccessors::Append(t, val, val + 4);
- sz = NAccessors::Size(t);
- UNIT_ASSERT_VALUES_EQUAL_C(5u, sz, comm);
-
- NAccessors::Clear(t);
-
- sz = NAccessors::Size(t);
- UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm);
- }
-
+ template <typename T>
+ void TestWrite(const char* comm) {
+ typename TMemoryTraits<T>::TElementType val[4] = {'t', 'e', 's', 't'};
+ T t;
+ NAccessors::Init(t);
+ NAccessors::Reserve(t, 6);
+
+ size_t sz = NAccessors::Size(t);
+ UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm);
+
+ NAccessors::Append(t, 'a');
+ sz = NAccessors::Size(t);
+ UNIT_ASSERT_VALUES_EQUAL_C(1u, sz, comm);
+
+ NAccessors::Append(t, val, val + 4);
+ sz = NAccessors::Size(t);
+ UNIT_ASSERT_VALUES_EQUAL_C(5u, sz, comm);
+
+ NAccessors::Clear(t);
+
+ sz = NAccessors::Size(t);
+ UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm);
+ }
+
void TestAccessors() {
TestRead('a', "char");
TestRead(1, "int");
@@ -74,17 +74,17 @@ private:
TestWrite<TString>("TString");
TestWrite<TVector<char>>("TVector<char>");
- TestWrite<TBuffer>("TBuffer");
+ TestWrite<TBuffer>("TBuffer");
TestWrite<TVector<ui64>>("TVector<ui64>");
TestWrite<TUtf16String>("TUtf16String");
-
+
std::array<TString, 10> sarr;
- NAccessors::Init(sarr);
- NAccessors::Clear(sarr);
-
+ NAccessors::Init(sarr);
+ NAccessors::Clear(sarr);
+
std::array<char, 10> carr;
- NAccessors::Init(carr);
- NAccessors::Clear(carr);
+ NAccessors::Init(carr);
+ NAccessors::Clear(carr);
TestRead(carr, "std::array<char, 10>");
}
};
diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h
index 8e4ca171a0..5bf1348bcc 100644
--- a/library/cpp/deprecated/split/delim_string_iter.h
+++ b/library/cpp/deprecated/split/delim_string_iter.h
@@ -136,26 +136,26 @@ private:
TStringBuf Delim;
};
-//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... }
+//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... }
struct TDelimStroka {
- TStringBuf S;
- TStringBuf Delim;
-
+ TStringBuf S;
+ TStringBuf Delim;
+
inline TDelimStroka(TStringBuf s, TStringBuf delim)
- : S(s)
- , Delim(delim)
+ : S(s)
+ , Delim(delim)
{
}
-
+
inline TDelimStringIter begin() const {
return TDelimStringIter(S, Delim);
- }
-
+ }
+
inline TDelimStringIter end() const {
return TDelimStringIter();
- }
-};
-
+ }
+};
+
inline TDelimStringIter begin_delim(const TString& str, TStringBuf delim) {
return TDelimStringIter(str, 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..c9d94b4a1d 100644
--- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp
+++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
@@ -38,17 +38,17 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) {
++it;
UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), "");
}
-
+
Y_UNIT_TEST(ForIter) {
TVector<TStringBuf> expected = {"1", "", "3@4", ""};
TVector<TStringBuf> got;
-
+
for (TStringBuf x : TDelimStroka("1@@@@3@4@@", "@@")) {
- got.push_back(x);
- }
-
- UNIT_ASSERT_EQUAL(got, expected);
- }
+ got.push_back(x);
+ }
+
+ UNIT_ASSERT_EQUAL(got, expected);
+ }
}
static void AssertKeyValueStringSplit(