ScummVM API documentation
Agi::WagProperty Class Reference

#include <wagparser.h>

Public Types

enum  WagPropertyCode {
  PC_GAMEDESC = 129, PC_GAMEAUTHOR, PC_GAMEID, PC_INTVERSION,
  PC_GAMELAST, PC_GAMEVERSION, PC_GAMEABOUT, PC_GAMEEXEC,
  PC_RESDIR, PC_DEFSYNTAX, PC_INVOBJDESC = 144, PC_VOCABWORDDESC = 160,
  PC_PALETTE = 172, PC_USERESNAMES = 180, PC_LOGIC = 192, PC_PICTURE = 208,
  PC_SOUND = 224, PC_VIEW = 240, PC_UNDEFINED = 0x100
}
 
enum  WagPropertyType {
  PT_ID, PT_DESC, PT_SYNTAX, PT_CRC32,
  PT_KEY, PT_INST0, PT_INST1, PT_INST2,
  PT_MUTE0, PT_MUTE1, PT_MUTE2, PT_MUTE3,
  PT_TPQN, PT_ROOM, PT_VIS0, PT_VIS1,
  PT_VIS2, PT_VIS3, PT_ALL = 0xff, PT_UNDEFINED = 0x100
}
 

Public Member Functions

 WagProperty ()
 
 ~WagProperty ()
 
 WagProperty (const WagProperty &other)
 
WagPropertyoperator= (const WagProperty &other)
 
bool read (Common::SeekableReadStream &stream)
 
void clear ()
 
bool readOk () const
 
enum WagPropertyCode getCode () const
 
enum WagPropertyType getType () const
 
byte getNumber () const
 
uint16 getSize () const
 
const char * getData () const
 
void setPropCode (WagPropertyCode propCode)
 
void setPropDataSize (Common::String str)
 

Protected Member Functions

void setDefaults ()
 
void deleteData ()
 
void deepCopy (const WagProperty &other)
 

Protected Attributes

bool _readOk
 Was the property read ok from the source stream?
 
enum WagPropertyCode _propCode
 Property code (Part of the property's header)
 
enum WagPropertyType _propType
 Property type (Part of the property's header)
 
byte _propNum
 Property number (Part of the property's header)
 
uint16 _propSize
 Property's size (Part of the property's header)
 
char * _propData
 The property's data (Plus a trailing zero for C-style string access)
 

Detailed Description

WagProperty represents a single property from WinAGI's *.wag file. A property consists of a header and of data. The header consists of the following:

  • Property code (Integer/Enumeration, 1 byte)
  • Property type (Integer/Enumeration, 1 byte)
  • Property number (Integer, 1 byte)
  • Property size (Little endian integer, 2 bytes) And then there's the data with as many bytes as defined in the header's property size variable.

Member Enumeration Documentation

◆ WagPropertyCode

Property codes taken from WinAGI 1.1.21's source code file WinAGI/AGIObjects.bas.

Enumerator
PC_GAMEDESC 

Game description (WinAGI 1.1.21 limits these to 4096 bytes)

PC_GAMEAUTHOR 

Game author (WinAGI 1.1.21 limits these to 256 bytes)

PC_GAMEID 

Game ID.

PC_INTVERSION 

Interpreter version (WinAGI 1.1.21 defaults to version 2.917)

PC_GAMELAST 

Last edit date.

PC_GAMEVERSION 

Game version (WinAGI 1.1.21 limits these to 256 bytes)

PC_GAMEABOUT 

About game (WinAGI 1.1.21 limits these to 4096 bytes)

PC_GAMEEXEC 

Game executable.

PC_RESDIR 

Resource directory name.

PC_DEFSYNTAX 

Default syntax.

PC_UNDEFINED 

An undefined property code (Added for ScummVM).

◆ WagPropertyType

Property types taken from WinAGI 1.1.21's source code file WinAGI/AGIObjects.bas. At the moment these aren't really at all needed by ScummVM. Just here if anyone decides to use them.

Enumerator
PT_UNDEFINED 

An undefined property type (Added for ScummVM).

Constructor & Destructor Documentation

◆ WagProperty() [1/2]

Agi::WagProperty::WagProperty ( )

Creates an empty WagProperty object. No property header or property data in it.

◆ ~WagProperty()

Agi::WagProperty::~WagProperty ( )

Destructor. Releases allocated memory if any etc. The usual.

◆ WagProperty() [2/2]

Agi::WagProperty::WagProperty ( const WagProperty other)

Copy constructor. Deep copies the variables.

Member Function Documentation

◆ operator=()

WagProperty& Agi::WagProperty::operator= ( const WagProperty other)

Assignment operator. Deep copies the variables.

◆ setDefaults()

void Agi::WagProperty::setDefaults ( )
protected

Sets the default values for member variables.

◆ deleteData()

void Agi::WagProperty::deleteData ( )
protected

Delete's the property's data from memory if we have it, otherwise does nothing.

◆ deepCopy()

void Agi::WagProperty::deepCopy ( const WagProperty other)
protected

Deep copies the parameter object to this object.

Parameters
otherThe object to be deep copied to this object.

◆ read()

bool Agi::WagProperty::read ( Common::SeekableReadStream stream)

Read in a property (Header and data).

Returns
True if reading was a success, false otherwise.

◆ clear()

void Agi::WagProperty::clear ( )

Clears the property. After this the property is empty. No header or data.

◆ readOk()

bool Agi::WagProperty::readOk ( ) const
inline

Was the property read ok from the source stream?

◆ getCode()

enum WagPropertyCode Agi::WagProperty::getCode ( ) const
inline

Return the property's code.

Returns
The property's code if readOk(), PC_UNDEFINED otherwise.

◆ getType()

enum WagPropertyType Agi::WagProperty::getType ( ) const
inline

Return the property's type.

Returns
The property's type if readOk(), PT_UNDEFINED otherwise.

◆ getNumber()

byte Agi::WagProperty::getNumber ( ) const
inline

Return the property's number.

Returns
The property's number if readOk(), 0 otherwise.

◆ getSize()

uint16 Agi::WagProperty::getSize ( ) const
inline

Return the property's data's length.

Returns
The property's data's length if readOk(), 0 otherwise.

◆ getData()

const char* Agi::WagProperty::getData ( ) const
inline

Return property's data. Constant access version. Can be used as a C-style string (i.e. this is guaranteed to have a trailing zero).

Returns
The property's data if readOk(), NULL otherwise.

◆ setPropCode()

void Agi::WagProperty::setPropCode ( WagPropertyCode  propCode)

Set property's code

Parameters
propCodethe code value to set

◆ setPropDataSize()

void Agi::WagProperty::setPropDataSize ( Common::String  str)

Set property's data and property's size

Parameters
strthe string that according to it these are set

The documentation for this class was generated from the following file: