26 #ifndef MYCURL_SLIST_H
27 #define MYCURL_SLIST_H
29 #include "../my_config.h"
35 #include <curl/curl.h>
56 mycurl_slist() { header =
nullptr; };
57 mycurl_slist(
const mycurl_slist & ref): appended(ref.appended) { header = rebuild(appended); };
58 mycurl_slist(mycurl_slist && ref) noexcept: appended(std::move(ref.appended)) { header = ref.header; ref.header =
nullptr; };
59 mycurl_slist & operator = (
const mycurl_slist & ref) { release(header); appended = ref.appended; header = rebuild(appended);
return *
this; };
60 mycurl_slist & operator = (mycurl_slist && ref) noexcept { std::swap(header, ref.header); std::swap(appended, ref.appended);
return *
this; };
61 ~mycurl_slist() { release(header); };
63 bool operator == (
const mycurl_slist & ref)
const;
64 bool operator != (
const mycurl_slist & ref)
const {
return ! (*
this == ref); };
66 void append(
const std::string & s);
67 const curl_slist *get_address()
const {
return header; };
68 void clear() { release(header); appended.clear(); };
69 bool empty()
const {
return appended.empty(); };
72 struct curl_slist* header;
73 std::deque<std::string> appended;
75 static curl_slist* rebuild(
const std::deque<std::string> & ap);
76 static void release(curl_slist* & ptr) { curl_slist_free_all(ptr); ptr =
nullptr; }
libdar namespace encapsulate all libdar symbols