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. More... | |
bool | download (std::string &path) |
Download url into path. More... | |
int | last_errorcode () |
Last error code, a CURLE return code. More... | |
std::string | last_error () |
Last Curl error message. More... | |
virtual void | on_chunk (const char *buff, unsigned bytes) |
Called when given bytes has been transferred from remote. More... | |
Protected Member Functions | |
long | get_filesize () |
Try to get remote filesize, return 0 on failure. More... | |
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.
Downloader::Downloader | ( | std::string | url | ) |
Definition at line 44 of file downloader.cpp.
bool Downloader::download | ( | std::ostream * | stream | ) |
Download url into stream, return false on errors.
Definition at line 55 of file downloader.cpp.
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.
|
protected |
Try to get remote filesize, return 0 on failure.
Definition at line 99 of file downloader.cpp.
std::string Downloader::last_error | ( | ) |
Last Curl error message.
Definition at line 49 of file downloader.cpp.
int Downloader::last_errorcode | ( | ) |
Last error code, a CURLE return code.
Definition at line 47 of file downloader.cpp.
|
virtual |
Called when given bytes has been transferred from remote.
Reimplemented in GuiDownloader.
Definition at line 51 of file downloader.cpp.
|
protected |
Definition at line 62 of file downloader.h.
|
protected |
Definition at line 63 of file downloader.h.
|
protected |
Definition at line 61 of file downloader.h.
|
protected |
Definition at line 60 of file downloader.h.