A download helper class used for downloading assets off of web servers.
This class can be used to simplify the process of downloading image files or other asset types off of a web server. Before using this helper the CYIHTTPService must be started using CYIHTTPService::Start. This helper will download and save undecoded asset data for later decoding.
This class is primarily used by the CYIRemoteAssetCatalog to download undecoded asset data and store it for later in-memory decoding. Other classes may make use of this helper if they require downloading data and not decoding it.
#include <network/YiRemoteAssetDownloadHelper.h>

Protected Member Functions | |
| virtual void | OnRequestCompleted (const std::shared_ptr< CYIHTTPRequest > &pRequest, const std::shared_ptr< CYIHTTPResponse > &pResponse, bool bCachedResponse) override |
| virtual void | CancelDownloadImplementation () override |
Protected Member Functions inherited from CYIAbstractDownloadHelper | |
| virtual void | OnRequestFailed (const std::shared_ptr< CYIHTTPRequest > &pRequest) |
Additional Inherited Members | |
Public Types inherited from CYIAbstractDownloadHelper | |
| enum | DOWNLOAD_STATE { IDLE = 0, DOWNLOADING } |
| enum | FAILURE_TYPE { INVALID_URL = 0, NETWORK_ERROR } |
Public Attributes inherited from CYIAbstractDownloadHelper | |
| CYISignal< FAILURE_TYPE, const CYIUrl & > | DownloadFailed |
| CYISignal< const CYIUrl & > | DownloadCancelled |
| CYISignal< const CYIUrl & > | DownloadComplete |
Protected Attributes inherited from CYIAbstractDownloadHelper | |
| DOWNLOAD_STATE | m_state |
| CYIUrl | m_url |
| std::shared_ptr< CYIHTTPRequest > | m_pCurrentRequest |
| std::shared_ptr< CYIHTTPResponse > | m_pCurrentResponse |
| CYIRecursiveMutex | m_stateMutex |
| CYIRemoteAssetDownloadHelper::CYIRemoteAssetDownloadHelper | ( | ) |
Constructs a default CYIRemoteAssetDownloadHelper.
| CYIRemoteAssetDownloadHelper::CYIRemoteAssetDownloadHelper | ( | const CYIUrl & | url | ) |
Constructs a CYIRemoteAssetDownloadHelper initialized with an asset url.
|
virtual |
|
overrideprotectedvirtual |
Called when a download is being cancelled. Implementations can assume that m_stateMutex is locked and m_state is DOWNLOADING.
Implements CYIAbstractDownloadHelper.
| void CYIRemoteAssetDownloadHelper::ClearData | ( | ) |
Clears the downloaded data from memory. This may be necessary as the amount of available memory decreases.
| const std::vector<uint8_t>& CYIRemoteAssetDownloadHelper::GetData | ( | ) | const |
Returns the undecoded, downloaded data.
|
overrideprotectedvirtual |
Called when the request has completed. Implementations should call the base class to get and save the downloaded data.
Reimplemented from CYIAbstractDownloadHelper.