diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
commit | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch) | |
tree | 506dac10f5df94fab310584ee51b24fc5a081c22 /util/string/type.cpp | |
parent | 2d37894b1b037cf24231090eda8589bbb44fb6fc (diff) | |
download | ydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/type.cpp')
-rw-r--r-- | util/string/type.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/util/string/type.cpp b/util/string/type.cpp index 49671c02c2..e8d9921911 100644 --- a/util/string/type.cpp +++ b/util/string/type.cpp @@ -1,8 +1,8 @@ #include "type.h" #include "ascii.h" -#include <array> - +#include <array> + bool IsSpace(const char* s, size_t len) noexcept { if (len == 0) { return false; @@ -21,7 +21,7 @@ static bool IsNumberT(const TStringType& s) noexcept { return false; } - return std::all_of(s.begin(), s.end(), IsAsciiDigit<typename TStringType::value_type>); + return std::all_of(s.begin(), s.end(), IsAsciiDigit<typename TStringType::value_type>); } bool IsNumber(const TStringBuf s) noexcept { @@ -38,7 +38,7 @@ static bool IsHexNumberT(const TStringType& s) noexcept { return false; } - return std::all_of(s.begin(), s.end(), IsAsciiHex<typename TStringType::value_type>); + return std::all_of(s.begin(), s.end(), IsAsciiHex<typename TStringType::value_type>); } bool IsHexNumber(const TStringBuf s) noexcept { @@ -49,20 +49,20 @@ bool IsHexNumber(const TWtringBuf s) noexcept { return IsHexNumberT(s); } -namespace { - template <size_t N> - bool IsCaseInsensitiveAnyOf(TStringBuf str, const std::array<TStringBuf, N>& options) { - for (auto option : options) { - if (str.size() == option.size() && ::strnicmp(str.data(), option.data(), str.size()) == 0) { - return true; - } - } +namespace { + template <size_t N> + bool IsCaseInsensitiveAnyOf(TStringBuf str, const std::array<TStringBuf, N>& options) { + for (auto option : options) { + if (str.size() == option.size() && ::strnicmp(str.data(), option.data(), str.size()) == 0) { + return true; + } + } return false; - } -} //anonymous namespace + } +} //anonymous namespace -bool IsTrue(const TStringBuf v) noexcept { - static constexpr std::array<TStringBuf, 7> trueOptions{ +bool IsTrue(const TStringBuf v) noexcept { + static constexpr std::array<TStringBuf, 7> trueOptions{ "true", "t", "yes", @@ -70,11 +70,11 @@ bool IsTrue(const TStringBuf v) noexcept { "on", "1", "da"}; - return IsCaseInsensitiveAnyOf(v, trueOptions); + return IsCaseInsensitiveAnyOf(v, trueOptions); } bool IsFalse(const TStringBuf v) noexcept { - static constexpr std::array<TStringBuf, 7> falseOptions{ + static constexpr std::array<TStringBuf, 7> falseOptions{ "false", "f", "no", @@ -82,5 +82,5 @@ bool IsFalse(const TStringBuf v) noexcept { "off", "0", "net"}; - return IsCaseInsensitiveAnyOf(v, falseOptions); + return IsCaseInsensitiveAnyOf(v, falseOptions); } |