UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
xml.h File Reference
#include <mxml.h>
#include "../shared/mathlib.h"
#include "../shared/ufotypes.h"

Go to the source code of this file.

Macros

#define xmlNode_t   mxml_node_t
 

Functions

void XML_AddString (xmlNode_t *parent, const char *name, const char *value)
 add a String attribute to the XML Node More...
 
void XML_AddBool (xmlNode_t *parent, const char *name, bool value)
 add a Boolean attribute to the XML Node More...
 
void XML_AddFloat (xmlNode_t *parent, const char *name, float value)
 add a Float attribute to the XML Node More...
 
void XML_AddDouble (xmlNode_t *parent, const char *name, double value)
 add a Double attribute to the XML Node More...
 
void XML_AddByte (xmlNode_t *parent, const char *name, byte value)
 add a Byte attribute to the XML Node More...
 
void XML_AddShort (xmlNode_t *parent, const char *name, short value)
 add a Short attribute to the XML Node More...
 
void XML_AddInt (xmlNode_t *parent, const char *name, int value)
 add an Int attribute to the XML Node More...
 
void XML_AddLong (xmlNode_t *parent, const char *name, long value)
 add a Long attribute to the XML Node More...
 
void XML_AddPos3 (xmlNode_t *parent, const char *name, const vec3_t pos)
 add a Pos3 data to the XML Tree More...
 
void XML_AddPos2 (xmlNode_t *parent, const char *name, const vec2_t pos)
 add a Pos2 data to the XML Tree More...
 
void XML_AddDate (xmlNode_t *parent, const char *name, const int day, const int sec)
 add a date data to the XML Tree More...
 
void XML_AddStringValue (xmlNode_t *parent, const char *name, const char *value)
 add a non-empty String attribute to the XML Node More...
 
void XML_AddBoolValue (xmlNode_t *parent, const char *name, bool value)
 add a non-false Boolean attribute to the XML Node More...
 
void XML_AddFloatValue (xmlNode_t *parent, const char *name, float value)
 add a non-zero Float attribute to the XML Node More...
 
void XML_AddDoubleValue (xmlNode_t *parent, const char *name, double value)
 add a non-zero Double attribute to the XML Node More...
 
void XML_AddByteValue (xmlNode_t *parent, const char *name, byte value)
 add a non-zero Byte attribute to the XML Node More...
 
void XML_AddShortValue (xmlNode_t *parent, const char *name, short value)
 add a non-zero Short attribute to the XML Node More...
 
void XML_AddIntValue (xmlNode_t *parent, const char *name, int value)
 add a non-zero Int attribute to the XML Node More...
 
void XML_AddLongValue (xmlNode_t *parent, const char *name, long value)
 add a non-zero Long attribute to the XML Node More...
 
xmlNode_tXML_AddNode (xmlNode_t *parent, const char *name)
 add a new node to the XML tree More...
 
bool XML_GetBool (xmlNode_t *parent, const char *name, const bool defaultval)
 retrieve a Boolean attribute from an XML Node More...
 
int XML_GetInt (xmlNode_t *parent, const char *name, const int defaultval)
 retrieve an Int attribute from an XML Node More...
 
short XML_GetShort (xmlNode_t *parent, const char *name, const short defaultval)
 retrieve a Short attribute from an XML Node More...
 
long XML_GetLong (xmlNode_t *parent, const char *name, const long defaultval)
 retrieve a Long attribute from an XML Node More...
 
const char * XML_GetString (xmlNode_t *parent, const char *name)
 retrieve a String attribute from an XML Node More...
 
float XML_GetFloat (xmlNode_t *parent, const char *name, const float defaultval)
 retrieve a Float attribute from an XML Node More...
 
double XML_GetDouble (xmlNode_t *parent, const char *name, const double defaultval)
 retrieve a Double attribute from an XML Node More...
 
xmlNode_tXML_GetPos2 (xmlNode_t *parent, const char *name, vec2_t pos)
 retrieve the first Pos2 data from an XML Node More...
 
xmlNode_tXML_GetNextPos2 (xmlNode_t *actual, xmlNode_t *parent, const char *name, vec2_t pos)
 retrieve the next Pos2 data from an XML Node More...
 
