6 #ifndef LIBPKG_DOWNLOAD
7 #define LIBPKG_DOWNLOAD
12 #include "curl/curl.h"
68 download(
const string& url,
const string& pathname);
89 {
return _error_buffer; }
95 {
return _bytes_done; }
101 {
return _bytes_total; }
129 static CURLM* _cmulti;
133 static unsigned int _cmulti_refcount;
The state in which the download has been successfully completed.
Definition: download.h:35
The state in which the download is in progress.
Definition: download.h:32
static const size_type npos
A null value for use in place of a byte count.
Definition: download.h:26
size_type bytes_done()
Get number of bytes downloaded.
Definition: download.h:94
string message() const
Get libcurl error message.
Definition: download.h:88
~download()
Destroy download action.
Definition: download.cc:78
static void poll_all()
Poll all download operations.
Definition: download.cc:122
int progress_callback(double dltotal, double dlnow)
Handler for CURLOPT_PROGRESSFUNCTION callbacks.
Definition: download.cc:101
download(const string &url, const string &pathname)
Construct download action.
Definition: download.cc:44
unsigned long long size_type
A type for representing byte counts.
Definition: download.h:23
void message_callback(CURLMsg *msg)
Handler for Curl messages.
Definition: download.cc:109
size_t write_callback(char *buffer, size_t size, size_t nitems)
Handler for CURLOPT_WRITEFUNCTION callbacks.
Definition: download.cc:95
state_type state() const
Get current state of the download.
Definition: download.h:76
CURLcode result() const
Get libcurl result code.
Definition: download.h:82
A class for downloading a file from a URL.
Definition: download.h:19
state_type
Definition: download.h:29
The state in which the download has failed.
Definition: download.h:37
size_type bytes_total()
Get total number of bytes to download.
Definition: download.h:100