1111#include < list>
1212#include < memory>
1313#include < mutex>
14- #include < string_view>
14+ #include " string_view.h "
1515#include < thread>
1616#include < unordered_map>
1717#include < unordered_set>
@@ -61,7 +61,7 @@ class CurlImpl {
6161 public:
6262 ~HeaderWriter ();
6363 curl_slist *release ();
64- void set (std::string_view key, std::string_view value) override ;
64+ void set (StringView key, StringView value) override ;
6565 };
6666
6767 class HeaderReader : public DictReader {
@@ -71,9 +71,9 @@ class CurlImpl {
7171 public:
7272 explicit HeaderReader (
7373 std::unordered_map<std::string, std::string> *response_headers_lower);
74- std::optional<std::string_view > lookup (std::string_view key) const override ;
74+ std::optional<StringView > lookup (StringView key) const override ;
7575 void visit (
76- const std::function<void (std::string_view key, std::string_view value)>
76+ const std::function<void (StringView key, StringView value)>
7777 &visitor) const override ;
7878 };
7979
@@ -88,7 +88,7 @@ class CurlImpl {
8888 void *user_data);
8989 static bool is_non_whitespace (unsigned char );
9090 static char to_lower (unsigned char );
91- static std::string_view trim (std::string_view );
91+ static StringView trim (StringView );
9292
9393 public:
9494 explicit CurlImpl (const std::shared_ptr<Logger> &logger);
@@ -426,7 +426,7 @@ curl_slist *CurlImpl::HeaderWriter::release() {
426426 return list;
427427}
428428
429- void CurlImpl::HeaderWriter::set (std::string_view key, std::string_view value) {
429+ void CurlImpl::HeaderWriter::set (StringView key, StringView value) {
430430 buffer_.clear ();
431431 buffer_ += key;
432432 buffer_ += " : " ;
@@ -439,8 +439,8 @@ CurlImpl::HeaderReader::HeaderReader(
439439 std::unordered_map<std::string, std::string> *response_headers_lower)
440440 : response_headers_lower_(response_headers_lower) {}
441441
442- std::optional<std::string_view > CurlImpl::HeaderReader::lookup (
443- std::string_view key) const {
442+ std::optional<StringView > CurlImpl::HeaderReader::lookup (
443+ StringView key) const {
444444 buffer_.clear ();
445445 std::transform (key.begin (), key.end (), std::back_inserter (buffer_),
446446 &to_lower);
@@ -453,7 +453,7 @@ std::optional<std::string_view> CurlImpl::HeaderReader::lookup(
453453}
454454
455455void CurlImpl::HeaderReader::visit (
456- const std::function<void (std::string_view key, std::string_view value)>
456+ const std::function<void (StringView key, StringView value)>
457457 &visitor) const {
458458 for (const auto &[key, value] : *response_headers_lower_) {
459459 visitor (key, value);
0 commit comments