zenilib: Zeni::XML_Element Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | List of all members
Zeni::XML_Element Class Reference
Zenilib

A node in an XML tree, possibly containing useful data. More...

`#include <XML.h>`

Inherits Zeni::XML_Element_c.

## Public Member Functions

| XML_Element (const TiXmlHandle &handle)
void | create_child (const String &field)
| Create a child node. More...
XML_Element | first ()
| Get the first subelement. More...
XML_Element | next ()
| Get the next subelement. More...
XML_Element | operator[] (const String &field)
| Get a named subelement. More...
void | remove_child (const XML_Element &child)
| Remove a child node, which will be rendered invalid. More...
void | set_bool (const bool &b)
| Set the contained string as a boolean. More...
void | set_double (const double &d)
| Set the contained string as a double precision floating point number. More...
void | set_float (const float &f)
| Set the contained string as a floating point number. More...
void | set_int (const int &i)
| Set the contained string as an integer. More...
void | set_string (const String &s)
| Set the contained string. More...
Public Member Functions inherited from Zeni::XML_Element_c
| XML_Element_c (const TiXmlHandle &handle)
XML_Element_c | first () const
| Get the first subelement. More...
bool | good () const
| Test to see if the Element is valid. More...
XML_Element_c | next () const
| Get the next subelement. More...
XML_Element_c | operator[] (const String &field) const
| Get a named subelement. More...
bool | to_bool () const
| Get the contained string as a boolean. More...
double | to_double () const
| Get the contained string as a double precision floating point number. More...
float | to_float () const
| Get the contained string as a floating point number. More...
int | to_int () const
| Get the contained string as an integer. More...
String | to_string () const
| Get the contained string. More...
String | value () const
| Get the value of the element (For nodes, this is the name) More...

## Additional Inherited Members

Protected Member Functions inherited from Zeni::XML_Element_c
TiXmlNode * | child (const String &field) const
TiXmlNode * | child_element (const String &field) const
TiXmlNode * | first_child () const
TiXmlNode * | first_child_element () const
Protected Attributes inherited from Zeni::XML_Element_c
TiXmlHandle | m_handle

## Detailed Description

A node in an XML tree, possibly containing useful data.

Note
  There is no functionality (currently) to cleanly exit an iteration through XML_Elements. The only way out is to catch the Bad_XML_Access when thrown.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 86 of file XML.h.

## Constructor & Destructor Documentation

Zeni::XML_Element::XML_Element | ( | const TiXmlHandle & | handle | ) |

Definition at line 140 of file XML.cpp.

Referenced by first(), next(), and operator[]().

## Member Function Documentation

void Zeni::XML_Element::create_child | ( | const String & | field | ) |

Create a child node.

Tree Modifiers

Definition at line 175 of file XML.cpp.

References Zeni::String::c_str(), TiXmlNode::LinkEndChild(), Zeni::XML_Element_c::m_handle, and TiXmlHandle::ToNode().

XML_Element Zeni::XML_Element::first | ( |  | ) |

Get the first subelement.

Definition at line 155 of file XML.cpp.

References Zeni::XML_Element_c::first_child_element(), Zeni::XML_Element_c::m_handle, TiXmlNode::ToElement(), TiXmlHandle::ToNode(), and XML_Element().

Referenced by Zeni::XML_Document::first().

XML_Element Zeni::XML_Element::next | ( |  | ) |

Get the next subelement.

Definition at line 165 of file XML.cpp.

References Zeni::XML_Element_c::m_handle, TiXmlNode::NextSiblingElement(), TiXmlHandle::ToNode(), and XML_Element().

XML_Element Zeni::XML_Element::operator[] | ( | const String & | field | ) |

Get a named subelement.

Tree Traversal

Definition at line 145 of file XML.cpp.

References Zeni::XML_Element_c::child_element(), Zeni::XML_Element_c::m_handle, TiXmlNode::ToElement(), TiXmlHandle::ToNode(), and XML_Element().

void Zeni::XML_Element::remove_child | ( | const XML_Element & | child | ) |

Remove a child node, which will be rendered invalid.

Definition at line 188 of file XML.cpp.

References Zeni::XML_Element_c::good(), Zeni::XML_Element_c::m_handle, TiXmlNode::RemoveChild(), and TiXmlHandle::ToNode().

void Zeni::XML_Element::set_bool | ( | const bool & | b | ) |

Set the contained string as a boolean.

Text Modifiers

Definition at line 200 of file XML.cpp.

References Zeni::itoa(), and set_string().

Referenced by Zeni::Video::save().

void Zeni::XML_Element::set_double | ( | const double & | d | ) |

Set the contained string as a double precision floating point number.

Definition at line 212 of file XML.cpp.

References Zeni::dtoa(), and set_string().

void Zeni::XML_Element::set_float | ( | const float & | f | ) |

Set the contained string as a floating point number.

Definition at line 208 of file XML.cpp.

References Zeni::ftoa(), and set_string().

void Zeni::XML_Element::set_int | ( | const int & | i | ) |

Set the contained string as an integer.

Definition at line 204 of file XML.cpp.

References Zeni::itoa(), and set_string().

Referenced by Zeni::Video::save().

void Zeni::XML_Element::set_string | ( | const String & | s | ) |

Set the contained string.

Definition at line 216 of file XML.cpp.

References Zeni::String::c_str(), Zeni::XML_Element_c::first_child(), Zeni::XML_Element_c::good(), TiXmlNode::LinkEndChild(), Zeni::XML_Element_c::m_handle, TiXmlNode::ReplaceChild(), TiXmlHandle::ToNode(), and TiXmlNode::ToText().

Referenced by Zeni::Video::save(), set_bool(), set_double(), set_float(), and set_int().

The documentation for this class was generated from the following files:

- zenilib/jni/external/zenilib/zeni/Zeni/XML.h
- zenilib/jni/external/zenilib/zeni/XML.cpp