aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/deprecated
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/deprecated
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/deprecated')
-rw-r--r--library/cpp/deprecated/accessors/accessors.cpp2
-rw-r--r--library/cpp/deprecated/accessors/accessors.h38
-rw-r--r--library/cpp/deprecated/accessors/accessors_impl.cpp2
-rw-r--r--library/cpp/deprecated/accessors/accessors_impl.h254
-rw-r--r--library/cpp/deprecated/accessors/accessors_ut.cpp12
-rw-r--r--library/cpp/deprecated/accessors/memory_traits.cpp2
-rw-r--r--library/cpp/deprecated/accessors/memory_traits.h22
-rw-r--r--library/cpp/deprecated/enum_codegen/enum_codegen.cpp2
-rw-r--r--library/cpp/deprecated/enum_codegen/enum_codegen.h48
-rw-r--r--library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp16
-rw-r--r--library/cpp/deprecated/kmp/kmp.cpp4
-rw-r--r--library/cpp/deprecated/kmp/kmp.h6
-rw-r--r--library/cpp/deprecated/kmp/kmp_ut.cpp18
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.cpp16
-rw-r--r--library/cpp/deprecated/mapped_file/mapped_file.h30
-rw-r--r--library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp2
-rw-r--r--library/cpp/deprecated/split/delim_string_iter.h32
-rw-r--r--library/cpp/deprecated/split/delim_string_iter_ut.cpp22
-rw-r--r--library/cpp/deprecated/split/split_iterator.cpp128
-rw-r--r--library/cpp/deprecated/split/split_iterator.h120
-rw-r--r--library/cpp/deprecated/split/split_iterator_ut.cpp32
-rw-r--r--library/cpp/deprecated/ya.make2
22 files changed, 405 insertions, 405 deletions
diff --git a/library/cpp/deprecated/accessors/accessors.cpp b/library/cpp/deprecated/accessors/accessors.cpp
index 7d37e586fa..92f8817c3e 100644
--- a/library/cpp/deprecated/accessors/accessors.cpp
+++ b/library/cpp/deprecated/accessors/accessors.cpp
@@ -1 +1 @@
-#include "accessors.h"
+#include "accessors.h"
diff --git a/library/cpp/deprecated/accessors/accessors.h b/library/cpp/deprecated/accessors/accessors.h
index 6d4b1da3ad..8ad5f56a34 100644
--- a/library/cpp/deprecated/accessors/accessors.h
+++ b/library/cpp/deprecated/accessors/accessors.h
@@ -3,7 +3,7 @@
#include "accessors_impl.h"
namespace NAccessors {
- /*
+ /*
* Adds API compatibility between different types representing memory regions.
*
* i.e. this will work:
@@ -23,26 +23,26 @@ namespace NAccessors {
* 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* 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 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);
- }
+ template <typename T>
+ inline size_t Size(const T& t) {
+ return End(t) - Begin(t);
+ }
/**
* This gives some unification in terms of memory manipulation.
*/
- template <typename T>
+ template <typename T>
inline void Reserve(T& t, size_t sz) {
NPrivate::TReserve<T>::Do(t, sz);
}
@@ -75,9 +75,9 @@ namespace NAccessors {
}
template <typename T>
- inline void Assign(T& t,
- const typename TMemoryTraits<T>::TElementType* beg,
- const typename TMemoryTraits<T>::TElementType* end) {
- NPrivate::TAssign<T>::Do(t, beg, end);
- }
+ inline void Assign(T& t,
+ const typename TMemoryTraits<T>::TElementType* beg,
+ const typename TMemoryTraits<T>::TElementType* end) {
+ NPrivate::TAssign<T>::Do(t, beg, end);
+ }
}
diff --git a/library/cpp/deprecated/accessors/accessors_impl.cpp b/library/cpp/deprecated/accessors/accessors_impl.cpp
index 0bf74cab7b..f5191d647e 100644
--- a/library/cpp/deprecated/accessors/accessors_impl.cpp
+++ b/library/cpp/deprecated/accessors/accessors_impl.cpp
@@ -1 +1 @@
-#include "accessors_impl.h"
+#include "accessors_impl.h"
diff --git a/library/cpp/deprecated/accessors/accessors_impl.h b/library/cpp/deprecated/accessors/accessors_impl.h
index 6b2b987351..e04cc0679f 100644
--- a/library/cpp/deprecated/accessors/accessors_impl.h
+++ b/library/cpp/deprecated/accessors/accessors_impl.h
@@ -3,114 +3,114 @@
#include "memory_traits.h"
namespace NAccessors {
- namespace NPrivate {
- template <typename Ta>
- struct TMemoryAccessorBase {
- enum {
- SimpleMemory = TMemoryTraits<Ta>::SimpleMemory,
- ContinuousMemory = TMemoryTraits<Ta>::ContinuousMemory,
- };
-
- struct TBadAccessor;
- };
-
- template <typename Ta>
- struct TBegin: public TMemoryAccessorBase<Ta> {
+ namespace NPrivate {
+ template <typename Ta>
+ struct TMemoryAccessorBase {
+ enum {
+ 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 TNoMemoryIndirectionBegin {
+ static const TElementType* Get(const Tb& b) {
+ return (const TElementType*)&b;
+ }
+ };
- template <typename Tb>
- struct TIndirectMemoryRegionBegin {
+ 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) {
- return (const TElementType*)b.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) {
+ return (const TElementType*)b.begin();
+ }
+ };
+
using TGet = std::conditional_t<THasBegin<Tb>::value, TByBegin<Tb>, TBybegin<Tb>>;
-
- static const TElementType* Get(const Tb& b) {
- return TGet::Get(b);
- }
- };
-
+
+ static const TElementType* Get(const Tb& b) {
+ return TGet::Get(b);
+ }
+ };
+
using TGet = std::conditional_t<
- TMemoryAccessorBase<Ta>::SimpleMemory,
- TNoMemoryIndirectionBegin<Ta>,
+ TMemoryAccessorBase<Ta>::SimpleMemory,
+ TNoMemoryIndirectionBegin<Ta>,
std::conditional_t<
- TMemoryAccessorBase<Ta>::ContinuousMemory,
- TIndirectMemoryRegionBegin<Ta>,
+ TMemoryAccessorBase<Ta>::ContinuousMemory,
+ TIndirectMemoryRegionBegin<Ta>,
typename TMemoryAccessorBase<Ta>::TBadAccessor>>;
-
- static const TElementType* Get(const Ta& b) {
- return TGet::Get(b);
+
+ static const TElementType* Get(const Ta& b) {
+ return TGet::Get(b);
}
};
- template <typename Ta>
- struct TEnd: public TMemoryAccessorBase<Ta> {
+ 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 TNoMemoryIndirectionEnd {
+ static const TElementType* Get(const Tb& b) {
+ return (const TElementType*)(&b + 1);
+ }
+ };
- template <typename Tb>
- struct TIndirectMemoryRegionEnd {
+ 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();
+ }
+ };
- 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);
- }
- };
+ static const TElementType* Get(const Tb& b) {
+ return TGet::Get(b);
+ }
+ };
using TGet = std::conditional_t<
- TMemoryAccessorBase<Ta>::SimpleMemory,
- TNoMemoryIndirectionEnd<Ta>,
+ TMemoryAccessorBase<Ta>::SimpleMemory,
+ TNoMemoryIndirectionEnd<Ta>,
std::conditional_t<
- TMemoryAccessorBase<Ta>::ContinuousMemory,
- TIndirectMemoryRegionEnd<Ta>,
+ TMemoryAccessorBase<Ta>::ContinuousMemory,
+ TIndirectMemoryRegionEnd<Ta>,
typename TMemoryAccessorBase<Ta>::TBadAccessor>>;
- static const TElementType* Get(const Ta& b) {
- return TGet::Get(b);
+ static const TElementType* Get(const Ta& b) {
+ return TGet::Get(b);
}
};
@@ -343,13 +343,13 @@ namespace NAccessors {
}
};
- template <typename Ta>
- struct TAssign: public TMemoryAccessorBase<Ta> {
+ 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) {
+ 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) {
@@ -357,63 +357,63 @@ namespace NAccessors {
} else {
Zero(b);
}
- }
- };
+ }
+ };
- template <typename Tb>
- struct TIndirectMemoryRegionAssign {
+ 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) {
- TClear<Tc, false>::Do(b);
- 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);
- }
- };
+ 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) {
+ TClear<Tc, false>::Do(b);
+ 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>,
+ TByAssign<Tb>,
std::conditional_t<
THasassign<Tb>::value,
- TByassign<Tb>,
+ TByassign<Tb>,
std::conditional_t<
- TMemoryTraits<Tb>::OwnsMemory,
- TByClearAppend<Tb>,
+ TMemoryTraits<Tb>::OwnsMemory,
+ TByClearAppend<Tb>,
TByConstruction<Tb>>>>;
- static void Do(Tb& b, const TElementType* beg, const TElementType* end) {
- TDo::Do(b, beg, end);
- }
- };
+ 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);
+ 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 a9bdc9fcc4..9d993b10bf 100644
--- a/library/cpp/deprecated/accessors/accessors_ut.cpp
+++ b/library/cpp/deprecated/accessors/accessors_ut.cpp
@@ -1,17 +1,17 @@
#include "accessors.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/generic/buffer.h>
#include <util/generic/vector.h>
#include <array>
class TAccessorsTest: public TTestBase {
- UNIT_TEST_SUITE(TAccessorsTest);
- UNIT_TEST(TestAccessors);
- UNIT_TEST_SUITE_END();
-
+ UNIT_TEST_SUITE(TAccessorsTest);
+ UNIT_TEST(TestAccessors);
+ UNIT_TEST_SUITE_END();
+
private:
template <typename T>
void TestRead(const T& t, const char* comm) {
@@ -50,7 +50,7 @@ private:
TestRead('a', "char");
TestRead(1, "int");
- int t[4] = {0, 1, 2, 3};
+ int t[4] = {0, 1, 2, 3};
TestRead(t, "int[4]");
diff --git a/library/cpp/deprecated/accessors/memory_traits.cpp b/library/cpp/deprecated/accessors/memory_traits.cpp
index df53026cf4..76d0d3bad4 100644
--- a/library/cpp/deprecated/accessors/memory_traits.cpp
+++ b/library/cpp/deprecated/accessors/memory_traits.cpp
@@ -1 +1 @@
-#include "memory_traits.h"
+#include "memory_traits.h"
diff --git a/library/cpp/deprecated/accessors/memory_traits.h b/library/cpp/deprecated/accessors/memory_traits.h
index aa837705d3..1ebf53f108 100644
--- a/library/cpp/deprecated/accessors/memory_traits.h
+++ b/library/cpp/deprecated/accessors/memory_traits.h
@@ -1,13 +1,13 @@
#pragma once
#include <util/generic/array_ref.h>
-#include <util/memory/blob.h>
-#include <util/memory/tempbuf.h>
+#include <util/memory/blob.h>
+#include <util/memory/tempbuf.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 <util/generic/vector.h>
+#include <util/generic/typetraits.h>
#include <array>
#include <string>
@@ -47,14 +47,14 @@ struct TMemoryTraits<std::array<T, n>> {
};
template <typename A, typename B>
-struct TMemoryTraits<std::pair<A, B>> {
+struct TMemoryTraits<std::pair<A, B>> {
enum {
SimpleMemory = TMemoryTraits<A>::SimpleMemory && TMemoryTraits<B>::SimpleMemory,
ContinuousMemory = SimpleMemory,
OwnsMemory = SimpleMemory,
};
- using TElementType = std::pair<A, B>;
+ using TElementType = std::pair<A, B>;
};
template <>
@@ -80,7 +80,7 @@ struct TMemoryTraits<TTempBuf> {
};
template <>
-struct TMemoryTraits< ::TBlob> {
+struct TMemoryTraits< ::TBlob> {
enum {
SimpleMemory = false,
ContinuousMemory = true,
@@ -101,7 +101,7 @@ struct TElementDependentMemoryTraits {
};
template <typename T, typename TAlloc>
-struct TMemoryTraits<std::vector<T, TAlloc>>: public TElementDependentMemoryTraits<T> {
+struct TMemoryTraits<std::vector<T, TAlloc>>: public TElementDependentMemoryTraits<T> {
enum {
OwnsMemory = TMemoryTraits<T>::OwnsMemory
};
@@ -112,14 +112,14 @@ struct TMemoryTraits<TVector<T, TAlloc>>: public TMemoryTraits<std::vector<T, TA
};
template <typename T>
-struct TMemoryTraits<TTempArray<T>>: public TElementDependentMemoryTraits<T> {
+struct TMemoryTraits<TTempArray<T>>: public TElementDependentMemoryTraits<T> {
enum {
OwnsMemory = TMemoryTraits<T>::OwnsMemory
};
};
template <typename T, typename TCharTraits, typename TAlloc>
-struct TMemoryTraits<std::basic_string<T, TCharTraits, TAlloc>>: public TElementDependentMemoryTraits<T> {
+struct TMemoryTraits<std::basic_string<T, TCharTraits, TAlloc>>: public TElementDependentMemoryTraits<T> {
enum {
OwnsMemory = TMemoryTraits<T>::OwnsMemory
};
@@ -154,7 +154,7 @@ struct TMemoryTraits<TBasicStringBuf<TCharType, TCharTraits>>: public TElementDe
};
template <>
-struct TMemoryTraits<TStringBuf>: public TElementDependentMemoryTraits<char> {
+struct TMemoryTraits<TStringBuf>: public TElementDependentMemoryTraits<char> {
enum {
OwnsMemory = false
};
diff --git a/library/cpp/deprecated/enum_codegen/enum_codegen.cpp b/library/cpp/deprecated/enum_codegen/enum_codegen.cpp
index 3931b05924..21ce9e6334 100644
--- a/library/cpp/deprecated/enum_codegen/enum_codegen.cpp
+++ b/library/cpp/deprecated/enum_codegen/enum_codegen.cpp
@@ -1 +1 @@
-#include "enum_codegen.h"
+#include "enum_codegen.h"
diff --git a/library/cpp/deprecated/enum_codegen/enum_codegen.h b/library/cpp/deprecated/enum_codegen/enum_codegen.h
index dfb04ecac2..2f050d91bd 100644
--- a/library/cpp/deprecated/enum_codegen/enum_codegen.h
+++ b/library/cpp/deprecated/enum_codegen/enum_codegen.h
@@ -5,29 +5,29 @@
#define ENUM_VALUE_GEN(name, value, ...) name = value,
#define ENUM_VALUE_GEN_NO_VALUE(name, ...) name,
-#define ENUM_TO_STRING_IMPL_ITEM(name, ...) \
- case name: \
- return #name;
-#define ENUM_LTLT_IMPL_ITEM(name, ...) \
- case name: \
- os << #name; \
- break;
+#define ENUM_TO_STRING_IMPL_ITEM(name, ...) \
+ case name: \
+ return #name;
+#define ENUM_LTLT_IMPL_ITEM(name, ...) \
+ case name: \
+ os << #name; \
+ break;
-#define ENUM_TO_STRING(type, MAP) \
- static inline const char* ToCString(type value) { \
- switch (value) { \
- MAP(ENUM_TO_STRING_IMPL_ITEM) \
- default: \
- return "UNKNOWN"; \
- } \
- } \
- \
+#define ENUM_TO_STRING(type, MAP) \
+ static inline const char* ToCString(type value) { \
+ switch (value) { \
+ MAP(ENUM_TO_STRING_IMPL_ITEM) \
+ default: \
+ return "UNKNOWN"; \
+ } \
+ } \
+ \
static inline IOutputStream& operator<<(IOutputStream& os, type value) { \
- switch (value) { \
- MAP(ENUM_LTLT_IMPL_ITEM) \
- default: \
- os << int(value); \
- break; \
- } \
- return os; \
- }
+ switch (value) { \
+ MAP(ENUM_LTLT_IMPL_ITEM) \
+ default: \
+ os << int(value); \
+ break; \
+ } \
+ return os; \
+ }
diff --git a/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp b/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp
index f8f1c9b6df..10f9c597e6 100644
--- a/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp
+++ b/library/cpp/deprecated/enum_codegen/enum_codegen_ut.cpp
@@ -2,11 +2,11 @@
#include "enum_codegen.h"
-#include <util/string/builder.h>
-
+#include <util/string/builder.h>
+
#define COLOR_MAP(XX) \
- XX(RED) \
- XX(GREEN) \
+ XX(RED) \
+ XX(GREEN) \
XX(BLUE)
enum EColor {
@@ -16,8 +16,8 @@ enum EColor {
ENUM_TO_STRING(EColor, COLOR_MAP)
#define MULTIPLIER_MAP(XX) \
- XX(GB, 9) \
- XX(MB, 6) \
+ XX(GB, 9) \
+ XX(MB, 6) \
XX(KB, 3)
enum EMultiplier {
@@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(EnumCodegen) {
Y_UNIT_TEST(ToCString) {
UNIT_ASSERT_VALUES_EQUAL("RED", ToCString(RED));
UNIT_ASSERT_VALUES_EQUAL("BLUE", ToCString(BLUE));
- UNIT_ASSERT_VALUES_EQUAL("GREEN", (TStringBuilder() << GREEN));
- UNIT_ASSERT_VALUES_EQUAL("GB", ToCString(GB));
+ UNIT_ASSERT_VALUES_EQUAL("GREEN", (TStringBuilder() << GREEN));
+ UNIT_ASSERT_VALUES_EQUAL("GB", ToCString(GB));
}
}
diff --git a/library/cpp/deprecated/kmp/kmp.cpp b/library/cpp/deprecated/kmp/kmp.cpp
index d02074c94a..cce93acc4b 100644
--- a/library/cpp/deprecated/kmp/kmp.cpp
+++ b/library/cpp/deprecated/kmp/kmp.cpp
@@ -1,5 +1,5 @@
-#include "kmp.h"
-
+#include "kmp.h"
+
#include <util/generic/yexception.h>
TKMPMatcher::TKMPMatcher(const char* patternBegin, const char* patternEnd)
diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h
index a7f72eece6..4689697738 100644
--- a/library/cpp/deprecated/kmp/kmp.h
+++ b/library/cpp/deprecated/kmp/kmp.h
@@ -3,9 +3,9 @@
#include <util/generic/ptr.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
-template <typename T>
+template <typename T>
void ComputePrefixFunction(const T* begin, const T* end, ssize_t** result) {
Y_ENSURE(begin != end, TStringBuf("empty pattern"));
ssize_t len = end - begin;
@@ -58,7 +58,7 @@ public:
}
};
-template <typename T>
+template <typename T>
class TKMPStreamMatcher {
public:
class ICallback {
diff --git a/library/cpp/deprecated/kmp/kmp_ut.cpp b/library/cpp/deprecated/kmp/kmp_ut.cpp
index c2eda83c57..8969cc1642 100644
--- a/library/cpp/deprecated/kmp/kmp_ut.cpp
+++ b/library/cpp/deprecated/kmp/kmp_ut.cpp
@@ -1,8 +1,8 @@
-#include "kmp.h"
-
+#include "kmp.h"
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/stream/output.h>
+#include <util/stream/output.h>
static TVector<int> FindAll(const TString& pattern, const TString& string) {
TVector<int> result;
@@ -17,12 +17,12 @@ static TVector<int> FindAll(const TString& pattern, const TString& string) {
return result;
}
-class TTestKMP: public TTestBase {
+class TTestKMP: public TTestBase {
UNIT_TEST_SUITE(TTestKMP);
- UNIT_TEST(Test);
- UNIT_TEST(TestStream);
+ UNIT_TEST(Test);
+ UNIT_TEST(TestStream);
UNIT_TEST_SUITE_END();
-
+
public:
void Test() {
TVector<int> ans = {0, 2};
@@ -35,12 +35,12 @@ public:
UNIT_ASSERT_EQUAL(FindAll("ab", "abab"), ans);
}
- class TKMPSimpleCallback: public TKMPStreamMatcher<int>::ICallback {
+ class TKMPSimpleCallback: public TKMPStreamMatcher<int>::ICallback {
private:
int* Begin;
int* End;
int Count;
-
+
public:
TKMPSimpleCallback(int* begin, int* end)
: Begin(begin)
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp
index b0e4511299..a11b79783d 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.cpp
+++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp
@@ -5,9 +5,9 @@
#include <util/system/hi_lo.h>
#include <util/system/filemap.h>
-TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
- Map_ = map;
- i64 len = Map_->Length();
+TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {
+ Map_ = map;
+ i64 len = Map_->Length();
if (Hi32(len) != 0 && sizeof(size_t) <= sizeof(ui32))
ythrow yexception() << "File '" << dbgName << "' mapping error: " << len << " too large";
@@ -36,7 +36,7 @@ void TMappedFile::init(const TString& name) {
}
void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode om) {
- THolder<TFileMap> map(new TFileMap(name, length, om));
+ THolder<TFileMap> map(new TFileMap(name, length, om));
TMappedFile newFile(map.Get(), name.data());
Y_UNUSED(map.Release());
newFile.swap(*this);
@@ -44,7 +44,7 @@ void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode o
}
void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) {
- THolder<TFileMap> map(new TFileMap(file, om));
+ THolder<TFileMap> map(new TFileMap(file, om));
TMappedFile newFile(map.Get(), dbgName);
Y_UNUSED(map.Release());
newFile.swap(*this);
@@ -52,13 +52,13 @@ void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* db
}
void TMappedFile::init(const TString& name, TFileMap::EOpenMode om) {
- THolder<TFileMap> map(new TFileMap(name, om));
+ THolder<TFileMap> map(new TFileMap(name, om));
TMappedFile newFile(map.Get(), name.data());
Y_UNUSED(map.Release());
newFile.swap(*this);
newFile.term();
}
-void TMappedFile::flush() {
- Map_->Flush();
+void TMappedFile::flush() {
+ Map_->Flush();
}
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h
index 45859ed65a..4b9c0c8c52 100644
--- a/library/cpp/deprecated/mapped_file/mapped_file.h
+++ b/library/cpp/deprecated/mapped_file/mapped_file.h
@@ -9,24 +9,24 @@
#include <util/system/file.h>
#include <util/system/filemap.h>
#include <util/system/yassert.h>
-
+
#include <cstdio>
-#include <new>
-
+#include <new>
+
/// Deprecated (by pg@), use TFileMap or TMemoryMap instead
-class TMappedFile {
+class TMappedFile {
private:
- TFileMap* Map_;
+ TFileMap* Map_;
private:
- TMappedFile(TFileMap* map, const char* dbgName);
+ TMappedFile(TFileMap* map, const char* dbgName);
public:
- TMappedFile() {
+ TMappedFile() {
Map_ = nullptr;
}
- ~TMappedFile() {
+ ~TMappedFile() {
term();
}
@@ -47,16 +47,16 @@ public:
void flush();
- void term() {
- if (Map_) {
- Map_->Unmap();
- delete Map_;
+ void term() {
+ if (Map_) {
+ Map_->Unmap();
+ delete Map_;
Map_ = nullptr;
}
}
- size_t getSize() const {
- return (Map_ ? Map_->MappedSize() : 0);
+ size_t getSize() const {
+ return (Map_ ? Map_->MappedSize() : 0);
}
void* getData(size_t pos = 0) const {
@@ -67,6 +67,6 @@ public:
void precharge(size_t pos = 0, size_t size = (size_t)-1) const;
void swap(TMappedFile& file) noexcept {
- DoSwap(Map_, file.Map_);
+ DoSwap(Map_, file.Map_);
}
};
diff --git a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
index afbd5b3358..1f40de11a3 100644
--- a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
+++ b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/deprecated/mapped_file/mapped_file.h>
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/system/fs.h>
Y_UNIT_TEST_SUITE(TMappedFileTest) {
diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h
index 8e4ca171a0..9ef4bada93 100644
--- a/library/cpp/deprecated/split/delim_string_iter.h
+++ b/library/cpp/deprecated/split/delim_string_iter.h
@@ -3,10 +3,10 @@
#include <util/generic/algorithm.h>
#include <util/generic/strbuf.h>
#include <util/generic/yexception.h>
-#include <util/string/cast.h>
-#include <util/system/yassert.h>
+#include <util/string/cast.h>
+#include <util/system/yassert.h>
-#include <iterator>
+#include <iterator>
class TDelimStringIter {
public:
@@ -18,8 +18,8 @@ public:
inline TDelimStringIter(const char* begin, const char* strEnd, TStringBuf delim)
: TDelimStringIter(TStringBuf(begin, strEnd), delim)
- {
- }
+ {
+ }
inline TDelimStringIter(TStringBuf str, TStringBuf delim)
: IsValid(true)
@@ -31,10 +31,10 @@ public:
inline TDelimStringIter()
: IsValid(false)
- {
- }
+ {
+ }
- inline explicit operator bool() const {
+ inline explicit operator bool() const {
return IsValid;
}
@@ -52,7 +52,7 @@ public:
}
inline void operator+=(size_t n) {
- for (; n > 0; --n) {
+ for (; n > 0; --n) {
++(*this);
}
}
@@ -74,7 +74,7 @@ public:
}
// Get & advance
- template <class T>
+ template <class T>
inline bool TryNext(T& t) {
if (IsValid) {
t = FromString<T>(Current);
@@ -85,7 +85,7 @@ public:
}
}
- template <class T>
+ template <class T>
inline TDelimStringIter& Next(T& t) // Get & advance
{
if (!TryNext(t))
@@ -93,7 +93,7 @@ public:
return *this;
}
- template <class T>
+ template <class T>
inline T GetNext() {
T res;
Next(res);
@@ -124,7 +124,7 @@ public:
private:
inline void UpdateCurrent() {
// it is much faster than TStringBuf::find
- size_t pos = std::search(Str.begin(), Str.end(), Delim.begin(), Delim.end()) - Str.begin();
+ size_t pos = std::search(Str.begin(), Str.end(), Delim.begin(), Delim.end()) - Str.begin();
Current = Str.Head(pos);
}
@@ -137,15 +137,15 @@ private:
};
//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... }
-struct TDelimStroka {
+struct TDelimStroka {
TStringBuf S;
TStringBuf Delim;
inline TDelimStroka(TStringBuf s, TStringBuf delim)
: S(s)
, Delim(delim)
- {
- }
+ {
+ }
inline TDelimStringIter begin() const {
return TDelimStringIter(S, 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..72ba1c4f69 100644
--- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp
+++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
@@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) {
TVector<TStringBuf> expected = {"1", "", "3@4", ""};
TVector<TStringBuf> got;
- for (TStringBuf x : TDelimStroka("1@@@@3@4@@", "@@")) {
+ for (TStringBuf x : TDelimStroka("1@@@@3@4@@", "@@")) {
got.push_back(x);
}
@@ -70,30 +70,30 @@ Y_UNIT_TEST_SUITE(TKeyValueDelimStringIterTestSuite) {
Y_UNIT_TEST(SingleCharacterAsDelimiter) {
AssertKeyValueStringSplit(
"abc=123,cde=qwer", ",",
- {{"abc", "123"},
- {"cde", "qwer"}});
+ {{"abc", "123"},
+ {"cde", "qwer"}});
}
Y_UNIT_TEST(MultipleCharactersAsDelimiter) {
AssertKeyValueStringSplit(
"abc=xyz@@qwerty=zxcv", "@@",
- {{"abc", "xyz"},
- {"qwerty", "zxcv"}});
+ {{"abc", "xyz"},
+ {"qwerty", "zxcv"}});
}
Y_UNIT_TEST(NoDelimiters) {
AssertKeyValueStringSplit(
"abc=zz", ",",
- {{"abc", "zz"}});
+ {{"abc", "zz"}});
}
Y_UNIT_TEST(EmptyElements) {
AssertKeyValueStringSplit(
"@@abc=zxy@@@@qwerty=y@@", "@@",
- {{"", ""},
- {"abc", "zxy"},
- {"", ""},
- {"qwerty", "y"},
- {"", ""}});
+ {{"", ""},
+ {"abc", "zxy"},
+ {"", ""},
+ {"qwerty", "y"},
+ {"", ""}});
}
}
diff --git a/library/cpp/deprecated/split/split_iterator.cpp b/library/cpp/deprecated/split/split_iterator.cpp
index 32262d25bd..b1fe9a5f15 100644
--- a/library/cpp/deprecated/split/split_iterator.cpp
+++ b/library/cpp/deprecated/split/split_iterator.cpp
@@ -1,23 +1,23 @@
-#include "split_iterator.h"
-
-#include <util/system/yassert.h>
-
-#include <cctype>
-#include <cstring>
-#include <cstdlib>
-
+#include "split_iterator.h"
+
+#include <util/system/yassert.h>
+
+#include <cctype>
+#include <cstring>
+#include <cstdlib>
+
/****************** TSplitDelimiters2 ******************/
-TSplitDelimiters::TSplitDelimiters(const char* s) {
+TSplitDelimiters::TSplitDelimiters(const char* s) {
memset(Delims, 0, sizeof(Delims));
while (*s)
- Delims[(ui8) * (s++)] = true;
+ Delims[(ui8) * (s++)] = true;
}
/****************** TSplitBase ******************/
-TSplitBase::TSplitBase(const char* str, size_t length)
- : Str(str)
- , Len(length)
+TSplitBase::TSplitBase(const char* str, size_t length)
+ : Str(str)
+ , Len(length)
{
}
@@ -29,62 +29,62 @@ TSplitBase::TSplitBase(const TString& s)
/****************** TDelimitersSplit ******************/
-TDelimitersSplit::TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters)
- : TSplitBase(str, length)
- , Delimiters(delimiters)
+TDelimitersSplit::TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters)
+ : TSplitBase(str, length)
+ , Delimiters(delimiters)
{
}
TDelimitersSplit::TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters)
- : TSplitBase(s)
- , Delimiters(delimiters)
+ : TSplitBase(s)
+ , Delimiters(delimiters)
{
}
-size_t TDelimitersSplit::Begin() const {
+size_t TDelimitersSplit::Begin() const {
size_t pos = 0;
- while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]))
+ while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]))
++pos;
return pos;
}
-TSizeTRegion TDelimitersSplit::Next(size_t& pos) const {
+TSizeTRegion TDelimitersSplit::Next(size_t& pos) const {
size_t begin = pos;
- while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]))
+ while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]))
++pos;
TSizeTRegion result(begin, pos);
- while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]))
+ while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]))
++pos;
-
+
return result;
}
-TDelimitersSplit::TIterator TDelimitersSplit::Iterator() const {
+TDelimitersSplit::TIterator TDelimitersSplit::Iterator() const {
return TIterator(*this);
}
/****************** TDelimitersStrictSplit ******************/
-TDelimitersStrictSplit::TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters)
- : TSplitBase(str, length)
- , Delimiters(delimiters)
+TDelimitersStrictSplit::TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters)
+ : TSplitBase(str, length)
+ , Delimiters(delimiters)
{
}
TDelimitersStrictSplit::TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters)
- : TSplitBase(s)
- , Delimiters(delimiters)
+ : TSplitBase(s)
+ , Delimiters(delimiters)
{
}
-TDelimitersStrictSplit::TIterator TDelimitersStrictSplit::Iterator() const {
+TDelimitersStrictSplit::TIterator TDelimitersStrictSplit::Iterator() const {
return TIterator(*this);
}
-TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const {
+TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const {
size_t begin = pos;
- while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]))
+ while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]))
++pos;
TSizeTRegion result(begin, pos);
@@ -94,7 +94,7 @@ TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const {
return result;
}
-size_t TDelimitersStrictSplit::Begin() const {
+size_t TDelimitersStrictSplit::Begin() const {
return 0;
}
@@ -142,84 +142,84 @@ size_t TScreenedDelimitersSplit::Begin() const {
/****************** TDelimitersSplitWithoutTags ******************/
-TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters)
- : TSplitBase(str, length)
- , Delimiters(delimiters)
+TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters)
+ : TSplitBase(str, length)
+ , Delimiters(delimiters)
{
}
TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters)
- : TSplitBase(s)
- , Delimiters(delimiters)
+ : TSplitBase(s)
+ , Delimiters(delimiters)
{
}
-size_t TDelimitersSplitWithoutTags::SkipTag(size_t pos) const {
+size_t TDelimitersSplitWithoutTags::SkipTag(size_t pos) const {
Y_ASSERT('<' == Str[pos]);
while ((pos < Len) && ('>' != Str[pos]))
++pos;
return pos + 1;
}
-size_t TDelimitersSplitWithoutTags::SkipDelimiters(size_t pos) const {
- while (true) {
- while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos]))
+size_t TDelimitersSplitWithoutTags::SkipDelimiters(size_t pos) const {
+ while (true) {
+ while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos]))
++pos;
- if (pos < Len) {
+ if (pos < Len) {
if ('<' != Str[pos])
break;
else
pos = SkipTag(pos);
- } else
+ } else
break;
}
return pos;
}
-size_t TDelimitersSplitWithoutTags::Begin() const {
+size_t TDelimitersSplitWithoutTags::Begin() const {
size_t pos = 0;
pos = SkipDelimiters(pos);
return pos;
}
-TSizeTRegion TDelimitersSplitWithoutTags::Next(size_t& pos) const {
+TSizeTRegion TDelimitersSplitWithoutTags::Next(size_t& pos) const {
size_t begin = pos;
- while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos]))
+ while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos]))
++pos;
TSizeTRegion result(begin, pos);
-
+
pos = SkipDelimiters(pos);
return result;
}
-TDelimitersSplitWithoutTags::TIterator TDelimitersSplitWithoutTags::Iterator() const {
+TDelimitersSplitWithoutTags::TIterator TDelimitersSplitWithoutTags::Iterator() const {
return TIterator(*this);
}
/****************** TCharSplit ******************/
-TCharSplit::TCharSplit(const char* str, size_t length)
- : TSplitBase(str, length)
+TCharSplit::TCharSplit(const char* str, size_t length)
+ : TSplitBase(str, length)
{
}
TCharSplit::TCharSplit(const TString& s)
- : TSplitBase(s)
+ : TSplitBase(s)
{
}
-TCharSplit::TIterator TCharSplit::Iterator() const {
+TCharSplit::TIterator TCharSplit::Iterator() const {
return TIterator(*this);
}
-TSizeTRegion TCharSplit::Next(size_t& pos) const {
+TSizeTRegion TCharSplit::Next(size_t& pos) const {
TSizeTRegion result(pos, pos + 1);
++pos;
return result;
}
-size_t TCharSplit::Begin() const {
+size_t TCharSplit::Begin() const {
return 0;
}
@@ -235,33 +235,33 @@ TCharSplitWithoutTags::TCharSplitWithoutTags(const TString& s)
{
}
-size_t TCharSplitWithoutTags::SkipTag(size_t pos) const {
+size_t TCharSplitWithoutTags::SkipTag(size_t pos) const {
Y_ASSERT('<' == Str[pos]);
while ((pos < Len) && ('>' != Str[pos]))
++pos;
return pos + 1;
}
-size_t TCharSplitWithoutTags::SkipDelimiters(size_t pos) const {
- while (true) {
- if (pos < Len) {
+size_t TCharSplitWithoutTags::SkipDelimiters(size_t pos) const {
+ while (true) {
+ if (pos < Len) {
if ('<' != Str[pos])
break;
else
pos = SkipTag(pos);
- } else
+ } else
break;
}
return pos;
}
-size_t TCharSplitWithoutTags::Begin() const {
+size_t TCharSplitWithoutTags::Begin() const {
size_t pos = 0;
pos = SkipDelimiters(pos);
return pos;
}
-TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const {
+TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const {
size_t begin = pos++;
TSizeTRegion result(begin, pos);
@@ -270,7 +270,7 @@ TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const {
return result;
}
-TCharSplitWithoutTags::TIterator TCharSplitWithoutTags::Iterator() const {
+TCharSplitWithoutTags::TIterator TCharSplitWithoutTags::Iterator() const {
return TIterator(*this);
}
diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h
index 0eacc29228..73f3693564 100644
--- a/library/cpp/deprecated/split/split_iterator.h
+++ b/library/cpp/deprecated/split/split_iterator.h
@@ -4,74 +4,74 @@
#include <util/string/cast.h>
#include <util/string/util.h>
#include <util/string/builder.h>
-
-#include <util/system/yassert.h>
+
+#include <util/system/yassert.h>
#include <util/system/defaults.h>
#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
-#include <cstdio>
-
-template <typename T>
-struct TNumPair {
- T Begin;
- T End;
-
+#include <cstdio>
+
+template <typename T>
+struct TNumPair {
+ T Begin;
+ T End;
+
TNumPair() = default;
-
- TNumPair(T begin, T end)
- : Begin(begin)
- , End(end)
- {
+
+ TNumPair(T begin, T end)
+ : Begin(begin)
+ , End(end)
+ {
Y_ASSERT(begin <= end);
- }
-
- T Length() const {
- return End - Begin + 1;
- }
-
- bool operator==(const TNumPair& r) const {
- return (Begin == r.Begin) && (End == r.End);
- }
-
- bool operator!=(const TNumPair& r) const {
- return (Begin != r.Begin) || (End != r.End);
- }
-};
-
+ }
+
+ T Length() const {
+ return End - Begin + 1;
+ }
+
+ bool operator==(const TNumPair& r) const {
+ return (Begin == r.Begin) && (End == r.End);
+ }
+
+ bool operator!=(const TNumPair& r) const {
+ return (Begin != r.Begin) || (End != r.End);
+ }
+};
+
using TSizeTRegion = TNumPair<size_t>;
using TUi32Region = TNumPair<ui32>;
-
-template <>
+
+template <>
inline TString ToString(const TUi32Region& r) {
- return TStringBuilder() << "(" << r.Begin << ", " << r.End << ")";
-}
-
-template <>
+ return TStringBuilder() << "(" << r.Begin << ", " << r.End << ")";
+}
+
+template <>
inline TUi32Region FromString(const TString& s) {
- TUi32Region result;
+ TUi32Region result;
sscanf(s.data(), "(%" PRIu32 ", %" PRIu32 ")", &result.Begin, &result.End);
- return result;
-}
-
-class TSplitDelimiters {
+ return result;
+}
+
+class TSplitDelimiters {
private:
bool Delims[256];
public:
explicit TSplitDelimiters(const char* s);
-
+
Y_FORCE_INLINE bool IsDelimiter(ui8 ch) const {
return Delims[ch];
}
};
-template <class Split>
+template <class Split>
class TSplitIterator;
-class TSplitBase {
+class TSplitBase {
protected:
const char* Str;
size_t Len;
@@ -94,11 +94,11 @@ private:
};
#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4512)
+#pragma warning(push)
+#pragma warning(disable : 4512)
#endif
-class TDelimitersSplit: public TSplitBase {
+class TDelimitersSplit: public TSplitBase {
private:
const TSplitDelimiters& Delimiters;
@@ -119,7 +119,7 @@ private:
TDelimitersSplit(TString&&, const TSplitDelimiters&) = delete;
};
-class TDelimitersStrictSplit: public TSplitBase {
+class TDelimitersStrictSplit: public TSplitBase {
private:
const TSplitDelimiters& Delimiters;
@@ -140,7 +140,7 @@ private:
TDelimitersStrictSplit(TString&&, const TSplitDelimiters&) = delete;
};
-class TScreenedDelimitersSplit: public TSplitBase {
+class TScreenedDelimitersSplit: public TSplitBase {
private:
const TSplitDelimiters& Delimiters;
const TSplitDelimiters& Screens;
@@ -162,7 +162,7 @@ private:
TScreenedDelimitersSplit(const TString&, const TSplitDelimiters&, TSplitDelimiters&&) = delete;
};
-class TDelimitersSplitWithoutTags: public TSplitBase {
+class TDelimitersSplitWithoutTags: public TSplitBase {
private:
const TSplitDelimiters& Delimiters;
size_t SkipTag(size_t pos) const;
@@ -185,7 +185,7 @@ private:
TDelimitersSplitWithoutTags(TString&&, const TSplitDelimiters&) = delete;
};
-class TCharSplit: public TSplitBase {
+class TCharSplit: public TSplitBase {
public:
using TIterator = TSplitIterator<TCharSplit>;
friend class TSplitIterator<TCharSplit>;
@@ -202,10 +202,10 @@ private:
};
#ifdef _MSC_VER
-#pragma warning(pop)
+#pragma warning(pop)
#endif
-class TCharSplitWithoutTags: public TSplitBase {
+class TCharSplitWithoutTags: public TSplitBase {
private:
size_t SkipTag(size_t pos) const;
size_t SkipDelimiters(size_t pos) const;
@@ -225,7 +225,7 @@ private:
TCharSplitWithoutTags(TString&&) = delete;
};
-class TSubstringSplitDelimiter {
+class TSubstringSplitDelimiter {
public:
TKMPMatcher Matcher;
size_t Len;
@@ -233,7 +233,7 @@ public:
TSubstringSplitDelimiter(const TString& s);
};
-class TSubstringSplit: public TSplitBase {
+class TSubstringSplit: public TSplitBase {
private:
const TSubstringSplitDelimiter& Delimiter;
@@ -253,8 +253,8 @@ private:
TSubstringSplit(const TString&, TSubstringSplitDelimiter&&) = delete;
};
-template <class TSplit>
-class TSplitIterator {
+template <class TSplit>
+class TSplitIterator {
protected:
const TSplit& Split;
size_t Pos;
@@ -271,12 +271,12 @@ public:
virtual ~TSplitIterator() {
delete CurrentStroka;
}
-
+
inline TSizeTRegion Next() {
Y_ENSURE(!Eof(), TStringBuf("eof reached"));
return Split.Next(Pos);
}
-
+
TStringBuf NextTok() {
if (Eof())
return TStringBuf();
@@ -308,8 +308,8 @@ public:
using TSplitTokens = TVector<TString>;
-template <typename TSplit>
-void Split(const TSplit& split, TSplitTokens* words) {
+template <typename TSplit>
+void Split(const TSplit& split, TSplitTokens* words) {
words->clear();
TSplitIterator<TSplit> it(split);
while (!it.Eof())
diff --git a/library/cpp/deprecated/split/split_iterator_ut.cpp b/library/cpp/deprecated/split/split_iterator_ut.cpp
index be5069c4be..c4df3b2d13 100644
--- a/library/cpp/deprecated/split/split_iterator_ut.cpp
+++ b/library/cpp/deprecated/split/split_iterator_ut.cpp
@@ -1,15 +1,15 @@
-#include "split_iterator.h"
+#include "split_iterator.h"
#include <library/cpp/testing/unittest/registar.h>
-class TSplitIteratorTest: public TTestBase {
+class TSplitIteratorTest: public TTestBase {
UNIT_TEST_SUITE(TSplitIteratorTest);
- UNIT_TEST(TestDelimiters);
- UNIT_TEST(TestDelimitersSplit);
- UNIT_TEST(TestDelimitersStrictSplit);
- UNIT_TEST(TestTail);
- UNIT_TEST(TestScreenedDelimitersSplit);
- UNIT_TEST(TestSubstringDelimiter);
+ UNIT_TEST(TestDelimiters);
+ UNIT_TEST(TestDelimitersSplit);
+ UNIT_TEST(TestDelimitersStrictSplit);
+ UNIT_TEST(TestTail);
+ UNIT_TEST(TestScreenedDelimitersSplit);
+ UNIT_TEST(TestSubstringDelimiter);
UNIT_TEST_SUITE_END();
public:
@@ -21,17 +21,17 @@ public:
void TestSubstringDelimiter();
};
-void TSplitIteratorTest::TestDelimiters() {
+void TSplitIteratorTest::TestDelimiters() {
TSplitDelimiters delims("@");
for (int i = 0; i < 256; ++i)
- if ('@' != i) {
+ if ('@' != i) {
UNIT_ASSERT(!delims.IsDelimiter((ui8)i));
- } else {
+ } else {
UNIT_ASSERT(delims.IsDelimiter((ui8)i));
}
}
-void TSplitIteratorTest::TestDelimitersSplit() {
+void TSplitIteratorTest::TestDelimitersSplit() {
{
TString s = "1a3b45cd";
TSplitDelimiters delims("abcd");
@@ -52,7 +52,7 @@ void TSplitIteratorTest::TestDelimitersSplit() {
}
}
-void TSplitIteratorTest::TestDelimitersStrictSplit() {
+void TSplitIteratorTest::TestDelimitersStrictSplit() {
{
TString s = "grp@2";
TSplitDelimiters delims("@");
@@ -74,7 +74,7 @@ void TSplitIteratorTest::TestDelimitersStrictSplit() {
}
}
-void TSplitIteratorTest::TestTail() {
+void TSplitIteratorTest::TestTail() {
TString s = "grp@2@4";
TSplitDelimiters delims("@");
TDelimitersSplit split(s, delims);
@@ -88,7 +88,7 @@ void TSplitIteratorTest::TestTail() {
UNIT_ASSERT_EQUAL(it.GetTail(), "");
}
-void TSplitIteratorTest::TestScreenedDelimitersSplit() {
+void TSplitIteratorTest::TestScreenedDelimitersSplit() {
{
const TString s = "77.88.58.91 - - [28/Aug/2008:00:08:07 +0400] \"GET /export/mordashka.tgz HTTP/1.1\" 304 - \"-\" \"libwww-perl/5.805\" \"news.yandex.ru,80\" \"-\" \"-\" 1219867687 \"0\" 3283 2";
const TSplitDelimiters delims(" ");
@@ -137,7 +137,7 @@ void TSplitIteratorTest::TestScreenedDelimitersSplit() {
}
}
-void TSplitIteratorTest::TestSubstringDelimiter() {
+void TSplitIteratorTest::TestSubstringDelimiter() {
const TString s = "a@@bb@@cc@c.d@@r";
static const TSubstringSplitDelimiter delimiter("@@");
const TSubstringSplit splitter(s, delimiter);
diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make
index 6c753f68a9..3fa78a0e1c 100644
--- a/library/cpp/deprecated/ya.make
+++ b/library/cpp/deprecated/ya.make
@@ -32,7 +32,7 @@ RECURSE(
prog_options/ut
sgi_hash
threadable
- transgene
+ transgene
datawork
datawork/conf
calc_module