aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorArslan Urtashev <urtashev@gmail.com>2022-02-10 16:48:55 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:55 +0300
commit1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parentb97740540e7302cec9efa181e106ae1990a0cc1c (diff)
downloadydb-1136f2ce7cce7bcc84e695272c0d92d4eb900c2b.tar.gz
Restoring authorship annotation for Arslan Urtashev <urtashev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/serialized_enum.h18
-rw-r--r--util/generic/string.h46
-rw-r--r--util/generic/string_ut.cpp4
-rw-r--r--util/generic/string_ut.h44
-rw-r--r--util/stream/output.cpp14
-rw-r--r--util/string/ascii.h32
-rw-r--r--util/system/env.cpp6
-rw-r--r--util/system/env.h4
-rw-r--r--util/system/env_ut.cpp4
9 files changed, 86 insertions, 86 deletions
diff --git a/util/generic/serialized_enum.h b/util/generic/serialized_enum.h
index d67ec655b8..79df2bac22 100644
--- a/util/generic/serialized_enum.h
+++ b/util/generic/serialized_enum.h
@@ -1,9 +1,9 @@
#pragma once
-#include <util/generic/fwd.h>
+#include <util/generic/fwd.h>
#include <util/generic/vector.h>
#include <util/generic/map.h>
-
+
#include <cstddef>
#include <type_traits>
@@ -30,7 +30,7 @@ in your ya.make
*/
template <typename EnumT>
Y_CONST_FUNCTION constexpr size_t GetEnumItemsCount();
-
+
namespace NEnumSerializationRuntime {
namespace NDetail {
template <typename EEnum>
@@ -83,12 +83,12 @@ namespace NEnumSerializationRuntime {
const TVector<TString>& GetEnumAllCppNamesImpl();
}
-/**
- * Returns names for items in enum or enum class
- *
- * @tparam EnumT enum type
- */
-template <typename EnumT>
+/**
+ * Returns names for items in enum or enum class
+ *
+ * @tparam EnumT enum type
+ */
+template <typename EnumT>
Y_CONST_FUNCTION ::NEnumSerializationRuntime::TMappedDictView<EnumT, TString> GetEnumNames() {
return ::NEnumSerializationRuntime::GetEnumNamesImpl<EnumT>();
}
diff --git a/util/generic/string.h b/util/generic/string.h
index e3e2a4912a..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -104,20 +104,20 @@ private:
};
template <class TStringType>
-class TBasicCharRef {
-public:
+class TBasicCharRef {
+public:
using TChar = typename TStringType::TChar;
-
+
TBasicCharRef(TStringType& s, size_t pos)
: S_(s)
, Pos_(pos)
{
}
-
- operator TChar() const {
- return S_.at(Pos_);
- }
-
+
+ operator TChar() const {
+ return S_.at(Pos_);
+ }
+
TChar* operator&() {
return S_.begin() + Pos_;
}
@@ -126,14 +126,14 @@ public:
return S_.cbegin() + Pos_;
}
- TBasicCharRef& operator=(TChar c) {
+ TBasicCharRef& operator=(TChar c) {
Y_ASSERT(Pos_ < S_.size() || (Pos_ == S_.size() && !c));
-
+
S_.Detach()[Pos_] = c;
-
- return *this;
- }
-
+
+ return *this;
+ }
+
TBasicCharRef& operator=(const TBasicCharRef& other) {
return this->operator=(static_cast<TChar>(other));
}
@@ -149,12 +149,12 @@ public:
*/
TBasicCharRef(const TBasicCharRef&) = default;
-private:
+private:
TStringType& S_;
- size_t Pos_;
-};
+ size_t Pos_;
+};
#endif
-
+
template <typename TCharType, typename TTraits>
class TBasicString: public TStringBase<TBasicString<TCharType, TTraits>, TCharType, TTraits> {
public:
@@ -252,7 +252,7 @@ public:
inline const_reference operator[](size_t pos) const noexcept {
Y_ASSERT(pos <= length());
-
+
return this->data()[pos];
}
@@ -264,8 +264,8 @@ public:
#else
return reference(*this, pos);
#endif
- }
-
+ }
+
using TBase::back;
inline reference back() noexcept {
@@ -468,9 +468,9 @@ public:
explicit TBasicString(const reference& c)
: TBasicString(&c, 1)
{
- }
+ }
#endif
-
+
TBasicString(size_t n, TCharType c)
#ifdef TSTRING_IS_STD_STRING
: Storage_(n, c)
diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp
index c2623acc17..ac82e9091d 100644
--- a/util/generic/string_ut.cpp
+++ b/util/generic/string_ut.cpp
@@ -742,7 +742,7 @@ public:
UNIT_TEST(TestStrCpy);
UNIT_TEST(TestPrefixSuffix);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestCharRef);
+ UNIT_TEST(TestCharRef);
#endif
UNIT_TEST(TestBack)
UNIT_TEST(TestFront)
@@ -804,7 +804,7 @@ public:
UNIT_TEST(TestStrCpy);
UNIT_TEST(TestPrefixSuffix);
#ifndef TSTRING_IS_STD_STRING
- UNIT_TEST(TestCharRef);
+ UNIT_TEST(TestCharRef);
#endif
UNIT_TEST(TestBack);
UNIT_TEST(TestFront)
diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h
index 99ce4999db..44bb10bdeb 100644
--- a/util/generic/string_ut.h
+++ b/util/generic/string_ut.h
@@ -997,37 +997,37 @@ public:
UNIT_ASSERT_EQUAL(str.StartsWith(emptyStr), true);
UNIT_ASSERT_EQUAL(str.EndsWith(emptyStr), true);
}
-
+
#ifndef TSTRING_IS_STD_STRING
- void TestCharRef() {
+ void TestCharRef() {
const char_type abc[] = {'a', 'b', 'c', 0};
const char_type bbc[] = {'b', 'b', 'c', 0};
const char_type cbc[] = {'c', 'b', 'c', 0};
-
+
TStringType s0 = abc;
TStringType s1 = s0;
-
- UNIT_ASSERT(!s0.IsDetached());
- UNIT_ASSERT(!s1.IsDetached());
-
- /* Read access shouldn't detach. */
+
+ UNIT_ASSERT(!s0.IsDetached());
+ UNIT_ASSERT(!s1.IsDetached());
+
+ /* Read access shouldn't detach. */
UNIT_ASSERT_VALUES_EQUAL(s0[0], (ui8)'a');
- UNIT_ASSERT(!s0.IsDetached());
- UNIT_ASSERT(!s1.IsDetached());
-
- /* Writing should detach. */
+ UNIT_ASSERT(!s0.IsDetached());
+ UNIT_ASSERT(!s1.IsDetached());
+
+ /* Writing should detach. */
s1[0] = (ui8)'b';
TStringType s2 = s0;
s0[0] = (ui8)'c';
-
- UNIT_ASSERT_VALUES_EQUAL(s0, cbc);
- UNIT_ASSERT_VALUES_EQUAL(s1, bbc);
- UNIT_ASSERT_VALUES_EQUAL(s2, abc);
- UNIT_ASSERT(s0.IsDetached());
- UNIT_ASSERT(s1.IsDetached());
- UNIT_ASSERT(s2.IsDetached());
-
- /* Accessing null terminator is OK. Note that writing into it is UB. */
+
+ UNIT_ASSERT_VALUES_EQUAL(s0, cbc);
+ UNIT_ASSERT_VALUES_EQUAL(s1, bbc);
+ UNIT_ASSERT_VALUES_EQUAL(s2, abc);
+ UNIT_ASSERT(s0.IsDetached());
+ UNIT_ASSERT(s1.IsDetached());
+ UNIT_ASSERT(s2.IsDetached());
+
+ /* Accessing null terminator is OK. Note that writing into it is UB. */
UNIT_ASSERT_VALUES_EQUAL(s0[3], (ui8)'\0');
UNIT_ASSERT_VALUES_EQUAL(s1[3], (ui8)'\0');
UNIT_ASSERT_VALUES_EQUAL(s2[3], (ui8)'\0');
@@ -1044,7 +1044,7 @@ public:
}
UNIT_ASSERT_VALUES_EQUAL(s1, red_eared);
}
- }
+ }
#endif
void TestBack() {
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index 983ae1cdec..db81b81b70 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -212,15 +212,15 @@ void Out<typename std::vector<bool>::reference>(IOutputStream& o, const std::vec
#ifndef TSTRING_IS_STD_STRING
template <>
void Out<TBasicCharRef<TString>>(IOutputStream& o, const TBasicCharRef<TString>& c) {
- o << static_cast<char>(c);
-}
-
-template <>
+ o << static_cast<char>(c);
+}
+
+template <>
void Out<TBasicCharRef<TUtf16String>>(IOutputStream& o, const TBasicCharRef<TUtf16String>& c) {
o << static_cast<wchar16>(c);
-}
-
-template <>
+}
+
+template <>
void Out<TBasicCharRef<TUtf32String>>(IOutputStream& o, const TBasicCharRef<TUtf32String>& c) {
o << static_cast<wchar32>(c);
}
diff --git a/util/string/ascii.h b/util/string/ascii.h
index 5ad6db1eff..10344384d3 100644
--- a/util/string/ascii.h
+++ b/util/string/ascii.h
@@ -27,36 +27,36 @@ namespace NPrivate {
extern const unsigned char ASCII_LOWER[256];
template <class T>
- struct TDereference {
- using type = T;
+ struct TDereference {
+ using type = T;
};
#ifndef TSTRING_IS_STD_STRING
template <class String>
- struct TDereference<TBasicCharRef<String>> {
- using type = typename String::value_type;
+ struct TDereference<TBasicCharRef<String>> {
+ using type = typename String::value_type;
};
#endif
template <class T>
- using TDereferenced = typename TDereference<T>::type;
-
+ using TDereferenced = typename TDereference<T>::type;
+
template <class T>
- bool RangeOk(T c) noexcept {
- static_assert(std::is_integral<T>::value, "Integral type character expected");
-
+ bool RangeOk(T c) noexcept {
+ static_assert(std::is_integral<T>::value, "Integral type character expected");
+
if (sizeof(T) == 1) {
- return true;
+ return true;
}
-
- return c >= static_cast<T>(0) && c <= static_cast<T>(127);
+
+ return c >= static_cast<T>(0) && c <= static_cast<T>(127);
}
-
+
#ifndef TSTRING_IS_STD_STRING
template <class String>
- bool RangeOk(const TBasicCharRef<String>& c) {
- return RangeOk(static_cast<typename String::value_type>(c));
- }
+ bool RangeOk(const TBasicCharRef<String>& c) {
+ return RangeOk(static_cast<typename String::value_type>(c));
+ }
#endif
}
diff --git a/util/system/env.cpp b/util/system/env.cpp
index 19d570532a..ead9b566a5 100644
--- a/util/system/env.cpp
+++ b/util/system/env.cpp
@@ -26,9 +26,9 @@ TString GetEnv(const TString& key, const TString& def) {
size_t len = GetEnvironmentVariableA(key.data(), nullptr, 0);
if (len == 0) {
- if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
- return def;
- }
+ if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
+ return def;
+ }
return TString{};
}
diff --git a/util/system/env.h b/util/system/env.h
index b8a3154710..e2ccdd1e95 100644
--- a/util/system/env.h
+++ b/util/system/env.h
@@ -5,8 +5,8 @@
/**
* Search the environment list provided by the host environment for associated variable.
*
- * @param key String identifying the name of the environmental variable to look for
- * @param def String that returns if environmental variable not found by key
+ * @param key String identifying the name of the environmental variable to look for
+ * @param def String that returns if environmental variable not found by key
*
* @return String that is associated with the matched environment variable or empty string if
* such variable is missing.
diff --git a/util/system/env_ut.cpp b/util/system/env_ut.cpp
index 5b34b3ea64..e03cc01658 100644
--- a/util/system/env_ut.cpp
+++ b/util/system/env_ut.cpp
@@ -10,11 +10,11 @@ Y_UNIT_TEST_SUITE(EnvTest) {
TString def = "Some default value for env var";
// first of all, it should be clear
UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString());
- UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), def);
+ UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), def);
SetEnv(key, value);
// set and see what value we get here
UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), value);
- UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), value);
+ UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), value);
// set empty value
SetEnv(key, TString());
UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString());