diff options
author | Alexander Tkachev | 2016-05-30 18:13:31 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | aa987e5c52899bfafff4f1f84479a67761569109 (patch) | |
tree | 468f076020836c51647b7708558832193cffceab /backends/cloud/storage.h | |
parent | a19fc52c329fdb0611eee7aedfb20fb0d1b9269c (diff) | |
download | scummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.tar.gz scummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.tar.bz2 scummvm-rg350-aa987e5c52899bfafff4f1f84479a67761569109.zip |
CLOUD: Add ListDirectoryStatus struct
It contains flags to indicate whether Request was interrupted or failed,
so dependent Requests may see that list is incomplete.
Diffstat (limited to 'backends/cloud/storage.h')
-rw-r--r-- | backends/cloud/storage.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/backends/cloud/storage.h b/backends/cloud/storage.h index 1749881a7d..311b3fdc9f 100644 --- a/backends/cloud/storage.h +++ b/backends/cloud/storage.h @@ -54,17 +54,39 @@ struct UploadStatus { interrupted(interrupt), failed(failure), file(f), response(resp), httpResponseCode(code) {} }; +/** Struct to represent upload() resulting status. */ +struct ListDirectoryStatus { + /** true if Request was interrupted (finished by user with finish()) */ + bool interrupted; + /** true if Request has failed (bad server response or some other error occurred) */ + bool failed; + /** Contains listed files (might be incomplete if failed or interrupted) */ + Common::Array<StorageFile> &files; + /** Server's original response (empty if not failed) */ + Common::String response; + /** Server's HTTP response code. */ + long httpResponseCode; + + ListDirectoryStatus(Common::Array<StorageFile> &f) : + interrupted(false), failed(false), files(f), response(), httpResponseCode(-1) {} + + ListDirectoryStatus(bool interrupt, bool failure, Common::Array<StorageFile> &f, Common::String resp, long code) : + interrupted(interrupt), failed(failure), files(f), response(resp), httpResponseCode(code) {} +}; + class Storage { public: typedef Networking::Response<Common::Array<StorageFile>&> FileArrayResponse; typedef Networking::Response<StorageInfo> StorageInfoResponse; typedef Networking::Response<bool> BoolResponse; typedef Networking::Response<UploadStatus> UploadResponse; + typedef Networking::Response<ListDirectoryStatus> ListDirectoryResponse; typedef Common::BaseCallback<FileArrayResponse> *FileArrayCallback; typedef Common::BaseCallback<StorageInfoResponse> *StorageInfoCallback; typedef Common::BaseCallback<BoolResponse> *BoolCallback; typedef Common::BaseCallback<UploadResponse> *UploadCallback; + typedef Common::BaseCallback<ListDirectoryResponse> *ListDirectoryCallback; Storage() {} virtual ~Storage() {} @@ -90,10 +112,10 @@ public: * a callback, which is called, when request is complete. */ - /** Returns Common::Array<StorageFile>. */ - virtual Networking::Request *listDirectory(Common::String path, FileArrayCallback callback, bool recursive = false) = 0; - - /** Calls the callback when finished. */ + /** Returns ListDirectoryStatus struct with list of files. */ + virtual Networking::Request *listDirectory(Common::String path, ListDirectoryCallback callback, bool recursive = false) = 0; + + /** Returns UploadStatus struct with info about uploaded file. */ virtual Networking::Request *upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback) = 0; virtual Networking::Request *upload(Common::String remotePath, Common::String localPath, UploadCallback callback) = 0; |