ScummVM API documentation
libfile.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 HYPNO_LIBFILE_H
23#define HYPNO_LIBFILE_H
24
25#include "common/archive.h"
26#include "common/array.h"
27#include "common/file.h"
28#include "common/memstream.h"
29#include "common/stream.h"
30
31namespace Hypno {
32
33typedef struct FileEntry {
34 Common::Path name;
35 uint32 start;
36 uint32 size;
37} FileEntry;
38
39class LibFile : public Common::Archive {
40public:
41 LibFile();
42 ~LibFile() override;
43
44 bool open(const Common::Path &prefix, const Common::Path &filename, bool encrypted);
45 void close();
46
47 // Common::Archive API implementation
48 bool hasFile(const Common::Path &path) const override;
49 int listMembers(Common::ArchiveMemberList &list) const override;
50 const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
52
53private:
54 bool _encrypted;
55 Common::File *_libfile;
56 Common::Path _prefix;
57 Common::Array<FileEntry> _fileEntries;
58 const FileEntry *getEntry(const Common::Path &path) const;
59};
60
61} // End of namespace Hypno
62
63#endif
64
Definition: archive.h:141
Definition: file.h:47
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
Definition: libfile.h:39
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
bool hasFile(const Common::Path &path) const override
int listMembers(Common::ArchiveMemberList &list) const override
Definition: libfile.h:33