ScummVM API documentation
saveload.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 MTROPOLIS_SAVELOAD_H
23 #define MTROPOLIS_SAVELOAD_H
24 
25 #include "mtropolis/core.h"
26 
27 namespace Common {
28 
29 class ReadStream;
30 class WriteStream;
31 
32 } // End of namespace Common
33 
34 namespace Graphics {
35 
36 struct Surface;
37 
38 } // End of namespace Graphics
39 
40 namespace MTropolis {
41 
42 class Modifier;
43 class Runtime;
44 class RuntimeObject;
45 
46 struct ISaveWriter : public IInterfaceBase {
47  virtual bool writeSave(Common::WriteStream *stream) = 0;
48 };
49 
50 struct ISaveReader : public IInterfaceBase {
51  virtual bool readSave(Common::ReadStream *stream, uint32 saveFileVersion) = 0;
52 };
53 
55  virtual bool promptSave(ISaveWriter *writer, const Graphics::Surface *screenshotOverride) = 0;
56  virtual bool namedSave(ISaveWriter *writer, const Graphics::Surface *screenshotOverride, const Common::String &fileName) = 0;
57 };
58 
60  virtual bool promptLoad(ISaveReader *reader) = 0;
61  virtual bool namedLoad(ISaveReader *reader, const Common::String &fileName) = 0;
62 };
63 
65  virtual bool autoSave(ISaveWriter *writer) = 0;
66 };
67 
68 class CompoundVarSaver : public ISaveWriter {
69 public:
70  CompoundVarSaver(Runtime *runtime, RuntimeObject *object);
71 
72  bool writeSave(Common::WriteStream *stream) override;
73 
74 private:
75  Runtime *_runtime;
76  RuntimeObject *_object;
77 };
78 
80 public:
81  virtual ~SaveLoadHooks();
82 
83  virtual void onLoad(Runtime *runtime, Modifier *saveLoadModifier, Modifier *varModifier);
84  virtual void onSave(Runtime *runtime, Modifier *saveLoadModifier, Modifier *varModifier);
85 };
86 
88 public:
89  virtual ~SaveLoadMechanismHooks();
90 
91  virtual bool canSaveNow(Runtime *runtime);
92  virtual Common::SharedPtr<ISaveWriter> createSaveWriter(Runtime *runtime);
93 };
94 
95 } // End of namespace MTropolis
96 
97 #endif /* MTROPOLIS_SAVELOAD_H */
Definition: str.h:59
Definition: surface.h:67
Definition: stream.h:77
Definition: saveload.h:46
Definition: runtime.h:1594
Definition: runtime.h:2052
Definition: runtime.h:3035
Definition: saveload.h:87
Definition: saveload.h:50
Definition: algorithm.h:29
Definition: saveload.h:68
Definition: formatinfo.h:28
Definition: saveload.h:59
Definition: actions.h:25
Definition: saveload.h:64
Definition: saveload.h:54
Definition: stream.h:385
Definition: ptr.h:159
Definition: saveload.h:79
Definition: core.h:33