aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/deprecated
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/deprecated
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/deprecated')
-rw-r--r--library/cpp/deprecated/accessors/accessors.h52
-rw-r--r--library/cpp/deprecated/accessors/accessors_impl.h90
-rw-r--r--library/cpp/deprecated/accessors/accessors_ut.cpp80
-rw-r--r--library/cpp/deprecated/accessors/memory_traits.h276
-rw-r--r--library/cpp/deprecated/kmp/kmp.h2
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.h2
-rw-r--r--library/cpp/deprecated/split/delim_string_iter.h2
-rw-r--r--library/cpp/deprecated/split/split_iterator.h2
8 files changed, 253 insertions, 253 deletions
diff --git a/library/cpp/deprecated/accessors/accessors.h b/library/cpp/deprecated/accessors/accessors.h
index 3ecdc2aab5..6d4b1da3ad 100644
--- a/library/cpp/deprecated/accessors/accessors.h
+++ b/library/cpp/deprecated/accessors/accessors.h
@@ -1,38 +1,38 @@
-#pragma once
-
-#include "accessors_impl.h"
-
-namespace NAccessors {
+#pragma once
+
+#include "accessors_impl.h"
+
+namespace NAccessors {
/*
- * Adds API compatibility between different types representing memory regions.
- *
- * i.e. this will work:
- *
+ * Adds API compatibility between different types representing memory regions.
+ *
+ * i.e. this will work:
+ *
* TString t;
- * const char* beg = NAccessors::Begin(t); // t.begin()
- * const char* end = NAccessors::End(t); // t.end()
- * size_t sz = NAccessors::Size(t); // t.size()
- *
- * as well as this:
- *
- * ui64 t;
- * const ui64* beg = NAccessors::Begin(t); // &t
- * const ui64* end = NAccessors::End(t); // &t + 1
- * size_t sz = NAccessors::Size(t); // 1
- *
- * Both will give you begin, end and size of the underlying memory region.
- */
-
+ * const char* beg = NAccessors::Begin(t); // t.begin()
+ * const char* end = NAccessors::End(t); // t.end()
+ * size_t sz = NAccessors::Size(t); // t.size()
+ *
+ * as well as this:
+ *
+ * ui64 t;
+ * const ui64* beg = NAccessors::Begin(t); // &t
+ * const ui64* end = NAccessors::End(t); // &t + 1
+ * size_t sz = NAccessors::Size(t); // 1
+ *
+ * Both will give you begin, end and size of the underlying memory region.
+ */
+
template <typename T>
inline const typename TMemoryTraits<T>::TElementType* Begin(const T& t) {
return NPrivate::TBegin<T>::Get(t);
}
-
+
template <typename T>
inline const typename TMemoryTraits<T>::TElementType* End(const T& t) {
return NPrivate::TEnd<T>::Get(t);
}
-
+
template <typename T>
inline size_t Size(const T& t) {
return End(t) - Begin(t);
@@ -80,4 +80,4 @@ namespace NAccessors {
const typename TMemoryTraits<T>::TElementType* end) {
NPrivate::TAssign<T>::Do(t, beg, end);
}
-}
+}
diff --git a/library/cpp/deprecated/accessors/accessors_impl.h b/library/cpp/deprecated/accessors/accessors_impl.h
index f73d0ad577..6b2b987351 100644
--- a/library/cpp/deprecated/accessors/accessors_impl.h
+++ b/library/cpp/deprecated/accessors/accessors_impl.h
@@ -1,8 +1,8 @@
-#pragma once
-
-#include "memory_traits.h"
-
-namespace NAccessors {
+#pragma once
+
+#include "memory_traits.h"
+
+namespace NAccessors {
namespace NPrivate {
template <typename Ta>
struct TMemoryAccessorBase {
@@ -10,33 +10,33 @@ namespace NAccessors {
SimpleMemory = TMemoryTraits<Ta>::SimpleMemory,
ContinuousMemory = TMemoryTraits<Ta>::ContinuousMemory,
};
-
+
struct TBadAccessor;
};
-
+
template <typename Ta>
struct TBegin: public TMemoryAccessorBase<Ta> {
using TElementType = typename TMemoryTraits<Ta>::TElementType;
-
+
template <typename Tb>
struct TNoMemoryIndirectionBegin {
static const TElementType* Get(const Tb& b) {
return (const TElementType*)&b;
}
};
-
+
template <typename Tb>
struct TIndirectMemoryRegionBegin {
Y_HAS_MEMBER(Begin);
Y_HAS_MEMBER(begin);
-
+
template <typename Tc>
struct TByBegin {
static const TElementType* Get(const Tc& b) {
return (const TElementType*)b.Begin();
}
};
-
+
template <typename Tc>
struct TBybegin {
static const TElementType* Get(const Tc& b) {
@@ -61,46 +61,46 @@ namespace NAccessors {
static const TElementType* Get(const Ta& b) {
return TGet::Get(b);
- }
- };
-
+ }
+ };
+
template <typename Ta>
struct TEnd: public TMemoryAccessorBase<Ta> {
using TElementType = typename TMemoryTraits<Ta>::TElementType;
-
+
template <typename Tb>
struct TNoMemoryIndirectionEnd {
static const TElementType* Get(const Tb& b) {
return (const TElementType*)(&b + 1);
}
};
-
+
template <typename Tb>
struct TIndirectMemoryRegionEnd {
Y_HAS_MEMBER(End);
Y_HAS_MEMBER(end);
-
+
template <typename Tc>
struct TByEnd {
static const TElementType* Get(const Tc& b) {
return (const TElementType*)b.End();
}
};
-
+
template <typename Tc>
struct TByend {
static const TElementType* Get(const Tc& b) {
return (const TElementType*)b.end();
}
};
-
+
using TGet = std::conditional_t<THasEnd<Tb>::value, TByEnd<Tb>, TByend<Tb>>;
-
+
static const TElementType* Get(const Tb& b) {
return TGet::Get(b);
}
};
-
+
using TGet = std::conditional_t<
TMemoryAccessorBase<Ta>::SimpleMemory,
TNoMemoryIndirectionEnd<Ta>,
@@ -108,11 +108,11 @@ namespace NAccessors {
TMemoryAccessorBase<Ta>::ContinuousMemory,
TIndirectMemoryRegionEnd<Ta>,
typename TMemoryAccessorBase<Ta>::TBadAccessor>>;
-
+
static const TElementType* Get(const Ta& b) {
return TGet::Get(b);
- }
- };
+ }
+ };
template <typename Ta, bool Init>
struct TClear: public TMemoryAccessorBase<Ta> {
@@ -346,39 +346,39 @@ namespace NAccessors {
template <typename Ta>
struct TAssign: public TMemoryAccessorBase<Ta> {
using TElementType = typename TMemoryTraits<Ta>::TElementType;
-
+
template <typename Tb>
struct TNoMemoryIndirectionAssign {
static void Do(Tb& b, const TElementType* beg, const TElementType* end) {
- if (sizeof(Tb) == sizeof(TElementType) && end - beg > 0) {
- memcpy(&b, beg, sizeof(Tb));
- } else if (end - beg > 0) {
- memcpy(&b, beg, Min<size_t>((end - beg) * sizeof(TElementType), sizeof(Tb)));
- } else {
- Zero(b);
- }
+ if (sizeof(Tb) == sizeof(TElementType) && end - beg > 0) {
+ memcpy(&b, beg, sizeof(Tb));
+ } else if (end - beg > 0) {
+ memcpy(&b, beg, Min<size_t>((end - beg) * sizeof(TElementType), sizeof(Tb)));
+ } else {
+ Zero(b);
+ }
}
};
-
+
template <typename Tb>
struct TIndirectMemoryRegionAssign {
Y_HAS_MEMBER(Assign);
Y_HAS_MEMBER(assign);
-
+
template <typename Tc>
struct TByAssign {
static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
b.Assign(beg, end);
}
};
-
+
template <typename Tc>
struct TByassign {
static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
b.assign(beg, end);
}
};
-
+
template <typename Tc>
struct TByClearAppend {
static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
@@ -386,14 +386,14 @@ namespace NAccessors {
TAppendRegion<Tc>::Do(b, beg, end);
}
};
-
+
template <typename Tc>
struct TByConstruction {
static void Do(Tc& b, const TElementType* beg, const TElementType* end) {
b = Tc(beg, end);
}
};
-
+
using TDo = std::conditional_t<
THasAssign<Tb>::value,
TByAssign<Tb>,
@@ -404,17 +404,17 @@ namespace NAccessors {
TMemoryTraits<Tb>::OwnsMemory,
TByClearAppend<Tb>,
TByConstruction<Tb>>>>;
-
+
static void Do(Tb& b, const TElementType* beg, const TElementType* end) {
TDo::Do(b, beg, end);
}
};
-
+
using TDo = std::conditional_t<TMemoryAccessorBase<Ta>::SimpleMemory, TNoMemoryIndirectionAssign<Ta>, TIndirectMemoryRegionAssign<Ta>>;
-
+
static void Do(Ta& b, const TElementType* beg, const TElementType* end) {
TDo::Do(b, beg, end);
- }
- };
- }
-}
+ }
+ };
+ }
+}
diff --git a/library/cpp/deprecated/accessors/accessors_ut.cpp b/library/cpp/deprecated/accessors/accessors_ut.cpp
index 80453964fd..a9bdc9fcc4 100644
--- a/library/cpp/deprecated/accessors/accessors_ut.cpp
+++ b/library/cpp/deprecated/accessors/accessors_ut.cpp
@@ -1,27 +1,27 @@
-#include "accessors.h"
-
+#include "accessors.h"
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/buffer.h>
-#include <util/generic/vector.h>
-
+#include <util/generic/buffer.h>
+#include <util/generic/vector.h>
+
#include <array>
-class TAccessorsTest: public TTestBase {
+class TAccessorsTest: public TTestBase {
UNIT_TEST_SUITE(TAccessorsTest);
UNIT_TEST(TestAccessors);
UNIT_TEST_SUITE_END();
-private:
- template <typename T>
- void TestRead(const T& t, const char* comm) {
- const char* beg = (const char*)NAccessors::Begin(t);
- const char* end = (const char*)NAccessors::End(t);
+private:
+ template <typename T>
+ void TestRead(const T& t, const char* comm) {
+ const char* beg = (const char*)NAccessors::Begin(t);
+ const char* end = (const char*)NAccessors::End(t);
long sz = NAccessors::Size(t) * sizeof(typename TMemoryTraits<T>::TElementType);
-
- UNIT_ASSERT_VALUES_EQUAL_C(end - beg, sz, comm);
- }
-
+
+ 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'};
@@ -46,32 +46,32 @@ private:
UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm);
}
- void TestAccessors() {
- TestRead('a', "char");
- TestRead(1, "int");
-
+ void TestAccessors() {
+ TestRead('a', "char");
+ TestRead(1, "int");
+
int t[4] = {0, 1, 2, 3};
-
- TestRead(t, "int[4]");
-
- TStringBuf sbuf = "test";
-
- TestRead(sbuf, "TStringBuf");
-
+
+ TestRead(t, "int[4]");
+
+ TStringBuf sbuf = "test";
+
+ TestRead(sbuf, "TStringBuf");
+
TUtf16String wtr;
- wtr.resize(10, 1024);
-
+ wtr.resize(10, 1024);
+
TestRead(wtr, "TUtf16String");
-
- TBuffer buf;
- buf.Resize(30);
-
- TestRead(buf, "TBuffer");
-
+
+ TBuffer buf;
+ buf.Resize(30);
+
+ TestRead(buf, "TBuffer");
+
TVector<ui64> vec(10, 100);
-
+
TestRead(vec, "TVector<ui64>");
-
+
TestWrite<TString>("TString");
TestWrite<TVector<char>>("TVector<char>");
TestWrite<TBuffer>("TBuffer");
@@ -86,7 +86,7 @@ private:
NAccessors::Init(carr);
NAccessors::Clear(carr);
TestRead(carr, "std::array<char, 10>");
- }
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TAccessorsTest)
+ }
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TAccessorsTest)
diff --git a/library/cpp/deprecated/accessors/memory_traits.h b/library/cpp/deprecated/accessors/memory_traits.h
index 1034113211..aa837705d3 100644
--- a/library/cpp/deprecated/accessors/memory_traits.h
+++ b/library/cpp/deprecated/accessors/memory_traits.h
@@ -1,168 +1,168 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/array_ref.h>
#include <util/memory/blob.h>
#include <util/memory/tempbuf.h>
-#include <util/generic/buffer.h>
-#include <util/generic/strbuf.h>
+#include <util/generic/buffer.h>
+#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/typetraits.h>
-
+
#include <array>
-#include <string>
+#include <string>
#include <utility>
-
-template <typename T>
-struct TMemoryTraits {
- enum {
+
+template <typename T>
+struct TMemoryTraits {
+ enum {
SimpleMemory = std::is_arithmetic<T>::value,
- ContinuousMemory = SimpleMemory,
- OwnsMemory = SimpleMemory,
- };
-
+ ContinuousMemory = SimpleMemory,
+ OwnsMemory = SimpleMemory,
+ };
+
using TElementType = T;
-};
-
-template <typename T, size_t n>
-struct TMemoryTraits<T[n]> {
- enum {
- SimpleMemory = TMemoryTraits<T>::SimpleMemory,
- ContinuousMemory = SimpleMemory,
- OwnsMemory = SimpleMemory,
- };
-
+};
+
+template <typename T, size_t n>
+struct TMemoryTraits<T[n]> {
+ enum {
+ SimpleMemory = TMemoryTraits<T>::SimpleMemory,
+ ContinuousMemory = SimpleMemory,
+ OwnsMemory = SimpleMemory,
+ };
+
using TElementType = T;
-};
-
-template <typename T, size_t n>
+};
+
+template <typename T, size_t n>
struct TMemoryTraits<std::array<T, n>> {
- enum {
- SimpleMemory = TMemoryTraits<T>::SimpleMemory,
- ContinuousMemory = SimpleMemory,
- OwnsMemory = SimpleMemory,
- };
-
+ enum {
+ SimpleMemory = TMemoryTraits<T>::SimpleMemory,
+ ContinuousMemory = SimpleMemory,
+ OwnsMemory = SimpleMemory,
+ };
+
using TElementType = T;
-};
-
-template <typename A, typename B>
+};
+
+template <typename A, typename B>
struct TMemoryTraits<std::pair<A, B>> {
- enum {
- SimpleMemory = TMemoryTraits<A>::SimpleMemory && TMemoryTraits<B>::SimpleMemory,
- ContinuousMemory = SimpleMemory,
- OwnsMemory = SimpleMemory,
- };
-
+ enum {
+ SimpleMemory = TMemoryTraits<A>::SimpleMemory && TMemoryTraits<B>::SimpleMemory,
+ ContinuousMemory = SimpleMemory,
+ OwnsMemory = SimpleMemory,
+ };
+
using TElementType = std::pair<A, B>;
-};
-
-template <>
-struct TMemoryTraits<TBuffer> {
- enum {
- SimpleMemory = false,
- ContinuousMemory = true,
- OwnsMemory = true,
- };
-
+};
+
+template <>
+struct TMemoryTraits<TBuffer> {
+ enum {
+ SimpleMemory = false,
+ ContinuousMemory = true,
+ OwnsMemory = true,
+ };
+
using TElementType = char;
-};
-
-template <>
-struct TMemoryTraits<TTempBuf> {
- enum {
- SimpleMemory = false,
- ContinuousMemory = true,
- OwnsMemory = true,
- };
-
+};
+
+template <>
+struct TMemoryTraits<TTempBuf> {
+ enum {
+ SimpleMemory = false,
+ ContinuousMemory = true,
+ OwnsMemory = true,
+ };
+
using TElementType = char;
-};
-
-template <>
+};
+
+template <>
struct TMemoryTraits< ::TBlob> {
- enum {
- SimpleMemory = false,
- ContinuousMemory = true,
- OwnsMemory = true,
- };
-
+ enum {
+ SimpleMemory = false,
+ ContinuousMemory = true,
+ OwnsMemory = true,
+ };
+
using TElementType = char;
-};
-
-template <typename T>
-struct TElementDependentMemoryTraits {
- enum {
- SimpleMemory = false,
- ContinuousMemory = TMemoryTraits<T>::SimpleMemory,
- };
-
+};
+
+template <typename T>
+struct TElementDependentMemoryTraits {
+ enum {
+ SimpleMemory = false,
+ ContinuousMemory = TMemoryTraits<T>::SimpleMemory,
+ };
+
using TElementType = T;
-};
-
-template <typename T, typename TAlloc>
+};
+
+template <typename T, typename TAlloc>
struct TMemoryTraits<std::vector<T, TAlloc>>: public TElementDependentMemoryTraits<T> {
- enum {
- OwnsMemory = TMemoryTraits<T>::OwnsMemory
- };
-};
-
-template <typename T, typename TAlloc>
+ enum {
+ OwnsMemory = TMemoryTraits<T>::OwnsMemory
+ };
+};
+
+template <typename T, typename TAlloc>
struct TMemoryTraits<TVector<T, TAlloc>>: public TMemoryTraits<std::vector<T, TAlloc>> {
-};
-
-template <typename T>
+};
+
+template <typename T>
struct TMemoryTraits<TTempArray<T>>: public TElementDependentMemoryTraits<T> {
- enum {
- OwnsMemory = TMemoryTraits<T>::OwnsMemory
- };
-};
-
-template <typename T, typename TCharTraits, typename TAlloc>
+ enum {
+ OwnsMemory = TMemoryTraits<T>::OwnsMemory
+ };
+};
+
+template <typename T, typename TCharTraits, typename TAlloc>
struct TMemoryTraits<std::basic_string<T, TCharTraits, TAlloc>>: public TElementDependentMemoryTraits<T> {
- enum {
- OwnsMemory = TMemoryTraits<T>::OwnsMemory
- };
-};
-
-template <>
+ enum {
+ OwnsMemory = TMemoryTraits<T>::OwnsMemory
+ };
+};
+
+template <>
struct TMemoryTraits<TString>: public TElementDependentMemoryTraits<char> {
- enum {
- OwnsMemory = true
- };
-};
-
-template <>
+ enum {
+ OwnsMemory = true
+ };
+};
+
+template <>
struct TMemoryTraits<TUtf16String>: public TElementDependentMemoryTraits<wchar16> {
- enum {
- OwnsMemory = true
- };
-};
-
-template <typename T>
+ enum {
+ OwnsMemory = true
+ };
+};
+
+template <typename T>
struct TMemoryTraits<TArrayRef<T>>: public TElementDependentMemoryTraits<T> {
- enum {
- OwnsMemory = false
- };
-};
-
-template <typename TCharType, typename TCharTraits>
+ enum {
+ OwnsMemory = false
+ };
+};
+
+template <typename TCharType, typename TCharTraits>
struct TMemoryTraits<TBasicStringBuf<TCharType, TCharTraits>>: public TElementDependentMemoryTraits<TCharType> {
- enum {
- OwnsMemory = false
- };
-};
-
-template <>
+ enum {
+ OwnsMemory = false
+ };
+};
+
+template <>
struct TMemoryTraits<TStringBuf>: public TElementDependentMemoryTraits<char> {
- enum {
- OwnsMemory = false
- };
-};
-
-template <>
+ enum {
+ OwnsMemory = false
+ };
+};
+
+template <>
struct TMemoryTraits<TWtringBuf>: public TElementDependentMemoryTraits<wchar16> {
- enum {
- OwnsMemory = false
- };
-};
+ enum {
+ OwnsMemory = false
+ };
+};
diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h
index c983129f3d..a7f72eece6 100644
--- a/library/cpp/deprecated/kmp/kmp.h
+++ b/library/cpp/deprecated/kmp/kmp.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/generic/ptr.h>
#include <util/generic/string.h>
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h
index 8a88742164..45859ed65a 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.h
+++ b/library/cpp/deprecated/mapped_file/mapped_file.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/generic/flags.h>
#include <util/generic/ptr.h>
diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h
index 0309b915e4..8e4ca171a0 100644
--- a/library/cpp/deprecated/split/delim_string_iter.h
+++ b/library/cpp/deprecated/split/delim_string_iter.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/generic/algorithm.h>
#include <util/generic/strbuf.h>
diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h
index 26e5865ef6..0eacc29228 100644
--- a/library/cpp/deprecated/split/split_iterator.h
+++ b/library/cpp/deprecated/split/split_iterator.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <library/cpp/deprecated/kmp/kmp.h>
#include <util/string/cast.h>