#include "cpr/curl_container.h" namespace cpr { template CurlContainer::CurlContainer(const std::initializer_list& containerList) : containerList_(containerList) {} template void CurlContainer::Add(const std::initializer_list& containerList) { for (const T& element : containerList) { containerList_.push_back(std::move(element)); } } template void CurlContainer::Add(const T& element) { containerList_.push_back(std::move(element)); } template <> const std::string CurlContainer::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::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; template class CurlContainer; } // namespace cpr