|
OpenCPN Partial API docs
|
Default downloader, usable in a CLI context. More...
#include "model/downloader.h"
Public Member Functions | |
| Downloader (std::string url) | |
| virtual | ~Downloader ()=default |
| Destroy the Downloader object. | |
| bool | download (std::ostream *stream) |
| Download url into stream, return false on errors. | |
| bool | download (std::string &path) |
| Download url into path. | |
| 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 |
Default downloader, usable in a CLI context.
Definition at line 35 of file downloader.h.
|
explicit |
Definition at line 55 of file downloader.cpp.
| bool Downloader::download | ( | std::ostream * | stream | ) |
Download url into stream, return false on errors.
Definition at line 66 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 94 of file downloader.cpp.
|
protected |
Try to get remote filesize, return 0 on failure.
Definition at line 110 of file downloader.cpp.
| std::string Downloader::last_error | ( | ) |
Last Curl error message.
Definition at line 60 of file downloader.cpp.
| int Downloader::last_errorcode | ( | ) |
Last error code, a CURLE return code.
Definition at line 58 of file downloader.cpp.
|
virtual |
Called when given bytes has been transferred from remote.
Reimplemented in GuiDownloader.
Definition at line 62 of file downloader.cpp.
|
protected |
Definition at line 68 of file downloader.h.
|
protected |
Definition at line 69 of file downloader.h.
|
protected |
Definition at line 67 of file downloader.h.
|
protected |
Definition at line 66 of file downloader.h.