#include <download.h>
|
static unsigned long | fadler32 (FILE *file) |
| Calculates the Alder-32 checksum for the given file.
|
|
|
static int | downloadProgress (void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) |
| A libcurl callback for reporting progress.
|
|
static size_t | writeBuffer (char *ptr, size_t size, size_t nmemb, void *stream) |
| A libcurl callback for writing to memory.
|
|
static int | downloadThread (void *ptr) |
|
Definition at line 43 of file download.h.
◆ Download()
Net::Download::Download |
( |
const std::string & |
url | ) |
|
◆ ~Download()
Net::Download::~Download |
( |
| ) |
|
◆ addHeader()
void Net::Download::addHeader |
( |
const char * |
header | ) |
|
◆ cancel()
void Net::Download::cancel |
( |
| ) |
|
Cancels the download.
Returns immediately, the canceled status will be noted in the next available update call.
Definition at line 126 of file download.cpp.
◆ downloadProgress()
int Net::Download::downloadProgress |
( |
void * |
clientp, |
|
|
curl_off_t |
dltotal, |
|
|
curl_off_t |
dlnow, |
|
|
curl_off_t |
ultotal, |
|
|
curl_off_t |
ulnow |
|
) |
| |
|
staticprivate |
A libcurl callback for reporting progress.
Definition at line 141 of file download.cpp.
◆ downloadThread()
int Net::Download::downloadThread |
( |
void * |
ptr | ) |
|
|
staticprivate |
◆ fadler32()
unsigned long Net::Download::fadler32 |
( |
FILE * |
file | ) |
|
|
static |
Calculates the Alder-32 checksum for the given file.
Definition at line 41 of file download.cpp.
◆ getBuffer()
std::string_view Net::Download::getBuffer |
( |
| ) |
const |
Returns a view on the downloaded data.
Definition at line 132 of file download.cpp.
◆ getError()
const char * Net::Download::getError |
( |
| ) |
const |
|
inline |
◆ getState()
◆ noCache()
void Net::Download::noCache |
( |
| ) |
|
Convience method for adding no-cache headers.
Definition at line 84 of file download.cpp.
◆ setFile()
void Net::Download::setFile |
( |
const std::string & |
filename, |
|
|
std::optional< unsigned long > |
adler32 = {} |
|
) |
| |
◆ setUseBuffer()
void Net::Download::setUseBuffer |
( |
| ) |
|
◆ start()
bool Net::Download::start |
( |
| ) |
|
Starts the download thread.
- Returns
- whether the thread could be created
Definition at line 107 of file download.cpp.
◆ writeBuffer()
size_t Net::Download::writeBuffer |
( |
char * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb, |
|
|
void * |
stream |
|
) |
| |
|
staticprivate |
A libcurl callback for writing to memory.
Definition at line 159 of file download.cpp.
◆ mAdler
std::optional<unsigned long> Net::Download::mAdler |
|
private |
◆ mBuffer
char* Net::Download::mBuffer = nullptr |
|
private |
Buffer for files downloaded to memory.
Definition at line 114 of file download.h.
◆ mCancel
bool Net::Download::mCancel = false |
|
private |
◆ mDownloadedBytes
size_t Net::Download::mDownloadedBytes = 0 |
|
private |
Byte count currently downloaded in mMemoryBuffer.
Definition at line 111 of file download.h.
◆ mError
char Net::Download::mError[CURL_ERROR_SIZE] |
|
private |
◆ mFileName
std::string Net::Download::mFileName |
|
private |
◆ mHeaders
curl_slist* Net::Download::mHeaders = nullptr |
|
private |
◆ mMemoryWrite
bool Net::Download::mMemoryWrite = false |
|
private |
◆ mState
◆ mThread
SDL_Thread* Net::Download::mThread = nullptr |
|
private |
◆ mUrl
std::string Net::Download::mUrl |
|
private |
The documentation for this class was generated from the following files: