aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/storagefile.h
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-08 12:34:13 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1 (patch)
tree8d5dcb25bd8fb981b49a07600ce07416152387c8 /backends/cloud/storagefile.h
parentf6e69b62765482d290b7673e97fb7cf6a03fc943 (diff)
downloadscummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.tar.gz
scummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.tar.bz2
scummvm-rg350-7e6a89c141d621b5caf8c66a58ecbcf60b2d52c1.zip
CLOUD: Update GoogleDriveStorage and StorageFile
Because of the Google Drive StorageFile now contains yet another field, `id`. For other storages `id` == `path`, and thus all common Requests (such as SavesSyncRequest, DownloadFolderRequest, etc) must be using id() instead of path(). That way these Requests won't cause id resolving which could be quite slow (when you call it for all files in the folder, for example).
Diffstat (limited to 'backends/cloud/storagefile.h')
-rw-r--r--backends/cloud/storagefile.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/backends/cloud/storagefile.h b/backends/cloud/storagefile.h
index 7503653d6b..1324cafc93 100644
--- a/backends/cloud/storagefile.h
+++ b/backends/cloud/storagefile.h
@@ -31,24 +31,33 @@ namespace Cloud {
* StorageFile represents a file storaged on remote cloud storage.
* It contains basic information about a file, and might be used
* when listing directories or syncing files.
+ *
+ * Some storages (Google Drive, for example) don't have an actual
+ * path notation to address files. Instead, they are using ids.
+ * As resolving id by path is not a fast operation, it's required
+ * to use ids if they are known, but user-friendly paths are
+ * necessary too, because these are used by Requests.
+ *
+ * If storage supports path notation, id would actually contain path.
*/
class StorageFile {
- Common::String _path, _name;
+ Common::String _id, _path, _name;
uint32 _size, _timestamp;
bool _isDirectory;
public:
StorageFile(); //invalid empty file
StorageFile(Common::String pth, uint32 sz, uint32 ts, bool dir);
+ StorageFile(Common::String id, Common::String path, Common::String name, uint32 sz, uint32 ts, bool dir);
- /** In this constructor <path> is used to storage <id> (in Google Drive, for example) */
- StorageFile(Common::String id, Common::String name, uint32 sz, uint32 ts, bool dir);
-
+ Common::String id() const { return _id; }
Common::String path() const { return _path; }
Common::String name() const { return _name; }
uint32 size() const { return _size; }
uint32 timestamp() const { return _timestamp; }
bool isDirectory() const { return _isDirectory; }
+
+ void setPath(Common::String path) { _path = path; }
};
} // End of namespace Cloud