duncan
Mom and Dad were wrong!
|
#include <downloader.h>
Public Member Functions | |
Downloader (dl::DownloadListener *l=0) | |
void | set_listener (dl::DownloadListener *) |
void | set_url (const std::string &) |
void | start_download (const std::string &, const std::string &) |
void | abort_download () |
bool | downloading () |
double | dlsize () |
double | dlcur () |
bool | update () |
double | progress_callback (double, double, double, double) |
Use libcurl to download files from a server.
see LICENSE
Downloader::Downloader | ( | dl::DownloadListener * | l = 0 | ) |
Initialise the object by setting the progress callback function.
l | pointer to a listener object |
void Downloader::abort_download | ( | ) |
Abort the current download.
double Downloader::dlcur | ( | ) |
Get the number of bytes currently downloaded.
double Downloader::dlsize | ( | ) |
Get the total size of the file being downloaded.
bool Downloader::downloading | ( | ) |
Get the value of downloading_.
double Downloader::progress_callback | ( | double | dltot, |
double | dlnow, | ||
double | , | ||
double | |||
) |
Progress has been made on the current download, so tell the listener (if it exists).
dltot | total size (in bytes) of file being downloaded |
dlnow | current number of bytes downloaded |
void Downloader::set_listener | ( | dl::DownloadListener * | l | ) |
Set the listener.
l | pointer to a listener object |
void Downloader::set_url | ( | const std::string & | url | ) |
Set the base URL from which to download.
url | URL from which to download |
void Downloader::start_download | ( | const std::string & | name, |
const std::string & | filename | ||
) |
Start downloading a particular file, and write the data to a file.
name | name of file to download |
filename | file to which data will be written |
bool Downloader::update | ( | ) |
Update the current download.