aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cgiparam/cgiparam.h
diff options
context:
space:
mode:
authorAlexey Salmin <alexey.salmin@gmail.com>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit3c5b1607b38f637d2f3313791ed25c2e080d2647 (patch)
tree99be7b96e7c66612fbca94331100ef3b5fedcb88 /library/cpp/cgiparam/cgiparam.h
parentde89752358147d7b25ef59a85b431bb564068a49 (diff)
downloadydb-3c5b1607b38f637d2f3313791ed25c2e080d2647.tar.gz
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cgiparam/cgiparam.h')
-rw-r--r--library/cpp/cgiparam/cgiparam.h60
1 files changed, 30 insertions, 30 deletions
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index 87d1ab0ad4..0c26a66f5d 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -88,13 +88,13 @@ public:
void InsertEscaped(const TStringBuf name, const TStringBuf value);
#if !defined(__GLIBCXX__)
- template <typename TName, typename TValue>
- inline void InsertUnescaped(TName&& name, TValue&& value) {
+ template <typename TName, typename TValue>
+ inline void InsertUnescaped(TName&& name, TValue&& value) {
// TStringBuf use as TName or TValue is C++17 actually.
// There is no pair constructor available in C++14 when required type
// is not implicitly constructible from given type.
// But libc++ pair allows this with C++14.
- emplace(std::forward<TName>(name), std::forward<TValue>(value));
+ emplace(std::forward<TName>(name), std::forward<TValue>(value));
}
#else
template <typename TName, typename TValue>
@@ -103,19 +103,19 @@ public:
}
#endif
- // replace all values for a given key with new values
- template <typename TIter>
- void ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, const TIter valuesEnd);
-
- void ReplaceUnescaped(const TStringBuf key, std::initializer_list<TStringBuf> values) {
- ReplaceUnescaped(key, values.begin(), values.end());
- }
+ // replace all values for a given key with new values
+ template <typename TIter>
+ void ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, const TIter valuesEnd);
- void ReplaceUnescaped(const TStringBuf key, const TStringBuf value) {
+ void ReplaceUnescaped(const TStringBuf key, std::initializer_list<TStringBuf> values) {
+ ReplaceUnescaped(key, values.begin(), values.end());
+ }
+
+ void ReplaceUnescaped(const TStringBuf key, const TStringBuf value) {
ReplaceUnescaped(key, {value});
- }
-
- // join multiple values into a single one using a separator
+ }
+
+ // join multiple values into a single one using a separator
// if val is a [possibly empty] non-NULL string, append it as well
void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf());
@@ -132,29 +132,29 @@ public:
return it->second.data();
}
};
-
-template <typename TIter>
-void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, const TIter valuesEnd) {
- const auto oldRange = equal_range(key);
- auto current = oldRange.first;
-
- // reuse as many existing nodes as possible (probably none)
+
+template <typename TIter>
+void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, const TIter valuesEnd) {
+ const auto oldRange = equal_range(key);
+ auto current = oldRange.first;
+
+ // reuse as many existing nodes as possible (probably none)
for (; valuesBegin != valuesEnd && current != oldRange.second; ++valuesBegin, ++current) {
- current->second = *valuesBegin;
- }
-
- // if there were more nodes than we need to insert then erase remaining ones
+ current->second = *valuesBegin;
+ }
+
+ // if there were more nodes than we need to insert then erase remaining ones
for (; current != oldRange.second; erase(current++)) {
- }
-
- // if there were less nodes than we need to insert then emplace the rest of the range
+ }
+
+ // if there were less nodes than we need to insert then emplace the rest of the range
if (valuesBegin != valuesEnd) {
const TString keyStr = TString(key);
for (; valuesBegin != valuesEnd; ++valuesBegin) {
emplace_hint(oldRange.second, keyStr, TString(*valuesBegin));
}
- }
-}
+ }
+}
/** TQuickCgiParam is a faster non-editable version of TCgiParameters.
* Care should be taken when replacing: