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

Handles the serialization of 2D background XML files. More...

#include <VGearsBackground2DFileXMLSerializer.h>

Inheritance diagram for VGears::Background2DFileXMLSerializer:
Collaboration diagram for VGears::Background2DFileXMLSerializer:

Public Member Functions

 Background2DFileXMLSerializer ()
 Constructor. More...
 
virtual ~Background2DFileXMLSerializer ()
 Destructor. More...
 
virtual void ImportBackground2DFile (Ogre::DataStreamPtr &stream, Background2DFile *dest)
 Imports a 2D background XML file. More...
 
- Public Member Functions inherited from VGears::XMLSerializer
 XMLSerializer ()
 Constructor. More...
 
virtual ~XMLSerializer ()
 Destructor. More...
 

Protected Member Functions

virtual void ReadHeader (TiXmlNode *node)
 Reads a file header and sets the instance data. More...
 
virtual bool ReadAttribute (TiXmlNode &node, const String &attribute, Blending &dest, const Blending &def)
 Reads an XMl node attribute as tile blending information. More...
 
virtual void readObject (TiXmlNode &node, Tile &dest)
 Reads an XML node as a tile. More...
 
virtual void readObject (TiXmlNode &node, Animation &dest)
 Reads an XML node as an animation. More...
 
virtual void readObject (TiXmlNode &node, KeyFrame &dest)
 Reads an XML node as a key frame. More...
 
template<typename ValueType >
void ReadVector (TiXmlNode &node, const String &tag, std::vector< ValueType > &dest)
 Reads a XML node as a vector. More...
 
template<typename KeyType , typename ValueType >
void ReadMap (TiXmlNode &node, const String &tag, const String &key_attribute, std::map< KeyType, ValueType > &dest)
 Reads a XML node as a map. 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...
 
- Protected Member Functions inherited from VGears::XMLSerializer
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...
 

Static Protected Attributes

static const String BLENDING_ALPHA
 Alpha-type blending key. More...
 
static const String BLENDING_ADD
 Add-type blending key. More...
 
static const String BLENDING_SUBTRACT
 Substract-type blending key. More...
 

Detailed Description

Handles the serialization of 2D background XML files.

Constructor & Destructor Documentation

◆ Background2DFileXMLSerializer()

VGears::Background2DFileXMLSerializer::Background2DFileXMLSerializer ( )

Constructor.

◆ ~Background2DFileXMLSerializer()

VGears::Background2DFileXMLSerializer::~Background2DFileXMLSerializer ( )
virtual

Destructor.

Member Function Documentation

◆ ImportBackground2DFile()

void VGears::Background2DFileXMLSerializer::ImportBackground2DFile ( Ogre::DataStreamPtr &  stream,
Background2DFile dest 
)
virtual

Imports a 2D background XML file.

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

◆ ReadAttribute() [1/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [2/10]

bool VGears::Background2DFileXMLSerializer::ReadAttribute ( TiXmlNode &  node,
const String attribute,
Blending dest,
const Blending def 
)
protectedvirtual

Reads an XMl node attribute as tile blending information.

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.

◆ ReadAttribute() [3/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [4/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [5/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [6/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [7/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [8/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [9/10]

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 from VGears::XMLSerializer.

◆ ReadAttribute() [10/10]

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 from VGears::XMLSerializer.

◆ ReadHeader()

void VGears::Background2DFileXMLSerializer::ReadHeader ( TiXmlNode *  node)
protectedvirtual

Reads a file header and sets the instance data.

Parameters
[in]nodeThe XML node to read from.

◆ ReadMap()

template<typename KeyType , typename ValueType >
void VGears::Background2DFileXMLSerializer::ReadMap ( TiXmlNode &  node,
const String tag,
const String key_attribute,
std::map< KeyType, ValueType > &  dest 
)
inlineprotected

Reads a XML node as a map.

Parameters
[in]nodeThe XML node to read.
[in]tagXML tag to read.
[in]key_attribute
Todo:
Understand and document.
Parameters
[out]destThe map data will be loaded here.

◆ readObject() [1/3]

void VGears::Background2DFileXMLSerializer::readObject ( TiXmlNode &  node,
Animation dest 
)
protectedvirtual

Reads an XML node as an animation.

Parameters
[in]nodeThe XML node to read.
[out]destThe formed animation data.

◆ readObject() [2/3]

void VGears::Background2DFileXMLSerializer::readObject ( TiXmlNode &  node,
KeyFrame dest 
)
protectedvirtual

Reads an XML node as a key frame.

Parameters
[in]nodeThe XML node to read.
[out]destThe formed key frame data.

◆ readObject() [3/3]

void VGears::Background2DFileXMLSerializer::readObject ( TiXmlNode &  node,
Tile dest 
)
protectedvirtual

Reads an XML node as a tile.

Parameters
[in]nodeThe XML node to read.
[out]destThe formed tile data.

◆ ReadVector()

template<typename ValueType >
void VGears::Background2DFileXMLSerializer::ReadVector ( TiXmlNode &  node,
const String tag,
std::vector< ValueType > &  dest 
)
inlineprotected

Reads a XML node as a vector.

Parameters
[in]nodeThe XML node to read.
[in]tagXML tag to read.
[out]destThe vector data will be loaded here.

Member Data Documentation

◆ BLENDING_ADD

const String VGears::Background2DFileXMLSerializer::BLENDING_ADD
staticprotected

Add-type blending key.

◆ BLENDING_ALPHA

const String VGears::Background2DFileXMLSerializer::BLENDING_ALPHA
staticprotected

Alpha-type blending key.

◆ BLENDING_SUBTRACT

const String VGears::Background2DFileXMLSerializer::BLENDING_SUBTRACT
staticprotected

Substract-type blending key.


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