You.i Engine
YiAssetDownloadHelper.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_ASSET_DOWNLOAD_HELPER_H_
3 #define _YI_ASSET_DOWNLOAD_HELPER_H_
4 
5 #include "asset/YiAsset.h"
6 #include "asset/YiAssetLoader.h"
8 
9 class CYIHTTPRequest;
10 class CYIHTTPResponse;
11 
24 {
25 public:
27  {
30  };
31 
33  {
37  };
38 
44 
48  CYIAssetDownloadHelper(const CYIUrl &url);
49 
50  virtual ~CYIAssetDownloadHelper();
51 
56 
70 
71 protected:
78  virtual void OnRequestCompleted(const std::shared_ptr<CYIHTTPRequest> &pRequest, const std::shared_ptr<CYIHTTPResponse> &pResponse, bool bCachedResponse) override;
79 
83  virtual void OnDecodeComplete(int32_t nJobID, std::shared_ptr<CYIAsset> pAsset, int32_t nLoadStatus, void *pListenerPrivate) override;
84 
88  virtual void CancelDownloadImplementation() override;
89 
90 private:
94 
98  bool IsValidAsset(std::shared_ptr<CYIAsset> pAsset) const;
99 
103  void ConvertDownloadFailedSignals(CYIAbstractDownloadHelper::FAILURE_TYPE, const CYIUrl & /*url*/);
104 
105  int32_t m_nAssetLoaderJobID;
106 
108 };
109 
114 #endif
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:114
Definition: YiAssetDownloadHelper.h:29
Definition: YiAssetDownloadHelper.h:35
The url provided is empty.
Definition: YiAbstractDownloadHelper.h:40
Listener interface for asynchronously decoded asset objects.
Definition: YiAssetLoader.h:50
CYISignal< const CYIUrl & > DownloadComplete
Definition: YiAbstractDownloadHelper.h:103
virtual void OnRequestCompleted(const std::shared_ptr< CYIHTTPRequest > &pRequest, const std::shared_ptr< CYIHTTPResponse > &pResponse, bool bCachedResponse) override
DOWNLOAD_STATE GetDownloadState() const
CYISignal< const CYIUrl & > AssetDownloadCancelled
Definition: YiAssetDownloadHelper.h:69
Contains information required to configure and perform a HTTP request.
Definition: YiHTTPRequest.h:34
Definition: YiAssetDownloadHelper.h:28
virtual void CancelDownloadImplementation() override
Definition: YiAssetDownloadHelper.h:34
FAILURE_TYPE
Definition: YiAbstractDownloadHelper.h:38
virtual void OnDecodeComplete(int32_t nJobID, std::shared_ptr< CYIAsset > pAsset, int32_t nLoadStatus, void *pListenerPrivate) override
An HTTP response class which includes the header and body portions of the response.
Definition: YiHTTPResponse.h:24
virtual ~CYIAssetDownloadHelper()
Definition: YiAbstractDownloadHelper.h:23
The download helper is downloading data.
Definition: YiAbstractDownloadHelper.h:32
A class used to encapsulate an URL.
Definition: YiUrl.h:24
CYISignal< const CYIUrl & > DownloadCancelled
Definition: YiAbstractDownloadHelper.h:99
DOWNLOAD_STATE
Definition: YiAbstractDownloadHelper.h:29
CYISignal< FAILURE_TYPE, const CYIUrl & > DownloadFailed
Definition: YiAbstractDownloadHelper.h:95
A download helper class used for downloading assets off of web servers.
Definition: YiAssetDownloadHelper.h:23
Definition: YiAssetDownloadHelper.h:36
CYISignal< const std::shared_ptr< CYIAsset > &, const CYIUrl & > AssetReady
Definition: YiAssetDownloadHelper.h:60
The download helper is not downloading data.
Definition: YiAbstractDownloadHelper.h:31
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:164
An error occurred while downloading data.
Definition: YiAbstractDownloadHelper.h:41
CYISignal< FAILURE_TYPE, const CYIUrl & > AssetDownloadFailed
Definition: YiAssetDownloadHelper.h:65
FAILURE_TYPE
Definition: YiAssetDownloadHelper.h:32