ScummVM API documentation
Cloud::OneDrive::OneDriveStorage Class Reference
Inheritance diagram for Cloud::OneDrive::OneDriveStorage:
Cloud::BaseStorage Cloud::Storage

Public Member Functions

 OneDriveStorage (const Common::String &code, Networking::ErrorCallback cb)
 
 OneDriveStorage (const Networking::JsonResponse &codeFlowJson, Networking::ErrorCallback cb)
 
void saveConfig (const Common::String &keyPrefix) override
 
Common::String name () const override
 
Networking::RequestlistDirectory (const Common::String &path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false) override
 
Networking::Requestupload (const Common::String &path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) override
 
Networking::RequeststreamFileById (const Common::String &path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback) override
 
Networking::RequestcreateDirectory (const Common::String &path, BoolCallback callback, Networking::ErrorCallback errorCallback) override
 
Networking::Requestinfo (StorageInfoCallback callback, Networking::ErrorCallback errorCallback) override
 
Common::String savesDirectoryPath () override
 
Common::String accessToken () const
 
- Public Member Functions inherited from Cloud::BaseStorage
 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
bool isEnabled () const
 
void enable ()
 
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::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 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 ()
 

Static Public Member Functions

static OneDriveStorageloadFromConfig (const Common::String &keyPrefix)
 
static void removeFromConfig (const Common::String &keyPrefix)
 

Protected Member Functions

Common::String cloudProvider () override
 
uint32 storageIndex () override
 
bool needsRefreshToken () override
 
bool canReuseRefreshToken () override
 
- Protected Member Functions inherited from Cloud::BaseStorage
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)
 
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)
 

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
 
- Static Protected Member Functions inherited from Cloud::BaseStorage
static bool loadIsEnabledFlag (const Common::String &keyPrefix)
 
static void removeIsEnabledFlag (const Common::String &keyPrefix)
 
- Protected Attributes inherited from Cloud::BaseStorage
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
 

Constructor & Destructor Documentation

◆ OneDriveStorage() [1/2]

Cloud::OneDrive::OneDriveStorage::OneDriveStorage ( const Common::String code,
Networking::ErrorCallback  cb 
)

This constructor uses OAuth code flow to get tokens.

◆ OneDriveStorage() [2/2]

Cloud::OneDrive::OneDriveStorage::OneDriveStorage ( const Networking::JsonResponse codeFlowJson,
Networking::ErrorCallback  cb 
)

This constructor extracts tokens from JSON acquired via OAuth code flow.

Member Function Documentation

◆ cloudProvider()

Common::String Cloud::OneDrive::OneDriveStorage::cloudProvider ( )
overrideprotectedvirtual
Returns
"onedrive"

Implements Cloud::BaseStorage.

◆ storageIndex()

uint32 Cloud::OneDrive::OneDriveStorage::storageIndex ( )
overrideprotectedvirtual
Returns
kStorageOneDriveId

Implements Cloud::BaseStorage.

◆ needsRefreshToken()

bool Cloud::OneDrive::OneDriveStorage::needsRefreshToken ( )
overrideprotectedvirtual

Return whether storage needs refresh_token to work.

Implements Cloud::BaseStorage.

◆ canReuseRefreshToken()

bool Cloud::OneDrive::OneDriveStorage::canReuseRefreshToken ( )
overrideprotectedvirtual

Return whether to expect new refresh_token on refresh.

Implements Cloud::BaseStorage.

◆ saveConfig()

void Cloud::OneDrive::OneDriveStorage::saveConfig ( const Common::String keyPrefix)
overridevirtual

Storage methods, which are used by CloudManager to save storage in configuration file. Save storage data using ConfMan.

Parameters
keyPrefixall saved keys must start with this prefix.
Note
every Storage must write keyPrefix + "type" key with common value (e.g. "Dropbox").

Implements Cloud::Storage.

◆ name()

Common::String Cloud::OneDrive::OneDriveStorage::name ( ) const
overridevirtual

Return unique storage name.

Returns
some unique storage name (for example, "Dropbox (user@example.com)")

Implements Cloud::Storage.

◆ listDirectory()

Networking::Request* Cloud::OneDrive::OneDriveStorage::listDirectory ( const Common::String path,
ListDirectoryCallback  callback,
Networking::ErrorCallback  errorCallback,
bool  recursive = false 
)
overridevirtual

Public Cloud API comes down there. Returns ListDirectoryStatus struct with list of files.

Implements Cloud::Storage.

◆ upload()

Networking::Request* Cloud::OneDrive::OneDriveStorage::upload ( const Common::String path,
Common::SeekableReadStream contents,
UploadCallback  callback,
Networking::ErrorCallback  errorCallback 
)
overridevirtual

Returns UploadStatus struct with info about uploaded file.

Implements Cloud::Storage.

◆ streamFileById()

Networking::Request* Cloud::OneDrive::OneDriveStorage::streamFileById ( const Common::String path,
Networking::NetworkReadStreamCallback  callback,
Networking::ErrorCallback  errorCallback 
)
overridevirtual

Returns pointer to Networking::NetworkReadStream.

Implements Cloud::Storage.

◆ createDirectory()

Networking::Request* Cloud::OneDrive::OneDriveStorage::createDirectory ( const Common::String path,
BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
)
overridevirtual

Calls the callback when finished.

Implements Cloud::Storage.

◆ info()

Networking::Request* Cloud::OneDrive::OneDriveStorage::info ( StorageInfoCallback  callback,
Networking::ErrorCallback  errorCallback 
)
overridevirtual

Returns the StorageInfo struct.

Implements Cloud::Storage.

◆ savesDirectoryPath()

Common::String Cloud::OneDrive::OneDriveStorage::savesDirectoryPath ( )
overridevirtual

Returns storage's saves directory path with the trailing slash.

Implements Cloud::Storage.

◆ loadFromConfig()

static OneDriveStorage* Cloud::OneDrive::OneDriveStorage::loadFromConfig ( const Common::String keyPrefix)
static

Load token and user id from configs and return OneDriveStorage for those.

Returns
pointer to the newly created OneDriveStorage or 0 if some problem occurred.

◆ removeFromConfig()

static void Cloud::OneDrive::OneDriveStorage::removeFromConfig ( const Common::String keyPrefix)
static

Remove all OneDriveStorage-related data from config.


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