3DCoat
3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
|
The class for the asyncronous downloading. Create the object, add items to download and do other job or wait till all downloads will be finished. More...
#include <download.h>
Public Member Functions | |
queue (int max_threads=2, int retry_attempts=20, std::function< bool(size_t, size_t)> progress=nullptr) | |
Construct the download queue. More... | |
void | waitTheFinish () |
Whait till all downloads finish. You can't add new downloads after this command. More... | |
bool | success () |
returns true if all downloads succeed. More... | |
void | add (const std::string &url, const std::string &to, bool unzip, std::function< void()> ready=nullptr, std::function< void(const std::string &)> error=nullptr) |
Add the item to be downloaded. More... | |
size_t | getProgress () |
returns the overall progress More... | |
std::pair< size_t, size_t > | getDownloadedSize () |
returns the downloaded size and the total size to be downloaded as the pair More... | |
The class for the asyncronous downloading. Create the object, add items to download and do other job or wait till all downloads will be finished.
downloader::queue::queue | ( | int | max_threads = 2 , |
int | retry_attempts = 20 , |
||
std::function< bool(size_t, size_t)> | progress = nullptr |
||
) |
Construct the download queue.
max_threads | maximum dowloading threads |
retry_attempts | retry attempts count |
progress | the callback to follow the progress, called with (downloaded, size_to+download) |
void downloader::queue::add | ( | const std::string & | url, |
const std::string & | to, | ||
bool | unzip, | ||
std::function< void()> | ready = nullptr , |
||
std::function< void(const std::string &)> | error = nullptr |
||
) |
Add the item to be downloaded.
url | the URL to download |
to | the filename for the downloaded file |
unzip | need unzip after the downloading? |
ready | the ready callback |
error | the errors callback, called with the error message. |
References zpp::reader::extractFirstToFile(), and success().
std::pair< size_t, size_t > downloader::queue::getDownloadedSize | ( | ) |
returns the downloaded size and the total size to be downloaded as the pair
size_t downloader::queue::getProgress | ( | ) |
returns the overall progress
bool downloader::queue::success | ( | ) |
returns true if all downloads succeed.
Referenced by add().
void downloader::queue::waitTheFinish | ( | ) |
Whait till all downloads finish. You can't add new downloads after this command.