aboutsummaryrefslogtreecommitdiffstats
path: root/util/string
diff options
context:
space:
mode:
authorsereglond <sereglond@yandex-team.ru>2022-02-10 16:47:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:46 +0300
commiteb3d925534734c808602b31b38b953677f0a279f (patch)
tree4222ef8dc375ee9f30b68a004ee42a0845e005b6 /util/string
parent4c8065245df3ea26b7757bcb1f8218df287f9148 (diff)
downloadydb-eb3d925534734c808602b31b38b953677f0a279f.tar.gz
Restoring authorship annotation for <sereglond@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string')
-rw-r--r--util/string/cast.cpp14
-rw-r--r--util/string/cast.h34
-rw-r--r--util/string/cast_ut.cpp4
3 files changed, 26 insertions, 26 deletions
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index aa1e65a8e9..4fb09cdd0c 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -29,7 +29,7 @@ using double_conversion::StringToDoubleConverter;
/*
* ------------------------------ formatters ------------------------------
*/
-
+
namespace {
constexpr char IntToChar[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
@@ -55,12 +55,12 @@ namespace {
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 {
Y_UNREACHABLE();
}
-
+
template <class T>
std::make_signed_t<T> NegatePositiveSigned(T value) noexcept {
return value > 0 ? (-std::make_signed_t<T>(value - 1) - 1) : 0;
@@ -70,7 +70,7 @@ namespace {
struct TBasicIntFormatter {
static_assert(1 < base && base < 17, "expect 1 < base && base < 17");
static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers.");
-
+
static inline size_t Format(T value, TChar* buf, size_t len) {
Y_ENSURE(len, TStringBuf("zero length"));
@@ -421,8 +421,8 @@ namespace {
template <> \
size_t IntToString<BASE, TYPE>(TYPE value, char* buf, size_t len) { \
return FormatInt<ITYPE, BASE, char>(value, buf, len); \
- }
-
+ }
+
#define DEF_INT_SPEC_I(TYPE, ITYPE) \
template <> \
size_t ToStringImpl<TYPE>(TYPE value, char* buf, size_t len) { \
@@ -586,7 +586,7 @@ bool TryFromStringImpl<TUtf16String>(const wchar16* data, size_t len, TUtf16Stri
} \
return status; \
}
-
+
#define DEF_INT_SPEC_II(CHAR, TYPE, ITYPE, BOUNDS) \
template <> \
TYPE FromStringImpl<TYPE>(const CHAR* data, size_t len) { \
diff --git a/util/string/cast.h b/util/string/cast.h
index 90e925c194..3d970ea2d8 100644
--- a/util/string/cast.h
+++ b/util/string/cast.h
@@ -311,18 +311,18 @@ inline T FromStringWithDefault(const TStringType& s) {
double StrToD(const char* b, char** se);
double StrToD(const char* b, const char* e, char** se);
-template <int base, class T>
-size_t IntToString(T t, char* buf, size_t len);
-
-template <int base, class T>
+template <int base, class T>
+size_t IntToString(T t, char* buf, size_t len);
+
+template <int base, class T>
inline TString IntToString(T t) {
static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value");
-
- char buf[256];
-
+
+ char buf[256];
+
return TString(buf, IntToString<base>(t, buf, sizeof(buf)));
-}
-
+}
+
template <int base, class TInt, class TChar>
bool TryIntFromString(const TChar* data, size_t len, TInt& result);
@@ -331,18 +331,18 @@ inline bool TryIntFromString(const TStringType& s, TInt& result) {
return TryIntFromString<base>(s.data(), s.size(), result);
}
-template <class TInt, int base, class TChar>
-TInt IntFromString(const TChar* str, size_t len);
-
-template <class TInt, int base, class TChar>
-inline TInt IntFromString(const TChar* str) {
+template <class TInt, int base, class TChar>
+TInt IntFromString(const TChar* str, size_t len);
+
+template <class TInt, int base, class TChar>
+inline TInt IntFromString(const TChar* str) {
return IntFromString<TInt, base>(str, std::char_traits<TChar>::length(str));
-}
-
+}
+
template <class TInt, int base, class TStringType>
inline TInt IntFromString(const TStringType& str) {
return IntFromString<TInt, base>(str.data(), str.size());
-}
+}
static inline TString ToString(const TStringBuf str) {
return TString(str);
diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp
index 033450c38c..a0957f66d4 100644
--- a/util/string/cast_ut.cpp
+++ b/util/string/cast_ut.cpp
@@ -20,10 +20,10 @@
#define EPS 10E-7
#define HEX_MACROS_MAP(mac, type, val) mac(type, val, 2) mac(type, val, 8) mac(type, val, 10) mac(type, val, 16)
-
+
#define OK_HEX_CHECK(type, val, base) UNIT_ASSERT_EQUAL((IntFromStringForCheck<base>(IntToString<base>(val))), val);
#define EXC_HEX_CHECK(type, val, base) UNIT_ASSERT_EXCEPTION((IntFromString<type, base>(IntToString<base>(val))), yexception);
-
+
#define TRY_HEX_MACROS_MAP(mac, type, val, result, def) \
mac(type, val, result, def, 2) \
mac(type, val, result, def, 8) \