ScummVM API documentation
Cloud::BaseStorage Class Referenceabstract
Inheritance diagram for Cloud::BaseStorage:
Cloud::Storage Cloud::Dropbox::DropboxStorage Cloud::Id::IdStorage Cloud::OneDrive::OneDriveStorage Cloud::Box::BoxStorage Cloud::GoogleDrive::GoogleDriveStorage

Public Member Functions

 BaseStorage (const Common::String &token, const Common::String &refreshToken, bool enabled=false)
 
virtual void refreshAccessToken (BoolCallback callback, Networking::ErrorCallback errorCallback=nullptr)
 
- Public Member Functions inherited from Cloud::Storage
virtual void saveConfig (const Common::String &keyPrefix)=0
 
virtual Common::String name () const =0
 
bool isEnabled () const
 
void enable ()
 
virtual Networking::RequestlistDirectory (const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false)=0
 
virtual Networking::Requestupload (const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback)=0
 
virtual Networking::Requestupload (const Common::String &remotePath, const Common::Path &localPath, UploadCallback callback, Networking::ErrorCallback errorCallback)
 
virtual bool uploadStreamSupported ()
 
virtual Networking::RequeststreamFile (const Common::String &path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback)
 
virtual Networking::RequeststreamFileById (const Common::String &id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback)=0
 
virtual Networking::Requestdownload (const Common::String &remotePath, const Common::Path &localPath, BoolCallback callback, Networking::ErrorCallback errorCallback)
 
virtual Networking::RequestdownloadById (const Common::String &remoteId, const Common::Path &localPath, BoolCallback callback, Networking::ErrorCallback errorCallback)
 
virtual Networking::RequestdownloadFolder (const Common::String &remotePath, const Common::Path &localPath, FileArrayCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false)
 
virtual SavesSyncRequestsyncSaves (BoolCallback callback, Networking::ErrorCallback errorCallback)
 
virtual Networking::RequestcreateDirectory (const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback)=0
 
virtual Networking::Requestinfo (StorageInfoCallback callback, Networking::ErrorCallback errorCallback)=0
 
virtual Common::String savesDirectoryPath ()=0
 
virtual bool isWorking ()
 
virtual bool isSyncing ()
 
virtual double getSyncDownloadingProgress ()
 
virtual void getSyncDownloadingInfo (SyncDownloadingInfo &info)
 
virtual double getSyncProgress ()
 
virtual Common::Array< Common::StringgetSyncingFiles ()
 
virtual void cancelSync ()
 
virtual bool startDownload (const Common::String &remotePath, const Common::Path &localPath)
 
virtual void cancelDownload ()
 
virtual void setDownloadTarget (GUI::CommandReceiver *target)
 
virtual bool isDownloading ()
 
virtual double getDownloadingProgress ()
 
virtual uint64 getDownloadBytesNumber ()
 
virtual uint64 getDownloadTotalBytesNumber ()
 
virtual uint64 getDownloadSpeed ()
 
virtual Common::String getDownloadRemoteDirectory ()
 
virtual Common::Path getDownloadLocalDirectory ()
 

Protected Member Functions

virtual void getAccessToken (const Common::String &code, Networking::ErrorCallback callback)
 
virtual void codeFlowComplete (Networking::ErrorCallback callback, const Networking::JsonResponse &response)
 
virtual void codeFlowFailed (Networking::ErrorCallback callback, const Networking::ErrorResponse &error)
 
virtual Common::String cloudProvider ()=0
 
virtual uint32 storageIndex ()=0
 
virtual bool needsRefreshToken ()=0
 
virtual bool canReuseRefreshToken ()=0
 
void saveIsEnabledFlag (const Common::String &keyPrefix) const
 
- Protected Member Functions inherited from Cloud::Storage
virtual Networking::ErrorCallback getErrorPrintingCallback ()
 
virtual void printErrorResponse (const Networking::ErrorResponse &error)
 
virtual Networking::RequestaddRequest (Networking::Request *request)
 
virtual void requestFinishedCallback (Networking::Request *invalidRequestPointer)
 
virtual void savesSyncDefaultCallback (const BoolResponse &response)
 
virtual void savesSyncDefaultErrorCallback (const Networking::ErrorResponse &error)
 
virtual void directoryDownloadedCallback (const FileArrayResponse &response)
 
virtual void directoryDownloadedErrorCallback (const Networking::ErrorResponse &error)
 

Static Protected Member Functions

static bool loadIsEnabledFlag (const Common::String &keyPrefix)
 
static void removeIsEnabledFlag (const Common::String &keyPrefix)
 

Protected Attributes

