ScummVM API documentation
basestorage.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef BACKENDS_CLOUD_BASE_STORAGE_H
23
#define BACKENDS_CLOUD_BASE_STORAGE_H
24
25
#include "backends/cloud/storage.h"
26
#include "backends/networking/curl/curljsonrequest.h"
27
28
namespace
Cloud
{
29
30
class
BaseStorage
:
public
Cloud::Storage
{
31
protected
:
33
Common::String
_token
, _refreshToken;
34
39
virtual
void
getAccessToken
(
const
Common::String
&code,
Networking::ErrorCallback
callback);
40
45
virtual
void
codeFlowComplete
(
Networking::ErrorCallback
callback,
const
Networking::JsonResponse
&response);
46
51
virtual
void
codeFlowFailed
(
Networking::ErrorCallback
callback,
const
Networking::ErrorResponse
&
error
);
52
57
virtual
Common::String
cloudProvider
() = 0;
58
64
virtual
uint32
storageIndex
() = 0;
65
69
virtual
bool
needsRefreshToken
() = 0;
70
74
virtual
bool
canReuseRefreshToken
() = 0;
75
76
private
:
77
void
tokenRefreshed(
BoolCallback
callback,
const
Networking::JsonResponse
&response);
78
79
protected
:
81
void
saveIsEnabledFlag
(
const
Common::String
&keyPrefix)
const
;
82
84
static
bool
loadIsEnabledFlag
(
const
Common::String
&keyPrefix);
85
87
static
void
removeIsEnabledFlag
(
const
Common::String
&keyPrefix);
88
89
public
:
90
BaseStorage
();
91
BaseStorage
(
const
Common::String
&token,
const
Common::String
&refreshToken,
bool
enabled =
false
);
92
~
BaseStorage
()
override
;
93
98
virtual
void
refreshAccessToken
(
BoolCallback
callback,
Networking::ErrorCallback
errorCallback =
nullptr
);
99
};
100
101
}
// End of namespace Cloud
102
103
#endif
Common::String
Definition:
str.h:59
Cloud
Definition:
basestorage.h:28
Cloud::Storage
Definition:
storage.h:47
Networking::ErrorResponse
Definition:
request.h:73
Networking::Response
Definition:
request.h:47
Cloud::BaseStorage::storageIndex
virtual uint32 storageIndex()=0
Cloud::BaseStorage::loadIsEnabledFlag
static bool loadIsEnabledFlag(const Common::String &keyPrefix)
Cloud::BaseStorage::removeIsEnabledFlag
static void removeIsEnabledFlag(const Common::String &keyPrefix)
Cloud::BaseStorage::refreshAccessToken
virtual void refreshAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback=nullptr)
Cloud::BaseStorage::_token
Common::String _token
Definition:
basestorage.h:33
Common::BaseCallback
Definition:
callback.h:49
Cloud::BaseStorage::cloudProvider
virtual Common::String cloudProvider()=0
Cloud::BaseStorage::codeFlowComplete
virtual void codeFlowComplete(Networking::ErrorCallback callback, const Networking::JsonResponse &response)
Cloud::BaseStorage::needsRefreshToken
virtual bool needsRefreshToken()=0
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Cloud::BaseStorage::getAccessToken
virtual void getAccessToken(const Common::String &code, Networking::ErrorCallback callback)
Cloud::BaseStorage::saveIsEnabledFlag
void saveIsEnabledFlag(const Common::String &keyPrefix) const
Cloud::BaseStorage::codeFlowFailed
virtual void codeFlowFailed(Networking::ErrorCallback callback, const Networking::ErrorResponse &error)
Cloud::BaseStorage::canReuseRefreshToken
virtual bool canReuseRefreshToken()=0
Cloud::BaseStorage
Definition:
basestorage.h:30
backends
cloud
basestorage.h
Generated on Mon Dec 23 2024 09:03:35 for ScummVM API documentation by
1.8.13