xmlNode_tXML_GetPos3 (xmlNode_t *parent, const char *name, vec3_t pos)
 retrieve the first Pos3 data from an XML Node More...
 
xmlNode_tXML_GetNextPos3 (xmlNode_t *actual, xmlNode_t *parent, const char *name, vec3_t pos)
 retrieve the next Pos3 data from an XML Node More...
 
xmlNode_tXML_GetDate (xmlNode_t *parent, const char *name, int *day, int *sec)
 retrieve the date data from an XML Node More...
 
xmlNode_tXML_GetNode (xmlNode_t *parent, const char *name)
 Get first Node of the XML tree by name. More...
 
xmlNode_tXML_GetNextNode (xmlNode_t *current, xmlNode_t *parent, const char *name)
 Get next Node of the XML tree by name. More...
 
xmlNode_tXML_Parse (const char *buffer)
 

Macro Definition Documentation

Function Documentation

void XML_AddBool ( xmlNode_t parent,
const char *  name,
bool  value 
)

add a Boolean attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 62 of file xml.cpp.

Referenced by GAME_GetImportData(), and XML_AddBoolValue().

void XML_AddBoolValue ( xmlNode_t parent,
const char *  name,
bool  value 
)

add a non-false Boolean attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is false nothing will be added

Definition at line 74 of file xml.cpp.

References XML_AddBool().

Referenced by GAME_GetImportData().

void XML_AddByte ( xmlNode_t parent,
const char *  name,
byte  value 
)

add a Byte attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 137 of file xml.cpp.

References XML_AddLong().

Referenced by GAME_GetImportData().

void XML_AddByteValue ( xmlNode_t parent,
const char *  name,
byte  value 
)

add a non-zero Byte attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 149 of file xml.cpp.

References XML_AddLongValue().

Referenced by GAME_GetImportData().

void XML_AddDate ( xmlNode_t parent,
const char *  name,
const int  day,
const int  sec 
)

add a date data to the XML Tree

Parameters
[out]parentXML Node structure to add to
[in]nameName of the node to add
[in]dayDay part of the date
[in]secSecond part of the date
Note
it creates a new node and adds day/sec attributes to the node

Definition at line 264 of file xml.cpp.

References XML_AddInt(), and xmlNode_t.

Referenced by GAME_GetImportData().

void XML_AddDouble ( xmlNode_t parent,
const char *  name,
double  value 
)

add a Double attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 110 of file xml.cpp.

Referenced by GAME_GetImportData(), XML_AddDoubleValue(), and XML_AddFloat().

void XML_AddDoubleValue ( xmlNode_t parent,
const char *  name,
double  value 
)

add a non-zero Double attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 124 of file xml.cpp.

References XML_AddDouble().

Referenced by GAME_GetImportData(), and XML_AddFloatValue().

void XML_AddFloat ( xmlNode_t parent,
const char *  name,
float  value 
)

add a Float attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 87 of file xml.cpp.

References XML_AddDouble().

Referenced by GAME_GetImportData(), XML_AddPos2(), and XML_AddPos3().

void XML_AddFloatValue ( xmlNode_t parent,
const char *  name,
float  value 
)

add a non-zero Float attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 99 of file xml.cpp.

References XML_AddDoubleValue().

Referenced by GAME_GetImportData().

void XML_AddInt ( xmlNode_t parent,
const char *  name,
int  value 
)

add an Int attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 183 of file xml.cpp.

References XML_AddLong().

Referenced by GAME_GetImportData(), GAME_SaveCharacter(), GAME_SaveItem(), and XML_AddDate().

void XML_AddIntValue ( xmlNode_t parent,
const char *  name,
int  value 
)

add a non-zero Int attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 195 of file xml.cpp.

References XML_AddLongValue().

Referenced by GAME_GetImportData(), GAME_SaveCharacter(), GAME_SaveItem(), and GAME_SaveTeam().

void XML_AddLong ( xmlNode_t parent,
const char *  name,
long  value 
)

add a Long attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 206 of file xml.cpp.

Referenced by GAME_GetImportData(), XML_AddByte(), XML_AddInt(), XML_AddLongValue(), and XML_AddShort().

void XML_AddLongValue ( xmlNode_t parent,
const char *  name,
long  value 
)

add a non-zero Long attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 220 of file xml.cpp.

References XML_AddLong().

