ScummVM API documentation
xfile_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 HARVESTER_XFILE_ARCHIVE_H
23#define HARVESTER_XFILE_ARCHIVE_H
24
25#include "common/archive.h"
26#include "common/file.h"
27#include "common/hashmap.h"
28#include "common/mutex.h"
29#include "common/ptr.h"
30
31namespace Harvester {
32
34public:
36 ~XFileArchive() override;
37
38 bool open(const Common::String &indexPath, const Common::String &dataPath);
39 void close();
40
41 bool hasFile(const Common::Path &path) const override;
42 int listMembers(Common::ArchiveMemberList &list) const override;
43 const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
45
46private:
47 struct Entry {
48 uint32 _archiveOffset = 0;
49 uint32 _storedSize = 0;
50 uint32 _packedFlag = 0;
51 uint32 _unpackedSize = 0;
52 };
53
54 Common::SeekableReadStream *openStoredEntry(const Entry &entry) const;
55 Common::SeekableReadStream *openPackedEntry(const Entry &entry) const;
56
57 Common::Path _dataPath;
59 mutable Common::Mutex _dataFileMutex;
61 EntryMap _entries;
62};
63
64} // End of namespace Harvester
65
66#endif // HARVESTER_XFILE_ARCHIVE_H
Definition: archive.h:141
Definition: list.h:44
Definition: mutex.h:67
Definition: path.h:52
Definition: stream.h:745
Definition: str.h:59
Definition: xfile_archive.h:33
int listMembers(Common::ArchiveMemberList &list) const override
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
bool hasFile(const Common::Path &path) const override