MoSync 3.3
MAUtil::DownloadListener Class Reference

A listener for events from the Downloader class. More...

#include <MAUtil/Downloader.h>

Inheritance diagram for MAUtil::DownloadListener:
MAP::MapSource MAP::CloudMadeMapSource MAP::GoogleMapSource MAP::OpenStreetMapSource

List of all members.

Public Member Functions

virtual void notifyProgress (Downloader *downloader, int downloadedBytes, int totalBytes)
virtual bool outOfMemory (Downloader *downloader)
virtual void finishedDownloading (Downloader *downloader, MAHandle data)=0
virtual void downloadCancelled (Downloader *downloader)=0
virtual void error (Downloader *downloader, int code)=0

Detailed Description

A listener for events from the Downloader class.


Member Function Documentation

virtual void MAUtil::DownloadListener::notifyProgress ( Downloader downloader,
int  downloadedBytes,
int  totalBytes 
) [virtual]

Called when some data has been downloaded to notify about the progress of the download.

Parameters:
downloaderA pointer to the downloader sending this event.
downloadedBytesThe amount of bytes downloaded.
totalBytesThe amount of bytes to be downloaded. Zero means that the total content length is unknown.
virtual bool MAUtil::DownloadListener::outOfMemory ( Downloader downloader) [virtual]

Called if the Downloader runs out of memory. Try to free some resource memory. If you managed to free some, return true to make the Downloader try again. If you can't free any more, return false to make the Downloader fail with CONNERR_DOWNLOADER_OOM. The default implementation does nothing and returns false. Note: This feature is not yet implemented, outOfMemory() is never called by download framework.

virtual void MAUtil::DownloadListener::finishedDownloading ( Downloader downloader,
MAHandle  data 
) [pure virtual]

Called when all data has been downloaded.

Parameters:
downloaderA pointer to the downloader sending this event.
dataMAHandle to the binary data resource with the downloaded data. It is the responsibility of the application to free the data handle once it is not needed (use maDestroyObject() for this). In case a handle was supplied to beginDownloading() the data parameter will refer to that handle.

Implemented in MAP::MapSource.

virtual void MAUtil::DownloadListener::downloadCancelled ( Downloader downloader) [pure virtual]

Called if the download has been cancelled.

Parameters:
downloaderA pointer to the downloader sending this event.

Implemented in MAP::MapSource.

virtual void MAUtil::DownloadListener::error ( Downloader downloader,
int  code 
) [pure virtual]

Called if an error occured.

Parameters:
downloaderA pointer to the downloader sending this event.
codeThe error code describing the error. See CONNERR .

Implemented in MAP::MapSource.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines