BALL::SimpleDownloader Class Reference

#include <BALL/SYSTEM/simpleDownloader.h>

List of all members.

Public Member Functions

 SimpleDownloader (const String &url, unsigned int timeout=UINT_MAX)
int downloadToBuffer (std::vector< char > &buffer)
int downloadToFile (const String &path)
void setTimeout (unsigned int timeout)
void setURL (const String &url)
const StringgetURL () const

Private Member Functions

int download_ (SimpleDownloaderHelper::DLThread &thread)

Private Attributes

String url_
unsigned int timeout_

Detailed Description

This class provides an interface for synchronous downloads. It currently relies on QNetworkAccessManager and thus on the existence of a QCoreApplication object. If no global instance is existing a local application object is created. For this reason you must not use this class in any thread but the main thread if you did not create a QCoreApplication object yourself.

Definition at line 29 of file simpleDownloader.h.


Constructor & Destructor Documentation

BALL::SimpleDownloader::SimpleDownloader ( const String url,
unsigned int  timeout = UINT_MAX 
)

Member Function Documentation

int BALL::SimpleDownloader::download_ ( SimpleDownloaderHelper::DLThread thread  )  [private]
int BALL::SimpleDownloader::downloadToBuffer ( std::vector< char > &  buffer  ) 

If the content of the download should be kept in memory you can use this function that stores the received bytes in the provides vector. Any previous content is overwritten.

Parameters:
buffer The buffer vector to use.
Returns:
Non-zero if an error occurred while downloading
int BALL::SimpleDownloader::downloadToFile ( const String path  ) 

Download the url and store the contents to a file.

Parameters:
path The path to the file the content is stored in.
Returns:
Non-zero if an error occurred while downloading
const String& BALL::SimpleDownloader::getURL (  )  const

Returns the current URL.

Returns:
The currently set URL
void BALL::SimpleDownloader::setTimeout ( unsigned int  timeout  ) 

Sets the maximum amount of time a download my take. The time is specified in milliseconds.

Parameters:
timeout The time in milliseconds.
void BALL::SimpleDownloader::setURL ( const String url  ) 

Sets the url of the download.

Parameters:
url The URL to download

Member Data Documentation

unsigned int BALL::SimpleDownloader::timeout_ [private]

Definition at line 84 of file simpleDownloader.h.

Definition at line 83 of file simpleDownloader.h.

Generated by  doxygen 1.6.3