diff options
author | maslov <maslov@yandex-team.ru> | 2022-02-10 16:48:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:18 +0300 |
commit | 9dc6a7dc845164ea1999b93fab2a8b7491a08d2b (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/cgiparam | |
parent | 7429d8be0f619d00069466e159d8ecd43a60f61a (diff) | |
download | ydb-9dc6a7dc845164ea1999b93fab2a8b7491a08d2b.tar.gz |
Restoring authorship annotation for <maslov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/cgiparam')
-rw-r--r-- | library/cpp/cgiparam/cgiparam.cpp | 24 | ||||
-rw-r--r-- | library/cpp/cgiparam/cgiparam.h | 10 |
2 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index 948f1060c3..f3277b8e4b 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -28,8 +28,8 @@ bool TCgiParameters::Erase(const TStringBuf name, size_t pos) { } return false; -} - +} + bool TCgiParameters::Erase(const TStringBuf name, const TStringBuf val) { const auto pair = equal_range(name); @@ -82,17 +82,17 @@ void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf va static inline TString DoUnescape(const TStringBuf s) { TString res; - + res.reserve(CgiUnescapeBufLen(s.size())); res.ReserveAndResize(CgiUnescape(res.begin(), s).size()); return res; } - + void TCgiParameters::InsertEscaped(const TStringBuf name, const TStringBuf value) { InsertUnescaped(DoUnescape(name), DoUnescape(value)); } - + template <bool addAll, class F> static inline void DoScan(const TStringBuf s, F& f) { ScanKeyValue<addAll, '&', '='>(s, f); @@ -115,8 +115,8 @@ void TCgiParameters::ScanAdd(const TStringBuf query) { TAddEscaped f = {this}; DoScan<false>(query, f); -} - +} + void TCgiParameters::ScanAddUnescaped(const TStringBuf query) { auto f = [this](const TStringBuf key, const TStringBuf val) { this->InsertUnescaped(key, val); @@ -147,8 +147,8 @@ TString TCgiParameters::Print() const { res.ReserveAndResize(end - res.data()); return res; -} - +} + char* TCgiParameters::Print(char* res) const { if (empty()) { return res; @@ -214,8 +214,8 @@ TCgiParameters::const_iterator TCgiParameters::Find(const TStringBuf name, size_ } return end(); -} - +} + bool TCgiParameters::Has(const TStringBuf name, const TStringBuf value) const noexcept { const auto pair = equal_range(name); @@ -226,7 +226,7 @@ bool TCgiParameters::Has(const TStringBuf name, const TStringBuf value) const no } return false; -} +} TQuickCgiParam::TQuickCgiParam(const TStringBuf cgiParamStr) { UnescapeBuf.reserve(CgiUnescapeBufLen(cgiParamStr.size())); diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 2abb4989a6..87d1ab0ad4 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -1,5 +1,5 @@ #pragma once - + #include <library/cpp/iterator/iterate_values.h> #include <util/generic/iterator_range.h> @@ -19,17 +19,17 @@ struct TStringLess { class TCgiParameters: public TMultiMap<TString, TString> { public: TCgiParameters() = default; - + explicit TCgiParameters(const TStringBuf cgiParamStr) { Scan(cgiParamStr); } - + TCgiParameters(std::initializer_list<std::pair<TString, TString>> il); void Flush() { erase(begin(), end()); } - + size_t EraseAll(const TStringBuf name); size_t NumOfValues(const TStringBuf name) const noexcept { @@ -131,7 +131,7 @@ public: return it->second.data(); } -}; +}; template <typename TIter> void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, const TIter valuesEnd) { |