Referenced by GAME_GetImportData(), XML_AddByteValue(), XML_AddIntValue(), and XML_AddShortValue().

xmlNode_t* XML_AddNode ( xmlNode_t parent,
const char *  name 
)

add a new node to the XML tree

Parameters
[out]parentXML Node structure to add to
[in]nameName of the new node return pointer to the new XML Node structure

Definition at line 277 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_SaveCharacter(), GAME_SaveInventory(), GAME_SaveTeam(), and GAME_SaveTeamInfo().

void XML_AddPos2 ( xmlNode_t parent,
const char *  name,
const vec2_t  pos 
)

add a Pos2 data to the XML Tree

Parameters
[out]parentXML Node structure to add to
[in]nameName of the node to add
[in]posPos2 structure with position data
Note
it creates a new node and adds coordinate(s) to the node as attributes

Definition at line 249 of file xml.cpp.

References XML_AddFloat(), and xmlNode_t.

Referenced by GAME_GetImportData().

void XML_AddPos3 ( xmlNode_t parent,
const char *  name,
const vec3_t  pos 
)

add a Pos3 data to the XML Tree

Parameters
[out]parentXML Node structure to add to
[in]nameName of the node to add
[in]posPos3 structure with position data
Note
it creates a new node and adds coordinate(s) to the node as attributes

Definition at line 234 of file xml.cpp.

References XML_AddFloat(), and xmlNode_t.

Referenced by GAME_GetImportData().

void XML_AddShort ( xmlNode_t parent,
const char *  name,
short  value 
)

add a Short attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 160 of file xml.cpp.

References XML_AddLong().

Referenced by GAME_GetImportData().

void XML_AddShortValue ( xmlNode_t parent,
const char *  name,
short  value 
)

add a non-zero Short attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is zero nothing will be added

Definition at line 172 of file xml.cpp.

References XML_AddLongValue().

Referenced by GAME_GetImportData().

void XML_AddString ( xmlNode_t parent,
const char *  name,
const char *  value 
)

add a String attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute

Definition at line 36 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_SaveCharacter(), GAME_SaveItem(), GAME_SaveTeam(), and XML_AddStringValue().

void XML_AddStringValue ( xmlNode_t parent,
const char *  name,
const char *  value 
)

add a non-empty String attribute to the XML Node

Parameters
[out]parentXML Node structure to add to
[in]nameName of the attribute
[in]valueValue of the attribute
Note
if the value is empty nothing will be added

Definition at line 49 of file xml.cpp.

References Q_strnull(), and XML_AddString().

Referenced by GAME_GetImportData().

bool XML_GetBool ( xmlNode_t parent,
const char *  name,
const bool  defaultval 
)

retrieve a Boolean attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 288 of file xml.cpp.

References Q_streq.

Referenced by GAME_GetImportData().

xmlNode_t* XML_GetDate ( xmlNode_t parent,
const char *  name,
int day,
int sec 
)

retrieve the date data from an XML Node

Parameters
[in]parentXML Node structure to get child from
[in]nameName of the pos node
[out]dayDay part of the date to fill
[out]secSecond part of the date to fill
Returns
pointer to the node the data was retrieved from
nullptr if no node with name found

Definition at line 471 of file xml.cpp.

References XML_GetInt(), XML_GetNode(), and xmlNode_t.

Referenced by GAME_GetImportData().

double XML_GetDouble ( xmlNode_t parent,
const char *  name,
const double  defaultval 
)

retrieve a Double attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 378 of file xml.cpp.

Referenced by GAME_GetImportData().

float XML_GetFloat ( xmlNode_t parent,
const char *  name,
const float  defaultval 
)

retrieve a Float attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 364 of file xml.cpp.

Referenced by GAME_GetImportData(), XML_GetNextPos2(), XML_GetNextPos3(), XML_GetPos2(), and XML_GetPos3().

int XML_GetInt ( xmlNode_t parent,
const char *  name,
const int  defaultval 
)

retrieve an Int attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 308 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_LoadCharacter(), GAME_LoadItem(), GAME_LoadTeam(), and XML_GetDate().

long XML_GetLong ( xmlNode_t parent,
const char *  name,
const long  defaultval 
)

retrieve a Long attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 336 of file xml.cpp.

