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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef PRINCE_ARCHIVE_H
24 #define PRINCE_ARCHIVE_H
25 
26 #include "common/archive.h"
27 #include "common/hashmap.h"
28 #include "common/hash-str.h"
29 
30 namespace Prince {
31 
32 class PtcArchive : public Common::Archive {
33 public:
34 	PtcArchive();
35 	~PtcArchive();
36 
37 	bool open(const Common::String &filename);
38 	bool openTranslation(const Common::String &filename);
39 	void close();
isOpen()40 	bool isOpen() const { return _stream != 0; }
41 
42 	// Common::Archive API implementation
43 	bool hasFile(const Common::String &name) const;
44 	int listMembers(Common::ArchiveMemberList &list) const;
45 	const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
46 	Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
47 
48 private:
49 	struct FileEntry {
50 		uint32 _offset;
51 		uint32 _size;
52 	};
53 
54 	Common::SeekableReadStream *_stream;
55 
56 	typedef Common::HashMap<Common::String, FileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
57 	FileMap _items;
58 };
59 
60 } // End of namespace Prince
61 
62 #endif
63