22#ifndef COMMON_IFF_CONTAINER_H
23#define COMMON_IFF_CONTAINER_H
25#include "common/scummsys.h"
26#include "common/endian.h"
27#include "common/func.h"
28#include "common/stream.h"
29#include "common/textconsole.h"
45#define ID_FORM MKTAG('F','O','R','M')
47#define ID_CAT MKTAG('C','A','T',' ')
49#define ID_LIST MKTAG('L','I','S','T')
51#define ID_PROP MKTAG('P','R','O','P')
53#define ID_END MKTAG('E','N','D',' ')
56#define ID_ILBM MKTAG('I','L','B','M')
58#define ID_DEEP MKTAG('D','E','E','P')
60#define ID_RGB8 MKTAG('R','G','B','8')
62#define ID_RGBN MKTAG('R','G','B','N')
64#define ID_PBM MKTAG('P','B','M',' ')
66#define ID_ACBM MKTAG('A','C','B','M')
68#define ID_8SVX MKTAG('8','S','V','X')
70#define ID_DATA MKTAG('D','A','T','A')
75#define ID_FVER MKTAG('F','V','E','R')
77#define ID_JUNK MKTAG('J','U','N','K')
79#define ID_ANNO MKTAG('A','N','N','O')
81#define ID_AUTH MKTAG('A','U','T','H')
83#define ID_CHRS MKTAG('C','H','R','S')
85#define ID_NAME MKTAG('N','A','M','E')
87#define ID_TEXT MKTAG('T','E','X','T')
89#define ID_copy MKTAG('(','c',')',' ')
94#define ID_BMHD MKTAG('B','M','H','D')
96#define ID_CMAP MKTAG('C','M','A','P')
98#define ID_GRAB MKTAG('G','R','A','B')
100#define ID_DEST MKTAG('D','E','S','T')
102#define ID_SPRT MKTAG('S','P','R','T')
104#define ID_CAMG MKTAG('C','A','M','G')
106#define ID_BODY MKTAG('B','O','D','Y')
108#define ID_CRNG MKTAG('C','R','N','G')
110#define ID_CCRT MKTAG('C','C','R','T')
112#define ID_CLUT MKTAG('C','L','U','T')
114#define ID_DPI MKTAG('D','P','I',' ')
116#define ID_DPPV MKTAG('D','P','P','V')
118#define ID_DRNG MKTAG('D','R','N','G')
120#define ID_EPSF MKTAG('E','P','S','F')
122#define ID_CMYK MKTAG('C','M','Y','K')
124#define ID_CNAM MKTAG('C','N','A','M')
126#define ID_PCHG MKTAG('P','C','H','G')
128#define ID_PRVW MKTAG('P','R','V','W')
130#define ID_XBMI MKTAG('X','B','M','I')
132#define ID_CTBL MKTAG('C','T','B','L')
134#define ID_DYCP MKTAG('D','Y','C','P')
136#define ID_SHAM MKTAG('S','H','A','M')
138#define ID_ABIT MKTAG('A','B','I','T')
140#define ID_DCOL MKTAG('D','C','O','L')
142#define ID_DPPS MKTAG('D','P','P','S')
144#define ID_TINY MKTAG('T','I','N','Y')
146#define ID_DPPV MKTAG('D','P','P','V')
151#define ID_VHDR MKTAG('V','H','D','R')
165 IFFChunk(IFF_ID type, uint32 size,
ReadStream *stream) : _type(type), _size(size), _stream(stream) {
186 IFFChunkNav() : _input(
nullptr) {
190 size = _bytesRead = 0;
192 void incBytesRead(uint32 inc) {
194 if (_bytesRead > size) {
195 error(
"Chunk overread");
203 bool hasReadAll()
const {
204 return (size - _bytesRead) == 0;
210 while (!hasReadAll()) {
215 bool eos()
const override {
return _input->
eos(); }
216 bool err()
const override {
return _input->
err(); }
217 void clearErr()
override { _input->
clearErr(); }
219 uint32 read(
void *dataPtr, uint32 dataSize)
override {
220 incBytesRead(dataSize);
221 return _input->
read(dataPtr, dataSize);
231 IFF_ID _formHeaderID;
275 bool eos()
const override;
277 uint32
read(
void *dataPtr, uint32 dataSize)
override;
Definition: iff_container.h:173
Functor1< IFFChunk &, bool > IFFCallback
Definition: iff_container.h:245
IFFChunkNav _formChunk
The root chunk of the file.
Definition: iff_container.h:226
void parse(IFFCallback &callback)
IFFChunkNav _chunk
The current chunk.
Definition: iff_container.h:227
Definition: iff_container.h:266
uint32 read(void *dataPtr, uint32 dataSize) override
bool eos() const override
uint32 readUint32BE()
Definition: stream.h:515
virtual bool eos() const =0
virtual uint32 read(void *dataPtr, uint32 dataSize)=0
virtual void clearErr()
Definition: stream.h:71
virtual bool err() const
Definition: stream.h:61
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: algorithm.h:29
Definition: iff_container.h:160