This class can be used to simplify the process of downloading data off of a web server. Before using this helper the CYIHTTPService must be started using CYIHTTPService::Start.
#include <network/YiAbstractDownloadHelper.h>

Public Types | |
| enum | DOWNLOAD_STATE { IDLE = 0, DOWNLOADING } |
| enum | FAILURE_TYPE { INVALID_URL = 0, NETWORK_ERROR } |
Public Attributes | |
| CYISignal< FAILURE_TYPE, const CYIUrl & > | DownloadFailed |
| CYISignal< const CYIUrl & > | DownloadCancelled |
| CYISignal< const CYIUrl & > | DownloadComplete |
Protected Member Functions | |
| virtual void | OnRequestCompleted (const std::shared_ptr< CYIHTTPRequest > &, const std::shared_ptr< CYIHTTPResponse > &, bool) |
| virtual void | OnRequestFailed (const std::shared_ptr< CYIHTTPRequest > &pRequest) |
| virtual void | CancelDownloadImplementation ()=0 |
Protected Attributes | |
| DOWNLOAD_STATE | m_state |
| CYIUrl | m_url |
| std::shared_ptr< CYIHTTPRequest > | m_pCurrentRequest |
| std::shared_ptr< CYIHTTPResponse > | m_pCurrentResponse |
| CYIRecursiveMutex | m_stateMutex |
| CYIAbstractDownloadHelper::CYIAbstractDownloadHelper | ( | ) |
Constructs a default CYIAbstractDownloadHelper.
| CYIAbstractDownloadHelper::CYIAbstractDownloadHelper | ( | const CYIUrl & | url | ) |
Constructs a CYIAbstractDownloadHelper initialized with a url.
|
virtual |
| void CYIAbstractDownloadHelper::CancelDownload | ( | ) |
Cancels the download of the current URL.
|
protectedpure virtual |
Called when a download is being cancelled. Implementations can assume that m_stateMutex is locked and m_state is DOWNLOADING.
Implemented in CYIAssetDownloadHelper, and CYIRemoteAssetDownloadHelper.
| DOWNLOAD_STATE CYIAbstractDownloadHelper::GetDownloadState | ( | ) | const |
Returns the current download state of the helper.
| const CYIUrl& CYIAbstractDownloadHelper::GetUrl | ( | ) | const |
Returns the current URL.
|
protectedvirtual |
Called when the request has completed.
Reimplemented in CYIAssetDownloadHelper, and CYIRemoteAssetDownloadHelper.
|
protectedvirtual |
Called when the download fails. Emits the CYIAbstractDownloadHelper::DownloadFailed signal.
| void CYIAbstractDownloadHelper::SetUrl | ( | const CYIUrl & | url | ) |
Sets the current URL to be used on download.
| void CYIAbstractDownloadHelper::StartDownload | ( | ) |
Starts the download with the current URL.
| void CYIAbstractDownloadHelper::StartDownload | ( | const CYIUrl & | url | ) |
Starts the download with url as the URL.
Signals that the download has been cancelled and provides the URL of the cancelled download.
Signals that the download has completed.
| CYISignal<FAILURE_TYPE, const CYIUrl & > CYIAbstractDownloadHelper::DownloadFailed |
Signals that the download has failed and provides the URL which the download failure occured along with the cause of failure.
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |