V-Gears 0
Free Final Fantasy VII engine.
VGears::XMLSerializer Class Reference

Handles the serialization of XML files. More...

#include <VGearsXMLSerializer.h>

Inheritance diagram for VGears::XMLSerializer:

Public Member Functions

 XMLSerializer ()
 Constructor. More...
 
virtual ~XMLSerializer ()
 Destructor. More...
 

Protected Member Functions

virtual void Parse (Ogre::DataStreamPtr &stream, TiXmlDocument &dest)
 Reads and parses the XML file. More...
 
virtual const StringReadAttribute (TiXmlNode &node, const String &attribute)
 Reads an XMl node attribute as a string. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, bool &dest, const bool &def=false)
 Reads an XMl node attribute as a boolean. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, int &dest, const int &def=0)
 Reads an XMl node attribute as an integer. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, String &dest, const String &def="")
 Reads an XMl node attribute as a string. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Ogre::Real &dest, const Ogre::Real &def=0)
 Reads an XMl node attribute as a real. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Ogre::Vector2 &dest, const Ogre::Vector2 &def=Ogre::Vector2::ZERO)
 Reads an XMl node attribute as a 2-dimension vector. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Ogre::Vector3 &dest, const Ogre::Vector3 &def=Ogre::Vector3::ZERO)
 Reads an XMl node attribute as a 3-dimension vector. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Ogre::Vector4 &dest, const Ogre::Vector4 &def=Ogre::Vector4::ZERO)
 Reads an XMl node attribute as a 4-dimension vector. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Ogre::Quaternion &dest, const Ogre::Quaternion &def=Ogre::Quaternion::IDENTITY)
 Reads an XMl node attribute as a quaternion. More...
 
virtual TiXmlNode * FindChildNode (TiXmlNode &node, const String &tag)
 Finds a child node of a XML node by name. More...
 

Detailed Description

Handles the serialization of XML files.

Constructor & Destructor Documentation

◆ XMLSerializer()

VGears::XMLSerializer::XMLSerializer ( )

Constructor.

◆ ~XMLSerializer()

VGears::XMLSerializer::~XMLSerializer ( )
virtual

Destructor.

Member Function Documentation

◆ FindChildNode()

TiXmlNode * VGears::XMLSerializer::FindChildNode ( TiXmlNode &  node,
const String tag 
)
protectedvirtual

Finds a child node of a XML node by name.

It doesn't search recursively, just among the direct children.

Parameters
[in]nodeThe XML node to search.
[in]tagName of the child to search for.
Returns
The child XML node by the specified name, or nullprt if there is no one that matches the name.

◆ Parse()

void VGears::XMLSerializer::Parse ( Ogre::DataStreamPtr &  stream,
TiXmlDocument &  dest 
)
protectedvirtual

Reads and parses the XML file.

Parameters
[in]streamThe contents of the XML file.
[out]destThe formed XML file.

◆ ReadAttribute() [1/9]

const String * VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute 
)
protectedvirtual

Reads an XMl node attribute as a string.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
Returns
The value of the specified attribute.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [2/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
bool &  dest,
const bool &  def = false 
)
protectedvirtual

Reads an XMl node attribute as a boolean.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [3/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
int &  dest,
const int &  def = 0 
)
protectedvirtual

Reads an XMl node attribute as an integer.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [4/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Ogre::Quaternion &  dest,
const Ogre::Quaternion &  def = Ogre::Quaternion::IDENTITY 
)
protectedvirtual

Reads an XMl node attribute as a quaternion.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [5/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Ogre::Real &  dest,
const Ogre::Real &  def = 0 
)
protectedvirtual

Reads an XMl node attribute as a real.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [6/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Ogre::Vector2 &  dest,
const Ogre::Vector2 &  def = Ogre::Vector2::ZERO 
)
protectedvirtual

Reads an XMl node attribute as a 2-dimension vector.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [7/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Ogre::Vector3 &  dest,
const Ogre::Vector3 &  def = Ogre::Vector3::ZERO 
)
protectedvirtual

Reads an XMl node attribute as a 3-dimension vector.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [8/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Ogre::Vector4 &  dest,
const Ogre::Vector4 &  def = Ogre::Vector4::ZERO 
)
protectedvirtual

Reads an XMl node attribute as a 4-dimension vector.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.

◆ ReadAttribute() [9/9]

bool VGears::XMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
String dest,
const String def = "" 
)
protectedvirtual

Reads an XMl node attribute as a string.

Parameters
[in]nodeThe XML node.
[in]attributeThe name of the attribute to read.
[out]destThe value of the specified attribute. If the attribute doesn't exists, the value of def will be set here.
[in]defDefault value.
Returns
True if the attribute was actually read, false if it didn't exist and the default value was loaded into dest.

Reimplemented in VGears::Background2DFileXMLSerializer.


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