mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-18 16:43:57 +08:00
Renamed replaceOrPut
to putOrReplace
.
This commit is contained in:
parent
8e9dafb9ad
commit
06a690d73e
@ -186,7 +186,7 @@ public:
|
||||
* @param value
|
||||
* @return - true if an entry was replaced, false if entry was only inserted.
|
||||
*/
|
||||
bool replaceOrPut(const Key& key, const StringKeyLabel& value) {
|
||||
bool putOrReplace(const Key& key, const StringKeyLabel& value) {
|
||||
|
||||
std::lock_guard<concurrency::SpinLock> lock(m_lock);
|
||||
|
||||
@ -202,12 +202,12 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases all occurrences of key and replaces them with a new entry. Not thread-safe.
|
||||
* @param key
|
||||
* @param value
|
||||
* @return - `true` if an entry was replaced, `false` if entry was only inserted.
|
||||
*/
|
||||
bool replaceOrPut_LockFree(const Key& key, const StringKeyLabel& value) {
|
||||
* Erases all occurrences of key and replaces them with a new entry. Not thread-safe.
|
||||
* @param key
|
||||
* @param value
|
||||
* @return - `true` if an entry was replaced, `false` if entry was only inserted.
|
||||
*/
|
||||
bool putOrReplace_LockFree(const Key& key, const StringKeyLabel& value) {
|
||||
|
||||
bool needsErase = m_map.find(key) != m_map.end();
|
||||
if (needsErase) {
|
||||
|
@ -101,13 +101,13 @@ bool Request::putHeaderIfNotExists(const oatpp::String& key, const oatpp::String
|
||||
return m_headers.putIfNotExists(key, value);
|
||||
}
|
||||
|
||||
bool Request::replaceOrPutHeader(const String &key, const String &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
bool Request::putOrReplaceHeader(const String &key, const String &value) {
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
bool Request::replaceOrPutHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
bool Request::putOrReplaceHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
const data::share::StringKeyLabel &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
void Request::putHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value) {
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
bool putOrReplaceHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
|
||||
/**
|
||||
* Replaces or adds header.
|
||||
@ -168,7 +168,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
bool putOrReplaceHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
|
||||
/**
|
||||
* Add http header.
|
||||
|
@ -66,12 +66,12 @@ bool Response::putHeaderIfNotExists(const oatpp::String& key, const oatpp::Strin
|
||||
return m_headers.putIfNotExists(key, value);
|
||||
}
|
||||
|
||||
bool Response::replaceOrPutHeader(const String &key, const String &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
bool Response::putOrReplaceHeader(const String &key, const String &value) {
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
bool Response::replaceOrPutHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
bool Response::putOrReplaceHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
const data::share::StringKeyLabel &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
void Response::putHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value) {
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
bool putOrReplaceHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
|
||||
/**
|
||||
* Replaces or adds header.
|
||||
@ -130,7 +130,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
bool putOrReplaceHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
|
||||
/**
|
||||
* Add http header.
|
||||
|
@ -68,12 +68,12 @@ bool Request::putHeaderIfNotExists(const oatpp::String& key, const oatpp::String
|
||||
return m_headers.putIfNotExists(key, value);
|
||||
}
|
||||
|
||||
bool Request::replaceOrPutHeader(const String &key, const String &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
bool Request::putOrReplaceHeader(const String &key, const String &value) {
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
bool Request::replaceOrPutHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
bool Request::putOrReplaceHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
const data::share::StringKeyLabel &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
void Request::putHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value) {
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
bool putOrReplaceHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
|
||||
/**
|
||||
* Replaces or adds header.
|
||||
@ -123,7 +123,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
bool putOrReplaceHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
|
||||
/**
|
||||
* Add http header.
|
||||
|
@ -56,13 +56,13 @@ bool Response::putHeaderIfNotExists(const oatpp::String& key, const oatpp::Strin
|
||||
return m_headers.putIfNotExists(key, value);
|
||||
}
|
||||
|
||||
bool Response::replaceOrPutHeader(const String &key, const String &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
bool Response::putOrReplaceHeader(const String &key, const String &value) {
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
bool Response::replaceOrPutHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
bool Response::putOrReplaceHeader_Unsafe(const data::share::StringKeyLabelCI_FAST &key,
|
||||
const data::share::StringKeyLabel &value) {
|
||||
return m_headers.replaceOrPut(key, value);
|
||||
return m_headers.putOrReplace(key, value);
|
||||
}
|
||||
|
||||
void Response::putHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value) {
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
bool putOrReplaceHeader(const oatpp::String& key, const oatpp::String& value);
|
||||
|
||||
/**
|
||||
* Replaces or adds header.
|
||||
@ -118,7 +118,7 @@ public:
|
||||
* @param value - &id:oatpp::String;.
|
||||
* @return - `true` if header was replaces, `false` if header was added.
|
||||
*/
|
||||
bool replaceOrPutHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
bool putOrReplaceHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value);
|
||||
|
||||
/**
|
||||
* Add http header.
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
}
|
||||
ENDPOINT_INTERCEPTOR(interceptor, replacer) {
|
||||
auto response = (this->*intercepted)(request);
|
||||
response->replaceOrPutHeader("to-be-replaced", "replaced_value");
|
||||
response->putOrReplaceHeader("to-be-replaced", "replaced_value");
|
||||
return response;
|
||||
}
|
||||
ENDPOINT_INTERCEPTOR(interceptor, asserter) {
|
||||
|
Loading…
Reference in New Issue
Block a user