ScummVM API documentation
wagparser.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 AGI_WAGPARSER_H
23#define AGI_WAGPARSER_H
24
25namespace Agi {
26
38// Constants, enumerations etc
39public:
54 PC_INVOBJDESC = 144,
55 PC_VOCABWORDDESC = 160,
56 PC_PALETTE = 172,
57 PC_USERESNAMES = 180,
58 PC_LOGIC = 192,
59 PC_PICTURE = 208,
60 PC_SOUND = 224,
61 PC_VIEW = 240,
62 PC_UNDEFINED = 0x100
63 };
64
70 PT_ID,
71 PT_DESC,
72 PT_SYNTAX,
73 PT_CRC32,
74 PT_KEY,
75 PT_INST0,
76 PT_INST1,
77 PT_INST2,
78 PT_MUTE0,
79 PT_MUTE1,
80 PT_MUTE2,
81 PT_MUTE3,
82 PT_TPQN,
83 PT_ROOM,
84 PT_VIS0,
85 PT_VIS1,
86 PT_VIS2,
87 PT_VIS3,
88 PT_ALL = 0xff,
89 PT_UNDEFINED = 0x100
90 };
91
92// Constructors, destructors, operators etc
93public:
99
104
109
114
115// Non-public helper methods
116protected:
121
126
131 void deepCopy(const WagProperty &other);
132
133// Public methods that have side-effects
134public:
140
145 void clear();
146
147// Public access functions
148public:
152 bool readOk() const { return _readOk; }
153
158 enum WagPropertyCode getCode() const { return _propCode; }
159
164 enum WagPropertyType getType() const { return _propType; }
165
170 byte getNumber() const { return _propNum; }
171
176 uint16 getSize() const { return _propSize; }
177
183 const char *getData() const { return _propData; }
184
190
196
197// Member variables
198protected:
199 bool _readOk;
202 byte _propNum;
203 uint16 _propSize;
204 char *_propData;
205};
206
207
213// Constants, type definitions, enumerations etc.
214public:
215 enum {
217 };
219
220public:
225
230
239
246 bool parse(const Common::FSNode &node);
247
253 const PropertyList &getProperties() const { return _propList; }
254
266
274 bool checkAgiVersionProperty(const WagProperty &version) const;
275
282
287 bool parsedOk() const { return _parsedOk; }
288
289protected:
296
303
304// Member variables
305protected:
308};
309
310} // End of namespace Agi
311
312#endif // AGI_WAGPARSER_H
Definition: wagparser.h:212
const WagProperty * getProperty(const WagProperty::WagPropertyCode code) const
uint16 convertToAgiVersionNumber(const WagProperty &version)
bool checkAgiVersionProperty(const WagProperty &version) const
bool parsedOk() const
Definition: wagparser.h:287
bool parse(const Common::FSNode &node)
Common::Array< WagProperty > PropertyList
A type definition for an array of *.wag file properties.
Definition: wagparser.h:218
@ WINAGI_VERSION_LENGTH
WinAGI's version string's length (Always 16)
Definition: wagparser.h:216
bool _parsedOk
Did the parsing of the file go ok?
Definition: wagparser.h:307
bool endOfProperties(const Common::SeekableReadStream &stream) const
PropertyList _propList
List of loaded properties from the file.
Definition: wagparser.h:306
const PropertyList & getProperties() const
Definition: wagparser.h:253
void addPropFromIni(Common::INIFile &iniWagFile, Common::String section, Common::String key, Agi::WagProperty::WagPropertyCode code)
bool checkWagVersion(Common::SeekableReadStream &stream)
Definition: wagparser.h:37
enum WagPropertyCode _propCode
Property code (Part of the property's header)
Definition: wagparser.h:200
bool _readOk
Was the property read ok from the source stream?
Definition: wagparser.h:199
uint16 getSize() const
Definition: wagparser.h:176
WagProperty & operator=(const WagProperty &other)
byte _propNum
Property number (Part of the property's header)
Definition: wagparser.h:202
enum WagPropertyType getType() const
Definition: wagparser.h:164
bool read(Common::SeekableReadStream &stream)
WagPropertyType
Definition: wagparser.h:69
@ PT_UNDEFINED
An undefined property type (Added for ScummVM).
Definition: wagparser.h:89
enum WagPropertyType _propType
Property type (Part of the property's header)
Definition: wagparser.h:201
void setPropDataSize(Common::String str)
const char * getData() const
Definition: wagparser.h:183
enum WagPropertyCode getCode() const
Definition: wagparser.h:158
byte getNumber() const
Definition: wagparser.h:170
WagProperty(const WagProperty &other)
char * _propData
The property's data (Plus a trailing zero for C-style string access)
Definition: wagparser.h:204
void setPropCode(WagPropertyCode propCode)
void deepCopy(const WagProperty &other)
bool readOk() const
Definition: wagparser.h:152
uint16 _propSize
Property's size (Part of the property's header)
Definition: wagparser.h:203
WagPropertyCode
Definition: wagparser.h:43
@ PC_GAMEAUTHOR
Game author (WinAGI 1.1.21 limits these to 256 bytes)
Definition: wagparser.h:45
@ PC_GAMEEXEC
Game executable.
Definition: wagparser.h:51
@ PC_INTVERSION
Interpreter version (WinAGI 1.1.21 defaults to version 2.917)
Definition: wagparser.h:47
@ PC_GAMEDESC
Game description (WinAGI 1.1.21 limits these to 4096 bytes)
Definition: wagparser.h:44
@ PC_RESDIR
Resource directory name.
Definition: wagparser.h:52
@ PC_GAMEABOUT
About game (WinAGI 1.1.21 limits these to 4096 bytes)
Definition: wagparser.h:50
@ PC_GAMEVERSION
Game version (WinAGI 1.1.21 limits these to 256 bytes)
Definition: wagparser.h:49
@ PC_GAMELAST
Last edit date.
Definition: wagparser.h:48
@ PC_DEFSYNTAX
Default syntax.
Definition: wagparser.h:53
@ PC_GAMEID
Game ID.
Definition: wagparser.h:46
@ PC_UNDEFINED
An undefined property code (Added for ScummVM).
Definition: wagparser.h:62
Definition: fs.h:69
Definition: ini-file.h:58
Definition: stream.h:745
Definition: str.h:59
Definition: agi.h:64