#include <sturl.h>
Inheritance diagram for StUrl:
Public Member Functions | |
StUrl () | |
StUrl (const StUrl &url) | |
~StUrl () | |
bool | download (bool append=false) |
void | setRemoteUrl (const StString &url) |
void | setLocalPath (const StString &path) |
void | setLowSpeedTimeout (long seconds) |
long | getLowSpeedTimeout () const |
void | setConnectionTimeout (long seconds) |
long | getConnectionTimeout () const |
StString | getRemoteUrl () |
StString | getLocalPath () |
StFile | getLocalFile () |
bool | isDownloading () const |
bool | downloadSucceed () const |
bool | hasTimeout () const |
unsigned | getBytesDone () |
unsigned | getBytesTotal () |
CURLcode | getCurlReturnCode () |
Protected Member Functions | |
virtual void | run () |
Private Member Functions | |
void | init () |
Static Private Member Functions | |
static size_t | writeData (void *buffer, size_t size, size_t count, void *stFilePointer) |
static int | setProgress (StUrl *url, double t, double d, double, double) |
Private Attributes | |
CURL * | cHandle |
StString | remote |
StString | local |
StFile | file |
volatile bool | succeed |
volatile bool | timeout |
CURLcode | returnCode |
long | lowSpeedTimeout |
long | connectionTimeout |
unsigned | bytesDone |
unsigned | bytesTotal |
unsigned | bytesStartSize |
It allows you to download file from remote url or local path and set the low speed and connection timeout.
StUrl::StUrl | ( | ) | [inline] |
StUrl::StUrl | ( | const StUrl & | url | ) |
StUrl::~StUrl | ( | ) | [inline] |
bool StUrl::download | ( | bool | append = false |
) |
Returns true when download starts
bool StUrl::downloadSucceed | ( | ) | const [inline] |
unsigned StUrl::getBytesDone | ( | ) | [inline] |
unsigned StUrl::getBytesTotal | ( | ) | [inline] |
long StUrl::getConnectionTimeout | ( | ) | const [inline] |
CURLcode StUrl::getCurlReturnCode | ( | ) | [inline] |
StFile StUrl::getLocalFile | ( | ) | [inline] |
StString StUrl::getLocalPath | ( | ) | [inline] |
long StUrl::getLowSpeedTimeout | ( | ) | const [inline] |
StString StUrl::getRemoteUrl | ( | ) | [inline] |
bool StUrl::hasTimeout | ( | ) | const [inline] |
void StUrl::init | ( | ) | [private] |
Reimplemented from StThread.
bool StUrl::isDownloading | ( | ) | const [inline] |
void StUrl::run | ( | ) | [protected, virtual] |
Create new thread and download file.
Implements StThread.
void StUrl::setConnectionTimeout | ( | long | seconds | ) |
void StUrl::setLocalPath | ( | const StString & | path | ) | [inline] |
void StUrl::setLowSpeedTimeout | ( | long | seconds | ) |
int StUrl::setProgress | ( | StUrl * | url, | |
double | t, | |||
double | d, | |||
double | , | |||
double | ||||
) | [static, private] |
void StUrl::setRemoteUrl | ( | const StString & | url | ) | [inline] |
size_t StUrl::writeData | ( | void * | buffer, | |
size_t | size, | |||
size_t | count, | |||
void * | stFilePointer | |||
) | [static, private] |
unsigned StUrl::bytesDone [private] |
unsigned StUrl::bytesStartSize [private] |
unsigned StUrl::bytesTotal [private] |
CURL* StUrl::cHandle [private] |
long StUrl::connectionTimeout [private] |
StFile StUrl::file [private] |
StString StUrl::local [private] |
long StUrl::lowSpeedTimeout [private] |
StString StUrl::remote [private] |
CURLcode StUrl::returnCode [private] |
volatile bool StUrl::succeed [private] |
volatile bool StUrl::timeout [private] |