mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
59
vendor/CPR/cpr/curl_container.cpp
vendored
Normal file
59
vendor/CPR/cpr/curl_container.cpp
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
#include "cpr/curl_container.h"
|
||||
|
||||
|
||||
namespace cpr {
|
||||
template <class T>
|
||||
CurlContainer<T>::CurlContainer(const std::initializer_list<T>& containerList)
|
||||
: containerList_(containerList) {}
|
||||
|
||||
template <class T>
|
||||
void CurlContainer<T>::Add(const std::initializer_list<T>& containerList) {
|
||||
for (const T& element : containerList) {
|
||||
containerList_.push_back(std::move(element));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void CurlContainer<T>::Add(const T& element) {
|
||||
containerList_.push_back(std::move(element));
|
||||
}
|
||||
|
||||
template <>
|
||||
const std::string CurlContainer<Parameter>::GetContent(const CurlHolder& holder) const {
|
||||
std::string content{};
|
||||
for (const Parameter& parameter : containerList_) {
|
||||
if (!content.empty()) {
|
||||
content += "&";
|
||||
}
|
||||
|
||||
std::string escapedKey = holder.urlEncode(parameter.key);
|
||||
if (parameter.value.empty()) {
|
||||
content += escapedKey;
|
||||
} else {
|
||||
std::string escapedValue = holder.urlEncode(parameter.value);
|
||||
content += escapedKey + "=";
|
||||
content += escapedValue;
|
||||
}
|
||||
};
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
template <>
|
||||
const std::string CurlContainer<Pair>::GetContent(const CurlHolder& holder) const {
|
||||
std::string content{};
|
||||
for (const cpr::Pair& element : containerList_) {
|
||||
if (!content.empty()) {
|
||||
content += "&";
|
||||
}
|
||||
std::string escaped = holder.urlEncode(element.value);
|
||||
content += element.key + "=" + escaped;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
template class CurlContainer<Pair>;
|
||||
template class CurlContainer<Parameter>;
|
||||
|
||||
} // namespace cpr
|
Reference in New Issue
Block a user