ScummVM API documentation
default-saves.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 #if !defined(BACKEND_SAVES_DEFAULT_H) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
23 #define BACKEND_SAVES_DEFAULT_H
24 
25 #include "common/scummsys.h"
26 #include "common/savefile.h"
27 #include "common/str.h"
28 #include "common/fs.h"
29 #include "common/hash-str.h"
30 
35 public:
37  DefaultSaveFileManager(const Common::Path &defaultSavepath);
38 
39  void updateSavefilesList(Common::StringArray &lockedFiles) override;
40  Common::StringArray listSavefiles(const Common::String &pattern) override;
41  Common::InSaveFile *openRawFile(const Common::String &filename) override;
42  Common::InSaveFile *openForLoading(const Common::String &filename) override;
43  Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) override;
44  bool removeSavefile(const Common::String &filename) override;
45  bool exists(const Common::String &filename) override;
46 
47 #ifdef USE_LIBCURL
48 
49  static const uint32 INVALID_TIMESTAMP = UINT_MAX;
50  static const char *const TIMESTAMPS_FILENAME;
51 
52  static Common::HashMap<Common::String, uint32> loadTimestamps();
53  static void saveTimestamps(Common::HashMap<Common::String, uint32> &timestamps);
54 #endif
55 
56  static Common::Path concatWithSavesPath(Common::String name);
57 
58 protected:
64  virtual Common::Path getSavePath() const;
65 
70  virtual void checkPath(const Common::FSNode &dir);
71 
76  virtual Common::ErrorCode removeFile(const Common::FSNode &fileNode);
77 
83  void assureCached(const Common::Path &savePathName);
84 
86 
94  SaveFileCache _saveFileCache;
95 
101 
102 private:
106  Common::Path _cachedDirectory;
107 };
108 
109 #endif
bool exists(const Common::String &filename) override
Definition: str.h:59
virtual void checkPath(const Common::FSNode &dir)
bool removeSavefile(const Common::String &filename) override
Definition: savefile.h:54
Common::StringArray _lockedFiles
Definition: default-saves.h:100
virtual Common::ErrorCode removeFile(const Common::FSNode &fileNode)
ErrorCode
Definition: error.h:47
Definition: path.h:52
Definition: stream.h:745
SaveFileCache _saveFileCache
Definition: default-saves.h:94
Definition: default-saves.h:34
Common::OutSaveFile * openForSaving(const Common::String &filename, bool compress=true) override
Definition: fs.h:69
void updateSavefilesList(Common::StringArray &lockedFiles) override
Common::StringArray listSavefiles(const Common::String &pattern) override
Common::InSaveFile * openRawFile(const Common::String &filename) override
Definition: savefile.h:142
virtual Common::Path getSavePath() const
void assureCached(const Common::Path &savePathName)
Common::InSaveFile * openForLoading(const Common::String &filename) override