aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cgiparam
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/cgiparam
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cgiparam')
-rw-r--r--library/cpp/cgiparam/cgiparam.cpp18
-rw-r--r--library/cpp/cgiparam/cgiparam.h14
-rw-r--r--library/cpp/cgiparam/cgiparam_ut.cpp4
-rw-r--r--library/cpp/cgiparam/fuzz/ya.make6
-rw-r--r--library/cpp/cgiparam/ut/ya.make16
-rw-r--r--library/cpp/cgiparam/ya.make26
6 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp
index f3277b8e4b..c5b735cffb 100644
--- a/library/cpp/cgiparam/cgiparam.cpp
+++ b/library/cpp/cgiparam/cgiparam.cpp
@@ -5,7 +5,7 @@
#include <util/generic/singleton.h>
-TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString>> il) {
+TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString>> il) {
for (const auto& item : il) {
insert(item);
}
@@ -14,7 +14,7 @@ TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString>
const TString& TCgiParameters::Get(const TStringBuf name, size_t numOfValue) const noexcept {
const auto it = Find(name, numOfValue);
- return end() == it ? Default<TString>() : it->second;
+ return end() == it ? Default<TString>() : it->second;
}
bool TCgiParameters::Erase(const TStringBuf name, size_t pos) {
@@ -63,10 +63,10 @@ void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf va
if (it == pair.second) { // not found
if (val.IsInited()) {
- emplace_hint(it, TString(key), TString(val));
+ emplace_hint(it, TString(key), TString(val));
}
} else {
- TString& dst = it->second;
+ TString& dst = it->second;
for (++it; it != pair.second; erase(it++)) {
dst += sep;
@@ -80,8 +80,8 @@ void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf va
}
}
-static inline TString DoUnescape(const TStringBuf s) {
- TString res;
+static inline TString DoUnescape(const TStringBuf s) {
+ TString res;
res.reserve(CgiUnescapeBufLen(s.size()));
res.ReserveAndResize(CgiUnescape(res.begin(), s).size());
@@ -139,8 +139,8 @@ void TCgiParameters::ScanAddAll(const TStringBuf query) {
DoScan<true>(query, f);
}
-TString TCgiParameters::Print() const {
- TString res;
+TString TCgiParameters::Print() const {
+ TString res;
res.reserve(PrintSize());
const char* end = Print(res.begin());
@@ -169,7 +169,7 @@ char* TCgiParameters::Print(char* res) const {
return res;
}
-size_t TCgiParameters::PrintSize() const noexcept {
+size_t TCgiParameters::PrintSize() const noexcept {
size_t res = size(); // for '&'
for (const auto& i : *this) {
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index 87d1ab0ad4..572393082c 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -5,18 +5,18 @@
#include <util/generic/iterator_range.h>
#include <util/generic/map.h>
#include <util/generic/strbuf.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <initializer_list>
struct TStringLess {
template <class T1, class T2>
- inline bool operator()(const T1& t1, const T2& t2) const noexcept {
+ inline bool operator()(const T1& t1, const T2& t2) const noexcept {
return TStringBuf(t1) < TStringBuf(t2);
}
};
-class TCgiParameters: public TMultiMap<TString, TString> {
+class TCgiParameters: public TMultiMap<TString, TString> {
public:
TCgiParameters() = default;
@@ -24,7 +24,7 @@ public:
Scan(cgiParamStr);
}
- TCgiParameters(std::initializer_list<std::pair<TString, TString>> il);
+ TCgiParameters(std::initializer_list<std::pair<TString, TString>> il);
void Flush() {
erase(begin(), end());
@@ -36,7 +36,7 @@ public:
return count(name);
}
- TString operator()() const {
+ TString operator()() const {
return Print();
}
@@ -51,11 +51,11 @@ public:
* @note The returned string has format <name1>=<value1>&<name2>=<value2>&...
* @note Names and values in the returned string are CGI-escaped.
*/
- TString Print() const;
+ TString Print() const;
char* Print(char* res) const;
Y_PURE_FUNCTION
- size_t PrintSize() const noexcept;
+ size_t PrintSize() const noexcept;
/** The same as Print* except that RFC-3986 reserved characters are escaped.
* @param safe - set of characters to be skipped in escaping
diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp
index a562342084..1c7f783a17 100644
--- a/library/cpp/cgiparam/cgiparam_ut.cpp
+++ b/library/cpp/cgiparam/cgiparam_ut.cpp
@@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) {
}
Y_UNIT_TEST(TestScan2) {
- const TString parsee("=000&aaa=bbb&ag0=&ccc=ddd");
+ const TString parsee("=000&aaa=bbb&ag0=&ccc=ddd");
TCgiParameters c;
c.Scan(parsee);
@@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) {
}
Y_UNIT_TEST(TestScan3) {
- const TString parsee("aaa=bbb&ag0=&ccc=ddd");
+ const TString parsee("aaa=bbb&ag0=&ccc=ddd");
TCgiParameters c;
c.Scan(parsee);
diff --git a/library/cpp/cgiparam/fuzz/ya.make b/library/cpp/cgiparam/fuzz/ya.make
index 8fb9d50d3b..4c549c7c1e 100644
--- a/library/cpp/cgiparam/fuzz/ya.make
+++ b/library/cpp/cgiparam/fuzz/ya.make
@@ -9,8 +9,8 @@ SRCS(
main.cpp
)
-PEERDIR(
+PEERDIR(
library/cpp/cgiparam
-)
-
+)
+
END()
diff --git a/library/cpp/cgiparam/ut/ya.make b/library/cpp/cgiparam/ut/ya.make
index 1eee403951..894d4da1a9 100644
--- a/library/cpp/cgiparam/ut/ya.make
+++ b/library/cpp/cgiparam/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/cgiparam)
-
-OWNER(g:util)
-
-SRCS(
- cgiparam_ut.cpp
-)
-
-END()
+
+OWNER(g:util)
+
+SRCS(
+ cgiparam_ut.cpp
+)
+
+END()
diff --git a/library/cpp/cgiparam/ya.make b/library/cpp/cgiparam/ya.make
index fa1a6a13c0..d3fd5b5b50 100644
--- a/library/cpp/cgiparam/ya.make
+++ b/library/cpp/cgiparam/ya.make
@@ -1,16 +1,16 @@
-LIBRARY()
-
-OWNER(g:util)
-
-SRCS(
- cgiparam.cpp
- cgiparam.h
-)
-
-PEERDIR(
+LIBRARY()
+
+OWNER(g:util)
+
+SRCS(
+ cgiparam.cpp
+ cgiparam.h
+)
+
+PEERDIR(
library/cpp/iterator
library/cpp/string_utils/quote
library/cpp/string_utils/scan
-)
-
-END()
+)
+
+END()