tinyxml.h
Go to the documentation of this file.
1 /*
2 www.sourceforge.net/projects/tinyxml
3 Original code by Lee Thomason (www.grinninglizard.com)
4 
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any
7 damages arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any
10 purpose, including commercial applications, and to alter it and
11 redistribute it freely, subject to the following restrictions:
12 
13 1. The origin of this software must not be misrepresented; you must
14 not claim that you wrote the original software. If you use this
15 software in a product, an acknowledgment in the product documentation
16 would be appreciated but is not required.
17 
18 2. Altered source versions must be plainly marked as such, and
19 must not be misrepresented as being the original software.
20 
21 3. This notice may not be removed or altered from any source
22 distribution.
23 */
24 
25 
26 #ifndef TINYXML_INCLUDED
27 #define TINYXML_INCLUDED
28 
29 
30 #ifndef TIXML_USE_STL
31 #define TIXML_USE_STL
32 #endif
33 
34 
35 #ifdef _MSC_VER
36 #pragma warning( push )
37 #pragma warning( disable : 4530 )
38 #pragma warning( disable : 4786 )
39 #endif
40 
41 #include <ctype.h>
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <assert.h>
46 
47 // Help out windows:
48 #if defined( _DEBUG ) && !defined( DEBUG )
49 #define DEBUG
50 #endif
51 
52 #ifdef TIXML_USE_STL
53  #include <string>
54  #include <iostream>
55  #include <sstream>
56  #define TIXML_STRING std::string
57 #else
58  #include "tinystr.h"
59  #define TIXML_STRING TiXmlString
60 #endif
61 
62 // Deprecated library function hell. Compilers want to use the
63 // new safe versions. This probably doesn't fully address the problem,
64 // but it gets closer. There are too many compilers for me to fully
65 // test. If you get compilation troubles, undefine TIXML_SAFE
66 #define TIXML_SAFE
67 
68 #ifdef TIXML_SAFE
69  #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
70  // Microsoft visual studio, version 2005 and higher.
71  #define TIXML_SNPRINTF _snprintf_s
72  #define TIXML_SSCANF sscanf_s
73  #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
74  // Microsoft visual studio, version 6 and higher.
75  //#pragma message( "Using _sn* functions." )
76  #define TIXML_SNPRINTF _snprintf
77  #define TIXML_SSCANF sscanf
78  #elif defined(__GNUC__) && (__GNUC__ >= 3 )
79  // GCC version 3 and higher.s
80  //#warning( "Using sn* functions." )
81  #define TIXML_SNPRINTF snprintf
82  #define TIXML_SSCANF sscanf
83  #else
84  #define TIXML_SNPRINTF snprintf
85  #define TIXML_SSCANF sscanf
86  #endif
87 #endif
88 
89 class TiXmlDocument;
90 class TiXmlElement;
91 class TiXmlComment;
92 class TiXmlUnknown;
93 class TiXmlAttribute;
94 class TiXmlText;
95 class TiXmlDeclaration;
96 class TiXmlParsingData;
97 
98 const int TIXML_MAJOR_VERSION = 2;
99 const int TIXML_MINOR_VERSION = 6;
100 const int TIXML_PATCH_VERSION = 2;
101 
102 /* Internal structure for tracking location of items
103  in the XML file.
104 */
106 {
108  void Clear() { row = col = -1; }
109 
110  int row; // 0 based.
111  int col; // 0 based.
112 };
113 
114 
135 {
136 public:
137  virtual ~TiXmlVisitor() {}
138 
140  virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; }
142  virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; }
143 
145  virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; }
147  virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; }
148 
150  virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; }
152  virtual bool Visit( const TiXmlText& /*text*/ ) { return true; }
154  virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; }
156  virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; }
157 };
158 
159 // Only used by Attribute::Query functions
160 enum
161 {
165 };
166 
167 
168 // Used by the parsing routines.
170 {
174 };
175 
177 
201 {
202  friend class TiXmlNode;
203  friend class TiXmlElement;
204  friend class TiXmlDocument;
205 
206 public:
207  TiXmlBase() : userData(0) {}
208  virtual ~TiXmlBase() {}
209 
219  virtual void Print( FILE* cfile, int depth ) const = 0;
220 
227  static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
228 
230  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
231 
250  int Row() const { return location.row + 1; }
251  int Column() const { return location.col + 1; }
252 
253  void SetUserData( void* user ) { userData = user; }
254  void* GetUserData() { return userData; }
255  const void* GetUserData() const { return userData; }
256 
257  // Table that returs, for a given lead byte, the total number of bytes
258  // in the UTF-8 sequence.
259  static const int utf8ByteTable[256];
260 
261  virtual const char* Parse( const char* p,
263  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
264 
268  static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
269 
270  enum
271  {
288 
290  };
291 
292 protected:
293 
294  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
295 
296  inline static bool IsWhiteSpace( char c )
297  {
298  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
299  }
300  inline static bool IsWhiteSpace( int c )
301  {
302  if ( c < 256 )
303  return IsWhiteSpace( (char) c );
304  return false; // Again, only truly correct for English/Latin...but usually works.
305  }
306 
307  #ifdef TIXML_USE_STL
308  static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
309  static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
310  #endif
311 
312  /* Reads an XML name into the string provided. Returns
313  a pointer just past the last character of the name,
314  or 0 if the function has an error.
315  */
316  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
317 
318  /* Reads text. Returns a pointer past the given end tag.
319  Wickedly complex options, but it keeps the (sensitive) code in one place.
320  */
321  static const char* ReadText( const char* in, // where to start
322  TIXML_STRING* text, // the string read
323  bool ignoreWhiteSpace, // whether to keep the white space
324  const char* endTag, // what ends this text
325  bool ignoreCase, // whether to ignore case in the end tag
326  TiXmlEncoding encoding ); // the current encoding
327 
328  // If an entity has been found, transform it into a character.
329  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
330 
331  // Get a character, while interpreting entities.
332  // The length can be from 0 to 4 bytes.
333  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
334  {
335  assert( p );
336  if ( encoding == TIXML_ENCODING_UTF8 )
337  {
338  *length = utf8ByteTable[ *((const unsigned char*)p) ];
339  assert( *length >= 0 && *length < 5 );
340  }
341  else
342  {
343  *length = 1;
344  }
345 
346  if ( *length == 1 )
347  {
348  if ( *p == '&' )
349  return GetEntity( p, _value, length, encoding );
350  *_value = *p;
351  return p+1;
352  }
353  else if ( *length )
354  {
355  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
356  // and the null terminator isn't needed
357  for( int i=0; p[i] && i<*length; ++i ) {
358  _value[i] = p[i];
359  }
360  return p + (*length);
361  }
362  else
363  {
364  // Not valid text.
365  return 0;
366  }
367  }
368 
369  // Return true if the next characters in the stream are any of the endTag sequences.
370  // Ignore case only works for english, and should only be relied on when comparing
371  // to English words: StringEqual( p, "version", true ) is fine.
372  static bool StringEqual( const char* p,
373  const char* endTag,
374  bool ignoreCase,
375  TiXmlEncoding encoding );
376 
377  static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
378 
380 
382  void* userData;
383 
384  // None of these methods are reliable for any language except English.
385  // Good for approximation, not great for accuracy.
386  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
387  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
388  inline static int ToLower( int v, TiXmlEncoding encoding )
389  {
390  if ( encoding == TIXML_ENCODING_UTF8 )
391  {
392  if ( v < 128 ) return tolower( v );
393  return v;
394  }
395  else
396  {
397  return tolower( v );
398  }
399  }
400  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
401 
402 private:
403  TiXmlBase( const TiXmlBase& ); // not implemented.
404  void operator=( const TiXmlBase& base ); // not allowed.
405 
406  struct Entity
407  {
408  const char* str;
409  unsigned int strLength;
410  char chr;
411  };
412  enum
413  {
414  NUM_ENTITY = 5,
415  MAX_ENTITY_LENGTH = 6
416 
417  };
418  static Entity entity[ NUM_ENTITY ];
419  static bool condenseWhiteSpace;
420 };
421 
422 
429 class TiXmlNode : public TiXmlBase
430 {
431  friend class TiXmlDocument;
432  friend class TiXmlElement;
433 
434 public:
435  #ifdef TIXML_USE_STL
436 
440  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
441 
458  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
459 
461  friend std::string& operator<< (std::string& out, const TiXmlNode& base );
462 
463  #endif
464 
468  enum NodeType
469  {
477  };
478 
479  virtual ~TiXmlNode();
480 
493  const char *Value() const { return value.c_str (); }
494 
495  #ifdef TIXML_USE_STL
496 
500  const std::string& ValueStr() const { return value; }
501  #endif
502 
503  const TIXML_STRING& ValueTStr() const { return value; }
504 
514  void SetValue(const char * _value) { value = _value;}
515 
516  #ifdef TIXML_USE_STL
517  void SetValue( const std::string& _value ) { value = _value; }
519  #endif
520 
522  void Clear();
523 
525  TiXmlNode* Parent() { return parent; }
526  const TiXmlNode* Parent() const { return parent; }
527 
528  const TiXmlNode* FirstChild() const { return firstChild; }
530  const TiXmlNode* FirstChild( const char * value ) const;
531  TiXmlNode* FirstChild( const char * _value ) {
533  // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
534  // call the method, cast the return back to non-const.
535  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
536  }
537  const TiXmlNode* LastChild() const { return lastChild; }
539 
540  const TiXmlNode* LastChild( const char * value ) const;
541  TiXmlNode* LastChild( const char * _value ) {
542  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
543  }
544 
545  #ifdef TIXML_USE_STL
546  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
547  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
548  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
549  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
550  #endif
551 
568  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
569  TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
570  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
571  }
572 
574  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
575  TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
576  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
577  }
578 
579  #ifdef TIXML_USE_STL
580  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
581  TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
582  #endif
583 
587  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
588 
589 
599  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
600 
604  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
605 
609  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
610 
614  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
615 
617  bool RemoveChild( TiXmlNode* removeThis );
618 
620  const TiXmlNode* PreviousSibling() const { return prev; }
622 
624  const TiXmlNode* PreviousSibling( const char * ) const;
625  TiXmlNode* PreviousSibling( const char *_prev ) {
626  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
627  }
628 
629  #ifdef TIXML_USE_STL
630  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
631  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
632  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
633  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
634  #endif
635 
637  const TiXmlNode* NextSibling() const { return next; }
638  TiXmlNode* NextSibling() { return next; }
639 
641  const TiXmlNode* NextSibling( const char * ) const;
642  TiXmlNode* NextSibling( const char* _next ) {
643  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
644  }
645 
650  const TiXmlElement* NextSiblingElement() const;
652  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
653  }
654 
659  const TiXmlElement* NextSiblingElement( const char * ) const;
660  TiXmlElement* NextSiblingElement( const char *_next ) {
661  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
662  }
663 
664  #ifdef TIXML_USE_STL
665  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
666  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
667  #endif
668 
670  const TiXmlElement* FirstChildElement() const;
672  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
673  }
674 
676  const TiXmlElement* FirstChildElement( const char * _value ) const;
677  TiXmlElement* FirstChildElement( const char * _value ) {
678  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
679  }
680 
681  #ifdef TIXML_USE_STL
682  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
683  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
684  #endif
685 
690  int Type() const { return type; }
691 
695  const TiXmlDocument* GetDocument() const;
697  return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
698  }
699 
701  bool NoChildren() const { return !firstChild; }
702 
703  virtual const TiXmlDocument* ToDocument() const { return 0; }
704  virtual const TiXmlElement* ToElement() const { return 0; }
705  virtual const TiXmlComment* ToComment() const { return 0; }
706  virtual const TiXmlUnknown* ToUnknown() const { return 0; }
707  virtual const TiXmlText* ToText() const { return 0; }
708  virtual const TiXmlDeclaration* ToDeclaration() const { return 0; }
709 
710  virtual TiXmlDocument* ToDocument() { return 0; }
711  virtual TiXmlElement* ToElement() { return 0; }
712  virtual TiXmlComment* ToComment() { return 0; }
713  virtual TiXmlUnknown* ToUnknown() { return 0; }
714  virtual TiXmlText* ToText() { return 0; }
715  virtual TiXmlDeclaration* ToDeclaration() { return 0; }
716 
720  virtual TiXmlNode* Clone() const = 0;
721 
744  virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
745 
746 protected:
747  TiXmlNode( NodeType _type );
748 
749  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
750  // and the assignment operator.
751  void CopyTo( TiXmlNode* target ) const;
752 
753  #ifdef TIXML_USE_STL
754  // The real work of the input operator.
755  virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
756  #endif
757 
758  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
759  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
760 
763 
766 
768 
771 
772 private:
773  TiXmlNode( const TiXmlNode& ); // not implemented.
774  void operator=( const TiXmlNode& base ); // not allowed.
775 };
776 
777 
785 class TiXmlAttribute : public TiXmlBase
786 {
787  friend class TiXmlAttributeSet;
788 
789 public:
792  {
793  document = 0;
794  prev = next = 0;
795  }
796 
797  #ifdef TIXML_USE_STL
798  TiXmlAttribute( const std::string& _name, const std::string& _value )
800  {
801  name = _name;
802  value = _value;
803  document = 0;
804  prev = next = 0;
805  }
806  #endif
807 
809  TiXmlAttribute( const char * _name, const char * _value )
810  {
811  name = _name;
812  value = _value;
813  document = 0;
814  prev = next = 0;
815  }
816 
817  const char* Name() const { return name.c_str(); }
818  const char* Value() const { return value.c_str(); }
819  #ifdef TIXML_USE_STL
820  const std::string& ValueStr() const { return value; }
821  #endif
822  int IntValue() const;
823  double DoubleValue() const;
824 
825  // Get the tinyxml string representation
826  const TIXML_STRING& NameTStr() const { return name; }
827 
837  int QueryIntValue( int* _value ) const;
839  int QueryDoubleValue( double* _value ) const;
840 
841  void SetName( const char* _name ) { name = _name; }
842  void SetValue( const char* _value ) { value = _value; }
843 
844  void SetIntValue( int _value );
845  void SetDoubleValue( double _value );
846 
847  #ifdef TIXML_USE_STL
848  void SetName( const std::string& _name ) { name = _name; }
851  void SetValue( const std::string& _value ) { value = _value; }
852  #endif
853 
855  const TiXmlAttribute* Next() const;
857  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
858  }
859 
861  const TiXmlAttribute* Previous() const;
863  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
864  }
865 
866  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
867  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
868  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
869 
870  /* Attribute parsing starts: first letter of the name
871  returns: the next char after the value end quote
872  */
873  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
874 
875  // Prints this Attribute to a FILE stream.
876  virtual void Print( FILE* cfile, int depth ) const {
877  Print( cfile, depth, 0 );
878  }
879  void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
880 
881  // [internal use]
882  // Set the document pointer so the attribute can report errors.
883  void SetDocument( TiXmlDocument* doc ) { document = doc; }
884 
885 private:
886  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
887  void operator=( const TiXmlAttribute& base ); // not allowed.
888 
889  TiXmlDocument* document; // A pointer back to a document, for error reporting.
894 };
895 
896 
897 /* A class used to manage a group of attributes.
898  It is only used internally, both by the ELEMENT and the DECLARATION.
899 
900  The set can be changed transparent to the Element and Declaration
901  classes that use it, but NOT transparent to the Attribute
902  which has to implement a next() and previous() method. Which makes
903  it a bit problematic and prevents the use of STL.
904 
905  This version is implemented with circular lists because:
906  - I like circular lists
907  - it demonstrates some independence from the (typical) doubly linked list.
908 */
910 {
911 public:
914 
915  void Add( TiXmlAttribute* attribute );
916  void Remove( TiXmlAttribute* attribute );
917 
918  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
919  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
920  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
921  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
922 
923  TiXmlAttribute* Find( const char* _name ) const;
924  TiXmlAttribute* FindOrCreate( const char* _name );
925 
926 # ifdef TIXML_USE_STL
927  TiXmlAttribute* Find( const std::string& _name ) const;
928  TiXmlAttribute* FindOrCreate( const std::string& _name );
929 # endif
930 
931 
932 private:
933  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
934  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
935  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
936  void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
937 
939 };
940 
941 
946 class TiXmlElement : public TiXmlNode
947 {
948 public:
950  TiXmlElement (const char * in_value);
951 
952  #ifdef TIXML_USE_STL
953  TiXmlElement( const std::string& _value );
955  #endif
956 
957  TiXmlElement( const TiXmlElement& );
958 
959  TiXmlElement& operator=( const TiXmlElement& base );
960 
961  virtual ~TiXmlElement();
962 
966  const char* Attribute( const char* name ) const;
967 
974  const char* Attribute( const char* name, int* i ) const;
975 
982  const char* Attribute( const char* name, double* d ) const;
983 
991  int QueryIntAttribute( const char* name, int* _value ) const;
993  int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
998  int QueryBoolAttribute( const char* name, bool* _value ) const;
1000  int QueryDoubleAttribute( const char* name, double* _value ) const;
1002  int QueryFloatAttribute( const char* name, float* _value ) const {
1003  double d;
1004  int result = QueryDoubleAttribute( name, &d );
1005  if ( result == TIXML_SUCCESS ) {
1006  *_value = (float)d;
1007  }
1008  return result;
1009  }
1010 
1011  #ifdef TIXML_USE_STL
1012  int QueryStringAttribute( const char* name, std::string* _value ) const {
1014  const char* cstr = Attribute( name );
1015  if ( cstr ) {
1016  *_value = std::string( cstr );
1017  return TIXML_SUCCESS;
1018  }
1019  return TIXML_NO_ATTRIBUTE;
1020  }
1021 
1030  template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
1031  {
1032  const TiXmlAttribute* node = attributeSet.Find( name );
1033  if ( !node )
1034  return TIXML_NO_ATTRIBUTE;
1035 
1036  std::stringstream sstream( node->ValueStr() );
1037  sstream >> *outValue;
1038  if ( !sstream.fail() )
1039  return TIXML_SUCCESS;
1040  return TIXML_WRONG_TYPE;
1041  }
1042 
1043  int QueryValueAttribute( const std::string& name, std::string* outValue ) const
1044  {
1045  const TiXmlAttribute* node = attributeSet.Find( name );
1046  if ( !node )
1047  return TIXML_NO_ATTRIBUTE;
1048  *outValue = node->ValueStr();
1049  return TIXML_SUCCESS;
1050  }
1051  #endif
1052 
1056  void SetAttribute( const char* name, const char * _value );
1057 
1058  #ifdef TIXML_USE_STL
1059  const std::string* Attribute( const std::string& name ) const;
1060  const std::string* Attribute( const std::string& name, int* i ) const;
1061  const std::string* Attribute( const std::string& name, double* d ) const;
1062  int QueryIntAttribute( const std::string& name, int* _value ) const;
1063  int QueryDoubleAttribute( const std::string& name, double* _value ) const;
1064 
1066  void SetAttribute( const std::string& name, const std::string& _value );
1068  void SetAttribute( const std::string& name, int _value );
1070  void SetDoubleAttribute( const std::string& name, double value );
1071  #endif
1072 
1076  void SetAttribute( const char * name, int value );
1077 
1081  void SetDoubleAttribute( const char * name, double value );
1082 
1085  void RemoveAttribute( const char * name );
1086  #ifdef TIXML_USE_STL
1087  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
1088  #endif
1089 
1090  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
1091  TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
1092  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
1093  TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
1094 
1127  const char* GetText() const;
1128 
1130  virtual TiXmlNode* Clone() const;
1131  // Print the Element to a FILE stream.
1132  virtual void Print( FILE* cfile, int depth ) const;
1133 
1134  /* Attribtue parsing starts: next char past '<'
1135  returns: next char past '>'
1136  */
1137  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1138 
1139  virtual const TiXmlElement* ToElement() const { return this; }
1140  virtual TiXmlElement* ToElement() { return this; }
1141 
1144  virtual bool Accept( TiXmlVisitor* visitor ) const;
1145 
1146 protected:
1147 
1148  void CopyTo( TiXmlElement* target ) const;
1149  void ClearThis(); // like clear, but initializes 'this' object as well
1150 
1151  // Used to be public [internal use]
1152  #ifdef TIXML_USE_STL
1153  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1154  #endif
1155  /* [internal use]
1156  Reads the "value" of the element -- another element, or text.
1157  This should terminate with the current end tag.
1158  */
1159  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1160 
1161 private:
1163 };
1164 
1165 
1168 class TiXmlComment : public TiXmlNode
1169 {
1170 public:
1172  TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {}
1174  TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {
1175  SetValue( _value );
1176  }
1177  TiXmlComment( const TiXmlComment& );
1178  TiXmlComment& operator=( const TiXmlComment& base );
1179 
1180  virtual ~TiXmlComment() {}
1181 
1183  virtual TiXmlNode* Clone() const;
1184  // Write this Comment to a FILE stream.
1185  virtual void Print( FILE* cfile, int depth ) const;
1186 
1187  /* Attribtue parsing starts: at the ! of the !--
1188  returns: next char past '>'
1189  */
1190  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1191 
1192  virtual const TiXmlComment* ToComment() const { return this; }
1193  virtual TiXmlComment* ToComment() { return this; }
1194 
1197  virtual bool Accept( TiXmlVisitor* visitor ) const;
1198 
1199 protected:
1200  void CopyTo( TiXmlComment* target ) const;
1201 
1202  // used to be public
1203  #ifdef TIXML_USE_STL
1204  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1205  #endif
1206 // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1207 
1208 private:
1209 
1210 };
1211 
1212 
1218 class TiXmlText : public TiXmlNode
1219 {
1220  friend class TiXmlElement;
1221 public:
1226  TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
1227  {
1228  SetValue( initValue );
1229  cdata = false;
1230  }
1231  virtual ~TiXmlText() {}
1232 
1233  #ifdef TIXML_USE_STL
1234  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
1236  {
1237  SetValue( initValue );
1238  cdata = false;
1239  }
1240  #endif
1241 
1242  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); }
1243  TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; }
1244 
1245  // Write this text object to a FILE stream.
1246  virtual void Print( FILE* cfile, int depth ) const;
1247 
1249  bool CDATA() const { return cdata; }
1251  void SetCDATA( bool _cdata ) { cdata = _cdata; }
1252 
1253  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1254 
1255  virtual const TiXmlText* ToText() const { return this; }
1256  virtual TiXmlText* ToText() { return this; }
1257 
1260  virtual bool Accept( TiXmlVisitor* content ) const;
1261 
1262 protected :
1264  virtual TiXmlNode* Clone() const;
1265  void CopyTo( TiXmlText* target ) const;
1266 
1267  bool Blank() const; // returns true if all white space and new lines
1268  // [internal use]
1269  #ifdef TIXML_USE_STL
1270  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1271  #endif
1272 
1273 private:
1274  bool cdata; // true if this should be input and output as a CDATA style text element
1275 };
1276 
1277 
1292 {
1293 public:
1295  TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {}
1296 
1297 #ifdef TIXML_USE_STL
1298  TiXmlDeclaration( const std::string& _version,
1300  const std::string& _encoding,
1301  const std::string& _standalone );
1302 #endif
1303 
1305  TiXmlDeclaration( const char* _version,
1306  const char* _encoding,
1307  const char* _standalone );
1308 
1309  TiXmlDeclaration( const TiXmlDeclaration& copy );
1310  TiXmlDeclaration& operator=( const TiXmlDeclaration& copy );
1311 
1312  virtual ~TiXmlDeclaration() {}
1313 
1315  const char *Version() const { return version.c_str (); }
1317  const char *Encoding() const { return encoding.c_str (); }
1319  const char *Standalone() const { return standalone.c_str (); }
1320 
1322  virtual TiXmlNode* Clone() const;
1323  // Print this declaration to a FILE stream.
1324  virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
1325  virtual void Print( FILE* cfile, int depth ) const {
1326  Print( cfile, depth, 0 );
1327  }
1328 
1329  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1330 
1331  virtual const TiXmlDeclaration* ToDeclaration() const { return this; }
1332  virtual TiXmlDeclaration* ToDeclaration() { return this; }
1333 
1336  virtual bool Accept( TiXmlVisitor* visitor ) const;
1337 
1338 protected:
1339  void CopyTo( TiXmlDeclaration* target ) const;
1340  // used to be public
1341  #ifdef TIXML_USE_STL
1342  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1343  #endif
1344 
1345 private:
1346 
1350 };
1351 
1352 
1360 class TiXmlUnknown : public TiXmlNode
1361 {
1362 public:
1363  TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {}
1364  virtual ~TiXmlUnknown() {}
1365 
1366  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); }
1367  TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; }
1368 
1370  virtual TiXmlNode* Clone() const;
1371  // Print this Unknown to a FILE stream.
1372  virtual void Print( FILE* cfile, int depth ) const;
1373 
1374  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1375 
1376  virtual const TiXmlUnknown* ToUnknown() const { return this; }
1377  virtual TiXmlUnknown* ToUnknown() { return this; }
1378 
1381  virtual bool Accept( TiXmlVisitor* content ) const;
1382 
1383 protected:
1384  void CopyTo( TiXmlUnknown* target ) const;
1385 
1386  #ifdef TIXML_USE_STL
1387  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1388  #endif
1389 
1390 private:
1391 
1392 };
1393 
1394 
1399 class TiXmlDocument : public TiXmlNode
1400 {
1401 public:
1403  TiXmlDocument();
1405  TiXmlDocument( const char * documentName );
1406 
1407  #ifdef TIXML_USE_STL
1408  TiXmlDocument( const std::string& documentName );
1410  #endif
1411 
1412  TiXmlDocument( const TiXmlDocument& copy );
1413  TiXmlDocument& operator=( const TiXmlDocument& copy );
1414 
1415  virtual ~TiXmlDocument() {}
1416 
1421  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1423  bool SaveFile() const;
1425  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1427  bool SaveFile( const char * filename ) const;
1433  bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1435  bool SaveFile( FILE* ) const;
1436 
1437  #ifdef TIXML_USE_STL
1438  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1439  {
1440  return LoadFile( filename.c_str(), encoding );
1441  }
1442  bool SaveFile( const std::string& filename ) const
1443  {
1444  return SaveFile( filename.c_str() );
1445  }
1446  #endif
1447 
1452  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1453 
1458  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1459  TiXmlElement* RootElement() { return FirstChildElement(); }
1460 
1466  bool Error() const { return error; }
1467 
1469  const char * ErrorDesc() const { return errorDesc.c_str (); }
1470 
1474  int ErrorId() const { return errorId; }
1475 
1483  int ErrorRow() const { return errorLocation.row+1; }
1484  int ErrorCol() const { return errorLocation.col+1; }
1485 
1510  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1511 
1512  int TabSize() const { return tabsize; }
1513 
1517  void ClearError() { error = false;
1518  errorId = 0;
1519  errorDesc = "";
1520  errorLocation.row = errorLocation.col = 0;
1521  //errorLocation.last = 0;
1522  }
1523 
1525  void Print() const { Print( stdout, 0 ); }
1526 
1527  /* Write the document to a string using formatted printing ("pretty print"). This
1528  will allocate a character array (new char[]) and return it as a pointer. The
1529  calling code pust call delete[] on the return char* to avoid a memory leak.
1530  */
1531  //char* PrintToMemory() const;
1532 
1534  virtual void Print( FILE* cfile, int depth = 0 ) const;
1535  // [internal use]
1536  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1537 
1538  virtual const TiXmlDocument* ToDocument() const { return this; }
1539  virtual TiXmlDocument* ToDocument() { return this; }
1540 
1543  virtual bool Accept( TiXmlVisitor* content ) const;
1544 
1545 protected :
1546  // [internal use]
1547  virtual TiXmlNode* Clone() const;
1548  #ifdef TIXML_USE_STL
1549  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1550  #endif
1551 
1552 private:
1553  void CopyTo( TiXmlDocument* target ) const;
1554 
1555  bool error;
1556  int errorId;
1558  int tabsize;
1560  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1561 };
1562 
1563 
1645 {
1646 public:
1648  TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
1650  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1651  TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; }
1652 
1654  TiXmlHandle FirstChild() const;
1656  TiXmlHandle FirstChild( const char * value ) const;
1658  TiXmlHandle FirstChildElement() const;
1660  TiXmlHandle FirstChildElement( const char * value ) const;
1661 
1665  TiXmlHandle Child( const char* value, int index ) const;
1669  TiXmlHandle Child( int index ) const;
1674  TiXmlHandle ChildElement( const char* value, int index ) const;
1679  TiXmlHandle ChildElement( int index ) const;
1680 
1681  #ifdef TIXML_USE_STL
1682  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1683  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1684 
1685  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1686  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1687  #endif
1688 
1691  TiXmlNode* ToNode() const { return node; }
1694  TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1697  TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1700  TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1701 
1705  TiXmlNode* Node() const { return ToNode(); }
1709  TiXmlElement* Element() const { return ToElement(); }
1713  TiXmlText* Text() const { return ToText(); }
1717  TiXmlUnknown* Unknown() const { return ToUnknown(); }
1718 
1719 private:
1721 };
1722 
1723 
1744 {
1745 public:
1746  TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
1747  buffer(), indent( " " ), lineBreak( "\n" ) {}
1748 
1749  virtual bool VisitEnter( const TiXmlDocument& doc );
1750  virtual bool VisitExit( const TiXmlDocument& doc );
1751 
1752  virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
1753  virtual bool VisitExit( const TiXmlElement& element );
1754 
1755  virtual bool Visit( const TiXmlDeclaration& declaration );
1756  virtual bool Visit( const TiXmlText& text );
1757  virtual bool Visit( const TiXmlComment& comment );
1758  virtual bool Visit( const TiXmlUnknown& unknown );
1759 
1763  void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
1765  const char* Indent() { return indent.c_str(); }
1770  void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; }
1772  const char* LineBreak() { return lineBreak.c_str(); }
1773 
1777  void SetStreamPrinting() { indent = "";
1778  lineBreak = "";
1779  }
1781  const char* CStr() { return buffer.c_str(); }
1783  size_t Size() { return buffer.size(); }
1784 
1785  #ifdef TIXML_USE_STL
1786  const std::string& Str() { return buffer; }
1788  #endif
1789 
1790 private:
1791  void DoIndent() {
1792  for( int i=0; i<depth; ++i )
1793  buffer += indent;
1794  }
1795  void DoLineBreak() {
1796  buffer += lineBreak;
1797  }
1798 
1799  int depth;
1804 };
1805 
1806 
1807 #ifdef _MSC_VER
1808 #pragma warning( pop )
1809 #endif
1810 
1811 #endif
TIXML_STRING standalone
Definition: tinyxml.h:1349
virtual ~TiXmlVisitor()
Definition: tinyxml.h:137
static const int utf8ByteTable[256]
Definition: tinyxml.h:259
d
TiXmlAttribute sentinel
Definition: tinyxml.h:938
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1484
TIXML_STRING errorDesc
Definition: tinyxml.h:1557
void DoLineBreak()
Definition: tinyxml.h:1795
TiXmlNode * LastChild(const char *_value)
The last child of this node matching &#39;value&#39;. Will be null if there are no children.
Definition: tinyxml.h:541
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1648
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:547
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:253
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1139
filename
TiXmlUnknown(const TiXmlUnknown &copy)
Definition: tinyxml.h:1366
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1172
void SetLineBreak(const char *_lineBreak)
Definition: tinyxml.h:1770
TiXmlElement * NextSiblingElement()
Definition: tinyxml.h:651
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1650
TiXmlNode * PreviousSibling(const char *_prev)
Definition: tinyxml.h:625
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:538
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:1772
const TiXmlNode * LastChild() const
Definition: tinyxml.h:537
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:711
ROSCPP_DECL void start()
virtual bool Visit(const TiXmlUnknown &)
Visit an unknown node.
Definition: tinyxml.h:156
bool operator==(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:866
TIXML_STRING version
Definition: tinyxml.h:1347
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:809
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1538
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:817
TiXmlNode * prev
Definition: tinyxml.h:769
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1469
bool operator<(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:867
void Print() const
Definition: tinyxml.h:1525
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:388
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
Definition: tinyxml.h:581
TiXmlElement * Element() const
Definition: tinyxml.h:1709
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
Definition: tinyxml.h:575
TiXmlNode * firstChild
Definition: tinyxml.h:764
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
TiXmlElement & operator=(const TiXmlElement &base)
Definition: tinyxml.cpp:547
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition: tinyxml.h:580
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:704
TiXmlHandle FirstChildElement(const std::string &_value) const
Definition: tinyxml.h:1683
TIXML_STRING lineBreak
Definition: tinyxml.h:1803
TIXML_STRING name
Definition: tinyxml.h:890
TiXmlDocument * document
Definition: tinyxml.h:889
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:707
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:666
TiXmlAttribute * FirstAttribute()
Definition: tinyxml.h:1091
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3589
bool Error() const
Definition: tinyxml.h:1466
int Column() const
See Row()
Definition: tinyxml.h:251
void operator=(const TiXmlAttributeSet &)
TiXmlElement * FirstChildElement(const char *_value)
Definition: tinyxml.h:677
void SetValue(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:851
TiXmlAttribute * Next()
Definition: tinyxml.h:856
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Definition: tinyxml.cpp:292
const std::string & ValueStr() const
Definition: tinyxml.h:500
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition: tinyxml.h:147
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1249
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:841
TiXmlNode * NextSibling()
Definition: tinyxml.h:638
void SetTabSize(int _tabsize)
Definition: tinyxml.h:1510
void DoIndent()
Definition: tinyxml.h:1791
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:791
TIXML_STRING buffer
Definition: tinyxml.h:1801
const int TIXML_PATCH_VERSION
Definition: tinyxml.h:100
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1319
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:849
TiXmlElement * NextSiblingElement(const char *_next)
Definition: tinyxml.h:660
virtual ~TiXmlText()
Definition: tinyxml.h:1231
const TIXML_STRING & NameTStr() const
Definition: tinyxml.h:826
TiXmlElement * FirstChildElement()
Definition: tinyxml.h:671
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:710
void ClearError()
Definition: tinyxml.h:1517
void Clear()
Definition: tinyxml.h:108
void CopyTo(TiXmlUnknown *target) const
Definition: tinyxml.cpp:1464
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1193
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:665
virtual ~TiXmlComment()
Definition: tinyxml.h:1180
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:876
static const char * errorString[TIXML_ERROR_STRING_COUNT]
Definition: tinyxml.h:377
void SetValue(const char *_value)
Definition: tinyxml.h:514
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Definition: tinyxml.cpp:210
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
TiXmlNode * ToNode() const
Definition: tinyxml.h:1691
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1140
const TIXML_STRING & ValueTStr() const
Definition: tinyxml.h:503
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:226
static bool condenseWhiteSpace
Definition: tinyxml.h:419
const std::string & ValueStr() const
Return the value of this attribute.
Definition: tinyxml.h:820
virtual ~TiXmlDocument()
Definition: tinyxml.h:1415
TiXmlNode * PreviousSibling()
Definition: tinyxml.h:621
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:140
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Definition: tinyxml.cpp:182
const TiXmlElement * RootElement() const
Definition: tinyxml.h:1458
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cpp:448
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:630
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1317
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:382
TiXmlAttribute * prev
Definition: tinyxml.h:892
TiXmlDocument * GetDocument()
Definition: tinyxml.h:696
const char * str
Definition: tinyxml.h:408
bool cdata
Definition: tinyxml.h:1274
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:620
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:703
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:818
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:296
std::istream & operator>>(std::istream &in, TiXmlNode &base)
Definition: tinyxml.cpp:1584
TiXmlCursor()
Definition: tinyxml.h:107
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1162
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition: tinyxml.h:152
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1255
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:176
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:705
TiXmlNode * NextSibling(const char *_next)
Definition: tinyxml.h:642
TiXmlNode * FirstChild()
Definition: tinyxml.h:529
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1315
TiXmlAttribute * next
Definition: tinyxml.h:893
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:230
TiXmlText(const TiXmlText &copy)
Definition: tinyxml.h:1242
static const char * ReadText(const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
TiXmlCursor location
Definition: tinyxml.h:379
const char * Value() const
Definition: tinyxml.h:493
const int TIXML_MAJOR_VERSION
Definition: tinyxml.h:98
int QueryValueAttribute(const std::string &name, std::string *outValue) const
Definition: tinyxml.h:1043
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:548
void SetIndent(const char *_indent)
Definition: tinyxml.h:1763
virtual ~TiXmlUnknown()
Definition: tinyxml.h:1364
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:1092
int QueryValueAttribute(const std::string &name, T *outValue) const
Definition: tinyxml.h:1030
void CopyTo(TiXmlText *target) const
Definition: tinyxml.cpp:1341
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.h:1438
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1539
TiXmlAttribute * Last()
Definition: tinyxml.h:921
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1251
const char * Indent()
Query the indention string.
Definition: tinyxml.h:1765
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:796
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:683
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1332
const TiXmlElement * NextSiblingElement() const
Definition: tinyxml.cpp:478
const TiXmlAttribute * Last() const
Definition: tinyxml.h:920
TiXmlEncoding
Definition: tinyxml.h:169
TiXmlElement * ToElement() const
Definition: tinyxml.h:1694
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:259
int ErrorRow() const
Definition: tinyxml.h:1483
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1717
TiXmlText & operator=(const TiXmlText &base)
Definition: tinyxml.h:1243
static bool StreamTo(std::istream *in, int character, TIXML_STRING *tag)
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:715
int Row() const
Definition: tinyxml.h:250
TiXmlNode * node
Definition: tinyxml.h:1720
static bool IsWhiteSpace(int c)
Definition: tinyxml.h:300
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:712
TIXML_STRING value
Definition: tinyxml.h:891
const TiXmlDocument * GetDocument() const
Definition: tinyxml.cpp:508
TiXmlUnknown * ToUnknown() const
Definition: tinyxml.h:1700
USBInterfaceDescriptor data
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
static void SetCondenseWhiteSpace(bool condense)
Definition: tinyxml.h:227
bool operator>(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:868
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:525
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:713
int Type() const
Definition: tinyxml.h:690
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1376
TiXmlComment(const char *_value)
Construct a comment from text.
Definition: tinyxml.h:1174
virtual ~TiXmlBase()
Definition: tinyxml.h:208
#define false
Definition: compiler.h:424
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:255
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:528
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cpp:885
TiXmlHandle operator=(const TiXmlHandle &ref)
Definition: tinyxml.h:1651
TiXmlNode * parent
Definition: tinyxml.h:761
TiXmlNode * IterateChildren(const TiXmlNode *previous)
Definition: tinyxml.h:569
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:708
TiXmlAttribute * Previous()
Definition: tinyxml.h:862
TIXML_STRING indent
Definition: tinyxml.h:1802
TiXmlNode(NodeType _type)
Definition: tinyxml.cpp:132
TiXmlElement * RootElement()
Definition: tinyxml.h:1459
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
Definition: tinyxml.cpp:52
TiXmlHandle ChildElement(const std::string &_value, int index) const
Definition: tinyxml.h:1686
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:254
const TiXmlAttribute * First() const
Definition: tinyxml.h:918
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:549
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:1783
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:631
TiXmlHandle Child(const std::string &_value, int index) const
Definition: tinyxml.h:1685
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:701
TiXmlNode * Node() const
Definition: tinyxml.h:1705
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:706
TiXmlNode * next
Definition: tinyxml.h:770
int TabSize() const
Definition: tinyxml.h:1512
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:142
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1192
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition: tinyxml.h:154
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:333
TiXmlText(const char *initValue)
Definition: tinyxml.h:1226
bool useMicrosoftBOM
Definition: tinyxml.h:1560
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1331
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:633
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
TiXmlDocument & operator=(const TiXmlDocument &copy)
Definition: tinyxml.cpp:942
TiXmlUnknown & operator=(const TiXmlUnknown &copy)
Definition: tinyxml.h:1367
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:1325
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:682
bool SaveFile(const std::string &filename) const
< STL std::string version.
Definition: tinyxml.h:1442
unsigned int strLength
Definition: tinyxml.h:409
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:1002
NodeType type
Definition: tinyxml.h:762
const TiXmlNode * Parent() const
Definition: tinyxml.h:526
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cpp:331
TIXML_STRING value
Definition: tinyxml.h:767
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition: tinyxml.h:1087
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:883
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1377
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:842
virtual ~TiXmlDeclaration()
Definition: tinyxml.h:1312
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
Definition: tinyxml.cpp:381
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cpp:871
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1256
TiXmlAttribute * LastAttribute()
Definition: tinyxml.h:1093
TiXmlNode * lastChild
Definition: tinyxml.h:765
std::ostream & operator<<(std::ostream &, Catch_global_namespace_dummy)
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1295
void SetStreamPrinting()
Definition: tinyxml.h:1777
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
TiXmlAttribute * First()
Definition: tinyxml.h:919
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:546
TiXmlHandle FirstChild(const std::string &_value) const
Definition: tinyxml.h:1682
virtual ~TiXmlNode()
Definition: tinyxml.cpp:143
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:637
TiXmlText * ToText() const
Definition: tinyxml.h:1697
static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag)
const char * CStr()
Return the result.
Definition: tinyxml.h:1781
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:714
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:632
#define TIXML_STRING
Definition: tinyxml.h:56
const int TIXML_MINOR_VERSION
Definition: tinyxml.h:99
int ErrorId() const
Definition: tinyxml.h:1474
TiXmlText * Text() const
Definition: tinyxml.h:1713
bool simpleTextPrint
Definition: tinyxml.h:1800
TiXmlCursor errorLocation
Definition: tinyxml.h:1559
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition: tinyxml.h:145
TIXML_STRING encoding
Definition: tinyxml.h:1348
TiXmlBase()
Definition: tinyxml.h:207
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition: tinyxml.h:150
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:1090


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:58