LibPkg
|
A class for downloading a file from a URL. More...
#include <download.h>
Public Types | |
enum | state_type { state_download, state_done, state_fail } |
typedef unsigned long long | size_type |
A type for representing byte counts. More... | |
Public Member Functions | |
download (const string &url, const string &pathname) | |
Construct download action. More... | |
~download () | |
Destroy download action. More... | |
state_type | state () const |
Get current state of the download. More... | |
CURLcode | result () const |
Get libcurl result code. More... | |
string | message () const |
Get libcurl error message. More... | |
size_type | bytes_done () |
Get number of bytes downloaded. More... | |
size_type | bytes_total () |
Get total number of bytes to download. More... | |
size_t | write_callback (char *buffer, size_t size, size_t nitems) |
Handler for CURLOPT_WRITEFUNCTION callbacks. More... | |
int | progress_callback (double dltotal, double dlnow) |
Handler for CURLOPT_PROGRESSFUNCTION callbacks. More... | |
void | message_callback (CURLMsg *msg) |
Handler for Curl messages. More... | |
Static Public Member Functions | |
static void | poll_all () |
Poll all download operations. More... | |
Static Public Attributes | |
static const size_type | npos =static_cast<size_type>(-1) |
A null value for use in place of a byte count. More... | |
A class for downloading a file from a URL.
typedef unsigned long long pkg::download::size_type |
A type for representing byte counts.
pkg::download::download | ( | const string & | url, |
const string & | pathname | ||
) |
Construct download action.
url | the URL from which to download |
pathname | the pathname to which the file is to be written |
References __riscosify_control.
pkg::download::~download | ( | ) |
Destroy download action.
References __riscosify_control.
|
inline |
|
inline |
Get libcurl result code.
|
inline |
|
inline |
Get number of bytes downloaded.
|
inline |
Get total number of bytes to download.
size_t pkg::download::write_callback | ( | char * | buffer, |
size_t | size, | ||
size_t | nitems | ||
) |
Handler for CURLOPT_WRITEFUNCTION callbacks.
buffer | the data buffer |
size | the size of each data item |
nitems | the number of data items |
int pkg::download::progress_callback | ( | double | dltotal, |
double | dlnow | ||
) |
Handler for CURLOPT_PROGRESSFUNCTION callbacks.
dltotal | the total number of bytes to download, or 0 if not known |
dlnow | the number of bytes downloaded |
References npos, and state_download.
void pkg::download::message_callback | ( | CURLMsg * | msg | ) |
Handler for Curl messages.
msg | the message |
References state_done, and state_fail.
Referenced by poll_all().
|
static |
Poll all download operations.
References __riscosify_control, and message_callback().
A null value for use in place of a byte count.
Referenced by progress_callback().
Reference Manual | LibPkg | Version 0.6.1 (28 Jan 2015) |