33 #ifndef TINYXML_INCLUDED
34 #define TINYXML_INCLUDED
37 #pragma warning( push )
38 #pragma warning( disable : 4530 )
39 #pragma warning( disable : 4786 )
49 #if defined( _DEBUG ) && !defined( DEBUG )
57 #define TIXML_STRING std::string
60 #define TIXML_STRING TiXmlString
70 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
72 #define TIXML_SNPRINTF _snprintf_s
73 #define TIXML_SNSCANF _snscanf_s
74 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
77 #define TIXML_SNPRINTF _snprintf
78 #define TIXML_SNSCANF _snscanf
79 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
82 #define TIXML_SNPRINTF snprintf
83 #define TIXML_SNSCANF snscanf
96 const int TIXML_MAJOR_VERSION = 2;
97 const int TIXML_MINOR_VERSION = 5;
98 const int TIXML_PATCH_VERSION = 2;
106 void Clear() { row = col = -1; }
168 TIXML_ENCODING_UNKNOWN,
170 TIXML_ENCODING_LEGACY
173 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
216 virtual void Print( FILE* cfile,
int depth )
const = 0;
247 int Row()
const {
return location.row + 1; }
248 int Column()
const {
return location.col + 1; }
256 static const int utf8ByteTable[256];
258 virtual const char*
Parse(
const char* p,
260 TiXmlEncoding encoding ) = 0;
266 TIXML_ERROR_OPENING_FILE,
267 TIXML_ERROR_OUT_OF_MEMORY,
268 TIXML_ERROR_PARSING_ELEMENT,
269 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
270 TIXML_ERROR_READING_ELEMENT_VALUE,
271 TIXML_ERROR_READING_ATTRIBUTES,
272 TIXML_ERROR_PARSING_EMPTY,
273 TIXML_ERROR_READING_END_TAG,
274 TIXML_ERROR_PARSING_UNKNOWN,
275 TIXML_ERROR_PARSING_COMMENT,
276 TIXML_ERROR_PARSING_DECLARATION,
277 TIXML_ERROR_DOCUMENT_EMPTY,
278 TIXML_ERROR_EMBEDDED_NULL,
279 TIXML_ERROR_PARSING_CDATA,
280 TIXML_ERROR_DOCUMENT_TOP_ONLY,
282 TIXML_ERROR_STRING_COUNT
287 static const char* SkipWhiteSpace(
const char*, TiXmlEncoding encoding );
288 inline static bool IsWhiteSpace(
char c )
290 return ( isspace( (
unsigned char) c ) || c ==
'\n' || c ==
'\r' );
292 inline static bool IsWhiteSpace(
int c )
295 return IsWhiteSpace( (
char) c );
300 static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
301 static bool StreamTo( std::istream * in,
int character, TIXML_STRING * tag );
308 static const char* ReadName(
const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
313 static const char* ReadText(
const char* in,
315 bool ignoreWhiteSpace,
318 TiXmlEncoding encoding );
321 static const char* GetEntity(
const char* in,
char* value,
int* length, TiXmlEncoding encoding );
325 inline static const char* GetChar(
const char* p,
char* _value,
int* length, TiXmlEncoding encoding )
328 if ( encoding == TIXML_ENCODING_UTF8 )
330 *length = utf8ByteTable[ *((
const unsigned char*)p) ];
331 assert( *length >= 0 && *length < 5 );
341 return GetEntity( p, _value, length, encoding );
349 for(
int i=0; p[i] && i<*length; ++i ) {
352 return p + (*length);
363 static void PutString(
const TIXML_STRING& str, TIXML_STRING* out );
368 static bool StringEqual(
const char* p,
371 TiXmlEncoding encoding );
373 static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
382 static int IsAlpha(
unsigned char anyByte, TiXmlEncoding encoding );
383 static int IsAlphaNum(
unsigned char anyByte, TiXmlEncoding encoding );
384 inline static int ToLower(
int v, TiXmlEncoding encoding )
386 if ( encoding == TIXML_ENCODING_UTF8 )
388 if ( v < 128 )
return tolower( v );
396 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
405 unsigned int strLength;
411 MAX_ENTITY_LENGTH = 6
414 static Entity entity[ NUM_ENTITY ];
415 static bool condenseWhiteSpace;
489 const char *
Value()
const {
return value.c_str (); }
496 const std::string&
ValueStr()
const {
return value; }
508 void SetValue(
const char * _value) { value = _value;}
511 void SetValue(
const std::string& _value ) { value = _value; }
529 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->FirstChild( _value ));
531 const TiXmlNode* LastChild()
const {
return lastChild; }
534 const TiXmlNode* LastChild(
const char * value )
const;
536 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->LastChild( _value ));
564 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( previous ) );
570 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( _value, previous ) );
620 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->PreviousSibling( _prev ) );
637 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSibling( _next ) );
655 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSiblingElement( _next ) );
672 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->FirstChildElement( _value ) );
684 int Type()
const {
return type; }
749 virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
753 TiXmlNode* Identify(
const char* start, TiXmlEncoding encoding );
792 TiXmlAttribute(
const std::string& _name,
const std::string& _value )
811 const char*
Name()
const {
return name.c_str(); }
812 const char*
Value()
const {
return value.c_str(); }
814 const std::string&
ValueStr()
const {
return value; }
820 const TIXML_STRING& NameTStr()
const {
return name; }
835 void SetName(
const char* _name ) { name = _name; }
836 void SetValue(
const char* _value ) { value = _value; }
842 void SetName(
const std::string& _name ) { name = _name; }
845 void SetValue(
const std::string& _value ) { value = _value; }
860 bool operator==(
const TiXmlAttribute& rhs )
const {
return rhs.name == name; }
861 bool operator<(
const TiXmlAttribute& rhs )
const {
return name < rhs.name; }
862 bool operator>(
const TiXmlAttribute& rhs )
const {
return name > rhs.name; }
867 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
870 virtual void Print( FILE* cfile,
int depth )
const {
871 Print( cfile, depth, 0 );
873 void Print( FILE* cfile,
int depth, TIXML_STRING* str )
const;
912 const TiXmlAttribute* First()
const {
return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
913 TiXmlAttribute* First() {
return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
914 const TiXmlAttribute* Last()
const {
return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
915 TiXmlAttribute* Last() {
return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
963 const char*
Attribute(
const char* name )
const;
971 const char*
Attribute(
const char* name,
int* i )
const;
979 const char*
Attribute(
const char* name,
double* d )
const;
995 if ( result == TIXML_SUCCESS ) {
1000 #ifdef TIXML_USE_STL
1011 return TIXML_NO_ATTRIBUTE;
1013 std::stringstream sstream( node->
ValueStr() );
1014 sstream >> *outValue;
1015 if ( !sstream.fail() )
1016 return TIXML_SUCCESS;
1017 return TIXML_WRONG_TYPE;
1024 void SetAttribute(
const char* name,
const char * _value );
1026 #ifdef TIXML_USE_STL
1027 const std::string*
Attribute(
const std::string& name )
const;
1028 const std::string*
Attribute(
const std::string& name,
int* i )
const;
1029 const std::string*
Attribute(
const std::string& name,
double* d )
const;
1034 void SetAttribute(
const std::string& name,
const std::string& _value );
1036 void SetAttribute(
const std::string& name,
int _value );
1052 #ifdef TIXML_USE_STL
1098 virtual void Print( FILE* cfile,
int depth )
const;
1103 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
1118 #ifdef TIXML_USE_STL
1119 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1125 const char* ReadValue(
const char* in,
TiXmlParsingData* prevData, TiXmlEncoding encoding );
1152 virtual void Print( FILE* cfile,
int depth )
const;
1157 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
1170 #ifdef TIXML_USE_STL
1171 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1200 #ifdef TIXML_USE_STL
1210 void operator=(
const TiXmlText& base ) { base.CopyTo(
this ); }
1213 virtual void Print( FILE* cfile,
int depth )
const;
1220 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
1236 #ifdef TIXML_USE_STL
1237 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1264 #ifdef TIXML_USE_STL
1267 const std::string& _encoding,
1268 const std::string& _standalone );
1273 const char* _encoding,
1274 const char* _standalone );
1282 const char *
Version()
const {
return version.c_str (); }
1284 const char *
Encoding()
const {
return encoding.c_str (); }
1291 virtual void Print( FILE* cfile,
int depth, TIXML_STRING* str )
const;
1292 virtual void Print( FILE* cfile,
int depth )
const {
1293 Print( cfile, depth, 0 );
1296 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
1308 #ifdef TIXML_USE_STL
1309 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1314 TIXML_STRING version;
1315 TIXML_STRING encoding;
1316 TIXML_STRING standalone;
1334 void operator=(
const TiXmlUnknown& copy ) { copy.CopyTo(
this ); }
1339 virtual void Print( FILE* cfile,
int depth )
const;
1341 virtual const char* Parse(
const char* p,
TiXmlParsingData* data, TiXmlEncoding encoding );
1353 #ifdef TIXML_USE_STL
1354 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1374 #ifdef TIXML_USE_STL
1388 bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1392 bool LoadFile(
const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1394 bool SaveFile(
const char * filename )
const;
1400 bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1404 #ifdef TIXML_USE_STL
1405 bool LoadFile(
const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1409 return LoadFile( filename.c_str(), encoding );
1415 return SaveFile( filename.c_str() );
1423 virtual const char*
Parse(
const char* p,
TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1440 const char *
ErrorDesc()
const {
return errorDesc.c_str (); }
1483 int TabSize()
const {
return tabsize; }
1491 errorLocation.row = errorLocation.col = 0;
1505 virtual void Print( FILE* cfile,
int depth = 0 )
const;
1507 void SetError(
int err,
const char* errorLocation,
TiXmlParsingData* prevData, TiXmlEncoding encoding );
1519 #ifdef TIXML_USE_STL
1520 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1528 TIXML_STRING errorDesc;
1531 bool useMicrosoftBOM;
1652 #ifdef TIXML_USE_STL
1656 TiXmlHandle Child(
const std::string& _value,
int index )
const {
return Child( _value.c_str(), index ); }
1718 buffer(), indent(
" " ), lineBreak(
"\n" ) {}
1734 void SetIndent(
const char* _indent ) { indent = _indent ? _indent :
"" ; }
1736 const char*
Indent() {
return indent.c_str(); }
1741 void SetLineBreak(
const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak :
""; }
1752 const char*
CStr() {
return buffer.c_str(); }
1754 size_t Size() {
return buffer.size(); }
1756 #ifdef TIXML_USE_STL
1757 const std::string&
Str() {
return buffer; }
1763 for(
int i=0; i<depth; ++i )
1766 void DoLineBreak() {
1767 buffer += lineBreak;
1771 bool simpleTextPrint;
1772 TIXML_STRING buffer;
1773 TIXML_STRING indent;
1774 TIXML_STRING lineBreak;
1779 #pragma warning( pop )
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
Definition: tinyxml.h:535
An attribute is a name-value pair.
Definition: tinyxml.h:779
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1619
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cc:1452
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1688
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:541
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition: tinyxml.cc:837
friend std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)
An output stream operator, for every class.
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:250
If you call the Accept() method, it requires being passed a TiXmlVisitor class to handle callbacks...
Definition: tinyxml.h:131
Definition: tinyxml.h:903
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1509
const std::string & ValueStr() const
Return Value() as a std::string.
Definition: tinyxml.h:496
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
Definition: tinyxml.h:1429
void SetLineBreak(const char *_lineBreak)
Set the line breaking string.
Definition: tinyxml.h:1741
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1105
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1621
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:532
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:1743
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cc:851
bool Error() const
If an error occurs, Error will be set to true.
Definition: tinyxml.h:1437
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:705
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cc:1275
virtual bool Visit(const TiXmlUnknown &)
Visit an unknow node.
Definition: tinyxml.h:153
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:803
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cc:1270
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1222
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cc:1628
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:252
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:684
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
Definition: tinyxml.h:575
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:676
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:696
Definition: tinyxml.h:103
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition: tinyxml.cc:1464
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
Definition: tinyxml.h:1445
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition: tinyxml.h:1292
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:660
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cc:1363
void SetValue(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:845
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
Definition: tinyxml.cc:281
bool SaveFile(const std::string &filename) const
< STL std::string version.
Definition: tinyxml.h:1411
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:1058
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition: tinyxml.h:144
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:835
void SetTabSize(int _tabsize)
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct v...
Definition: tinyxml.h:1481
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cc:875
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:785
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1286
TiXmlElement * ToElement() const
Return the handle as a TiXmlElement.
Definition: tinyxml.h:1665
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:704
void ClearError()
If you have handled the error, it can be reset with this call.
Definition: tinyxml.h:1488
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:812
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:699
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
Definition: tinyxml.cc:1234
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition: tinyxml.cc:762
friend std::istream & operator>>(std::istream &in, TiXmlNode &base)
An input stream operator, for every class.
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition: tinyxml.cc:915
void SetValue(const char *_value)
Changes the value of the node.
Definition: tinyxml.h:508
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1455
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:202
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cc:1757
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1106
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:217
NodeType
The types of XML nodes supported by TinyXml.
Definition: tinyxml.h:464
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:702
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:137
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cc:1652
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1284
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cc:175
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:811
void SetDoubleValue(double _value)
Set the value from a double.
Definition: tinyxml.cc:1259
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:378
virtual bool Accept(TiXmlVisitor *visitor) const =0
Accept a hierchical visit the nodes in the TinyXML DOM.
void Print() const
Write the document to standard out using formatted printing ("pretty print").
Definition: tinyxml.h:1496
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1258
Any tag that tinyXml doesn't recognize is saved as an unknown.
Definition: tinyxml.h:1327
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition: tinyxml.h:149
int ErrorRow() const
Returns the location (if known) of the error.
Definition: tinyxml.h:1454
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1282
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
Definition: tinyxml.cc:1733
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition: tinyxml.cc:1478
int Column() const
See Row()
Definition: tinyxml.h:248
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:227
void SetIndent(const char *_indent)
Set the indent characters for printing.
Definition: tinyxml.h:1734
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:522
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1440
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.h:1405
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1343
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1510
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cc:1168
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
Definition: tinyxml.cc:407
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
Definition: tinyxml.cc:1132
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:708
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition: tinyxml.cc:1329
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition: tinyxml.h:870
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1218
const char * Indent()
Query the indention string.
Definition: tinyxml.h:1736
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:677
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition: tinyxml.cc:924
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1299
Always the top level node.
Definition: tinyxml.h:1366
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:422
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1298
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cc:1241
TiXmlElement(const char *in_value)
Construct an element.
Definition: tinyxml.cc:495
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:542
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:992
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:614
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:626
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:249
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:709
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:698
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
Definition: tinyxml.cc:1695
const std::string & ValueStr() const
Return the value of this attribute.
Definition: tinyxml.h:814
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cc:482
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1216
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition: tinyxml.h:1615
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:706
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition: tinyxml.h:574
TiXmlText * Text() const
Definition: tinyxml.h:1684
TiXmlNode * Node() const
Definition: tinyxml.h:1676
TiXmlNode * ToNode() const
Return the handle as a TiXmlNode.
Definition: tinyxml.h:1662
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cc:1188
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
Definition: tinyxml.h:224
TiXmlBase is a base class for every class in TinyXml.
Definition: tinyxml.h:197
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:452
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:519
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:707
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:700
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cc:1752
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
Definition: tinyxmlparser.cc:712
int QueryIntAttribute(const char *name, int *_value) const
QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer...
Definition: tinyxml.cc:634
int Row() const
Return the position, in the original source file, of this node or attribute.
Definition: tinyxml.h:247
TiXmlElement * Element() const
Definition: tinyxml.h:1680
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition: tinyxml.cc:1154
int QueryValueAttribute(const std::string &name, T *outValue) const
Template form of the attribute query which will try to read the attribute into the specified type...
Definition: tinyxml.h:1007
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:251
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:425
Definition: tinyxmlparser.cc:179
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:701
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:543
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:1754
void SetIntValue(int _value)
Set the value from an integer.
Definition: tinyxml.cc:1248
Print to memory functionality.
Definition: tinyxml.h:1714
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:625
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cc:1484
XML text.
Definition: tinyxml.h:1185
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:540
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:139
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition: tinyxml.h:151
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cc:654
TiXmlText(const char *initValue)
Constructor for text element.
Definition: tinyxml.h:1193
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
Definition: tinyxml.cc:355
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Definition: tinyxml.h:489
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:627
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:695
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition: tinyxml.cc:1446
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:1056
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cc:309
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition: tinyxml.h:1053
const char * GetText() const
Convenience function for easy access to the text inside an element.
Definition: tinyxml.cc:862
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1344
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:697
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition: tinyxml.cc:158
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:836
const std::string & Str()
Return the result.
Definition: tinyxml.h:1758
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:631
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1223
TiXmlText * ToText() const
Return the handle as a TiXmlText.
Definition: tinyxml.h:1668
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1262
void SetStreamPrinting()
Switch over to "stream printing" which is the most dense formatting without linebreaks.
Definition: tinyxml.h:1748
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml.cc:546
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition: tinyxml.cc:1357
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:659
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
Definition: tinyxml.cc:1849
TiXmlUnknown * ToUnknown() const
Return the handle as a TiXmlUnknown.
Definition: tinyxml.h:1671
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:624
const char * CStr()
Return the result.
Definition: tinyxml.h:1752
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:708
The element is a container class.
Definition: tinyxml.h:943
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition: tinyxml.h:142
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition: tinyxml.h:147