UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
xml.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2020 UFO: Alien Invasion.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 */
20 
21 #pragma once
22 
23 #include <mxml.h>
24 #define xmlNode_t mxml_node_t
25 #include "../shared/mathlib.h"
26 #include "../shared/ufotypes.h"
27 
28 void XML_AddString(xmlNode_t* parent, const char* name, const char* value);
29 void XML_AddBool(xmlNode_t* parent, const char* name, bool value);
30 void XML_AddFloat(xmlNode_t* parent, const char* name, float value);
31 void XML_AddDouble(xmlNode_t* parent, const char* name, double value);
32 void XML_AddByte(xmlNode_t* parent, const char* name, byte value);
33 void XML_AddShort(xmlNode_t* parent, const char* name, short value);
34 void XML_AddInt(xmlNode_t* parent, const char* name, int value);
35 void XML_AddLong(xmlNode_t* parent, const char* name, long value);
36 void XML_AddPos3(xmlNode_t* parent, const char* name, const vec3_t pos);
37 void XML_AddPos2(xmlNode_t* parent, const char* name, const vec2_t pos);
38 void XML_AddDate(xmlNode_t* parent, const char* name, const int day, const int sec);
39 
40 void XML_AddStringValue(xmlNode_t* parent, const char* name, const char* value);
41 void XML_AddBoolValue(xmlNode_t* parent, const char* name, bool value);
42 void XML_AddFloatValue(xmlNode_t* parent, const char* name, float value);
43 void XML_AddDoubleValue(xmlNode_t* parent, const char* name, double value);
44 void XML_AddByteValue(xmlNode_t* parent, const char* name, byte value);
45 void XML_AddShortValue(xmlNode_t* parent, const char* name, short value);
46 void XML_AddIntValue(xmlNode_t* parent, const char* name, int value);
47 void XML_AddLongValue(xmlNode_t* parent, const char* name, long value);
48 
49 xmlNode_t* XML_AddNode(xmlNode_t* parent, const char* name);
50 
51 bool XML_GetBool(xmlNode_t* parent, const char* name, const bool defaultval);
52 int XML_GetInt(xmlNode_t* parent, const char* name, const int defaultval);
53 short XML_GetShort(xmlNode_t* parent, const char* name, const short defaultval);
54 long XML_GetLong(xmlNode_t* parent, const char* name, const long defaultval);
55 const char* XML_GetString(xmlNode_t* parent, const char* name);
56 float XML_GetFloat(xmlNode_t* parent, const char* name, const float defaultval);
57 double XML_GetDouble(xmlNode_t* parent, const char* name, const double defaultval);
58 xmlNode_t* XML_GetPos2(xmlNode_t* parent, const char* name, vec2_t pos);
59 xmlNode_t* XML_GetNextPos2(xmlNode_t* actual, xmlNode_t* parent, const char* name, vec2_t pos);
60 xmlNode_t* XML_GetPos3(xmlNode_t* parent, const char* name, vec3_t pos);
61 xmlNode_t* XML_GetNextPos3(xmlNode_t* actual, xmlNode_t* parent, const char* name, vec3_t pos);
62 xmlNode_t* XML_GetDate(xmlNode_t* parent, const char* name, int* day, int* sec);
63 
64 xmlNode_t* XML_GetNode(xmlNode_t* parent, const char* name);
65 xmlNode_t* XML_GetNextNode(xmlNode_t* current, xmlNode_t* parent, const char* name);
66 
67 xmlNode_t* XML_Parse(const char* buffer);
void XML_AddInt(xmlNode_t *parent, const char *name, int value)
add an Int attribute to the XML Node
Definition: xml.cpp:183
void XML_AddPos2(xmlNode_t *parent, const char *name, const vec2_t pos)
add a Pos2 data to the XML Tree
Definition: xml.cpp:249
xmlNode_t * XML_GetDate(xmlNode_t *parent, const char *name, int *day, int *sec)
retrieve the date data from an XML Node
Definition: xml.cpp:471
void XML_AddByteValue(xmlNode_t *parent, const char *name, byte value)
add a non-zero Byte attribute to the XML Node
Definition: xml.cpp:149
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
Definition: xml.cpp:413
void XML_AddByte(xmlNode_t *parent, const char *name, byte value)
add a Byte attribute to the XML Node
Definition: xml.cpp:137
void XML_AddBoolValue(xmlNode_t *parent, const char *name, bool value)
add a non-false Boolean attribute to the XML Node
Definition: xml.cpp:74
void XML_AddDate(xmlNode_t *parent, const char *name, const int day, const int sec)
add a date data to the XML Tree
Definition: xml.cpp:264
void XML_AddShortValue(xmlNode_t *parent, const char *name, short value)
add a non-zero Short attribute to the XML Node
Definition: xml.cpp:172
void XML_AddDoubleValue(xmlNode_t *parent, const char *name, double value)
add a non-zero Double attribute to the XML Node
Definition: xml.cpp:124
void XML_AddIntValue(xmlNode_t *parent, const char *name, int value)
add a non-zero Int attribute to the XML Node
Definition: xml.cpp:195
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
Definition: xml.cpp:451
long XML_GetLong(xmlNode_t *parent, const char *name, const long defaultval)
retrieve a Long attribute from an XML Node
Definition: xml.cpp:336
float XML_GetFloat(xmlNode_t *parent, const char *name, const float defaultval)
retrieve a Float attribute from an XML Node
Definition: xml.cpp:364
void XML_AddShort(xmlNode_t *parent, const char *name, short value)
add a Short attribute to the XML Node
Definition: xml.cpp:160
void XML_AddFloat(xmlNode_t *parent, const char *name, float value)
add a Float attribute to the XML Node
Definition: xml.cpp:87
void XML_AddLongValue(xmlNode_t *parent, const char *name, long value)
add a non-zero Long attribute to the XML Node
Definition: xml.cpp:220
#define xmlNode_t
Definition: xml.h:24
int XML_GetInt(xmlNode_t *parent, const char *name, const int defaultval)
retrieve an Int attribute from an XML Node
Definition: xml.cpp:308
void XML_AddFloatValue(xmlNode_t *parent, const char *name, float value)
add a non-zero Float attribute to the XML Node
Definition: xml.cpp:99
xmlNode_t * XML_Parse(const char *buffer)
Definition: xml.cpp:531
void XML_AddPos3(xmlNode_t *parent, const char *name, const vec3_t pos)
add a Pos3 data to the XML Tree
Definition: xml.cpp:234
void XML_AddBool(xmlNode_t *parent, const char *name, bool value)
add a Boolean attribute to the XML Node
Definition: xml.cpp:62
void XML_AddStringValue(xmlNode_t *parent, const char *name, const char *value)
add a non-empty String attribute to the XML Node
Definition: xml.cpp:49
void XML_AddString(xmlNode_t *parent, const char *name, const char *value)
add a String attribute to the XML Node
Definition: xml.cpp:36
xmlNode_t * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Get next Node of the XML tree by name.
Definition: xml.cpp:499
double XML_GetDouble(xmlNode_t *parent, const char *name, const double defaultval)
retrieve a Double attribute from an XML Node
Definition: xml.cpp:378
xmlNode_t * XML_AddNode(xmlNode_t *parent, const char *name)
add a new node to the XML tree
Definition: xml.cpp:277
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
xmlNode_t * XML_GetNode(xmlNode_t *parent, const char *name)
Get first Node of the XML tree by name.
Definition: xml.cpp:487
bool XML_GetBool(xmlNode_t *parent, const char *name, const bool defaultval)
retrieve a Boolean attribute from an XML Node
Definition: xml.cpp:288
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
const char * XML_GetString(xmlNode_t *parent, const char *name)
retrieve a String attribute from an XML Node
Definition: xml.cpp:350
xmlNode_t * XML_GetPos2(xmlNode_t *parent, const char *name, vec2_t pos)
retrieve the first Pos2 data from an XML Node
Definition: xml.cpp:394
short XML_GetShort(xmlNode_t *parent, const char *name, const short defaultval)
retrieve a Short attribute from an XML Node
Definition: xml.cpp:322
void XML_AddLong(xmlNode_t *parent, const char *name, long value)
add a Long attribute to the XML Node
Definition: xml.cpp:206
uint8_t byte
Definition: ufotypes.h:34
void XML_AddDouble(xmlNode_t *parent, const char *name, double value)
add a Double attribute to the XML Node
Definition: xml.cpp:110
xmlNode_t * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
retrieve the first Pos3 data from an XML Node
Definition: xml.cpp:431