XMLElement Class Reference
Inheritance diagram for XMLElement:
XMLNode

Public Types

enum  ElementClosingType { OPEN , CLOSED , CLOSING }
 

Public Member Functions

const char * Name () const
 Get the name of an element(which is the Value() of the node.) More...
 
void SetName (const char *str, bool staticMem=false)
 Set the name of the element. More...
 
virtual XMLElementToElement ()
 Safely cast to an Element, or null. More...
 
virtual const XMLElementToElement () const
 
virtual bool Accept (XMLVisitor *visitor) const
 
const char * Attribute (const char *name, const char *value=nullptr) const
 
int IntAttribute (const char *name, int defaultValue=0) const
 
unsigned UnsignedAttribute (const char *name, unsigned defaultValue=0) const
 See IntAttribute() More...
 
int64_t Int64Attribute (const char *name, int64_t defaultValue=0) const
 See IntAttribute() More...
 
bool BoolAttribute (const char *name, bool defaultValue=false) const
 See IntAttribute() More...
 
double DoubleAttribute (const char *name, double defaultValue=0) const
 See IntAttribute() More...
 
float FloatAttribute (const char *name, float defaultValue=0) const
 See IntAttribute() More...
 
XMLError QueryIntAttribute (const char *name, int *value) const
 
XMLError QueryUnsignedAttribute (const char *name, unsigned int *value) const
 See QueryIntAttribute() More...
 
XMLError QueryInt64Attribute (const char *name, int64_t *value) const
 See QueryIntAttribute() More...
 
XMLError QueryBoolAttribute (const char *name, bool *value) const
 See QueryIntAttribute() More...
 
XMLError QueryDoubleAttribute (const char *name, double *value) const
 See QueryIntAttribute() More...
 
XMLError QueryFloatAttribute (const char *name, float *value) const
 See QueryIntAttribute() More...
 
XMLError QueryStringAttribute (const char *name, const char **value) const
 See QueryIntAttribute() More...
 
int QueryAttribute (const char *name, int *value) const
 
int QueryAttribute (const char *name, unsigned int *value) const
 
int QueryAttribute (const char *name, int64_t *value) const
 
int QueryAttribute (const char *name, bool *value) const
 
int QueryAttribute (const char *name, double *value) const
 
int QueryAttribute (const char *name, float *value) const
 
void SetAttribute (const char *name, const char *value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, int value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, unsigned value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, int64_t value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, bool value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, double value)
 Sets the named attribute to value. More...
 
void SetAttribute (const char *name, float value)
 Sets the named attribute to value. More...
 
void DeleteAttribute (const char *name)
 
const XMLAttributeFirstAttribute () const
 Return the first attribute in the list. More...
 
const XMLAttributeFindAttribute (const char *name) const
 Query a specific attribute in the list. More...
 
const char * GetText () const
 
void SetText (const char *inText)
 
