ScummVM API documentation
savefile.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 COMMON_SAVEFILE_H
23
#define COMMON_SAVEFILE_H
24
25
#include "common/noncopyable.h"
26
#include "common/scummsys.h"
27
#include "common/stream.h"
28
#include "common/str-array.h"
29
#include "common/error.h"
30
31
namespace
Common
{
32
47
typedef
SeekableReadStream
InSaveFile
;
48
54
class
OutSaveFile
:
public
SeekableWriteStream
{
55
protected
:
56
WriteStream
*
_wrapped
;
58
public
:
59
OutSaveFile
(
WriteStream
*w);
60
virtual
~
OutSaveFile
();
61
67
bool
err
()
const override
;
68
72
void
clearErr
()
override
;
73
85
void
finalize
()
override
;
86
92
bool
flush
()
override
;
93
100
uint32
write
(
const
void
*dataPtr, uint32 dataSize)
override
;
101
108
int64
pos
()
const override
;
109
114
bool
seek
(int64 offset,
int
whence)
override
;
115
120
int64
size
()
const override
;
121
};
122
142
class
SaveFileManager
:
NonCopyable
{
143
144
protected
:
145
Error
_error
;
146
String
_errorDesc
;
153
virtual
void
setError
(
Error
error
,
const
String
&errorDesc) { _error =
error
; _errorDesc = errorDesc; }
154
155
public
:
156
virtual
~
SaveFileManager
() {}
157
161
virtual
void
clearError
() { _error =
kNoError
; _errorDesc.
clear
(); }
162
168
virtual
Error
getError
() {
return
_error; }
169
175
virtual
String
getErrorDesc
() {
return
_errorDesc; }
176
183
virtual
String
popErrorDesc();
184
202
virtual
OutSaveFile
*openForSaving(
const
String
&name,
bool
compress =
true
) = 0;
203
210
virtual
InSaveFile *openForLoading(
const
String
&name) = 0;
211
219
virtual
InSaveFile *openRawFile(
const
String
&name) = 0;
220
227
virtual
bool
removeSavefile(
const
String
&name) = 0;
228
238
virtual
bool
renameSavefile(
const
String
&oldName,
const
String
&newName,
bool
compress =
true
);
239
249
virtual
bool
copySavefile(
const
String
&oldName,
const
String
&newName,
bool
compress =
true
);
250
262
virtual
StringArray
listSavefiles(
const
String
&pattern) = 0;
263
269
virtual
void
updateSavefilesList(
StringArray
&lockedFiles) = 0;
270
278
virtual
bool
exists(
const
String
&name) = 0;
279
};
280
283
}
// End of namespace Common
284
285
#endif
Common::BaseString::clear
void clear()
Common::String
Definition:
str.h:59
Common::SaveFileManager::_error
Error _error
Definition:
savefile.h:145
Common::WriteStream
Definition:
stream.h:77
Common::OutSaveFile
Definition:
savefile.h:54
Common::Error
Definition:
error.h:84
Common::OutSaveFile::clearErr
void clearErr() override
Common::Array< String >
Common::OutSaveFile::OutSaveFile
OutSaveFile(WriteStream *w)
Common::SaveFileManager::getError
virtual Error getError()
Definition:
savefile.h:168
Common::OutSaveFile::err
bool err() const override
Common::kNoError
No error occurred.
Definition:
error.h:48
Common::OutSaveFile::size
int64 size() const override
Common::SeekableReadStream
Definition:
stream.h:745
Common::NonCopyable
Definition:
noncopyable.h:39
Common::OutSaveFile::finalize
void finalize() override
Common::SaveFileManager::_errorDesc
String _errorDesc
Definition:
savefile.h:146
Common::OutSaveFile::_wrapped
WriteStream * _wrapped
Definition:
savefile.h:56
Common
Definition:
algorithm.h:29
Common::OutSaveFile::seek
bool seek(int64 offset, int whence) override
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Common::SaveFileManager::clearError
virtual void clearError()
Definition:
savefile.h:161
Common::OutSaveFile::write
uint32 write(const void *dataPtr, uint32 dataSize) override
Common::SeekableWriteStream
Definition:
stream.h:351
Common::SaveFileManager::getErrorDesc
virtual String getErrorDesc()
Definition:
savefile.h:175
Common::SaveFileManager::setError
virtual void setError(Error error, const String &errorDesc)
Definition:
savefile.h:153
Common::InSaveFile
SeekableReadStream InSaveFile
Definition:
savefile.h:47
Common::SaveFileManager
Definition:
savefile.h:142
Common::OutSaveFile::flush
bool flush() override
Common::OutSaveFile::pos
int64 pos() const override
common
savefile.h
Generated on Tue Dec 3 2024 09:07:34 for ScummVM API documentation by
1.8.13