Game Development Reference
In-Depth Information
Method
Description
ParseOpen
This method gets called when the text parser reaches the open
curly brace of the class definition. It can be used to initialize
anything that might be needed internally during the process of
parsing an object.
It is important that you do not use this method to initialize all the
member variables of your class to some default values. The class
constructor is a far better place to do this, as it is guaranteed to be
called however the instance ends up being created.
ParseAttribute
This method is called whenever an attribute is encountered in
the object definition. The attribute is passed as a standard C-style
string to this method, which can then process it as needed.
The text parser can be used within this method to extract any
data elements in a variety of different ways, including strings,
integers, and Boolean values.
ParseClose
This method is called when the closing curly brace of the class
definition is encountered.
ParseCloseChild
It is possible to embed class definitions inside other class
definitions in an ITX file. If a class does not implement the
ParseClose method then when its closing curly brace is
encountered, the ParseCloseChild method will be called on
the parent class with a pointer to the child class.
In this case parent and child do not refer to class inheritance
hierarchies, but rather to how the classes have been defined in
the ITX file. For example:
ParentClass
{
name "parent"
ChildClass
{
name "child"
}
}
When overriding any of these methods, you should normally call the version of the
method from the superclass, be that CIwManaged or some other class derived from it.
For example, the name attribute is parsed by CIwManaged::ParseAttribute , which
not only reads the name for the class but also generates a hash value of the name.
The hash value is very important when it comes to serializing and resolving class
instances later.
Search WWH ::




Custom Search