Referenced by GAME_GetImportData().

xmlNode_t* XML_GetNextNode ( xmlNode_t current,
xmlNode_t parent,
const char *  name 
)

Get next Node of the XML tree by name.

Parameters
[in]currentPointer to the previous Node was found
[in]parentParent XML Node structure
[in]nameName of the node to retrieve
Returns
pointer to the found XML Node structure or nullptr

Definition at line 499 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_LoadCharacter(), GAME_LoadInventory(), GAME_LoadTeam(), GAME_LoadTeamInfo(), XML_GetNextPos2(), and XML_GetNextPos3().

xmlNode_t* XML_GetNextPos2 ( xmlNode_t actual,
xmlNode_t parent,
const char *  name,
vec2_t  pos 
)

retrieve the next Pos2 data from an XML Node

Parameters
[in]actualXML Node pointer of the previous pos data
[in]parentXML Node structure to get child from
[in]nameName of the pos node
[out]posvec2_t structure to fill
Returns
pointer to the node the data was retrieved from
nullptr if no Node with name found

Definition at line 413 of file xml.cpp.

References XML_GetFloat(), XML_GetNextNode(), and xmlNode_t.

Referenced by GAME_GetImportData().

xmlNode_t* XML_GetNextPos3 ( xmlNode_t actual,
xmlNode_t parent,
const char *  name,
vec3_t  pos 
)

retrieve the next Pos3 data from an XML Node

Parameters
[in]actualXML Node pointer of the previous pos data
[in]parentXML Node structure to get child from
[in]nameName of the pos node
[out]posvec3_t structure to fill
Returns
pointer to the node the data was retrieved from
nullptr if no Node with name found

Definition at line 451 of file xml.cpp.

References XML_GetFloat(), XML_GetNextNode(), and xmlNode_t.

Referenced by GAME_GetImportData().

xmlNode_t* XML_GetNode ( xmlNode_t parent,
const char *  name 
)

Get first Node of the XML tree by name.

Parameters
[in]parentParent XML Node structure
[in]nameName of the node to retrieve
Returns
pointer to the found XML Node structure or nullptr

Definition at line 487 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_LoadCharacter(), GAME_LoadInventory(), GAME_LoadTeam(), GAME_LoadTeamInfo(), XML_GetDate(), XML_GetPos2(), and XML_GetPos3().

xmlNode_t* XML_GetPos2 ( xmlNode_t parent,
const char *  name,
vec2_t  pos 
)

retrieve the first Pos2 data from an XML Node

Parameters
[in]parentXML Node structure to get child from
[in]nameName of the pos node
[out]posvec2_t structure to fill
Returns
pointer to the node the data was retrieved from
nullptr if no node with name found

Definition at line 394 of file xml.cpp.

References XML_GetFloat(), XML_GetNode(), and xmlNode_t.

Referenced by GAME_GetImportData().

xmlNode_t* XML_GetPos3 ( xmlNode_t parent,
const char *  name,
vec3_t  pos 
)

retrieve the first Pos3 data from an XML Node

Parameters
[in]parentXML Node structure to get child from
[in]nameName of the pos node
[out]posvec3_t structure to fill
Returns
pointer to the node the data was retrieved from
nullptr if no node with name found

Definition at line 431 of file xml.cpp.

References XML_GetFloat(), XML_GetNode(), and xmlNode_t.

Referenced by GAME_GetImportData().

short XML_GetShort ( xmlNode_t parent,
const char *  name,
const short  defaultval 
)

retrieve a Short attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
[in]defaultvalDefault value to return if no such attribute defined

Definition at line 322 of file xml.cpp.

Referenced by GAME_GetImportData().

const char* XML_GetString ( xmlNode_t parent,
const char *  name 
)

retrieve a String attribute from an XML Node

Parameters
[in]parentXML Node structure to get from
[in]nameName of the attribute
Returns
empty string if no such attribute defined

Definition at line 350 of file xml.cpp.

Referenced by GAME_GetImportData(), GAME_LoadCharacter(), GAME_LoadItem(), and GAME_LoadTeam().

xmlNode_t* XML_Parse ( const char *  buffer)

Definition at line 531 of file xml.cpp.

References mxml_ufo_type_cb().

Referenced by GAME_GetImportData(), and GAME_LoadTeam().