duncan
Mom and Dad were wrong!
Public Member Functions
dl::Downloader Class Reference

#include <downloader.h>

Collaboration diagram for dl::Downloader:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

Use libcurl to download files from a server.

Author:
Harry Slatyer
Malcolm Gill

see LICENSE


Constructor & Destructor Documentation

Downloader::Downloader ( dl::DownloadListener l = 0)

Initialise the object by setting the progress callback function.

Parameters:
lpointer to a listener object

Member Function Documentation

void Downloader::abort_download ( )

Abort the current download.

double Downloader::dlcur ( )

Get the number of bytes currently downloaded.

Returns:
number of bytes currently downloaded
double Downloader::dlsize ( )

Get the total size of the file being downloaded.

Returns:
size (in bytes) of file
bool Downloader::downloading ( )

Get the value of downloading_.

Returns:
whether a file is currently 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).

Parameters:
dltottotal size (in bytes) of file being downloaded
dlnowcurrent number of bytes downloaded
void Downloader::set_listener ( dl::DownloadListener l)

Set the listener.

Parameters:
lpointer to a listener object
void Downloader::set_url ( const std::string &  url)

Set the base URL from which to download.

Parameters:
urlURL 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.

Parameters:
namename of file to download
filenamefile to which data will be written
bool Downloader::update ( )

Update the current download.

Returns:
whether or not the file is still downloading

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations