Configuration file wrapper. More...
#include <configuration.h>
Public Member Functions | |
bool | addNode (TiXmlElement *node) |
bool | addNode (TiXmlElement *node, TiXmlElement *parent) |
CConfiguration (const char *rootNode) | |
CConfiguration () | |
void | clear () |
TiXmlElement * | findNode (const char *name) |
TiXmlElement * | findNode (const char *name, TiXmlElement *start) |
void | findNodes (const char *name, std::vector< TiXmlElement * > &result) |
void | findNodes (const char *name, std::vector< TiXmlElement * > &result, TiXmlElement *start) |
bool | getBoolean (const char *str, bool def=false) |
bool | getBoolean (const char *str, TiXmlElement *start, bool def=false) |
TiXmlDocument & | getDocument () |
double | getDouble (const char *str, double def=0.0) |
double | getDouble (const char *str, TiXmlElement *start, double def=0.0) |
float | getFloat (const char *str, float def=0.0) |
float | getFloat (const char *str, TiXmlElement *start, float def=0.0) |
int | getInteger (const char *str, int def=0) |
int | getInteger (const char *str, TiXmlElement *start, int def=0) |
TiXmlElement * | getNode (const char *name) |
const char * | getString (const char *str, const char *def="") |
const char * | getString (const char *str, TiXmlElement *start, const char *def="") |
unsigned long | getUnsignedLong (const char *str, unsigned long def=0) |
bool | insertNode (TiXmlElement *node, TiXmlElement *afterThis) |
bool | insertNode (TiXmlElement *node, TiXmlElement *afterThis, TiXmlElement *parent) |
bool | load (const char *cfgFile) |
bool | parse (const char *str) |
bool | removeAttribute (TiXmlElement *element, const char *name) |
bool | removeNode (TiXmlElement *element) |
bool | removeNode (TiXmlElement *element, TiXmlElement *parent) |
void | save (const char *cfgFile) |
void | setBoolean (const char *str, bool value) |
void | setDouble (const char *str, double value) |
void | setFloat (const char *str, float value) |
void | setInteger (const char *str, int value) |
void | setRootNode (const char *node) |
void | setString (const char *str, const char *value) |
virtual | ~CConfiguration () |
Static Public Member Functions | |
static bool | getAttributeBoolean (TiXmlElement *node, const char *str, bool def=false) |
static double | getAttributeDouble (TiXmlElement *node, const char *str, double def=0.0) |
static float | getAttributeFloat (TiXmlElement *node, const char *str, float def=0.0) |
static int | getAttributeInteger (TiXmlElement *node, const char *str, int def=0) |
static const char * | getAttributeString (TiXmlElement *node, const char *str, const char *def="") |
static unsigned long | getAttributeUnsignedLong (TiXmlElement *node, const char *str, unsigned long def=0) |
static std::string | getText (TiXmlElement *node) |
static void | setAttributeBoolean (TiXmlElement *node, const char *str, bool value) |
static void | setAttributeDouble (TiXmlElement *node, const char *str, double value) |
static void | setAttributeFloat (TiXmlElement *node, const char *str, float value) |
static void | setAttributeInteger (TiXmlElement *node, const char *str, int value) |
static void | setAttributeString (TiXmlElement *node, const char *str, const char *value) |
Protected Member Functions | |
void | findNodes (const char *name, std::vector< TiXmlElement * > &result, TiXmlElement *start, unsigned int level) |
Protected Attributes | |
TiXmlDocument | doc |
char | rootNode [255] |
Configuration file wrapper.
Copyright (c) 2016, Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loads and stores configuration data (in a xml file). Set rootNode to root node of xml file first, then use setters and getters to access the data.
Definition at line 34 of file configuration.h.
CConfiguration::CConfiguration | ( | const char * | rootNode | ) |
Definition at line 34 of file configuration.cpp.
CConfiguration::CConfiguration | ( | ) |
Definition at line 29 of file configuration.cpp.
|
virtual |
Definition at line 44 of file configuration.cpp.
bool CConfiguration::addNode | ( | TiXmlElement * | node | ) |
Definition at line 453 of file configuration.cpp.
bool CConfiguration::addNode | ( | TiXmlElement * | node, |
TiXmlElement * | parent | ||
) |
Definition at line 462 of file configuration.cpp.
void CConfiguration::clear | ( | ) |
Definition at line 48 of file configuration.cpp.
TiXmlElement * CConfiguration::findNode | ( | const char * | name | ) |
Definition at line 101 of file configuration.cpp.
TiXmlElement * CConfiguration::findNode | ( | const char * | name, |
TiXmlElement * | start | ||
) |
Definition at line 108 of file configuration.cpp.
|
protected |
Definition at line 160 of file configuration.cpp.
void CConfiguration::findNodes | ( | const char * | name, |
std::vector< TiXmlElement * > & | result | ||
) |
Definition at line 153 of file configuration.cpp.
void CConfiguration::findNodes | ( | const char * | name, |
std::vector< TiXmlElement * > & | result, | ||
TiXmlElement * | start | ||
) |
Definition at line 186 of file configuration.cpp.
|
static |
Definition at line 255 of file configuration.cpp.
|
static |
Definition at line 227 of file configuration.cpp.
|
static |
Definition at line 219 of file configuration.cpp.
|
static |
Definition at line 246 of file configuration.cpp.
|
static |
Definition at line 237 of file configuration.cpp.
|
static |
Definition at line 88 of file configuration.cpp.
bool CConfiguration::getBoolean | ( | const char * | str, |
bool | def = false |
||
) |
Definition at line 392 of file configuration.cpp.
bool CConfiguration::getBoolean | ( | const char * | str, |
TiXmlElement * | start, | ||
bool | def = false |
||
) |
Definition at line 436 of file configuration.cpp.
TiXmlDocument & CConfiguration::getDocument | ( | ) |
Definition at line 39 of file configuration.cpp.
double CConfiguration::getDouble | ( | const char * | str, |
double | def = 0.0 |
||
) |
Definition at line 376 of file configuration.cpp.
double CConfiguration::getDouble | ( | const char * | str, |
TiXmlElement * | start, | ||
double | def = 0.0 |
||
) |
Definition at line 420 of file configuration.cpp.
float CConfiguration::getFloat | ( | const char * | str, |
float | def = 0.0 |
||
) |
Definition at line 371 of file configuration.cpp.
float CConfiguration::getFloat | ( | const char * | str, |
TiXmlElement * | start, | ||
float | def = 0.0 |
||
) |
Definition at line 415 of file configuration.cpp.
int CConfiguration::getInteger | ( | const char * | str, |
int | def = 0 |
||
) |
Definition at line 384 of file configuration.cpp.
int CConfiguration::getInteger | ( | const char * | str, |
TiXmlElement * | start, | ||
int | def = 0 |
||
) |
Definition at line 428 of file configuration.cpp.
TiXmlElement * CConfiguration::getNode | ( | const char * | name | ) |
Definition at line 448 of file configuration.cpp.
const char * CConfiguration::getString | ( | const char * | str, |
const char * | def = "" |
||
) |
Definition at line 361 of file configuration.cpp.
const char * CConfiguration::getString | ( | const char * | str, |
TiXmlElement * | start, | ||
const char * | def = "" |
||
) |
Definition at line 405 of file configuration.cpp.
|
static |
Definition at line 353 of file configuration.cpp.
unsigned long CConfiguration::getUnsignedLong | ( | const char * | str, |
unsigned long | def = 0 |
||
) |
Definition at line 80 of file configuration.cpp.
bool CConfiguration::insertNode | ( | TiXmlElement * | node, |
TiXmlElement * | afterThis | ||
) |
Definition at line 474 of file configuration.cpp.
bool CConfiguration::insertNode | ( | TiXmlElement * | node, |
TiXmlElement * | afterThis, | ||
TiXmlElement * | parent | ||
) |
Definition at line 486 of file configuration.cpp.
bool CConfiguration::load | ( | const char * | cfgFile | ) |
Definition at line 65 of file configuration.cpp.
bool CConfiguration::parse | ( | const char * | str | ) |
Definition at line 72 of file configuration.cpp.
bool CConfiguration::removeAttribute | ( | TiXmlElement * | element, |
const char * | name | ||
) |
Definition at line 520 of file configuration.cpp.
bool CConfiguration::removeNode | ( | TiXmlElement * | element | ) |
Definition at line 512 of file configuration.cpp.
bool CConfiguration::removeNode | ( | TiXmlElement * | element, |
TiXmlElement * | parent | ||
) |
Definition at line 501 of file configuration.cpp.
void CConfiguration::save | ( | const char * | cfgFile | ) |
Definition at line 96 of file configuration.cpp.
|
static |
Definition at line 303 of file configuration.cpp.
|
static |
Definition at line 281 of file configuration.cpp.
|
static |
Definition at line 273 of file configuration.cpp.
|
static |
Definition at line 295 of file configuration.cpp.
|
static |
Definition at line 289 of file configuration.cpp.
void CConfiguration::setBoolean | ( | const char * | str, |
bool | value | ||
) |
Definition at line 345 of file configuration.cpp.
void CConfiguration::setDouble | ( | const char * | str, |
double | value | ||
) |
Definition at line 320 of file configuration.cpp.
void CConfiguration::setFloat | ( | const char * | str, |
float | value | ||
) |
Definition at line 313 of file configuration.cpp.
void CConfiguration::setInteger | ( | const char * | str, |
int | value | ||
) |
Definition at line 338 of file configuration.cpp.
void CConfiguration::setRootNode | ( | const char * | node | ) |
Definition at line 53 of file configuration.cpp.
void CConfiguration::setString | ( | const char * | str, |
const char * | value | ||
) |
Definition at line 327 of file configuration.cpp.
|
protected |
Definition at line 37 of file configuration.h.
|
protected |
Definition at line 38 of file configuration.h.