#include <Downloader.h>
|
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 |
|
|
int | getConnectionTimeout () |
|
void | setConnectionTimeout (int timeout) |
|
void | setErrorCallback (const ErrorCallback &callback) |
|
void | setProgressCallback (const ProgressCallback &callback) |
|
void | setSuccessCallback (const SuccessCallback &callback) |
|
ErrorCallback | getErrorCallback () const |
|
ProgressCallback | getProgressCallback () const |
|
SuccessCallback | getSuccessCallback () const |
|
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="") |
|
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 () |
|
|
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 |
|
void | downloadToBuffer (const std::string &srcUrl, const std::string &customId, const StreamData &buffer, const ProgressData &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) |
|
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) |
|
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 |
Enumerator |
---|
CREATE_FILE |
|
NETWORK |
|
NO_NEW_VERSION |
|
UNCOMPRESS |
|
CURL_UNINIT |
|
CURL_MULTI_ERROR |
|
CURL_EASY_ERROR |
|
INVALID_URL |
|
INVALID_STORAGE_PATH |
|
void batchDownloadAsync |
( |
const DownloadUnits & |
units, |
|
|
const std::string & |
batchId = "" |
|
) |
| |
void batchDownloadSync |
( |
const DownloadUnits & |
units, |
|
|
const std::string & |
batchId = "" |
|
) |
| |
void download |
( |
const std::string & |
srcUrl, |
|
|
const std::string & |
customId, |
|
|
const FileDescriptor & |
fDesc, |
|
|
const ProgressData & |
data |
|
) |
| |
|
protected |
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 downloadToBuffer |
( |
const std::string & |
srcUrl, |
|
|
const std::string & |
customId, |
|
|
const StreamData & |
buffer, |
|
|
const ProgressData & |
data |
|
) |
| |
|
protected |
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 = "" |
|
) |
| |
int getConnectionTimeout |
( |
| ) |
|
long getContentSize |
( |
const std::string & |
srcUrl | ) |
const |
void notifyError |
( |
ErrorCode |
code, |
|
|
const std::string & |
msg = "" , |
|
|
const std::string & |
customId = "" , |
|
|
int |
curle_code = 0 , |
|
|
int |
curlm_code = 0 |
|
) |
| |
|
protected |
void notifyError |
( |
const std::string & |
msg, |
|
|
int |
curlm_code, |
|
|
const std::string & |
customId = "" |
|
) |
| |
|
protected |
void notifyError |
( |
const std::string & |
msg, |
|
|
const std::string & |
customId, |
|
|
int |
curle_code |
|
) |
| |
|
protected |
void prepareDownload |
( |
const std::string & |
srcUrl, |
|
|
const std::string & |
storagePath, |
|
|
const std::string & |
customId, |
|
|
bool |
resumeDownload, |
|
|
FileDescriptor * |
fDesc, |
|
|
ProgressData * |
pData |
|
) |
| |
|
protected |
bool prepareHeader |
( |
void * |
curl, |
|
|
const std::string & |
srcUrl |
|
) |
| const |
|
protected |
void setConnectionTimeout |
( |
int |
timeout | ) |
|
The documentation for this class was generated from the following file:
- /Users/huihoo/Software/huihoo-code/cocos2d-x/cocos2d-x-3.3/extensions/assets-manager/Downloader.h