OpenCPN Partial API docs
|
Handle downloading of files from remote urls. More...
#include <downloader.h>
Public Member Functions | |
Downloader (std::string url) | |
bool | download (std::ostream *stream) |
Download url into stream, return false on errors. | |
bool | download (std::string &path) |
Download url into path. More... | |
int | last_errorcode () |
Last error code, a CURLE return code. | |
std::string | last_error () |
Last Curl error message. | |
virtual void | on_chunk (const char *buff, unsigned bytes) |
Called when given bytes has been transferred from remote. | |
Protected Member Functions | |
long | get_filesize () |
Try to get remote filesize, return 0 on failure. | |
Protected Attributes | |
std::string | url |
std::ostream * | stream |
std::string | error_msg |
int | errorcode |
Handle downloading of files from remote urls.
Default downloader, usable in a CLI context.
Definition at line 34 of file downloader.h.
bool Downloader::download | ( | std::string & | path | ) |
Download url into path.
If path is empty, set it to a temporary filename used. Return false on errors.
Definition at line 83 of file downloader.cpp.