#include <Downloader.h>
Classes | |
struct | DownloadUnit |
struct | Error |
struct | FileDescriptor |
struct | ProgressData |
struct | StreamData |
Public Types | |
enum | ErrorCode { CREATE_FILE, NETWORK, NO_NEW_VERSION, UNCOMPRESS, CURL_UNINIT, CURL_MULTI_ERROR, CURL_EASY_ERROR, INVALID_URL, INVALID_STORAGE_PATH } |
typedef std::unordered_map < std::string, DownloadUnit > | DownloadUnits |
typedef std::function< void(const Downloader::Error &)> | ErrorCallback |
typedef std::function< void(double, double, const std::string &, const std::string &)> | ProgressCallback |
typedef std::function< void(const std::string &, const std::string &, const std::string &)> | SuccessCallback |
Public Member Functions | |
int | getConnectionTimeout () |
void | setConnectionTimeout (int timeout) |
void | setErrorCallback (const ErrorCallback &callback) |
var | setErrorCallback ( var callback) |
local | setErrorCallback ( local callback) |
void | setProgressCallback (const ProgressCallback &callback) |
void | setSuccessCallback (const SuccessCallback &callback) |
ErrorCallback | getErrorCallback () const |
ProgressCallback | getProgressCallback () const |
var | getProgressCallback () |
SuccessCallback | getSuccessCallback () const |
var | getSuccessCallback () |
local | getSuccessCallback () |
long | getContentSize (const std::string &srcUrl) const |
void | downloadToBufferAsync (const std::string &srcUrl, unsigned char *buffer, const long &size, const std::string &customId="") |
void | downloadToBufferSync (const std::string &srcUrl, unsigned char *buffer, const long &size, const std::string &customId="") |
var | downloadToBufferSync ( var srcUrl, var buffer, var size) |
local | downloadToBufferSync ( local srcUrl, local buffer, local size) |
void | downloadAsync (const std::string &srcUrl, const std::string &storagePath, const std::string &customId="") |
void | downloadSync (const std::string &srcUrl, const std::string &storagePath, const std::string &customId="") |
void | batchDownloadAsync (const DownloadUnits &units, const std::string &batchId="") |
void | batchDownloadSync (const DownloadUnits &units, const std::string &batchId="") |
Downloader () | |
The default constructor. More... | |
~Downloader () |
Protected Member Functions | |
void | prepareDownload (const std::string &srcUrl, const std::string &storagePath, const std::string &customId, bool resumeDownload, FileDescriptor *fDesc, ProgressData *pData) |
bool | prepareHeader (void *curl, const std::string &srcUrl) const |
var | prepareHeader ( var curl, var srcUrl) |
local | prepareHeader ( local curl, local srcUrl) |
void | downloadToBuffer (const std::string &srcUrl, const std::string &customId, const StreamData &buffer, const ProgressData &data) |
var | downloadToBuffer ( var srcUrl, var customId, var buffer, var data) |
local | downloadToBuffer ( local srcUrl, local customId, local buffer, local data) |
void | download (const std::string &srcUrl, const std::string &customId, const FileDescriptor &fDesc, const ProgressData &data) |
void | groupBatchDownload (const DownloadUnits &units) |
void | notifyError (ErrorCode code, const std::string &msg="", const std::string &customId="", int curle_code=0, int curlm_code=0) |
var | notifyError ( var code, var 0, var 0) |
local | notifyError ( local code, local 0, local 0) |
void | notifyError (const std::string &msg, int curlm_code, const std::string &customId="") |
void | notifyError (const std::string &msg, const std::string &customId, int curle_code) |
Friends | |
class | AssetsManagerEx |
typedef std::unordered_map <std::string, DownloadUnit> DownloadUnits |
var DownloadUnits |
local DownloadUnits |
typedef std::function<void(const Downloader::Error &)> ErrorCallback |
var ErrorCallback |
local ErrorCallback |
typedef std::function<void(double, double, const std::string &, const std::string &)> ProgressCallback |
var ProgressCallback |
local ProgressCallback |
typedef std::function<void(const std::string &, const std::string &, const std::string &)> SuccessCallback |
var SuccessCallback |
local SuccessCallback |
|
strong |
|
strong |
|
strong |
Downloader | ( | ) |
The default constructor.
var Downloader | ( | ) |
The default constructor.
local Downloader | ( | ) |
The default constructor.
~Downloader | ( | ) |
var ~Downloader | ( | ) |
local ~Downloader | ( | ) |
void batchDownloadAsync | ( | const DownloadUnits & | units, |
const std::string & | batchId = "" |
||
) |
var batchDownloadAsync | ( | var | units, |
var | batchId = "" |
||
) |
local batchDownloadAsync | ( | local | units, |
local | batchId = "" |
||
) |
void batchDownloadSync | ( | const DownloadUnits & | units, |
const std::string & | batchId = "" |
||
) |
var batchDownloadSync | ( | var | units, |
var | batchId = "" |
||
) |
local batchDownloadSync | ( | local | units, |
local | batchId = "" |
||
) |
|
protected |
|
protected |
|
protected |
void downloadAsync | ( | const std::string & | srcUrl, |
const std::string & | storagePath, | ||
const std::string & | customId = "" |
||
) |
var downloadAsync | ( | var | srcUrl, |
var | storagePath, | ||
var | customId = "" |
||
) |
local downloadAsync | ( | local | srcUrl, |
local | storagePath, | ||
local | customId = "" |
||
) |
void downloadSync | ( | const std::string & | srcUrl, |
const std::string & | storagePath, | ||
const std::string & | customId = "" |
||
) |
var downloadSync | ( | var | srcUrl, |
var | storagePath, | ||
var | customId = "" |
||
) |
local downloadSync | ( | local | srcUrl, |
local | storagePath, | ||
local | customId = "" |
||
) |
|
protected |
|
protected |
|
protected |
void downloadToBufferAsync | ( | const std::string & | srcUrl, |
unsigned char * | buffer, | ||
const long & | size, | ||
const std::string & | customId = "" |
||
) |
var downloadToBufferAsync | ( | var | srcUrl, |
var | buffer, | ||
var | size, | ||
var | customId = "" |
||
) |
local downloadToBufferAsync | ( | local | srcUrl, |
local | buffer, | ||
local | size, | ||
local | customId = "" |
||
) |
void downloadToBufferSync | ( | const std::string & | srcUrl, |
unsigned char * | buffer, | ||
const long & | size, | ||
const std::string & | customId = "" |
||
) |
var downloadToBufferSync | ( | var | srcUrl, |
var | buffer, | ||
var | size, | ||
var | customId = "" |
||
) |
local downloadToBufferSync | ( | local | srcUrl, |
local | buffer, | ||
local | size, | ||
local | customId = "" |
||
) |
int getConnectionTimeout | ( | ) |
var getConnectionTimeout | ( | ) |
local getConnectionTimeout | ( | ) |
long getContentSize | ( | const std::string & | srcUrl | ) | const |
var getContentSize | ( | var | srcUrl | ) |
local getContentSize | ( | local | srcUrl | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void setConnectionTimeout | ( | int | timeout | ) |
var setConnectionTimeout | ( | var | timeout | ) |
local setConnectionTimeout | ( | local | timeout | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |