#include <xml.h>
Public Member Functions | |
Element (TiXmlElement *i) | |
~Element () | |
Element | operator() () |
return child element | |
Element | operator() (const char *el) |
return child el element | |
operator bool () | |
is this valid element? | |
Element | Sibling () |
return sibling element | |
Element | Sibling (const char *el) |
return el sibling element | |
const char * | operator[] (const char *attr) |
attr val (null is not exist) | |
int | Int (const char *attr) |
get int (bail out if error) | |
bool | Bool (const char *attr) |
get bool (bail out if error) | |
Private Member Functions | |
void | BailOut (const char *attr) |
bail out with error message | |
Private Attributes | |
TiXmlElement * | e |
Xml::Element child = root("Child"); Xml::Element child = root(); for( ; child ; child = child.Sibling("Child")) //... string name = child["name"]; int age = child.Int("age"); bool dead = child.Bool("isdead");
It is the sole responsibility of user to check if int/bool attribute exists (using operator[]), before loading it. Otherwise the program bails out with an error message.
|
|
|
|
|
bail out with error message
|
|
get bool (bail out if error)
|
|
get int (bail out if error)
|
|
is this valid element?
|
|
return child el element
|
|
return child element
|
|
attr val (null is not exist)
|
|
return el sibling element
|
|
return sibling element
|
|
|