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 #include "common/str.h"
27 
28 namespace Ultima {
29 namespace Ultima8 {
30 
31 class U8SaveFile : public Common::Archive {
32 public:
36  ~U8SaveFile() override;
37 
39  bool isValid() const {
40  return _valid;
41  }
42 
43  // Common::Archive API implementation
44  bool hasFile(const Common::Path &path) const override;
45  int listMembers(Common::ArchiveMemberList &list) const override;
46  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
48 
49  static bool isU8SaveFile(Common::SeekableReadStream *rs);
50 
51 protected:
53  bool _valid;
54 
55  struct FileEntry {
56  uint32 _offset;
57  uint32 _size;
58  FileEntry() : _offset(0), _size(0) {}
59  };
60 
62  U8SaveFileMap _map;
63 
64 private:
65  bool readMetadata();
66 };
67 
68 } // End of namespace Ultima8
69 } // End of namespace Ultima
70 
71 #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:39
Definition: u8_save_file.h:55
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
Definition: u8_save_file.h:31
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override