22 #if defined(_DEBUG) && defined(_WINDOWS)
23 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
36 std::cerr <<
"Bad XML_Element_c attempted to access field '" << field <<
"'\n";
46 std::cerr <<
"Bad XML_Element_c attempted to access first field\n";
56 std::cerr <<
"Bad XML_Element_c attempted to access next field\n";
70 std::cerr <<
"Bad XML_Element_c attempted to access value\n";
76 std::cerr <<
"XML_Element_c invalid\n";
80 return element->
Value();
101 std::cerr <<
"Bad XML_Element_c attempted to_string()\n";
107 std::cerr <<
"XML_Element_c invalid\n";
111 const char * text = element->
GetText();
113 std::cerr <<
"XML_Element_c attempted to_string() on non-leaf node\n";
147 std::cerr <<
"Bad XML_Element_c attempted to access field '" << field <<
"'\n";
157 std::cerr <<
"Bad XML_Element_c attempted to access first field\n";
167 std::cerr <<
"Bad XML_Element_c attempted to access next field\n";
177 std::cerr <<
"Bad XML_Element_c attempted to create_child(...)\n";
183 std::cerr <<
"XML_Element_c failed to create a child\n";
190 std::cerr <<
"Bad XML_Element_c attempted to remove_child(...)\n";
195 std::cerr <<
"XML_Element_c failed to remove a child\n";
218 std::cerr <<
"Bad XML_Element_c attempted set_string(...)\n";
231 std::cerr <<
"XML_Element_c attempted set_string(...) on non-leaf node\n";
264 std::cerr <<
"Failed to load XML_Document from memory\n"
272 std::cerr <<
"Failed to load XML_Document '" << filename <<
"'\n"
280 std::cerr <<
"Failed to save XML_Document" << std::endl
288 std::cerr <<
"Failed to save XML_Document '" << filename <<
"'\n"
334 std::cerr <<
"Bad XML_Document attempted to save\n";
343 std::cerr <<
"Bad XML_Document attempted to save to '" << filename <<
"'\n";
352 std::cerr <<
"Bad XML_Document attempted to access field '" << field <<
"'\n";
356 return (*m_root)[field];
361 std::cerr <<
"Bad XML_Document attempted to access field '" << field <<
"'\n";
365 return (*m_root)[field];
370 std::cerr <<
"Bad XML_Document attempted to access first field\n";
374 return m_root->
first();
379 std::cerr <<
"Bad XML_Document attempted to access first field\n";
383 return m_root->
first();
XML_Element operator[](const String &field)
Get a named subelement.
TiXmlNode * child(const String &field) const
String to_string() const
Get the contained string.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
void remove_child(const XML_Element &child)
Remove a child node, which will be rendered invalid.
void set_float(const float &f)
Set the contained string as a floating point number.
XML_Element_c(const TiXmlHandle &handle)
bool try_load(const String &filename)
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
void create_child(const String &field)
Create a child node.
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
XML_Element first()
Get the first subelement.
const char * c_str() const
String dtoa(const double &number)
void load_mem(const String &data)
return Display return Display Bool Bool int d
void create_root(const String &field)
(Re)Initializes the document with a given root field
float to_float() const
Get the contained string as a floating point number.
const char * Value() const
TiXmlElement * ToElement() const
void set_string(const String &s)
Set the contained string.
bool to_bool() const
Get the contained string as a boolean.
bool try_load_mem(const String &data)
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
String ftoa(const float &number)
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
TiXmlNode * first_child_element() const
double to_double() const
Get the contained string as a double precision floating point number.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
XML_Element_c operator[](const String &field) const
Get a named subelement.
TiXmlNode * first_child() const
const TiXmlElement * NextSiblingElement() const
String itoa(const int &number)
void set_bool(const bool &b)
Set the contained string as a boolean.
XML_Element_c operator[](const String &field) const
Get a named subelement.
void load(const String &filename)
void ZENI_LOGE(const Zeni::String &str)
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
A node in an XML tree, possibly containing useful data.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
XML_Element next()
Get the next subelement.
XML_Element_c first() const
Get the first subelement.
const char * GetText() const
void set_double(const double &d)
Set the contained string as a double precision floating point number.
String value() const
Get the value of the element (For nodes, this is the name)
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
TiXmlNode * child_element(const String &field) const
GLdouble GLdouble GLdouble b
int to_int() const
Get the contained string as an integer.
XML_Element_c next() const
Get the next subelement.
void set_int(const int &i)
Set the contained string as an integer.
XML_Element(const TiXmlHandle &handle)
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
XML_Element_c first() const
Get the first subelement.
TiXmlNode * ToNode() const
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
bool good() const
Test to see if the Element is valid.