ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
obb_archive.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 TETRAEDGE_OBB_ARCHIVE_H
23 #define TETRAEDGE_OBB_ARCHIVE_H
24 
25 #include "common/archive.h"
26 #include "common/ptr.h"
27 #include "common/stream.h"
28 #include "common/hashmap.h"
29 #include "common/hash-str.h"
30 
31 namespace Tetraedge {
32 
33 class ObbArchive : public Common::Archive {
34 public:
35  bool hasFile(const Common::Path &path) const override;
36  int listMembers(Common::ArchiveMemberList&) const override;
37  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
39 
40  // Similar to FileDescriptionBin but in native-endian and native strings.
41  struct FileDescriptor {
42  FileDescriptor() : _fileOffset(0), _fileSize(0) {}
43  FileDescriptor(uint32 offset,
44  uint32 size) : _fileOffset(offset), _fileSize(size) {}
45 
46  uint32 _fileOffset;
47  uint32 _fileSize;
48  };
49 
51 
52  static bool readFileMap(Common::SeekableReadStream &indexFile, FileMap &files);
53  static ObbArchive* open(const Common::Path& obbName);
54 
55 private:
56  ObbArchive(const FileMap& files,
57  const Common::Path& obbName) : _files(files), _obbName(obbName) {}
58 
59  FileMap _files;
60  Common::Path _obbName;
61 };
62 }
63 
64 #endif
Definition: detection.h:27
Definition: obb_archive.h:33
bool hasFile(const Common::Path &path) const override
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:141
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
Definition: obb_archive.h:41
int listMembers(Common::ArchiveMemberList &) const override