#include <wagparser.h>
Public Types | |
enum | { WINAGI_VERSION_LENGTH = 16 } |
typedef Common::Array< WagProperty > | PropertyList |
A type definition for an array of *.wag file properties. | |
Public Member Functions | |
WagFileParser () | |
~WagFileParser () | |
void | addPropFromIni (Common::INIFile &iniWagFile, Common::String section, Common::String key, Agi::WagProperty::WagPropertyCode code) |
bool | parse (const Common::FSNode &node) |
const PropertyList & | getProperties () const |
const WagProperty * | getProperty (const WagProperty::WagPropertyCode code) const |
bool | checkAgiVersionProperty (const WagProperty &version) const |
uint16 | convertToAgiVersionNumber (const WagProperty &version) |
bool | parsedOk () const |
Protected Member Functions | |
bool | checkWagVersion (Common::SeekableReadStream &stream) |
bool | endOfProperties (const Common::SeekableReadStream &stream) const |
Protected Attributes | |
PropertyList | _propList |
List of loaded properties from the file. | |
bool | _parsedOk |
Did the parsing of the file go ok? | |
Class for parsing *.wag files created by WinAGI. Using this class you can get information about fanmade AGI games if they have provided a *.wag file with them.
Agi::WagFileParser::WagFileParser | ( | ) |
Constructor. Creates a WagFileParser object in a default state.
Agi::WagFileParser::~WagFileParser | ( | ) |
Destructor.
void Agi::WagFileParser::addPropFromIni | ( | Common::INIFile & | iniWagFile, |
Common::String | section, | ||
Common::String | key, | ||
Agi::WagProperty::WagPropertyCode | code | ||
) |
Add property to _propList from INI file, if key exist
iniWagFile | ini loaded from WAG file stream |
section | ini section |
key | ini key |
code | corresponding WAG code |
bool Agi::WagFileParser::parse | ( | const Common::FSNode & | node | ) |
Loads a *.wag file and parses it.
filename | Name of the file to be parsed. |
|
inline |
Get list of the loaded properties.
const WagProperty* Agi::WagFileParser::getProperty | ( | const WagProperty::WagPropertyCode | code | ) | const |
Get property with the given property code.
TODO/FIXME: Handle cases where several properties with the given property code are found. At the moment we don't need this functionality because the properties we use for fallback detection probably don't have multiples in the WAG-file. TODO: Make this faster than linear time if desired/needed.
bool Agi::WagFileParser::checkAgiVersionProperty | ( | const WagProperty & | version | ) | const |
Tests if the given property contains a valid AGI interpreter version string. A valid AGI interpreter version string is of the form "X.Y" or "X,Y" where X is a single decimal digit and Y is a string of decimal digits (At least one digit).
version | The property to be tested. |
uint16 Agi::WagFileParser::convertToAgiVersionNumber | ( | const WagProperty & | version | ) |
Convert property's data to an AGI interpreter version number.
version | The property to be converted (Property code should be PC_INTVERSION). |
|
inline |
Was the file parsed successfully?
|
protected |
Checks if stream has a valid WinAGI version string in its end.
stream | The stream to be checked. |
|
protected |
Checks if we're at or past the end of the properties stored in the stream.
stream | The stream whose seeking position is to be checked. |