ScummVM API documentation
savegame.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 ULTIMA8_FILESYS_SAVEGAME_H
23 #define ULTIMA8_FILESYS_SAVEGAME_H
24 
25 #include "ultima/shared/std/string.h"
26 #include "common/hashmap.h"
27 #include "common/stream.h"
28 #include "common/memstream.h"
29 #include "engines/metaengine.h"
30 
31 namespace Ultima {
32 namespace Ultima8 {
33 
34 class ZipFile;
35 class IDataSource;
36 
38 private:
39  ExtendedSavegameHeader _header;
40  Common::Archive *_archive;
41  uint32 _version;
42 public:
43  explicit SavegameReader(Common::SeekableReadStream *rs, bool metadataOnly = false);
44  ~SavegameReader();
45 
46  enum State { SAVE_CORRUPT, SAVE_VALID, SAVE_OUT_OF_DATE, SAVE_TOO_RECENT };
47  State isValid() const;
48 
49  uint32 getVersion() const { return _version; }
50 
51  Std::string getDescription() const { return _header.description; }
52 
57 };
58 
60  class FileEntry : public Common::Array<byte> {
61  public:
62  Std::string _name;
63  FileEntry() : Common::Array<byte>() {}
64  };
65 private:
66  Common::WriteStream *_file;
68 public:
69  explicit SavegameWriter(Common::WriteStream *ws);
70  virtual ~SavegameWriter();
71 
76  bool writeFile(const Std::string &name, const uint8 *data, uint32 size);
77 
81  bool writeFile(const Std::string &name, Common::MemoryWriteStreamDynamic *buf);
82 
84  bool finish();
85 };
86 
87 } // End of namespace Ultima8
88 } // End of namespace Ultima
89 
90 #endif
Definition: savegame.h:37
Definition: stream.h:77
Definition: array.h:52
Definition: memstream.h:194
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:141
Definition: detection.h:27
Definition: string.h:30
Common::SeekableReadStream * getDataSource(const Common::Path &name)
Definition: savegame.h:59
Definition: metaengine.h:94
Common::String description
Definition: metaengine.h:98