ScummVM API documentation
u8_save_file.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_U8SAVEFILE_H
23 #define ULTIMA8_FILESYS_U8SAVEFILE_H
24 
25 #include "common/archive.h"
26 
27 #include "ultima/shared/std/containers.h"
28 #include "ultima/shared/std/string.h"
29 
30 namespace Ultima {
31 namespace Ultima8 {
32 
33 class U8SaveFile : public Common::Archive {
34 public:
38  ~U8SaveFile() override;
39 
41  bool isValid() const {
42  return _valid;
43  }
44 
45  // Common::Archive API implementation
46  bool hasFile(const Common::Path &path) const override;
47  int listMembers(Common::ArchiveMemberList &list) const override;
48  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
50 
51  static bool isU8SaveFile(Common::SeekableReadStream *rs);
52 
53 protected:
55  bool _valid;
56 
57  struct FileEntry {
58  uint32 _offset;
59  uint32 _size;
60  FileEntry() : _offset(0), _size(0) {}
61  };
62 
64  U8SaveFileMap _map;
65 
66 private:
67  bool readMetadata();
68 };
69 
70 } // End of namespace Ultima8
71 } // End of namespace Ultima
72 
73 #endif
U8SaveFile(Common::SeekableReadStream *rs)
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
bool hasFile(const Common::Path &path) const override
Definition: archive.h:141
Definition: detection.h:27
int listMembers(Common::ArchiveMemberList &list) const override
bool isValid() const
Check if constructed object is indeed a valid archive.
Definition: u8_save_file.h:41
Definition: u8_save_file.h:57
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
Definition: u8_save_file.h:33
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override