Common::String _token
 
Common::String _refreshToken
 
- Protected Attributes inherited from Cloud::Storage
uint32 _runningRequestsCount
 
Common::Mutex _runningRequestsMutex
 
SavesSyncRequest_savesSyncRequest
 
bool _syncRestartRequestsed
 
FolderDownloadRequest_downloadFolderRequest
 
bool _isEnabled
 

Additional Inherited Members

- Public Types inherited from Cloud::Storage
typedef Networking::Response< const Common::Array< StorageFile > & > FileArrayResponse
 
typedef Networking::Response< const StorageInfo & > StorageInfoResponse
 
typedef Networking::Response< bool > BoolResponse
 
typedef Networking::Response< const StorageFile & > UploadResponse
 
typedef Networking::Response< const Common::Array< StorageFile > & > ListDirectoryResponse
 
typedef Common::BaseCallback< const FileArrayResponse & > * FileArrayCallback
 
typedef Common::BaseCallback< const StorageInfoResponse & > * StorageInfoCallback
 
typedef Common::BaseCallback< const BoolResponse & > * BoolCallback
 
typedef Common::BaseCallback< const UploadResponse & > * UploadCallback
 
typedef Common::BaseCallback< const ListDirectoryResponse & > * ListDirectoryCallback
 

Member Function Documentation

◆ getAccessToken()

virtual void Cloud::BaseStorage::getAccessToken ( const Common::String code,
Networking::ErrorCallback  callback 
)
protectedvirtual

Gets token from cloud.scummvm.org using given code. Base implementation for storages with common auth procedure.

◆ codeFlowComplete()

virtual void Cloud::BaseStorage::codeFlowComplete ( Networking::ErrorCallback  callback,
const Networking::JsonResponse response 
)
protectedvirtual

Handles JSON response which should contain access token requested with getAccessToken().

◆ codeFlowFailed()

virtual void Cloud::BaseStorage::codeFlowFailed ( Networking::ErrorCallback  callback,
const Networking::ErrorResponse error 
)
protectedvirtual

Handles network errors occurred while getting access token requested with getAccessToken().

◆ cloudProvider()

virtual Common::String Cloud::BaseStorage::cloudProvider ( )
protectedpure virtual

Return cloud provider name, used in cloud.scummvm.org endpoints.

Returns
cloud provider (for example, "dropbox").

Implemented in Cloud::GoogleDrive::GoogleDriveStorage, Cloud::Box::BoxStorage, Cloud::OneDrive::OneDriveStorage, and Cloud::Dropbox::DropboxStorage.

◆ storageIndex()

virtual uint32 Cloud::BaseStorage::storageIndex ( )
protectedpure virtual

Return CloudManager's StorageID for this storage.

Returns
StorageID corresponding to this storage (for example, kStorageDropboxId).

Implemented in Cloud::GoogleDrive::GoogleDriveStorage, Cloud::Box::BoxStorage, Cloud::OneDrive::OneDriveStorage, and Cloud::Dropbox::DropboxStorage.

◆ needsRefreshToken()

virtual bool Cloud::BaseStorage::needsRefreshToken ( )
protectedpure virtual

◆ canReuseRefreshToken()

virtual bool Cloud::BaseStorage::canReuseRefreshToken ( )
protectedpure virtual

Return whether to expect new refresh_token on refresh.

Implemented in Cloud::GoogleDrive::GoogleDriveStorage, Cloud::Box::BoxStorage, Cloud::OneDrive::OneDriveStorage, and Cloud::Dropbox::DropboxStorage.

◆ saveIsEnabledFlag()

void Cloud::BaseStorage::saveIsEnabledFlag ( const Common::String keyPrefix) const
protected

Helper function to save Storage::_isEnabled into config.

◆ loadIsEnabledFlag()

static bool Cloud::BaseStorage::loadIsEnabledFlag ( const Common::String keyPrefix)
staticprotected

Helper function to load Storage::_isEnabled value from config.

◆ removeIsEnabledFlag()

static void Cloud::BaseStorage::removeIsEnabledFlag ( const Common::String keyPrefix)
staticprotected

Helper function to remove Storage::_isEnabled from config.

◆ refreshAccessToken()

virtual void Cloud::BaseStorage::refreshAccessToken ( BoolCallback  callback,
Networking::ErrorCallback  errorCallback = nullptr 
)
virtual

Gets new access_token. Pass a callback, so you could continue your work when new token is available.

Member Data Documentation

◆ _token

Common::String Cloud::BaseStorage::_token
protected

Storage's access and refresh tokens.


The documentation for this class was generated from the following file: