UFO: Alien Invasion
xml.h
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2022 UFO: Alien Invasion.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 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
28void XML_AddString(xmlNode_t* parent, const char* name, const char* value);
29void XML_AddBool(xmlNode_t* parent, const char* name, bool value);
30void XML_AddFloat(xmlNode_t* parent, const char* name, float value);
31void XML_AddDouble(xmlNode_t* parent, const char* name, double value);
32void XML_AddByte(xmlNode_t* parent, const char* name, byte value);
33void XML_AddShort(xmlNode_t* parent, const char* name, short value);
34void XML_AddInt(xmlNode_t* parent, const char* name, int value);
35void XML_AddLong(xmlNode_t* parent, const char* name, long value);
36void XML_AddPos3(xmlNode_t* parent, const char* name, const vec3_t pos);
37void XML_AddPos2(xmlNode_t* parent, const char* name, const vec2_t pos);
38void XML_AddDate(xmlNode_t* parent, const char* name, const int day, const int sec);
39
40void XML_AddStringValue(xmlNode_t* parent, const char* name, const char* value);
41void XML_AddBoolValue(xmlNode_t* parent, const char* name, bool value);
42void XML_AddFloatValue(xmlNode_t* parent, const char* name, float value);
43void XML_AddDoubleValue(xmlNode_t* parent, const char* name, double value);
44void XML_AddByteValue(xmlNode_t* parent, const char* name, byte value);
45void XML_AddShortValue(xmlNode_t* parent, const char* name, short value);
46void XML_AddIntValue(xmlNode_t* parent, const char* name, int value);
47void XML_AddLongValue(xmlNode_t* parent, const char* name, long value);
48
49xmlNode_t* XML_AddNode(xmlNode_t* parent, const char* name);
50
51bool XML_GetBool(xmlNode_t* parent, const char* name, const bool defaultval);
52int XML_GetInt(xmlNode_t* parent, const char* name, const int defaultval);
53short XML_GetShort(xmlNode_t* parent, const char* name, const short defaultval);
54long XML_GetLong(xmlNode_t* parent, const char* name, const long defaultval);
55const char* XML_GetString(xmlNode_t* parent, const char* name);
56float XML_GetFloat(xmlNode_t* parent, const char* name, const float defaultval);
57double XML_GetDouble(xmlNode_t* parent, const char* name, const double defaultval);
58xmlNode_t* XML_GetPos2(xmlNode_t* parent, const char* name, vec2_t pos);
59xmlNode_t* XML_GetNextPos2(xmlNode_t* actual, xmlNode_t* parent, const char* name, vec2_t pos);
60xmlNode_t* XML_GetPos3(xmlNode_t* parent, const char* name, vec3_t pos);
61xmlNode_t* XML_GetNextPos3(xmlNode_t* actual, xmlNode_t* parent, const char* name, vec3_t pos);
62xmlNode_t* XML_GetDate(xmlNode_t* parent, const char* name, int* day, int* sec);
63
64xmlNode_t* XML_GetNode(xmlNode_t* parent, const char* name);
65xmlNode_t* XML_GetNextNode(xmlNode_t* current, xmlNode_t* parent, const char* name);
66
67xmlNode_t* XML_Parse(const char* buffer);
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
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_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Get next Node of the XML tree by name.
Definition: xml.cpp:499
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
double XML_GetDouble(xmlNode_t *parent, const char *name, const double defaultval)
retrieve a Double attribute from an XML Node
Definition: xml.cpp:378
float XML_GetFloat(xmlNode_t *parent, const char *name, const float defaultval)
retrieve a Float attribute from an XML Node
Definition: xml.cpp:364
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
void XML_AddByte(xmlNode_t *parent, const char *name, byte value)
add a Byte attribute to the XML Node
Definition: xml.cpp:137
bool XML_GetBool(xmlNode_t *parent, const char *name, const bool defaultval)
retrieve a Boolean attribute from an XML Node
Definition: xml.cpp:288
void XML_AddString(xmlNode_t *parent, const char *name, const char *value)
add a String attribute to the XML Node
Definition: xml.cpp:36
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
long XML_GetLong(xmlNode_t *parent, const char *name, const long defaultval)
retrieve a Long attribute from an XML Node
Definition: xml.cpp:336
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
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_AddShortValue(xmlNode_t *parent, const char *name, short value)
add a non-zero Short attribute to the XML Node
Definition: xml.cpp:172
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_AddFloat(xmlNode_t *parent, const char *name, float value)
add a Float attribute to the XML Node
Definition: xml.cpp:87
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_AddDouble(xmlNode_t *parent, const char *name, double value)
add a Double attribute to the XML Node
Definition: xml.cpp:110
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
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
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
const char * XML_GetString(xmlNode_t *parent, const char *name)
retrieve a String attribute from an XML Node
Definition: xml.cpp:350
void XML_AddLong(xmlNode_t *parent, const char *name, long value)
add a Long attribute to the XML Node
Definition: xml.cpp:206
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
void XML_AddBool(xmlNode_t *parent, const char *name, bool value)
add a Boolean attribute to the XML Node
Definition: xml.cpp:62
xmlNode_t * XML_Parse(const char *buffer)
Definition: xml.cpp:531
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
xmlNode_t * XML_AddNode(xmlNode_t *parent, const char *name)
add a new node to the XML tree
Definition: xml.cpp:277
void XML_AddInt(xmlNode_t *parent, const char *name, int value)
add an Int attribute to the XML Node
Definition: xml.cpp:183
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_AddShort(xmlNode_t *parent, const char *name, short value)
add a Short attribute to the XML Node
Definition: xml.cpp:160
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
#define xmlNode_t
Definition: xml.h:24
xmlNode_t * XML_GetNode(xmlNode_t *parent, const char *name)
Get first Node of the XML tree by name.
Definition: xml.cpp:487
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_AddBoolValue(xmlNode_t *parent, const char *name, bool value)
add a non-false Boolean attribute to the XML Node
Definition: xml.cpp:74