33 #include <curl/curl.h> 43 CURL *handle =
nullptr;
52 :handle(curl_easy_init())
54 if (handle ==
nullptr)
55 throw std::runtime_error(
"curl_easy_init() failed");
66 if (handle !=
nullptr)
67 curl_easy_cleanup(handle);
70 operator bool()
const {
71 return handle !=
nullptr;
75 std::swap(handle, src.handle);
85 CURLcode code = curl_easy_setopt(handle, option, value);
87 throw std::runtime_error(curl_easy_strerror(code));
An OO wrapper for a "CURL*" (a libCURL "easy" handle).
void SetOption(CURLoption option, T value)
CurlEasy()
Allocate a new CURL*.
CurlEasy & operator=(CurlEasy &&src)
CurlEasy(std::nullptr_t)
Create an empty instance.