#include <OBTtinyxml.h>
Public Types | |
enum | NodeType { DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT, DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT } |
The types of XML nodes supported by TinyXml. More... | |
enum | NodeType { DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT, DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT } |
The types of XML nodes supported by TinyXml. More... | |
Public Member Functions | |
virtual | ~TiXmlNode () |
const char * | Value () const |
The meaning of 'value' changes for the specific type of TiXmlNode. | |
const std::string & | ValueStr () const |
Return Value() as a std::string. | |
const TIXML_STRING & | ValueTStr () const |
void | setValue (const char *_value) |
Changes the value of the node. | |
void | setValue (const std::string &_value) |
STL std::string form. | |
void | Clear () |
Delete all the children of this node. Does not affect 'this'. | |
TiXmlNode * | Parent () |
One step up the DOM. | |
const TiXmlNode * | Parent () const |
const TiXmlNode * | FirstChild () const |
The first child of this node. Will be null if there are no children. | |
TiXmlNode * | FirstChild () |
const TiXmlNode * | FirstChild (const char *value) const |
The first child of this node with the matching 'value'. | |
TiXmlNode * | FirstChild (const char *_value) |
The first child of this node with the matching 'value'. Will be null if none found. | |
const TiXmlNode * | LastChild () const |
TiXmlNode * | LastChild () |
The last child of this node. Will be null if there are no children. | |
const TiXmlNode * | LastChild (const char *value) const |
TiXmlNode * | LastChild (const char *_value) |
The last child of this node matching 'value'. Will be null if there are no children. | |
const TiXmlNode * | FirstChild (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | FirstChild (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | LastChild (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | LastChild (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | IterateChildren (const TiXmlNode *previous) const |
An alternate way to walk the children of a node. | |
TiXmlNode * | IterateChildren (const TiXmlNode *previous) |
const TiXmlNode * | IterateChildren (const char *value, const TiXmlNode *previous) const |
This flavor of IterateChildren searches for children with a particular 'value'. | |
TiXmlNode * | IterateChildren (const char *_value, const TiXmlNode *previous) |
const TiXmlNode * | IterateChildren (const std::string &_value, const TiXmlNode *previous) const |
STL std::string form. | |
TiXmlNode * | IterateChildren (const std::string &_value, const TiXmlNode *previous) |
STL std::string form. | |
TiXmlNode * | InsertEndChild (const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | LinkEndChild (TiXmlNode *addThis) |
Add a new node related to this. | |
TiXmlNode * | InsertBeforeChild (TiXmlNode *beforeThis, const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | InsertAfterChild (TiXmlNode *afterThis, const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | ReplaceChild (TiXmlNode *replaceThis, const TiXmlNode &withThis) |
Replace a child of this node. | |
bool | RemoveChild (TiXmlNode *removeThis) |
Delete a child of this node. | |
const TiXmlNode * | PreviousSibling () const |
Navigate to a sibling node. | |
TiXmlNode * | PreviousSibling () |
const TiXmlNode * | PreviousSibling (const char *) const |
Navigate to a sibling node. | |
TiXmlNode * | PreviousSibling (const char *_prev) |
const TiXmlNode * | PreviousSibling (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | PreviousSibling (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | NextSibling (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | NextSibling (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | NextSibling () const |
Navigate to a sibling node. | |
TiXmlNode * | NextSibling () |
const TiXmlNode * | NextSibling (const char *) const |
Navigate to a sibling node with the given 'value'. | |
TiXmlNode * | NextSibling (const char *_next) |
const TiXmlElement * | NextSiblingElement () const |
Convenience function to get through elements. | |
TiXmlElement * | NextSiblingElement () |
const TiXmlElement * | NextSiblingElement (const char *) const |
Convenience function to get through elements. | |
TiXmlElement * | NextSiblingElement (const char *_next) |
const TiXmlElement * | NextSiblingElement (const std::string &_value) const |
STL std::string form. | |
TiXmlElement * | NextSiblingElement (const std::string &_value) |
STL std::string form. | |
const TiXmlElement * | FirstChildElement () const |
Convenience function to get through elements. | |
TiXmlElement * | FirstChildElement () |
const TiXmlElement * | FirstChildElement (const char *_value) const |
Convenience function to get through elements. | |
TiXmlElement * | FirstChildElement (const char *_value) |
const TiXmlElement * | FirstChildElement (const std::string &_value) const |
STL std::string form. | |
TiXmlElement * | FirstChildElement (const std::string &_value) |
STL std::string form. | |
int | Type () const |
Query the type (as an enumerated value, above) of this node. | |
const TiXmlDocument * | GetDocument () const |
Return a pointer to the Document this node lives in. | |
TiXmlDocument * | GetDocument () |
bool | NoChildren () const |
Returns true if this node has no children. | |
virtual const TiXmlDocument * | ToDocument () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlElement * | ToElement () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlComment * | ToComment () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlUnknown * | ToUnknown () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlText * | ToText () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlDeclaration * | ToDeclaration () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlDocument * | ToDocument () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlElement * | ToElement () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlComment * | ToComment () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlUnknown * | ToUnknown () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlText * | ToText () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlDeclaration * | ToDeclaration () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlNode * | Clone () const =0 |
Create an exact duplicate of this node and return it. | |
virtual bool | Accept (TiXmlVisitor *visitor) const =0 |
Accept a hierchical visit the nodes in the TinyXML DOM. | |
virtual | ~TiXmlNode () |
const char * | Value () const |
The meaning of 'value' changes for the specific type of TiXmlNode. | |
const std::string & | ValueStr () const |
Return Value() as a std::string. | |
const TIXML_STRING & | ValueTStr () const |
void | SetValue (const char *_value) |
Changes the value of the node. | |
void | SetValue (const std::string &_value) |
STL std::string form. | |
void | Clear () |
Delete all the children of this node. Does not affect 'this'. | |
TiXmlNode * | Parent () |
One step up the DOM. | |
const TiXmlNode * | Parent () const |
const TiXmlNode * | FirstChild () const |
The first child of this node. Will be null if there are no children. | |
TiXmlNode * | FirstChild () |
const TiXmlNode * | FirstChild (const char *value) const |
The first child of this node with the matching 'value'. | |
TiXmlNode * | FirstChild (const char *_value) |
The first child of this node with the matching 'value'. Will be null if none found. | |
const TiXmlNode * | LastChild () const |
TiXmlNode * | LastChild () |
The last child of this node. Will be null if there are no children. | |
const TiXmlNode * | LastChild (const char *value) const |
TiXmlNode * | LastChild (const char *_value) |
The last child of this node matching 'value'. Will be null if there are no children. | |
const TiXmlNode * | FirstChild (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | FirstChild (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | LastChild (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | LastChild (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | IterateChildren (const TiXmlNode *previous) const |
An alternate way to walk the children of a node. | |
TiXmlNode * | IterateChildren (const TiXmlNode *previous) |
const TiXmlNode * | IterateChildren (const char *value, const TiXmlNode *previous) const |
This flavor of IterateChildren searches for children with a particular 'value'. | |
TiXmlNode * | IterateChildren (const char *_value, const TiXmlNode *previous) |
const TiXmlNode * | IterateChildren (const std::string &_value, const TiXmlNode *previous) const |
STL std::string form. | |
TiXmlNode * | IterateChildren (const std::string &_value, const TiXmlNode *previous) |
STL std::string form. | |
TiXmlNode * | InsertEndChild (const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | LinkEndChild (TiXmlNode *addThis) |
Add a new node related to this. | |
TiXmlNode * | InsertBeforeChild (TiXmlNode *beforeThis, const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | InsertAfterChild (TiXmlNode *afterThis, const TiXmlNode &addThis) |
Add a new node related to this. | |
TiXmlNode * | ReplaceChild (TiXmlNode *replaceThis, const TiXmlNode &withThis) |
Replace a child of this node. | |
bool | RemoveChild (TiXmlNode *removeThis) |
Delete a child of this node. | |
const TiXmlNode * | PreviousSibling () const |
Navigate to a sibling node. | |
TiXmlNode * | PreviousSibling () |
const TiXmlNode * | PreviousSibling (const char *) const |
Navigate to a sibling node. | |
TiXmlNode * | PreviousSibling (const char *_prev) |
const TiXmlNode * | PreviousSibling (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | PreviousSibling (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | NextSibling (const std::string &_value) const |
STL std::string form. | |
TiXmlNode * | NextSibling (const std::string &_value) |
STL std::string form. | |
const TiXmlNode * | NextSibling () const |
Navigate to a sibling node. | |
TiXmlNode * | NextSibling () |
const TiXmlNode * | NextSibling (const char *) const |
Navigate to a sibling node with the given 'value'. | |
TiXmlNode * | NextSibling (const char *_next) |
const TiXmlElement * | NextSiblingElement () const |
Convenience function to get through elements. | |
TiXmlElement * | NextSiblingElement () |
const TiXmlElement * | NextSiblingElement (const char *) const |
Convenience function to get through elements. | |
TiXmlElement * | NextSiblingElement (const char *_next) |
const TiXmlElement * | NextSiblingElement (const std::string &_value) const |
STL std::string form. | |
TiXmlElement * | NextSiblingElement (const std::string &_value) |
STL std::string form. | |
const TiXmlElement * | FirstChildElement () const |
Convenience function to get through elements. | |
TiXmlElement * | FirstChildElement () |
const TiXmlElement * | FirstChildElement (const char *_value) const |
Convenience function to get through elements. | |
TiXmlElement * | FirstChildElement (const char *_value) |
const TiXmlElement * | FirstChildElement (const std::string &_value) const |
STL std::string form. | |
TiXmlElement * | FirstChildElement (const std::string &_value) |
STL std::string form. | |
int | Type () const |
Query the type (as an enumerated value, above) of this node. | |
const TiXmlDocument * | GetDocument () const |
Return a pointer to the Document this node lives in. | |
TiXmlDocument * | GetDocument () |
bool | NoChildren () const |
Returns true if this node has no children. | |
virtual const TiXmlDocument * | ToDocument () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlElement * | ToElement () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlComment * | ToComment () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlUnknown * | ToUnknown () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlText * | ToText () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual const TiXmlDeclaration * | ToDeclaration () const |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlDocument * | ToDocument () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlElement * | ToElement () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlComment * | ToComment () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlUnknown * | ToUnknown () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlText * | ToText () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlDeclaration * | ToDeclaration () |
Cast to a more defined type. Will return null if not of the requested type. | |
virtual TiXmlNode * | Clone () const =0 |
Create an exact duplicate of this node and return it. | |
virtual bool | Accept (TiXmlVisitor *visitor) const =0 |
Accept a hierchical visit the nodes in the TinyXML DOM. | |
Protected Member Functions | |
TiXmlNode (NodeType _type) | |
void | CopyTo (TiXmlNode *target) const |
virtual void | StreamIn (std::istream *in, TIXML_STRING *tag)=0 |
TiXmlNode * | Identify (const char *start, TiXmlEncoding encoding) |
TiXmlNode (NodeType _type) | |
void | CopyTo (TiXmlNode *target) const |
virtual void | StreamIn (std::istream *in, TIXML_STRING *tag)=0 |
TiXmlNode * | Identify (const char *start, TiXmlEncoding encoding) |
Protected Attributes | |
TiXmlNode * | parent |
NodeType | type |
TiXmlNode * | firstChild |
TiXmlNode * | lastChild |
TIXML_STRING | value |
TiXmlNode * | prev |
TiXmlNode * | next |
TiXmlNode * | parent |
TiXmlNode * | firstChild |
TiXmlNode * | lastChild |
TiXmlNode * | prev |
TiXmlNode * | next |
Private Member Functions | |
TiXmlNode (const TiXmlNode &) | |
void | operator= (const TiXmlNode &base) |
TiXmlNode (const TiXmlNode &) | |
void | operator= (const TiXmlNode &base) |
Friends | |
class | TiXmlDocument |
class | TiXmlElement |
OBT_API friend std::istream & | operator>> (std::istream &in, TiXmlNode &base) |
An input stream operator, for every class. | |
OBT_API friend std::ostream & | operator<< (std::ostream &out, const TiXmlNode &base) |
An output stream operator, for every class. | |
OBT_API friend std::string & | operator<< (std::string &out, const TiXmlNode &base) |
Appends the XML node or attribute to a std::string. | |
std::istream & | operator>> (std::istream &in, TiXmlNode &base) |
An input stream operator, for every class. | |
std::ostream & | operator<< (std::ostream &out, const TiXmlNode &base) |
An output stream operator, for every class. | |
std::string & | operator<< (std::string &out, const TiXmlNode &base) |
Appends the XML node or attribute to a std::string. |
(Except for attributes). Nodes have siblings, a parent, and children. A node can be in a document, or stand on its own. The type of a TiXmlNode can be queried, and it can be cast to its more defined type.
Definition at line 432 of file OBTtinyxml.h.
The types of XML nodes supported by TinyXml.
(All the unsupported types are picked up by UNKNOWN.)
DOCUMENT | |
ELEMENT | |
COMMENT | |
UNKNOWN | |
TEXT | |
DECLARATION | |
TYPECOUNT | |
DOCUMENT | |
ELEMENT | |
COMMENT | |
UNKNOWN | |
TEXT | |
DECLARATION | |
TYPECOUNT |
Definition at line 471 of file OBTtinyxml.h.
00472 { 00473 DOCUMENT, 00474 ELEMENT, 00475 COMMENT, 00476 UNKNOWN, 00477 TEXT, 00478 DECLARATION, 00479 TYPECOUNT 00480 };
The types of XML nodes supported by TinyXml.
(All the unsupported types are picked up by UNKNOWN.)
DOCUMENT | |
ELEMENT | |
COMMENT | |
UNKNOWN | |
TEXT | |
DECLARATION | |
TYPECOUNT | |
DOCUMENT | |
ELEMENT | |
COMMENT | |
UNKNOWN | |
TEXT | |
DECLARATION | |
TYPECOUNT |
Definition at line 470 of file tiny/OBTtinyxml.h.
00471 { 00472 DOCUMENT, 00473 ELEMENT, 00474 COMMENT, 00475 UNKNOWN, 00476 TEXT, 00477 DECLARATION, 00478 TYPECOUNT 00479 };
OBT::TiXmlNode::~TiXmlNode | ( | ) | [virtual] |
Definition at line 148 of file OBTtinyxml.cpp.
References firstChild, and next.
00149 { 00150 TiXmlNode* node = firstChild; 00151 TiXmlNode* temp = 0; 00152 00153 while ( node ) 00154 { 00155 temp = node; 00156 node = node->next; 00157 delete temp; 00158 } 00159 }
OBT::TiXmlNode::TiXmlNode | ( | NodeType | _type | ) | [protected] |
Definition at line 137 of file OBTtinyxml.cpp.
References firstChild, lastChild, next, parent, prev, and type.
00137 : TiXmlBase() 00138 { 00139 parent = 0; 00140 type = _type; 00141 firstChild = 0; 00142 lastChild = 0; 00143 prev = 0; 00144 next = 0; 00145 }
OBT::TiXmlNode::TiXmlNode | ( | const TiXmlNode & | ) | [private] |
virtual OBT::TiXmlNode::~TiXmlNode | ( | ) | [virtual] |
OBT::TiXmlNode::TiXmlNode | ( | NodeType | _type | ) | [protected] |
OBT::TiXmlNode::TiXmlNode | ( | const TiXmlNode & | ) | [private] |
const char* OBT::TiXmlNode::Value | ( | ) | const [inline] |
The meaning of 'value' changes for the specific type of TiXmlNode.
Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
The subclasses will wrap this function.
Definition at line 496 of file OBTtinyxml.h.
Referenced by OBT::XMLConfigurationFileParser::AddChildren(), OBT::TiXmlElement::Clone(), FirstChild(), OBT::TiXmlElement::GetText(), LastChild(), OBT::TiXmlDocument::LoadFile(), NextSibling(), PreviousSibling(), OBT::TiXmlDocument::SaveFile(), OBT::TiXmlPrinter::Visit(), OBT::TiXmlPrinter::VisitEnter(), and OBT::TiXmlPrinter::VisitExit().
00496 { return value.c_str (); }
const std::string& OBT::TiXmlNode::ValueStr | ( | ) | const [inline] |
Return Value() as a std::string.
If you only use STL, this is more efficient than calling Value(). Only available in STL mode.
Definition at line 503 of file OBTtinyxml.h.
00503 { return value; }
const TIXML_STRING& OBT::TiXmlNode::ValueTStr | ( | ) | const [inline] |
Definition at line 506 of file OBTtinyxml.h.
Referenced by OBT::TiXmlPrinter::Visit().
00506 { return value; }
void OBT::TiXmlNode::setValue | ( | const char * | _value | ) | [inline] |
Changes the value of the node.
Defined as:
Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
Definition at line 517 of file OBTtinyxml.h.
Referenced by CopyTo().
00517 { value = _value;}
void OBT::TiXmlNode::setValue | ( | const std::string & | _value | ) | [inline] |
void OBT::TiXmlNode::Clear | ( | ) |
Delete all the children of this node. Does not affect 'this'.
Definition at line 169 of file OBTtinyxml.cpp.
References firstChild, lastChild, and next.
Referenced by OBT::TiXmlElement::ClearThis(), OBT::TiXmlDocument::LoadFile(), OBT::TiXmlDeclaration::operator=(), OBT::TiXmlComment::operator=(), and OBT::TiXmlDocument::operator=().
00170 { 00171 TiXmlNode* node = firstChild; 00172 TiXmlNode* temp = 0; 00173 00174 while ( node ) 00175 { 00176 temp = node; 00177 node = node->next; 00178 delete temp; 00179 } 00180 00181 firstChild = 0; 00182 lastChild = 0; 00183 }
TiXmlNode* OBT::TiXmlNode::Parent | ( | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::Parent | ( | ) | const [inline] |
const TiXmlNode* OBT::TiXmlNode::FirstChild | ( | ) | const [inline] |
The first child of this node. Will be null if there are no children.
Definition at line 531 of file OBTtinyxml.h.
Referenced by OBT::TiXmlDocument::Accept(), OBT::TiXmlElement::Accept(), OBT::TiXmlHandle::Child(), FirstChild(), OBT::TiXmlHandle::FirstChild(), FirstChildElement(), OBT::TiXmlElement::GetText(), IterateChildren(), OBT::TiXmlDocument::Print(), OBT::TiXmlPrinter::VisitEnter(), and OBT::TiXmlPrinter::VisitExit().
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | ) | [inline] |
const TiXmlNode * OBT::TiXmlNode::FirstChild | ( | const char * | value | ) | const |
The first child of this node with the matching 'value'.
Will be null if none found.
Definition at line 342 of file OBTtinyxml.cpp.
References firstChild, next, and Value().
00343 { 00344 const TiXmlNode* node; 00345 for ( node = firstChild; node; node = node->next ) 00346 { 00347 if ( strcmp( node->Value(), _value ) == 0 ) 00348 return node; 00349 } 00350 return 0; 00351 }
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const char * | _value | ) | [inline] |
The first child of this node with the matching 'value'. Will be null if none found.
Definition at line 535 of file OBTtinyxml.h.
00535 { 00536 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) 00537 // call the method, cast the return back to non-const. 00538 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); 00539 }
const TiXmlNode* OBT::TiXmlNode::LastChild | ( | ) | const [inline] |
Definition at line 540 of file OBTtinyxml.h.
Referenced by LastChild(), and OBT::TiXmlPrinter::VisitEnter().
00540 { return lastChild; }
TiXmlNode* OBT::TiXmlNode::LastChild | ( | ) | [inline] |
The last child of this node. Will be null if there are no children.
Definition at line 541 of file OBTtinyxml.h.
00541 { return lastChild; }
const TiXmlNode * OBT::TiXmlNode::LastChild | ( | const char * | value | ) | const |
TiXmlNode* OBT::TiXmlNode::LastChild | ( | const char * | _value | ) | [inline] |
The last child of this node matching 'value'. Will be null if there are no children.
Definition at line 544 of file OBTtinyxml.h.
00544 { 00545 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); 00546 }
const TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const std::string & | _value | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::LastChild | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::LastChild | ( | const std::string & | _value | ) | [inline] |
An alternate way to walk the children of a node.
One way to iterate over nodes is:
for( child = parent->FirstChild(); child; child = child->NextSibling() )
IterateChildren does the same thing with the syntax:
child = 0; while( child = parent->IterateChildren( child ) )
IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done.
Definition at line 366 of file OBTtinyxml.cpp.
References FirstChild(), NextSibling(), and parent.
Referenced by IterateChildren().
00367 { 00368 if ( !previous ) 00369 { 00370 return FirstChild(); 00371 } 00372 else 00373 { 00374 assert( previous->parent == this ); 00375 return previous->NextSibling(); 00376 } 00377 }
Definition at line 572 of file OBTtinyxml.h.
00572 { 00573 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); 00574 }
const TiXmlNode * OBT::TiXmlNode::IterateChildren | ( | const char * | value, | |
const TiXmlNode * | previous | |||
) | const |
This flavor of IterateChildren searches for children with a particular 'value'.
Definition at line 380 of file OBTtinyxml.cpp.
References FirstChild(), NextSibling(), and parent.
00381 { 00382 if ( !previous ) 00383 { 00384 return FirstChild( val ); 00385 } 00386 else 00387 { 00388 assert( previous->parent == this ); 00389 return previous->NextSibling( val ); 00390 } 00391 }
TiXmlNode* OBT::TiXmlNode::IterateChildren | ( | const char * | _value, | |
const TiXmlNode * | previous | |||
) | [inline] |
Definition at line 578 of file OBTtinyxml.h.
00578 { 00579 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); 00580 }
Add a new node related to this.
Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured.
Definition at line 213 of file OBTtinyxml.cpp.
References Clone(), DOCUMENT, GetDocument(), LinkEndChild(), OBT::TiXmlDocument::SetError(), OBT::TIXML_ENCODING_UNKNOWN, OBT::TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY, and Type().
00214 { 00215 if ( addThis.Type() == TiXmlNode::DOCUMENT ) 00216 { 00217 if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); 00218 return 0; 00219 } 00220 TiXmlNode* node = addThis.Clone(); 00221 if ( !node ) 00222 return 0; 00223 00224 return LinkEndChild( node ); 00225 }
Add a new node related to this.
Adds a child past the LastChild.
NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.
Definition at line 186 of file OBTtinyxml.cpp.
References DOCUMENT, firstChild, GetDocument(), lastChild, next, parent, prev, OBT::TiXmlDocument::SetError(), OBT::TIXML_ENCODING_UNKNOWN, OBT::TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY, and Type().
Referenced by OBT::TiXmlDocument::CopyTo(), OBT::TiXmlElement::CopyTo(), InsertEndChild(), OBT::TiXmlDocument::Parse(), and OBT::TiXmlElement::ReadValue().
00187 { 00188 assert( node->parent == 0 || node->parent == this ); 00189 assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); 00190 00191 if ( node->Type() == TiXmlNode::DOCUMENT ) 00192 { 00193 delete node; 00194 if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); 00195 return 0; 00196 } 00197 00198 node->parent = this; 00199 00200 node->prev = lastChild; 00201 node->next = 0; 00202 00203 if ( lastChild ) 00204 lastChild->next = node; 00205 else 00206 firstChild = node; // it was an empty list. 00207 00208 lastChild = node; 00209 return node; 00210 }
Add a new node related to this.
Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured.
Definition at line 228 of file OBTtinyxml.cpp.
References Clone(), DOCUMENT, firstChild, GetDocument(), next, parent, prev, OBT::TiXmlDocument::SetError(), OBT::TIXML_ENCODING_UNKNOWN, OBT::TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY, and Type().
00229 { 00230 if ( !beforeThis || beforeThis->parent != this ) { 00231 return 0; 00232 } 00233 if ( addThis.Type() == TiXmlNode::DOCUMENT ) 00234 { 00235 if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); 00236 return 0; 00237 } 00238 00239 TiXmlNode* node = addThis.Clone(); 00240 if ( !node ) 00241 return 0; 00242 node->parent = this; 00243 00244 node->next = beforeThis; 00245 node->prev = beforeThis->prev; 00246 if ( beforeThis->prev ) 00247 { 00248 beforeThis->prev->next = node; 00249 } 00250 else 00251 { 00252 assert( firstChild == beforeThis ); 00253 firstChild = node; 00254 } 00255 beforeThis->prev = node; 00256 return node; 00257 }
Add a new node related to this.
Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured.
Definition at line 260 of file OBTtinyxml.cpp.
References Clone(), DOCUMENT, GetDocument(), lastChild, next, parent, prev, OBT::TiXmlDocument::SetError(), OBT::TIXML_ENCODING_UNKNOWN, OBT::TiXmlBase::TIXML_ERROR_DOCUMENT_TOP_ONLY, and Type().
00261 { 00262 if ( !afterThis || afterThis->parent != this ) { 00263 return 0; 00264 } 00265 if ( addThis.Type() == TiXmlNode::DOCUMENT ) 00266 { 00267 if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); 00268 return 0; 00269 } 00270 00271 TiXmlNode* node = addThis.Clone(); 00272 if ( !node ) 00273 return 0; 00274 node->parent = this; 00275 00276 node->prev = afterThis; 00277 node->next = afterThis->next; 00278 if ( afterThis->next ) 00279 { 00280 afterThis->next->prev = node; 00281 } 00282 else 00283 { 00284 assert( lastChild == afterThis ); 00285 lastChild = node; 00286 } 00287 afterThis->next = node; 00288 return node; 00289 }
Replace a child of this node.
Returns a pointer to the new object or NULL if an error occured.
Definition at line 292 of file OBTtinyxml.cpp.
References Clone(), firstChild, lastChild, next, parent, and prev.
00293 { 00294 if ( replaceThis->parent != this ) 00295 return 0; 00296 00297 TiXmlNode* node = withThis.Clone(); 00298 if ( !node ) 00299 return 0; 00300 00301 node->next = replaceThis->next; 00302 node->prev = replaceThis->prev; 00303 00304 if ( replaceThis->next ) 00305 replaceThis->next->prev = node; 00306 else 00307 lastChild = node; 00308 00309 if ( replaceThis->prev ) 00310 replaceThis->prev->next = node; 00311 else 00312 firstChild = node; 00313 00314 delete replaceThis; 00315 node->parent = this; 00316 return node; 00317 }
bool OBT::TiXmlNode::RemoveChild | ( | TiXmlNode * | removeThis | ) |
Delete a child of this node.
Definition at line 320 of file OBTtinyxml.cpp.
References firstChild, lastChild, next, parent, and prev.
00321 { 00322 if ( removeThis->parent != this ) 00323 { 00324 assert( 0 ); 00325 return false; 00326 } 00327 00328 if ( removeThis->next ) 00329 removeThis->next->prev = removeThis->prev; 00330 else 00331 lastChild = removeThis->prev; 00332 00333 if ( removeThis->prev ) 00334 removeThis->prev->next = removeThis->next; 00335 else 00336 firstChild = removeThis->next; 00337 00338 delete removeThis; 00339 return true; 00340 }
const TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | ) | const [inline] |
Navigate to a sibling node.
Definition at line 623 of file OBTtinyxml.h.
Referenced by PreviousSibling().
00623 { return prev; }
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | ) | [inline] |
const TiXmlNode * OBT::TiXmlNode::PreviousSibling | ( | const char * | _value | ) | const |
Navigate to a sibling node.
Definition at line 406 of file OBTtinyxml.cpp.
00407 { 00408 const TiXmlNode* node; 00409 for ( node = prev; node; node = node->prev ) 00410 { 00411 if ( strcmp( node->Value(), _value ) == 0 ) 00412 return node; 00413 } 00414 return 0; 00415 }
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const char * | _prev | ) | [inline] |
Definition at line 628 of file OBTtinyxml.h.
00628 { 00629 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); 00630 }
const TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const std::string & | _value | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const std::string & | _value | ) | const [inline] |
STL std::string form.
Definition at line 635 of file OBTtinyxml.h.
Referenced by OBT::TiXmlDocument::Accept(), OBT::TiXmlElement::Accept(), OBT::TiXmlHandle::Child(), OBT::TiXmlDocument::CopyTo(), OBT::TiXmlElement::CopyTo(), FirstChildElement(), IterateChildren(), NextSiblingElement(), OBT::TiXmlDocument::Print(), and OBT::TiXmlElement::Print().
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const std::string & | _value | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::NextSibling | ( | ) | const [inline] |
Navigate to a sibling node.
Definition at line 640 of file OBTtinyxml.h.
Referenced by NextSibling(), and NextSiblingElement().
00640 { return next; }
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | ) | [inline] |
const TiXmlNode * OBT::TiXmlNode::NextSibling | ( | const char * | _value | ) | const |
Navigate to a sibling node with the given 'value'.
Definition at line 394 of file OBTtinyxml.cpp.
00395 { 00396 const TiXmlNode* node; 00397 for ( node = next; node; node = node->next ) 00398 { 00399 if ( strcmp( node->Value(), _value ) == 0 ) 00400 return node; 00401 } 00402 return 0; 00403 }
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const char * | _next | ) | [inline] |
Definition at line 645 of file OBTtinyxml.h.
00645 { 00646 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); 00647 }
const TiXmlElement * OBT::TiXmlNode::NextSiblingElement | ( | ) | const |
Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.
Definition at line 463 of file OBTtinyxml.cpp.
References NextSibling(), and ToElement().
Referenced by OBT::XMLConfigurationFileParser::AddChildren(), OBT::TiXmlHandle::ChildElement(), and NextSiblingElement().
00464 { 00465 const TiXmlNode* node; 00466 00467 for ( node = NextSibling(); 00468 node; 00469 node = node->NextSibling() ) 00470 { 00471 if ( node->ToElement() ) 00472 return node->ToElement(); 00473 } 00474 return 0; 00475 }
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | ) | [inline] |
Definition at line 654 of file OBTtinyxml.h.
00654 { 00655 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); 00656 }
const TiXmlElement * OBT::TiXmlNode::NextSiblingElement | ( | const char * | _value | ) | const |
Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.
Definition at line 478 of file OBTtinyxml.cpp.
References NextSibling(), and ToElement().
00479 { 00480 const TiXmlNode* node; 00481 00482 for ( node = NextSibling( _value ); 00483 node; 00484 node = node->NextSibling( _value ) ) 00485 { 00486 if ( node->ToElement() ) 00487 return node->ToElement(); 00488 } 00489 return 0; 00490 }
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const char * | _next | ) | [inline] |
Definition at line 663 of file OBTtinyxml.h.
00663 { 00664 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); 00665 }
const TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const std::string & | _value | ) | const [inline] |
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const std::string & | _value | ) | [inline] |
const TiXmlElement * OBT::TiXmlNode::FirstChildElement | ( | ) | const |
Convenience function to get through elements.
Definition at line 433 of file OBTtinyxml.cpp.
References FirstChild(), NextSibling(), and ToElement().
Referenced by OBT::XMLConfigurationFileParser::AddChildren(), OBT::TiXmlHandle::ChildElement(), FirstChildElement(), OBT::TiXmlHandle::FirstChildElement(), and OBT::TiXmlDocument::RootElement().
00434 { 00435 const TiXmlNode* node; 00436 00437 for ( node = FirstChild(); 00438 node; 00439 node = node->NextSibling() ) 00440 { 00441 if ( node->ToElement() ) 00442 return node->ToElement(); 00443 } 00444 return 0; 00445 }
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | ) | [inline] |
Definition at line 674 of file OBTtinyxml.h.
00674 { 00675 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); 00676 }
const TiXmlElement * OBT::TiXmlNode::FirstChildElement | ( | const char * | _value | ) | const |
Convenience function to get through elements.
Definition at line 448 of file OBTtinyxml.cpp.
References FirstChild(), NextSibling(), and ToElement().
00449 { 00450 const TiXmlNode* node; 00451 00452 for ( node = FirstChild( _value ); 00453 node; 00454 node = node->NextSibling( _value ) ) 00455 { 00456 if ( node->ToElement() ) 00457 return node->ToElement(); 00458 } 00459 return 0; 00460 }
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const char * | _value | ) | [inline] |
Definition at line 680 of file OBTtinyxml.h.
00680 { 00681 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); 00682 }
const TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const std::string & | _value | ) | const [inline] |
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const std::string & | _value | ) | [inline] |
int OBT::TiXmlNode::Type | ( | ) | const [inline] |
Query the type (as an enumerated value, above) of this node.
The possible types are: DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, and DECLARATION.
Definition at line 693 of file OBTtinyxml.h.
Referenced by InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), and LinkEndChild().
00693 { return type; }
const TiXmlDocument * OBT::TiXmlNode::GetDocument | ( | ) | const |
Return a pointer to the Document this node lives in.
Returns null if not in a document.
Definition at line 493 of file OBTtinyxml.cpp.
References parent, and ToDocument().
Referenced by Identify(), InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), LinkEndChild(), OBT::TiXmlDeclaration::Parse(), OBT::TiXmlText::Parse(), OBT::TiXmlComment::Parse(), OBT::TiXmlUnknown::Parse(), OBT::TiXmlElement::Parse(), OBT::TiXmlElement::ReadValue(), OBT::TiXmlElement::SetAttribute(), OBT::TiXmlDeclaration::StreamIn(), OBT::TiXmlText::StreamIn(), OBT::TiXmlComment::StreamIn(), OBT::TiXmlUnknown::StreamIn(), and OBT::TiXmlElement::StreamIn().
00494 { 00495 const TiXmlNode* node; 00496 00497 for( node = this; node; node = node->parent ) 00498 { 00499 if ( node->ToDocument() ) 00500 return node->ToDocument(); 00501 } 00502 return 0; 00503 }
TiXmlDocument* OBT::TiXmlNode::GetDocument | ( | ) | [inline] |
Definition at line 699 of file OBTtinyxml.h.
00699 { 00700 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); 00701 }
bool OBT::TiXmlNode::NoChildren | ( | ) | const [inline] |
Returns true if this node has no children.
Definition at line 704 of file OBTtinyxml.h.
00704 { return !firstChild; }
virtual const TiXmlDocument* OBT::TiXmlNode::ToDocument | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDocument, and OBT::TiXmlDocument.
Definition at line 706 of file OBTtinyxml.h.
Referenced by GetDocument().
virtual const TiXmlElement* OBT::TiXmlNode::ToElement | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlElement, and OBT::TiXmlElement.
Definition at line 707 of file OBTtinyxml.h.
Referenced by FirstChildElement(), NextSiblingElement(), OBT::TiXmlDocument::StreamIn(), and OBT::TiXmlHandle::ToElement().
virtual const TiXmlComment* OBT::TiXmlNode::ToComment | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlComment, and OBT::TiXmlComment.
Definition at line 708 of file OBTtinyxml.h.
virtual const TiXmlUnknown* OBT::TiXmlNode::ToUnknown | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlUnknown, and OBT::TiXmlUnknown.
Definition at line 709 of file OBTtinyxml.h.
Referenced by OBT::TiXmlHandle::ToUnknown().
virtual const TiXmlText* OBT::TiXmlNode::ToText | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlText, and OBT::TiXmlText.
Definition at line 710 of file OBTtinyxml.h.
Referenced by OBT::TiXmlElement::GetText(), OBT::TiXmlElement::Print(), OBT::TiXmlHandle::ToText(), and OBT::TiXmlPrinter::VisitEnter().
virtual const TiXmlDeclaration* OBT::TiXmlNode::ToDeclaration | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDeclaration, and OBT::TiXmlDeclaration.
Definition at line 711 of file OBTtinyxml.h.
Referenced by OBT::TiXmlDocument::Parse().
virtual TiXmlDocument* OBT::TiXmlNode::ToDocument | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDocument, and OBT::TiXmlDocument.
Definition at line 713 of file OBTtinyxml.h.
virtual TiXmlElement* OBT::TiXmlNode::ToElement | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlElement, and OBT::TiXmlElement.
Definition at line 714 of file OBTtinyxml.h.
virtual TiXmlComment* OBT::TiXmlNode::ToComment | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlComment, and OBT::TiXmlComment.
Definition at line 715 of file OBTtinyxml.h.
virtual TiXmlUnknown* OBT::TiXmlNode::ToUnknown | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlUnknown, and OBT::TiXmlUnknown.
Definition at line 716 of file OBTtinyxml.h.
virtual TiXmlText* OBT::TiXmlNode::ToText | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlText, and OBT::TiXmlText.
Definition at line 717 of file OBTtinyxml.h.
virtual TiXmlDeclaration* OBT::TiXmlNode::ToDeclaration | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDeclaration, and OBT::TiXmlDeclaration.
Definition at line 718 of file OBTtinyxml.h.
virtual TiXmlNode* OBT::TiXmlNode::Clone | ( | ) | const [pure virtual] |
Create an exact duplicate of this node and return it.
The memory must be deleted by the caller.
Implemented in OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, OBT::TiXmlDocument, OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, and OBT::TiXmlDocument.
Referenced by OBT::TiXmlDocument::CopyTo(), OBT::TiXmlElement::CopyTo(), InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), and ReplaceChild().
virtual bool OBT::TiXmlNode::Accept | ( | TiXmlVisitor * | visitor | ) | const [pure virtual] |
Accept a hierchical visit the nodes in the TinyXML DOM.
Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface.
This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for "visiting".
An example of using Accept():
TiXmlPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
Implemented in OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, OBT::TiXmlDocument, OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, and OBT::TiXmlDocument.
Referenced by OBT::operator<<().
void OBT::TiXmlNode::CopyTo | ( | TiXmlNode * | target | ) | const [protected] |
Definition at line 162 of file OBTtinyxml.cpp.
References setValue(), OBT::TiXmlBase::userData, and value.
Referenced by OBT::TiXmlUnknown::CopyTo(), OBT::TiXmlDeclaration::CopyTo(), OBT::TiXmlText::CopyTo(), OBT::TiXmlComment::CopyTo(), OBT::TiXmlDocument::CopyTo(), and OBT::TiXmlElement::CopyTo().
virtual void OBT::TiXmlNode::StreamIn | ( | std::istream * | in, | |
TIXML_STRING * | tag | |||
) | [protected, pure virtual] |
Implemented in OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, OBT::TiXmlDocument, OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, and OBT::TiXmlDocument.
Referenced by OBT::operator>>(), OBT::TiXmlElement::StreamIn(), and OBT::TiXmlDocument::StreamIn().
TiXmlNode * OBT::TiXmlNode::Identify | ( | const char * | start, | |
TiXmlEncoding | encoding | |||
) | [protected] |
Definition at line 820 of file OBTtinyxmlparser.cpp.
References GetDocument(), OBT::TiXmlBase::IsAlpha(), parent, OBT::TiXmlText::SetCDATA(), OBT::TiXmlDocument::SetError(), OBT::TiXmlBase::SkipWhiteSpace(), OBT::TiXmlBase::StringEqual(), OBT::TIXML_ENCODING_UNKNOWN, OBT::TiXmlBase::TIXML_ERROR_OUT_OF_MEMORY, and TiXmlElement.
Referenced by OBT::TiXmlDocument::Parse(), OBT::TiXmlElement::ReadValue(), OBT::TiXmlElement::StreamIn(), and OBT::TiXmlDocument::StreamIn().
00821 { 00822 TiXmlNode* returnNode = 0; 00823 00824 p = SkipWhiteSpace( p, encoding ); 00825 if( !p || !*p || *p != '<' ) 00826 { 00827 return 0; 00828 } 00829 00830 TiXmlDocument* doc = GetDocument(); 00831 p = SkipWhiteSpace( p, encoding ); 00832 00833 if ( !p || !*p ) 00834 { 00835 return 0; 00836 } 00837 00838 // What is this thing? 00839 // - Elements start with a letter or underscore, but xml is reserved. 00840 // - Comments: <!-- 00841 // - Decleration: <?xml 00842 // - Everthing else is unknown to tinyxml. 00843 // 00844 00845 const char* xmlHeader = { "<?xml" }; 00846 const char* commentHeader = { "<!--" }; 00847 const char* dtdHeader = { "<!" }; 00848 const char* cdataHeader = { "<![CDATA[" }; 00849 00850 if ( StringEqual( p, xmlHeader, true, encoding ) ) 00851 { 00852 #ifdef DEBUG_PARSER 00853 TIXML_LOG( "XML parsing Declaration\n" ); 00854 #endif 00855 returnNode = new TiXmlDeclaration(); 00856 } 00857 else if ( StringEqual( p, commentHeader, false, encoding ) ) 00858 { 00859 #ifdef DEBUG_PARSER 00860 TIXML_LOG( "XML parsing Comment\n" ); 00861 #endif 00862 returnNode = new TiXmlComment(); 00863 } 00864 else if ( StringEqual( p, cdataHeader, false, encoding ) ) 00865 { 00866 #ifdef DEBUG_PARSER 00867 TIXML_LOG( "XML parsing CDATA\n" ); 00868 #endif 00869 TiXmlText* text = new TiXmlText( "" ); 00870 text->SetCDATA( true ); 00871 returnNode = text; 00872 } 00873 else if ( StringEqual( p, dtdHeader, false, encoding ) ) 00874 { 00875 #ifdef DEBUG_PARSER 00876 TIXML_LOG( "XML parsing Unknown(1)\n" ); 00877 #endif 00878 returnNode = new TiXmlUnknown(); 00879 } 00880 else if ( IsAlpha( *(p+1), encoding ) 00881 || *(p+1) == '_' ) 00882 { 00883 #ifdef DEBUG_PARSER 00884 TIXML_LOG( "XML parsing Element\n" ); 00885 #endif 00886 returnNode = new TiXmlElement( "" ); 00887 } 00888 else 00889 { 00890 #ifdef DEBUG_PARSER 00891 TIXML_LOG( "XML parsing Unknown(2)\n" ); 00892 #endif 00893 returnNode = new TiXmlUnknown(); 00894 } 00895 00896 if ( returnNode ) 00897 { 00898 // Set the parent, so it can report errors 00899 returnNode->parent = this; 00900 } 00901 else 00902 { 00903 if ( doc ) 00904 doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); 00905 } 00906 return returnNode; 00907 }
void OBT::TiXmlNode::operator= | ( | const TiXmlNode & | base | ) | [private] |
const char* OBT::TiXmlNode::Value | ( | ) | const [inline] |
The meaning of 'value' changes for the specific type of TiXmlNode.
Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
The subclasses will wrap this function.
Definition at line 495 of file tiny/OBTtinyxml.h.
References value.
00495 { return value.c_str (); }
const std::string& OBT::TiXmlNode::ValueStr | ( | ) | const [inline] |
const TIXML_STRING& OBT::TiXmlNode::ValueTStr | ( | ) | const [inline] |
void OBT::TiXmlNode::SetValue | ( | const char * | _value | ) | [inline] |
Changes the value of the node.
Defined as:
Document: filename of the xml file Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
Definition at line 516 of file tiny/OBTtinyxml.h.
References value.
Referenced by OBT::TiXmlComment::TiXmlComment(), and OBT::TiXmlText::TiXmlText().
00516 { value = _value;}
void OBT::TiXmlNode::SetValue | ( | const std::string & | _value | ) | [inline] |
void OBT::TiXmlNode::Clear | ( | ) |
Delete all the children of this node. Does not affect 'this'.
TiXmlNode* OBT::TiXmlNode::Parent | ( | ) | [inline] |
One step up the DOM.
Definition at line 527 of file tiny/OBTtinyxml.h.
References parent.
00527 { return parent; }
const TiXmlNode* OBT::TiXmlNode::Parent | ( | ) | const [inline] |
const TiXmlNode* OBT::TiXmlNode::FirstChild | ( | ) | const [inline] |
The first child of this node. Will be null if there are no children.
Definition at line 530 of file tiny/OBTtinyxml.h.
References firstChild.
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | ) | [inline] |
Definition at line 531 of file tiny/OBTtinyxml.h.
References firstChild.
00531 { return firstChild; }
const TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const char * | value | ) | const |
The first child of this node with the matching 'value'.
Will be null if none found.
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const char * | _value | ) | [inline] |
The first child of this node with the matching 'value'. Will be null if none found.
Definition at line 534 of file tiny/OBTtinyxml.h.
00534 { 00535 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) 00536 // call the method, cast the return back to non-const. 00537 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); 00538 }
const TiXmlNode* OBT::TiXmlNode::LastChild | ( | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::LastChild | ( | ) | [inline] |
The last child of this node. Will be null if there are no children.
Definition at line 540 of file tiny/OBTtinyxml.h.
References lastChild.
00540 { return lastChild; }
const TiXmlNode* OBT::TiXmlNode::LastChild | ( | const char * | value | ) | const |
TiXmlNode* OBT::TiXmlNode::LastChild | ( | const char * | _value | ) | [inline] |
The last child of this node matching 'value'. Will be null if there are no children.
Definition at line 543 of file tiny/OBTtinyxml.h.
00543 { 00544 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); 00545 }
const TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::FirstChild | ( | const std::string & | _value | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::LastChild | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::LastChild | ( | const std::string & | _value | ) | [inline] |
An alternate way to walk the children of a node.
One way to iterate over nodes is:
for( child = parent->FirstChild(); child; child = child->NextSibling() )
IterateChildren does the same thing with the syntax:
child = 0; while( child = parent->IterateChildren( child ) )
IterateChildren takes the previous child as input and finds the next one. If the previous child is null, it returns the first. IterateChildren will return null when done.
Definition at line 571 of file tiny/OBTtinyxml.h.
00571 { 00572 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); 00573 }
const TiXmlNode* OBT::TiXmlNode::IterateChildren | ( | const char * | value, | |
const TiXmlNode * | previous | |||
) | const |
This flavor of IterateChildren searches for children with a particular 'value'.
TiXmlNode* OBT::TiXmlNode::IterateChildren | ( | const char * | _value, | |
const TiXmlNode * | previous | |||
) | [inline] |
Definition at line 577 of file tiny/OBTtinyxml.h.
00577 { 00578 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); 00579 }
const TiXmlNode* OBT::TiXmlNode::IterateChildren | ( | const std::string & | _value, | |
const TiXmlNode * | previous | |||
) | const [inline] |
STL std::string form.
Definition at line 582 of file tiny/OBTtinyxml.h.
References IterateChildren().
TiXmlNode* OBT::TiXmlNode::IterateChildren | ( | const std::string & | _value, | |
const TiXmlNode * | previous | |||
) | [inline] |
STL std::string form.
Definition at line 583 of file tiny/OBTtinyxml.h.
References IterateChildren().
Add a new node related to this.
Adds a child past the LastChild. Returns a pointer to the new object or NULL if an error occured.
Add a new node related to this.
Adds a child past the LastChild.
NOTE: the node to be added is passed by pointer, and will be henceforth owned (and deleted) by tinyXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.
Add a new node related to this.
Adds a child before the specified child. Returns a pointer to the new object or NULL if an error occured.
Add a new node related to this.
Adds a child after the specified child. Returns a pointer to the new object or NULL if an error occured.
Replace a child of this node.
Returns a pointer to the new object or NULL if an error occured.
bool OBT::TiXmlNode::RemoveChild | ( | TiXmlNode * | removeThis | ) |
Delete a child of this node.
const TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | ) | const [inline] |
Navigate to a sibling node.
Definition at line 622 of file tiny/OBTtinyxml.h.
References prev.
00622 { return prev; }
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const char * | ) | const |
Navigate to a sibling node.
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const char * | _prev | ) | [inline] |
Definition at line 627 of file tiny/OBTtinyxml.h.
00627 { 00628 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); 00629 }
const TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const std::string & | _value | ) | const [inline] |
STL std::string form.
Definition at line 632 of file tiny/OBTtinyxml.h.
References PreviousSibling().
TiXmlNode* OBT::TiXmlNode::PreviousSibling | ( | const std::string & | _value | ) | [inline] |
STL std::string form.
Definition at line 633 of file tiny/OBTtinyxml.h.
References PreviousSibling().
const TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const std::string & | _value | ) | const [inline] |
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const std::string & | _value | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::NextSibling | ( | ) | const [inline] |
Navigate to a sibling node.
Definition at line 639 of file tiny/OBTtinyxml.h.
References next.
00639 { return next; }
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | ) | [inline] |
const TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const char * | ) | const |
Navigate to a sibling node with the given 'value'.
TiXmlNode* OBT::TiXmlNode::NextSibling | ( | const char * | _next | ) | [inline] |
Definition at line 644 of file tiny/OBTtinyxml.h.
00644 { 00645 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); 00646 }
const TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | ) | const |
Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | ) | [inline] |
Definition at line 653 of file tiny/OBTtinyxml.h.
00653 { 00654 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); 00655 }
const TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const char * | ) | const |
Convenience function to get through elements.
Calls NextSibling and ToElement. Will skip all non-Element nodes. Returns 0 if there is not another element.
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const char * | _next | ) | [inline] |
Definition at line 662 of file tiny/OBTtinyxml.h.
00662 { 00663 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); 00664 }
const TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const std::string & | _value | ) | const [inline] |
STL std::string form.
Definition at line 667 of file tiny/OBTtinyxml.h.
References NextSiblingElement().
TiXmlElement* OBT::TiXmlNode::NextSiblingElement | ( | const std::string & | _value | ) | [inline] |
STL std::string form.
Definition at line 668 of file tiny/OBTtinyxml.h.
References NextSiblingElement().
const TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | ) | const |
Convenience function to get through elements.
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | ) | [inline] |
Definition at line 673 of file tiny/OBTtinyxml.h.
00673 { 00674 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); 00675 }
const TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const char * | _value | ) | const |
Convenience function to get through elements.
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const char * | _value | ) | [inline] |
Definition at line 679 of file tiny/OBTtinyxml.h.
00679 { 00680 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); 00681 }
const TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const std::string & | _value | ) | const [inline] |
STL std::string form.
Definition at line 684 of file tiny/OBTtinyxml.h.
References FirstChildElement().
TiXmlElement* OBT::TiXmlNode::FirstChildElement | ( | const std::string & | _value | ) | [inline] |
STL std::string form.
Definition at line 685 of file tiny/OBTtinyxml.h.
References FirstChildElement().
int OBT::TiXmlNode::Type | ( | ) | const [inline] |
Query the type (as an enumerated value, above) of this node.
The possible types are: DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, and DECLARATION.
Definition at line 692 of file tiny/OBTtinyxml.h.
References type.
00692 { return type; }
const TiXmlDocument* OBT::TiXmlNode::GetDocument | ( | ) | const |
Return a pointer to the Document this node lives in.
Returns null if not in a document.
TiXmlDocument* OBT::TiXmlNode::GetDocument | ( | ) | [inline] |
Definition at line 698 of file tiny/OBTtinyxml.h.
00698 { 00699 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); 00700 }
bool OBT::TiXmlNode::NoChildren | ( | ) | const [inline] |
Returns true if this node has no children.
Definition at line 703 of file tiny/OBTtinyxml.h.
References firstChild.
00703 { return !firstChild; }
virtual const TiXmlDocument* OBT::TiXmlNode::ToDocument | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDocument, and OBT::TiXmlDocument.
Definition at line 705 of file tiny/OBTtinyxml.h.
virtual const TiXmlElement* OBT::TiXmlNode::ToElement | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlElement, and OBT::TiXmlElement.
Definition at line 706 of file tiny/OBTtinyxml.h.
virtual const TiXmlComment* OBT::TiXmlNode::ToComment | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlComment, and OBT::TiXmlComment.
Definition at line 707 of file tiny/OBTtinyxml.h.
virtual const TiXmlUnknown* OBT::TiXmlNode::ToUnknown | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlUnknown, and OBT::TiXmlUnknown.
Definition at line 708 of file tiny/OBTtinyxml.h.
virtual const TiXmlText* OBT::TiXmlNode::ToText | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlText, and OBT::TiXmlText.
Definition at line 709 of file tiny/OBTtinyxml.h.
virtual const TiXmlDeclaration* OBT::TiXmlNode::ToDeclaration | ( | ) | const [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDeclaration, and OBT::TiXmlDeclaration.
Definition at line 710 of file tiny/OBTtinyxml.h.
virtual TiXmlDocument* OBT::TiXmlNode::ToDocument | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDocument, and OBT::TiXmlDocument.
Definition at line 712 of file tiny/OBTtinyxml.h.
virtual TiXmlElement* OBT::TiXmlNode::ToElement | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlElement, and OBT::TiXmlElement.
Definition at line 713 of file tiny/OBTtinyxml.h.
virtual TiXmlComment* OBT::TiXmlNode::ToComment | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlComment, and OBT::TiXmlComment.
Definition at line 714 of file tiny/OBTtinyxml.h.
virtual TiXmlUnknown* OBT::TiXmlNode::ToUnknown | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlUnknown, and OBT::TiXmlUnknown.
Definition at line 715 of file tiny/OBTtinyxml.h.
virtual TiXmlText* OBT::TiXmlNode::ToText | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlText, and OBT::TiXmlText.
Definition at line 716 of file tiny/OBTtinyxml.h.
virtual TiXmlDeclaration* OBT::TiXmlNode::ToDeclaration | ( | ) | [inline, virtual] |
Cast to a more defined type. Will return null if not of the requested type.
Reimplemented in OBT::TiXmlDeclaration, and OBT::TiXmlDeclaration.
Definition at line 717 of file tiny/OBTtinyxml.h.
virtual TiXmlNode* OBT::TiXmlNode::Clone | ( | ) | const [pure virtual] |
Create an exact duplicate of this node and return it.
The memory must be deleted by the caller.
Implemented in OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, OBT::TiXmlDocument, OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, and OBT::TiXmlDocument.
virtual bool OBT::TiXmlNode::Accept | ( | TiXmlVisitor * | visitor | ) | const [pure virtual] |
Accept a hierchical visit the nodes in the TinyXML DOM.
Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface.
This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for "visiting".
An example of using Accept():
TiXmlPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
Implemented in OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, OBT::TiXmlDocument, OBT::TiXmlElement, OBT::TiXmlComment, OBT::TiXmlText, OBT::TiXmlDeclaration, OBT::TiXmlUnknown, and OBT::TiXmlDocument.
void OBT::TiXmlNode::CopyTo | ( | TiXmlNode * | target | ) | const [protected] |
virtual void OBT::TiXmlNode::StreamIn | ( | std::istream * | in, | |
TIXML_STRING * | tag | |||
) | [protected, pure virtual] |
TiXmlNode* OBT::TiXmlNode::Identify | ( | const char * | start, | |
TiXmlEncoding | encoding | |||
) | [protected] |
void OBT::TiXmlNode::operator= | ( | const TiXmlNode & | base | ) | [private] |
TiXmlDocument [friend] |
TiXmlElement [friend] |
Reimplemented from OBT::TiXmlBase.
Reimplemented in OBT::TiXmlText.
Definition at line 435 of file OBTtinyxml.h.
Referenced by Identify().
OBT_API friend std::istream& operator>> | ( | std::istream & | in, | |
TiXmlNode & | base | |||
) | [friend] |
An input stream operator, for every class.
Tolerant of newlines and formatting, but doesn't expect them.
Definition at line 1600 of file OBTtinyxml.cpp.
01601 { 01602 TIXML_STRING tag; 01603 tag.reserve( 8 * 1000 ); 01604 base.StreamIn( &in, &tag ); 01605 01606 base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); 01607 return in; 01608 }
OBT_API friend std::ostream& operator<< | ( | std::ostream & | out, | |
const TiXmlNode & | base | |||
) | [friend] |
An output stream operator, for every class.
Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines.
The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is true of all input streams, but it's worth keeping in mind.
A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element.
Definition at line 1613 of file OBTtinyxml.cpp.
01614 { 01615 TiXmlPrinter printer; 01616 printer.SetStreamPrinting(); 01617 base.Accept( &printer ); 01618 out << printer.Str(); 01619 01620 return out; 01621 }
OBT_API friend std::string& operator<< | ( | std::string & | out, | |
const TiXmlNode & | base | |||
) | [friend] |
Appends the XML node or attribute to a std::string.
Definition at line 1624 of file OBTtinyxml.cpp.
01625 { 01626 TiXmlPrinter printer; 01627 printer.SetStreamPrinting(); 01628 base.Accept( &printer ); 01629 out.append( printer.Str() ); 01630 01631 return out; 01632 }
std::istream& operator>> | ( | std::istream & | in, | |
TiXmlNode & | base | |||
) | [friend] |
An input stream operator, for every class.
Tolerant of newlines and formatting, but doesn't expect them.
Definition at line 1600 of file OBTtinyxml.cpp.
01601 { 01602 TIXML_STRING tag; 01603 tag.reserve( 8 * 1000 ); 01604 base.StreamIn( &in, &tag ); 01605 01606 base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); 01607 return in; 01608 }
std::ostream& operator<< | ( | std::ostream & | out, | |
const TiXmlNode & | base | |||
) | [friend] |
An output stream operator, for every class.
Note that this outputs without any newlines or formatting, as opposed to Print(), which includes tabs and new lines.
The operator<< and operator>> are not completely symmetric. Writing a node to a stream is very well defined. You'll get a nice stream of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create a TiXmlElement (for example) and read that from an input stream, the text needs to define an element or junk will result. This is true of all input streams, but it's worth keeping in mind.
A TiXmlDocument will read nodes until it reads a root element, and all the children of that root element.
Definition at line 1613 of file OBTtinyxml.cpp.
01614 { 01615 TiXmlPrinter printer; 01616 printer.SetStreamPrinting(); 01617 base.Accept( &printer ); 01618 out << printer.Str(); 01619 01620 return out; 01621 }
std::string& operator<< | ( | std::string & | out, | |
const TiXmlNode & | base | |||
) | [friend] |
Appends the XML node or attribute to a std::string.
Definition at line 1624 of file OBTtinyxml.cpp.
01625 { 01626 TiXmlPrinter printer; 01627 printer.SetStreamPrinting(); 01628 base.Accept( &printer ); 01629 out.append( printer.Str() ); 01630 01631 return out; 01632 }
TiXmlNode* OBT::TiXmlNode::parent [protected] |
Definition at line 764 of file OBTtinyxml.h.
Referenced by GetDocument(), Identify(), InsertAfterChild(), InsertBeforeChild(), IterateChildren(), LinkEndChild(), Parent(), RemoveChild(), ReplaceChild(), and TiXmlNode().
NodeType OBT::TiXmlNode::type [protected] |
TiXmlNode* OBT::TiXmlNode::firstChild [protected] |
Definition at line 767 of file OBTtinyxml.h.
Referenced by Clear(), OBT::TiXmlDocument::CopyTo(), OBT::TiXmlElement::CopyTo(), FirstChild(), InsertBeforeChild(), LinkEndChild(), NoChildren(), OBT::TiXmlDocument::Parse(), OBT::TiXmlElement::Print(), RemoveChild(), ReplaceChild(), OBT::TiXmlElement::TiXmlElement(), TiXmlNode(), and ~TiXmlNode().
TiXmlNode* OBT::TiXmlNode::lastChild [protected] |
Definition at line 768 of file OBTtinyxml.h.
Referenced by Clear(), InsertAfterChild(), LastChild(), LinkEndChild(), OBT::TiXmlElement::Print(), RemoveChild(), ReplaceChild(), OBT::TiXmlElement::TiXmlElement(), and TiXmlNode().
TIXML_STRING OBT::TiXmlNode::value [protected] |
Definition at line 770 of file OBTtinyxml.h.
Referenced by OBT::TiXmlText::Blank(), CopyTo(), OBT::TiXmlDocument::LoadFile(), OBT::TiXmlText::Parse(), OBT::TiXmlComment::Parse(), OBT::TiXmlUnknown::Parse(), OBT::TiXmlElement::Parse(), OBT::TiXmlUnknown::Print(), OBT::TiXmlText::Print(), OBT::TiXmlComment::Print(), OBT::TiXmlElement::Print(), SetValue(), OBT::TiXmlDocument::TiXmlDocument(), OBT::TiXmlElement::TiXmlElement(), Value(), ValueStr(), and ValueTStr().
TiXmlNode* OBT::TiXmlNode::prev [protected] |
Definition at line 772 of file OBTtinyxml.h.
Referenced by InsertAfterChild(), InsertBeforeChild(), LastChild(), LinkEndChild(), PreviousSibling(), RemoveChild(), ReplaceChild(), and TiXmlNode().
TiXmlNode* OBT::TiXmlNode::next [protected] |
Definition at line 773 of file OBTtinyxml.h.
Referenced by Clear(), FirstChild(), InsertAfterChild(), InsertBeforeChild(), LinkEndChild(), NextSibling(), RemoveChild(), ReplaceChild(), TiXmlNode(), and ~TiXmlNode().
TiXmlNode* OBT::TiXmlNode::parent [protected] |
Definition at line 763 of file tiny/OBTtinyxml.h.
TiXmlNode* OBT::TiXmlNode::firstChild [protected] |
Definition at line 766 of file tiny/OBTtinyxml.h.
TiXmlNode* OBT::TiXmlNode::lastChild [protected] |
Definition at line 767 of file tiny/OBTtinyxml.h.
TiXmlNode* OBT::TiXmlNode::prev [protected] |
Definition at line 771 of file tiny/OBTtinyxml.h.
TiXmlNode* OBT::TiXmlNode::next [protected] |
Definition at line 772 of file tiny/OBTtinyxml.h.