diff options
author | moskupols <moskupols@yandex-team.ru> | 2022-02-10 16:50:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:52 +0300 |
commit | 7a8bfeeee3a2a91c8b26e196d49efc264a0f9941 (patch) | |
tree | 1b8e23cfad053b844f02054a0d30f8d1c355859f /library | |
parent | dd6b55b11723e4bb5b0cf7bffc0e45f15e2e46d3 (diff) | |
download | ydb-7a8bfeeee3a2a91c8b26e196d49efc264a0f9941.tar.gz |
Restoring authorship annotation for <moskupols@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opt.h | 12 | ||||
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 26 | ||||
-rw-r--r-- | library/cpp/uri/other.cpp | 34 | ||||
-rw-r--r-- | library/cpp/uri/other.h | 24 |
4 files changed, 48 insertions, 48 deletions
diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h index a8dd5adca9..3272af30b2 100644 --- a/library/cpp/getopt/small/last_getopt_opt.h +++ b/library/cpp/getopt/small/last_getopt_opt.h @@ -684,12 +684,12 @@ namespace NLastGetopt { return Handler1T<T>([target](auto&& value) { target->insert(std::move(value)); }); } - // Emplaces TString arg to *target for each argument - template <typename T> - TOpt& EmplaceTo(TVector<T>* target) { - return Handler1T<TString>([target](TString arg) { target->emplace_back(std::move(arg)); } ); - } - + // Emplaces TString arg to *target for each argument + template <typename T> + TOpt& EmplaceTo(TVector<T>* target) { + return Handler1T<TString>([target](TString arg) { target->emplace_back(std::move(arg)); } ); + } + template <class Container> TOpt& SplitHandler(Container* target, const char delim) { return Handler(new NLastGetopt::TOptSplitHandler<Container>(target, delim)); diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index c99a1d053d..bfb790b78c 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -713,19 +713,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { UNIT_ASSERT_VALUES_EQUAL(19, ints.at(1)); } - Y_UNIT_TEST(TestEmplaceTo) { - TVector<std::tuple<TString>> richPaths; - - TOptsNoDefault opts; - opts.AddLongOption("path").EmplaceTo(&richPaths); - - TOptsParseResultTestWrapper r(&opts, V({"cmd", "--path=<a=b>//cool", "--path=//nice"})); - - UNIT_ASSERT_VALUES_EQUAL(size_t(2), richPaths.size()); - UNIT_ASSERT_VALUES_EQUAL("<a=b>//cool", std::get<0>(richPaths.at(0))); - UNIT_ASSERT_VALUES_EQUAL("//nice", std::get<0>(richPaths.at(1))); - } - + Y_UNIT_TEST(TestEmplaceTo) { + TVector<std::tuple<TString>> richPaths; + + TOptsNoDefault opts; + opts.AddLongOption("path").EmplaceTo(&richPaths); + + TOptsParseResultTestWrapper r(&opts, V({"cmd", "--path=<a=b>//cool", "--path=//nice"})); + + UNIT_ASSERT_VALUES_EQUAL(size_t(2), richPaths.size()); + UNIT_ASSERT_VALUES_EQUAL("<a=b>//cool", std::get<0>(richPaths.at(0))); + UNIT_ASSERT_VALUES_EQUAL("//nice", std::get<0>(richPaths.at(1))); + } + Y_UNIT_TEST(TestKVHandler) { TStringBuilder keyvals; diff --git a/library/cpp/uri/other.cpp b/library/cpp/uri/other.cpp index b23a5b68a9..e069c491a8 100644 --- a/library/cpp/uri/other.cpp +++ b/library/cpp/uri/other.cpp @@ -62,21 +62,21 @@ void InvertDomain(char* begin, char* end) { b = e + 1; } } - -void InvertUrl(char* begin, char* end) { + +void InvertUrl(char* begin, char* end) { char* slash = strchr(begin, '/'); - if (slash) { - *slash = 0; - } - strlwr(begin); - if (slash) { - *slash = '/'; - } - InvertDomain(begin, end); - TrspChars(begin); -} - -void RevertUrl(char* begin, char* end) { - UnTrspChars(begin); - InvertDomain(begin, end); -} + if (slash) { + *slash = 0; + } + strlwr(begin); + if (slash) { + *slash = '/'; + } + InvertDomain(begin, end); + TrspChars(begin); +} + +void RevertUrl(char* begin, char* end) { + UnTrspChars(begin); + InvertDomain(begin, end); +} diff --git a/library/cpp/uri/other.h b/library/cpp/uri/other.h index 7aec22e77b..766930c3bf 100644 --- a/library/cpp/uri/other.h +++ b/library/cpp/uri/other.h @@ -19,23 +19,23 @@ inline TString& InvertDomain(TString& url) { return url; } -void InvertUrl(char* begin, char* end); - -inline void InvertUrl(char* url) { - InvertUrl(url, url + strlen(url)); -} - +void InvertUrl(char* begin, char* end); + +inline void InvertUrl(char* url) { + InvertUrl(url, url + strlen(url)); +} + inline TString& InvertUrl(TString& url) { InvertUrl(url.begin(), url.begin() + url.size()); return url; } -void RevertUrl(char* begin, char* end); - -inline void RevertUrl(char* url) { - RevertUrl(url, url + strlen(url)); -} - +void RevertUrl(char* begin, char* end); + +inline void RevertUrl(char* url) { + RevertUrl(url, url + strlen(url)); +} + inline TString& RevertUrl(TString& url) { RevertUrl(url.begin(), url.begin() + url.size()); return url; |