MAUtil::AudioDownloader Class Reference

#include <MAUtil/Downloader.h>

Inheritance diagram for MAUtil::AudioDownloader:

MAUtil::Downloader MAUtil::HttpConnectionListener MAUtil::ConnectionListener List of all members.

Detailed Description

The AudioDownloader class. Use it to simplify asynchronous downloading of audio to audio resources.


Public Member Functions

int beginDownloading (const char *url, MAHandle placeholder=0, const char *mimeType=0, bool forceMyMime=false)
virtual int beginDownloading (const char *url, MAHandle placeholder)
void addDownloadListener (DownloadListener *dl)
void removeDownloadListener (DownloadListener *dl)
virtual void cancelDownloading ()
bool isDownloading () const
virtual void connectFinished (Connection *conn, int result) __attribute__((noreturn))
virtual void connWriteFinished (Connection *conn, int result) __attribute__((noreturn))
virtual void connReadFinished (Connection *conn, int result) __attribute__((noreturn))

Protected Member Functions

virtual void httpFinished (HttpConnection *http, int result)
virtual MAHandle getHandle ()
void fireFinishedDownloading (MAHandle data)
void fireError (int code)
void connRecvFinished (Connection *conn, int result)

Protected Attributes

String mMimeType
bool mForce
HttpConnectionmConn
bool mIsDownloading
bool mUserData
MAHandle mData
int mDataOffset
int mContentLength
Vector< DownloadListener * > mDownloadListeners


Member Function Documentation

int MAUtil::AudioDownloader::beginDownloading const char *  url,
MAHandle  placeholder = 0,
const char *  mimeType = 0,
bool  forceMyMime = false
 

Same as Downloader::beginDownloading() with an additional optional parameter to specify mime type of the downloaded file. If neither the server or you provide a mime type, CONNERR_NOHEADER will be thrown. If both the server and you provide a mime type, by default the server's will be picked, but you can force use of your mime type.

virtual int MAUtil::AudioDownloader::beginDownloading const char *  url,
MAHandle  placeholder
[virtual]
 

Function to begin downloading a file.

Parameters:
url C string containing a null terminated url to the file.
placeholder Optional argument to specify a placeholder to use for the binary resource of the downloaded data.
Returns:
>0 on success, or a CONNERR code < 0 on failure.

Reimplemented from MAUtil::Downloader.

virtual void MAUtil::AudioDownloader::httpFinished HttpConnection http,
int  result
[protected, virtual]
 

Called when a finish operation is done.

Parameters:
http The HttpConnection that ran the operation.
result The HTTP response code (eg 200 or 404) on success, or a CONNERR code < 0 on failure.

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.

Parameters:
dl Pointer to the DownloadListener instance.

void MAUtil::Downloader::removeDownloadListener DownloadListener dl  )  [inherited]
 

virtual void MAUtil::Downloader::cancelDownloading  )  [virtual, inherited]
 

Function to cancel the current download.

Reimplemented in MAUtil::ImageDownloader.

bool MAUtil::Downloader::isDownloading  )  const [inline, inherited]
 

Function to retrieve if the Downloader is currently downloading something.

Returns:
a boolean value, if true the function is currently downloading otherwise it isn't.

virtual MAHandle MAUtil::Downloader::getHandle  )  [protected, virtual, inherited]
 

Reimplemented in MAUtil::ImageDownloader.

void MAUtil::Downloader::fireFinishedDownloading MAHandle  data  )  [protected, inherited]
 

void MAUtil::Downloader::fireError int  code  )  [protected, inherited]
 

void MAUtil::Downloader::connRecvFinished Connection conn,
int  result
[protected, virtual, inherited]
 

Called when a recv operation finishes.

Parameters:
conn The Connection that ran the operation.
result The number of bytes read on success, or a CONNERR code < 0 on failure.

Reimplemented from MAUtil::ConnectionListener.

virtual void MAUtil::ConnectionListener::connectFinished Connection conn,
int  result
[virtual, inherited]
 

Called when a connect operation finishes.

Parameters:
conn The Connection that ran the operation.
result The result of the operation. > 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.

virtual void MAUtil::ConnectionListener::connReadFinished Connection conn,
int  result
[virtual, inherited]
 

Called when a read operation finishes.


Member Data Documentation

String MAUtil::AudioDownloader::mMimeType [protected]
 

bool MAUtil::AudioDownloader::mForce [protected]
 

HttpConnection* MAUtil::Downloader::mConn [protected, inherited]
 

bool MAUtil::Downloader::mIsDownloading [protected, inherited]
 

bool MAUtil::Downloader::mUserData [protected, inherited]
 

MAHandle MAUtil::Downloader::mData [protected, inherited]
 

int MAUtil::Downloader::mDataOffset [protected, inherited]
 

int MAUtil::Downloader::mContentLength [protected, inherited]
 

Vector<DownloadListener*> MAUtil::Downloader::mDownloadListeners [protected, inherited]
 


Generated on Sat Feb 13 00:15:39 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO