ScummVM API documentation
iff.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 NANCY_IFF_H
23#define NANCY_IFF_H
24
25#include "common/array.h"
26#include "common/str.h"
27
28namespace Common {
29struct IFFChunk;
30class SeekableReadStream;
31}
32
33namespace Nancy {
34
35class IFF {
36public:
38 ~IFF();
39
40 const byte *getChunk(uint32 id, uint &size, uint index = 0) const;
41 Common::SeekableReadStream *getChunkStream(const Common::String &id, uint index = 0) const;
42
43 void list(Common::Array<Common::String> &nameList) const;
44
45 // The files named in this IFF's USE chunks
46 const Common::Array<Common::String> &getIncludes() const { return _includes; }
47 // The included file a chunk came from; empty for the IFF's own chunks
48 Common::String getChunkSource(const Common::String &id, uint index = 0) const;
49
50private:
51 static Common::String idToString(uint32 id);
52 static uint32 stringToId(const Common::String &s);
53
54 bool callback(Common::IFFChunk &chunk);
55 void resolveIncludes();
56
57 struct Chunk {
58 uint32 id;
59 byte *buf;
60 uint32 size;
61 double key; // ordering key, see resolveIncludes()
62 Common::String source;
63 };
64
65 const Common::SeekableReadStream *_stream;
68 uint32 _nextDATAChunk;
69};
70
71} // End of namespace Nancy
72
73#endif // NANCY_IFF_H
Definition: stream.h:745
Definition: str.h:59
Definition: iff.h:35
Definition: algorithm.h:29
Definition: actionmanager.h:32
Definition: iff_container.h:160