|
MoSync 3.2.1
|
The ImageDownloader class. Use it to simplify asynchronous downloading of images to image resources. More...
#include <MAUtil/Downloader.h>
The ImageDownloader class. Use it to simplify asynchronous downloading of images to image resources.
| virtual MAUtil::ImageDownloader::~ImageDownloader | ( | ) | [virtual] |
| int MAUtil::ImageDownloader::beginDownloading | ( | const char * | url, |
| MAHandle | placeholder = 0 |
||
| ) | [virtual] |
Reimplemented from MAUtil::Downloader.
| virtual MAHandle MAUtil::ImageDownloader::getHandle | ( | ) | [protected, virtual] |
Return the image handle of the downloader. The caller of this method should fire an error to listeners.
Reimplemented from MAUtil::Downloader.
| virtual void MAUtil::ImageDownloader::closeConnection | ( | int | cleanup | ) | [protected, virtual] |
Close the connection used by the downloader. This is part of the normal finishing of the download, and is also done on errors and on cancelling the download.
| cleanup | if 1 free downloaded resources, if 0 do not do free downloaded resources. Cleanup is done on errors and on cancelling a download. |
Reimplemented from MAUtil::Downloader.
| void MAUtil::Downloader::addDownloadListener | ( | DownloadListener * | dl | ) | [inherited] |
Function to register a DownloadListener, to which all events for this Downloader is distributed.
| dl | Pointer to the DownloadListener instance. |
| void MAUtil::Downloader::removeDownloadListener | ( | DownloadListener * | dl | ) | [inherited] |
Remove a DownloadListener.
| dl | Pointer to the DownloadListener instance. |
| virtual int MAUtil::Downloader::cancelDownloading | ( | ) | [virtual, inherited] |
Function to cancel the current download. Do cleanup and send downloadCancelled to listeners.
| bool MAUtil::Downloader::isDownloading | ( | ) | const [inline, inherited] |
Function to retrieve if the Downloader is currently downloading something.
References MAUtil::Downloader::mIsDownloading.
| MAHandle MAUtil::Downloader::getDataPlaceholder | ( | ) | [protected, inherited] |
Helper method to get the data handle. Used by friend classes.
| void MAUtil::Downloader::fireNotifyProgress | ( | int | dataOffset, |
| int | contentLength | ||
| ) | [protected, inherited] |
Send notifyProgress to listeners.
| void MAUtil::Downloader::fireFinishedDownloading | ( | MAHandle | data | ) | [protected, inherited] |
Close connection and send finishedDownloading to listeners.
| void MAUtil::Downloader::fireError | ( | int | code | ) | [protected, inherited] |
Do cleanup and send error to listeners.
| void MAUtil::Downloader::deleteReader | ( | ) | [protected, inherited] |
Delete the reader object (this is the object that performs the download).
| virtual void MAUtil::Downloader::httpFinished | ( | HttpConnection * | http, |
| int | result | ||
| ) | [protected, virtual, inherited] |
Callback method in HttpConnectionListener.
Implements MAUtil::HttpConnectionListener.
Reimplemented in MAUtil::AudioDownloader.
| void MAUtil::Downloader::connRecvFinished | ( | Connection * | conn, |
| int | result | ||
| ) | [protected, virtual, inherited] |
Callback method.
Reimplemented from MAUtil::ConnectionListener.
| virtual void MAUtil::ConnectionListener::connectFinished | ( | Connection * | conn, |
| int | result | ||
| ) | [virtual, inherited] |
Called when a connect operation finishes.
| conn | The Connection that ran the operation. |
| result | > 0 on success, or a CONNERR code < 0 on failure. |
| virtual void MAUtil::ConnectionListener::connWriteFinished | ( | Connection * | conn, |
| int | result | ||
| ) | [virtual, inherited] |
Called when a write operation finishes.
| conn | The Connection that ran the operation. |
| result | > 0 on success, or a CONNERR code < 0 on failure. |
Reimplemented in Wormhole::HighLevelHttpConnection.
| virtual void MAUtil::ConnectionListener::connReadFinished | ( | Connection * | conn, |
| int | result | ||
| ) | [virtual, inherited] |
Called when a read operation finishes.
| conn | The Connection that ran the operation. |
| result | > 0 on success, or a CONNERR code < 0 on failure. |
Reimplemented in Wormhole::HighLevelHttpConnection.
bool MAUtil::ImageDownloader::mIsImagePlaceholderSystemAllocated [protected] |
bool MAUtil::ImageDownloader::mIsImageCreated [protected] |
MAHandle MAUtil::ImageDownloader::mImagePlaceholder [protected] |
HttpConnection* MAUtil::Downloader::mConn [protected, inherited] |
bool MAUtil::Downloader::mIsDownloading [protected, inherited] |
Referenced by MAUtil::Downloader::isDownloading().
bool MAUtil::Downloader::mIsDataPlaceholderSystemAllocated [protected, inherited] |
MAHandle MAUtil::Downloader::mDataPlaceholder [protected, inherited] |
Vector<DownloadListener*> MAUtil::Downloader::mDownloadListeners [protected, inherited] |
DownloaderReader* MAUtil::Downloader::mReader [protected, inherited] |
Object that performs the actual download. A downloader is configured with different readers depending on the how the server sends the data to the client.