void SetText (int value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
void SetText (unsigned value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
void SetText (int64_t value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
void SetText (bool value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
void SetText (double value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
void SetText (float value)
 Convenience method for setting text inside an element. See SetText() for important limitations. More...
 
XMLError QueryIntText (int *ival) const
 
XMLError QueryUnsignedText (unsigned *uval) const
 See QueryIntText() More...
 
XMLError QueryInt64Text (int64_t *uval) const
 See QueryIntText() More...
 
XMLError QueryBoolText (bool *bval) const
 See QueryIntText() More...
 
XMLError QueryDoubleText (double *dval) const
 See QueryIntText() More...
 
XMLError QueryFloatText (float *fval) const
 See QueryIntText() More...
 
int IntText (int defaultValue=0) const
 
unsigned UnsignedText (unsigned defaultValue=0) const
 See QueryIntText() More...
 
int64_t Int64Text (int64_t defaultValue=0) const
 See QueryIntText() More...
 
bool BoolText (bool defaultValue=false) const
 See QueryIntText() More...
 
double DoubleText (double defaultValue=0) const
 See QueryIntText() More...
 
float FloatText (float defaultValue=0) const
 See QueryIntText() More...
 
ElementClosingType ClosingType () const
 
virtual XMLNodeShallowClone (XMLDocument *document) const
 
virtual bool ShallowEqual (const XMLNode *compare) const
 
- Public Member Functions inherited from XMLNode
const XMLDocumentGetDocument () const
 Get the XMLDocument that owns this XMLNode. More...
 
XMLDocumentGetDocument ()
 Get the XMLDocument that owns this XMLNode. More...
 
virtual XMLTextToText ()
 Safely cast to Text, or null. More...
 
virtual XMLCommentToComment ()
 Safely cast to a Comment, or null. More...
 
virtual XMLDocumentToDocument ()
 Safely cast to a Document, or null. More...
 
virtual XMLDeclarationToDeclaration ()
 Safely cast to a Declaration, or null. More...
 
virtual XMLUnknownToUnknown ()
 Safely cast to an Unknown, or null. More...
 
virtual const XMLTextToText () const
 
virtual const XMLCommentToComment () const
 
virtual const XMLDocumentToDocument () const
 
virtual const XMLDeclarationToDeclaration () const
 
virtual const XMLUnknownToUnknown () const
 
const char * Value () const
 
void SetValue (const char *val, bool staticMem=false)
 
int GetLineNum () const
 Gets the line number the node is in, if the document was parsed from a file. More...
 
const XMLNodeParent () const
 Get the parent of this node on the DOM. More...
 
XMLNodeParent ()
 
bool NoChildren () const
 Returns true if this node has no children. More...
 
const XMLNodeFirstChild () const
 Get the first child node, or null if none exists. More...
 
XMLNodeFirstChild ()
 
const XMLElementFirstChildElement (const char *name=nullptr) const
 
XMLElementFirstChildElement (const char *name=nullptr)
 
const XMLNodeLastChild () const
 Get the last child node, or null if none exists. More...
 
XMLNodeLastChild ()
 
const XMLElementLastChildElement (const char *name=nullptr) const
 
XMLElementLastChildElement (const char *name=nullptr)
 
const XMLNodePreviousSibling () const
 Get the previous(left) sibling node of this node. More...
 
XMLNodePreviousSibling ()
 
const XMLElementPreviousSiblingElement (const char *name=nullptr) const
 Get the previous(left) sibling element of this node, with an optionally supplied name. More...
 
XMLElementPreviousSiblingElement (const char *name=nullptr)
 
const XMLNodeNextSibling () const
 Get the next(right) sibling node of this node. More...
 
XMLNodeNextSibling ()
 
const XMLElementNextSiblingElement (const char *name=nullptr) const
 Get the next(right) sibling element of this node, with an optionally supplied name. More...
 
XMLElementNextSiblingElement (const char *name=nullptr)
 
XMLNodeInsertEndChild (XMLNode *addThis)
 
XMLNodeLinkEndChild (XMLNode *addThis)
 
XMLNodeInsertFirstChild (XMLNode *addThis)
 
XMLNodeInsertAfterChild (XMLNode *afterThis, XMLNode *addThis)
 
void DeleteChildren ()
 
void DeleteChild (XMLNode *node)
 
XMLNodeDeepClone (XMLDocument *target) const
 
void SetUserData (void *userData)
 
void * GetUserData () const
 

Protected Member Functions

char * ParseDeep (char *p, StrPair *parentEndTag, int *curLineNumPtr)
 
- Protected Member Functions inherited from XMLNode
 XMLNode (XMLDocument *)
 

Private Types

enum  { BUF_SIZE = 200 }
 

Private Member Functions

 XMLElement (XMLDocument *doc)
 
 XMLElement (const XMLElement &)
 
void operator= (const XMLElement &)
 
XMLAttributeFindAttribute (const char *name)
 
XMLAttributeFindOrCreateAttribute (const char *name)
 
char * ParseAttributes (char *p, int *curLineNumPtr)
 
XMLAttributeCreateAttribute ()
 

Static Private Member Functions

static void DeleteAttribute (XMLAttribute *attribute)
 

Private Attributes

ElementClosingType _closingType
 
XMLAttribute_rootAttribute
 

Friends

class XMLDocument
 

Additional Inherited Members

- Protected Attributes inherited from XMLNode
XMLDocument_document
 
XMLNode_parent
 
StrPair _value
 
int _parseLineNum
 
XMLNode_firstChild
 
XMLNode_lastChild
 
XMLNode_prev
 
XMLNode_next
 
void * _userData
 

Detailed Description

Definition at line 1242 of file tinyxml2.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Definition at line 1632 of file tinyxml2.h.

◆ ElementClosingType

enum ElementClosingType

Definition at line 1603 of file tinyxml2.h.

Constructor & Destructor Documentation

◆ XMLElement()

XMLElement ( XMLDocument doc)
private

Definition at line 1630 of file tinyxml2.cpp.

◆ ~XMLElement()

~XMLElement ( )
privatevirtual

Definition at line 1637 of file tinyxml2.cpp.

Member Function Documentation

◆ Accept()

bool Accept ( XMLVisitor visitor) const
virtual

Implements XMLNode.

Definition at line 2145 of file tinyxml2.cpp.

◆ Attribute()

const char * Attribute ( const char *  name,
const char *  value = nullptr 
) const

Definition at line 1661 of file tinyxml2.cpp.

◆ BoolAttribute()

bool BoolAttribute ( const char *  name,
bool  defaultValue = false 
) const

See IntAttribute()

Definition at line 1696 of file tinyxml2.cpp.

◆ BoolText()

bool BoolText ( bool  defaultValue = false) const

See QueryIntText()

Definition at line 1897 of file tinyxml2.cpp.

◆ ClosingType()

ElementClosingType ClosingType ( ) const
inline

Definition at line 1608 of file tinyxml2.h.

◆ CreateAttribute()

XMLAttribute * CreateAttribute ( )
private

Definition at line 2054 of file tinyxml2.cpp.

◆ DeleteAttribute() [1/2]

void DeleteAttribute ( const char *  name)

Definition at line 1952 of file tinyxml2.cpp.

◆ DeleteAttribute() [2/2]

void DeleteAttribute ( XMLAttribute attribute)
staticprivate

Definition at line 2043 of file tinyxml2.cpp.

◆ DoubleAttribute()

double DoubleAttribute ( const char *  name,
double  defaultValue = 0 
) const

See IntAttribute()

Definition at line 1703 of file tinyxml2.cpp.

◆ DoubleText()

double DoubleText ( double  defaultValue = 0) const

See QueryIntText()

Definition at line 1904 of file tinyxml2.cpp.

◆ FindAttribute() [1/2]

XMLAttribute * FindAttribute ( const char *  name)
inlineprivate

Definition at line 1623 of file tinyxml2.h.

◆ FindAttribute() [2/2]

const XMLAttribute * FindAttribute ( const char *  name) const

Query a specific attribute in the list.

Definition at line 1648 of file tinyxml2.cpp.

◆ FindOrCreateAttribute()

XMLAttribute * FindOrCreateAttribute ( const char *  name)
private

Definition at line 1919 of file tinyxml2.cpp.

◆ FirstAttribute()

const XMLAttribute * FirstAttribute ( ) const
inline

Return the first attribute in the list.

Definition at line 1467 of file tinyxml2.h.

◆ FloatAttribute()

float FloatAttribute ( const char *  name,
float  defaultValue = 0 
) const

See IntAttribute()

Definition at line 1710 of file tinyxml2.cpp.

◆ FloatText()

float FloatText ( float  defaultValue = 0) const

See QueryIntText()

Definition at line 1911 of file tinyxml2.cpp.

◆ GetText()

const char * GetText ( ) const

Definition at line 1717 of file tinyxml2.cpp.

◆ Int64Attribute()

int64_t Int64Attribute ( const char *  name,
int64_t  defaultValue = 0 
) const

See IntAttribute()

Definition at line 1689 of file tinyxml2.cpp.

◆ Int64Text()

int64_t Int64Text ( int64_t  defaultValue = 0) const

See QueryIntText()

Definition at line 1890 of file tinyxml2.cpp.

◆ IntAttribute()

int IntAttribute ( const char *  name,
int  defaultValue = 0 
) const

Definition at line 1675 of file tinyxml2.cpp.

◆ IntText()

int IntText ( int  defaultValue = 0) const

Definition at line 1876 of file tinyxml2.cpp.

◆ Name()

const char * Name ( ) const
inline

Get the name of an element(which is the Value() of the node.)

Definition at line 1247 of file tinyxml2.h.

◆ ParseAttributes()

char * ParseAttributes ( char *  p,
int *  curLineNumPtr 
)
private

Definition at line 1975 of file tinyxml2.cpp.

◆ ParseDeep()

char * ParseDeep ( char *  p,
StrPair parentEndTag,
int *  curLineNumPtr 
)
protectedvirtual

Reimplemented from XMLNode.

Definition at line 2068 of file tinyxml2.cpp.

◆ QueryAttribute() [1/6]

int QueryAttribute ( const char *  name,
bool *  value 
) const
inline

Definition at line 1411 of file tinyxml2.h.

◆ QueryAttribute() [2/6]

int QueryAttribute ( const char *  name,
double *  value 
) const
inline

Definition at line 1415 of file tinyxml2.h.

◆ QueryAttribute() [3/6]

int QueryAttribute ( const char *  name,
float *  value 
) const
inline

Definition at line 1419 of file tinyxml2.h.

◆ QueryAttribute() [4/6]

int QueryAttribute ( const char *  name,
int *  value 
) const
inline

Definition at line 1399 of file tinyxml2.h.

◆ QueryAttribute() [5/6]

int QueryAttribute ( const char *  name,
int64_t *  value 
) const
inline

Definition at line 1407 of file tinyxml2.h.

◆ QueryAttribute() [6/6]

int QueryAttribute ( const char *  name,
unsigned int *  value 
) const
inline

Definition at line 1403 of file tinyxml2.h.

◆ QueryBoolAttribute()

XMLError QueryBoolAttribute ( const char *  name,
bool *  value 
) const
inline

See QueryIntAttribute()

Definition at line 1346 of file tinyxml2.h.

◆ QueryBoolText()

XMLError QueryBoolText ( bool *  bval) const

See QueryIntText()

Definition at line 1832 of file tinyxml2.cpp.

◆ QueryDoubleAttribute()

XMLError QueryDoubleAttribute ( const char *  name,
double *  value 
) const
inline

See QueryIntAttribute()

Definition at line 1354 of file tinyxml2.h.

◆ QueryDoubleText()

XMLError QueryDoubleText ( double *  dval) const

See QueryIntText()

Definition at line 1847 of file tinyxml2.cpp.

◆ QueryFloatAttribute()

XMLError QueryFloatAttribute ( const char *  name,
float *  value 
) const
inline

See QueryIntAttribute()

Definition at line 1362 of file tinyxml2.h.

◆ QueryFloatText()

XMLError QueryFloatText ( float *  fval) const

See QueryIntText()

Definition at line 1862 of file tinyxml2.cpp.

◆ QueryInt64Attribute()

XMLError QueryInt64Attribute ( const char *  name,
int64_t *  value 
) const
inline

See QueryIntAttribute()

Definition at line 1337 of file tinyxml2.h.

◆ QueryInt64Text()

XMLError QueryInt64Text ( int64_t *  uval) const

See QueryIntText()

Definition at line 1817 of file tinyxml2.cpp.

◆ QueryIntAttribute()

XMLError QueryIntAttribute ( const char *  name,
int *  value 
) const
inline

Definition at line 1319 of file tinyxml2.h.

◆ QueryIntText()

XMLError QueryIntText ( int *  ival) const

Definition at line 1787 of file tinyxml2.cpp.

◆ QueryStringAttribute()

XMLError QueryStringAttribute ( const char *  name,
const char **  value 
) const
inline

See QueryIntAttribute()

Definition at line 1371 of file tinyxml2.h.

◆ QueryUnsignedAttribute()

XMLError QueryUnsignedAttribute ( const char *  name,
unsigned int *  value 
) const
inline

See QueryIntAttribute()

Definition at line 1328 of file tinyxml2.h.

◆ QueryUnsignedText()

XMLError QueryUnsignedText ( unsigned *  uval) const

See QueryIntText()

Definition at line 1802 of file tinyxml2.cpp.

◆ SetAttribute() [1/7]

void SetAttribute ( const char *  name,
bool  value 
)
inline

Sets the named attribute to value.

Definition at line 1446 of file tinyxml2.h.

◆ SetAttribute() [2/7]

void SetAttribute ( const char *  name,
const char *  value 
)
inline

Sets the named attribute to value.

Definition at line 1424 of file tinyxml2.h.

◆ SetAttribute() [3/7]

void SetAttribute ( const char *  name,
double  value 
)
inline

Sets the named attribute to value.

Definition at line 1451 of file tinyxml2.h.

◆ SetAttribute() [4/7]

void SetAttribute ( const char *  name,
float  value 
)
inline

Sets the named attribute to value.

Definition at line 1456 of file tinyxml2.h.

◆ SetAttribute() [5/7]

void SetAttribute ( const char *  name,
int  value 
)
inline

Sets the named attribute to value.

Definition at line 1429 of file tinyxml2.h.

◆ SetAttribute() [6/7]

void SetAttribute ( const char *  name,
int64_t  value 
)
inline

Sets the named attribute to value.

Definition at line 1440 of file tinyxml2.h.

◆ SetAttribute() [7/7]

void SetAttribute ( const char *  name,
unsigned  value 
)
inline

Sets the named attribute to value.

Definition at line 1434 of file tinyxml2.h.

◆ SetName()

void SetName ( const char *  str,
bool  staticMem = false 
)
inline

Set the name of the element.

Definition at line 1251 of file tinyxml2.h.

◆ SetText() [1/7]

void SetText ( bool  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1763 of file tinyxml2.cpp.

◆ SetText() [2/7]

void SetText ( const char *  inText)

Definition at line 1727 of file tinyxml2.cpp.

◆ SetText() [3/7]

void SetText ( double  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1779 of file tinyxml2.cpp.

◆ SetText() [4/7]

void SetText ( float  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1771 of file tinyxml2.cpp.

◆ SetText() [5/7]

void SetText ( int  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1739 of file tinyxml2.cpp.

◆ SetText() [6/7]

void SetText ( int64_t  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1755 of file tinyxml2.cpp.

◆ SetText() [7/7]

void SetText ( unsigned  value)

Convenience method for setting text inside an element. See SetText() for important limitations.

Definition at line 1747 of file tinyxml2.cpp.

◆ ShallowClone()

XMLNode * ShallowClone ( XMLDocument document) const
virtual

Implements XMLNode.

Definition at line 2100 of file tinyxml2.cpp.

◆ ShallowEqual()

bool ShallowEqual ( const XMLNode compare) const
virtual

Implements XMLNode.

Definition at line 2115 of file tinyxml2.cpp.

◆ ToElement() [1/2]

virtual XMLElement * ToElement ( )
inlinevirtual

Safely cast to an Element, or null.

Reimplemented from XMLNode.

Definition at line 1255 of file tinyxml2.h.

◆ ToElement() [2/2]

virtual const XMLElement * ToElement ( ) const
inlinevirtual

Reimplemented from XMLNode.

Definition at line 1258 of file tinyxml2.h.

◆ UnsignedAttribute()

unsigned UnsignedAttribute ( const char *  name,
unsigned  defaultValue = 0 
) const

See IntAttribute()

Definition at line 1682 of file tinyxml2.cpp.

◆ UnsignedText()

unsigned UnsignedText ( unsigned  defaultValue = 0) const

See QueryIntText()

Definition at line 1883 of file tinyxml2.cpp.

Friends And Related Function Documentation

◆ XMLDocument

friend class XMLDocument
friend

Definition at line 1244 of file tinyxml2.h.

Member Data Documentation

◆ _closingType

ElementClosingType _closingType
private

Definition at line 1633 of file tinyxml2.h.

◆ _rootAttribute

XMLAttribute* _rootAttribute
private

Definition at line 1637 of file tinyxml2.h.


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