aboutsummaryrefslogtreecommitdiffstats
path: root/util/string
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.ru>2022-02-10 16:46:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:32 +0300
commit00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (patch)
treecb7a9f4a92c0d4cc5a86eeed49ad71e810953c1f /util/string
parent83a8efcf3af051e3dd59c00d1d5dafc96412ec1e (diff)
downloadydb-00afc96e9c0298054b7386fa7fb9e3cc3d67b974.tar.gz
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string')
-rw-r--r--util/string/cast.cpp28
-rw-r--r--util/string/cast.h2
-rw-r--r--util/string/cast_ut.cpp52
-rw-r--r--util/string/type.cpp4
4 files changed, 43 insertions, 43 deletions
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index aa1e65a8e9..75741efe21 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -54,7 +54,7 @@ namespace {
template <class T>
std::enable_if_t<std::is_signed<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T value) noexcept {
return std::make_unsigned_t<T>(-(value + 1)) + std::make_unsigned_t<T>(1);
- }
+ }
template <class T>
std::enable_if_t<std::is_unsigned<T>::value, std::make_unsigned_t<T>> NegateNegativeSigned(T) noexcept {
@@ -482,29 +482,29 @@ size_t ToStringImpl<bool>(bool t, char* buf, size_t len) {
/*
* ------------------------------ parsers ------------------------------
*/
-
-template <>
+
+template <>
bool TryFromStringImpl<bool>(const char* data, size_t len, bool& result) {
- if (len == 1) {
- if (data[0] == '0') {
+ if (len == 1) {
+ if (data[0] == '0') {
result = false;
return true;
- } else if (data[0] == '1') {
+ } else if (data[0] == '1') {
result = true;
- return true;
- }
- }
- TStringBuf buf(data, len);
+ return true;
+ }
+ }
+ TStringBuf buf(data, len);
if (IsTrue(buf)) {
result = true;
- return true;
+ return true;
} else if (IsFalse(buf)) {
result = false;
return true;
- }
+ }
return false;
-}
-
+}
+
template <>
bool FromStringImpl<bool>(const char* data, size_t len) {
bool result;
diff --git a/util/string/cast.h b/util/string/cast.h
index 90e925c194..7a176a5c77 100644
--- a/util/string/cast.h
+++ b/util/string/cast.h
@@ -124,7 +124,7 @@ struct TFromStringException: public TBadCastException {
/*
* specialized for:
- * bool
+ * bool
* short
* unsigned short
* int
diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp
index 033450c38c..e7be19c96a 100644
--- a/util/string/cast_ut.cpp
+++ b/util/string/cast_ut.cpp
@@ -40,31 +40,31 @@
UNIT_ASSERT_VALUES_EQUAL(TryIntFromStringForCheck<base>(IntToString<base>(val), result), false); \
UNIT_ASSERT_VALUES_EQUAL(result, def);
-template <class A>
-struct TRet {
+template <class A>
+struct TRet {
template <int base>
inline A IntFromStringForCheck(const TString& str) {
- return IntFromString<A, base>(str);
- }
+ return IntFromString<A, base>(str);
+ }
template <int base>
inline bool TryIntFromStringForCheck(const TString& str, A& result) {
return TryIntFromString<base>(str, result);
}
- template <class B>
+ template <class B>
inline void CheckOK(B v) {
UNIT_ASSERT_VALUES_EQUAL(FromString<A>(ToString(v)), v); // char
UNIT_ASSERT_VALUES_EQUAL(FromString<A>(ToWtring(v)), v); // wide char
HEX_MACROS_MAP(OK_HEX_CHECK, A, v);
- }
+ }
- template <class B>
+ template <class B>
inline void CheckExc(B v) {
UNIT_ASSERT_EXCEPTION(FromString<A>(ToString(v)), yexception); // char
UNIT_ASSERT_EXCEPTION(FromString<A>(ToWtring(v)), yexception); // wide char
HEX_MACROS_MAP(EXC_HEX_CHECK, A, v);
- }
+ }
template <class B>
inline void CheckTryOK(B v) {
@@ -89,16 +89,16 @@ struct TRet {
TRY_HEX_MACROS_MAP(TRY_FAIL_HEX_CHECK, A, v, convV, defaultV);
}
-};
-
-template <>
-struct TRet<bool> {
- template <class B>
+};
+
+template <>
+struct TRet<bool> {
+ template <class B>
inline void CheckOK(B v) {
UNIT_ASSERT_VALUES_EQUAL(FromString<bool>(ToString(v)), v);
- }
-
- template <class B>
+ }
+
+ template <class B>
inline void CheckTryOK(B v) {
B convV;
UNIT_ASSERT_VALUES_EQUAL(TryFromString<bool>(ToString(v), convV), true);
@@ -107,8 +107,8 @@ struct TRet<bool> {
template <class B>
inline void CheckExc(B v) {
- UNIT_ASSERT_EXCEPTION(FromString<bool>(ToString(v)), yexception);
- }
+ UNIT_ASSERT_EXCEPTION(FromString<bool>(ToString(v)), yexception);
+ }
template <class B>
inline void CheckTryFail(B v) {
@@ -117,13 +117,13 @@ struct TRet<bool> {
UNIT_ASSERT_VALUES_EQUAL(TryFromString<bool>(ToString(v), convV), false);
UNIT_ASSERT_VALUES_EQUAL(defaultV, convV);
}
-};
-
-template <class A>
-inline TRet<A> F() {
- return TRet<A>();
-};
-
+};
+
+template <class A>
+inline TRet<A> F() {
+ return TRet<A>();
+};
+
#if 0
template <class T>
inline void CheckConvertToBuffer(const T& value, const size_t size, const TString& canonValue) {
@@ -181,7 +181,7 @@ Y_UNIT_TEST_SUITE(TCastTest) {
test1(bool, false);
test2(bool, "");
test2(bool, "a");
-
+
test2(ui8, -1);
test1(i8, -1);
test1(i8, SCHAR_MAX);
diff --git a/util/string/type.cpp b/util/string/type.cpp
index 49671c02c2..c6b6f7aea5 100644
--- a/util/string/type.cpp
+++ b/util/string/type.cpp
@@ -72,7 +72,7 @@ bool IsTrue(const TStringBuf v) noexcept {
"da"};
return IsCaseInsensitiveAnyOf(v, trueOptions);
}
-
+
bool IsFalse(const TStringBuf v) noexcept {
static constexpr std::array<TStringBuf, 7> falseOptions{
"false",
@@ -83,4 +83,4 @@ bool IsFalse(const TStringBuf v) noexcept {
"0",
"net"};
return IsCaseInsensitiveAnyOf(v, falseOptions);
-}
+}