StUrl Class Reference

StUrl enables to download files. More...

#include <sturl.h>

Inheritance diagram for StUrl:

StThread List of all members.

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

Detailed Description

StUrl enables to download files.

It allows you to download file from remote url or local path and set the low speed and connection timeout.


Constructor & Destructor Documentation

StUrl::StUrl (  )  [inline]

StUrl::StUrl ( const StUrl url  ) 

StUrl::~StUrl (  )  [inline]


Member Function Documentation

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]

Returns:
CURLcode that curl_easy_perform() returns

StFile StUrl::getLocalFile (  )  [inline]

Returns:
Stfile from given local path.

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]


Member Data Documentation

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]


The documentation for this class was generated from the following files:
Generated on Tue Nov 14 21:15:10 2006 for Smart Tools Library by  doxygen 1.4.7