GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
tinyxml.h
1 /*
2 www.sourceforge.net/projects/tinyxml
3 Original code (2.0 and earlier )copyright (c) 2000-2002 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  F.Gaede, DESY : added #define TIXML_USE_STL for use with gear
25  : put everything in namespace gear
26 
27  $Id$
28 */
29 
30 #ifndef TIXML_USE_STL
31 #define TIXML_USE_STL
32 #endif
33 
34 #ifndef TINYXML_INCLUDED
35 #define TINYXML_INCLUDED
36 
37 #ifdef _MSC_VER
38 #pragma warning( disable : 4530 )
39 #pragma warning( disable : 4786 )
40 #endif
41 
42 #include <ctype.h>
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 #include <assert.h>
47 
48 // Help out windows:
49 #if defined( _DEBUG ) && !defined( DEBUG )
50 #define DEBUG
51 #endif
52 
53 #if defined( DEBUG ) && defined( _MSC_VER )
54 #include <windows.h>
55 #define TIXML_LOG OutputDebugString
56 #else
57 #define TIXML_LOG printf
58 #endif
59 
60 #ifdef TIXML_USE_STL
61  #include <string>
62  #include <iostream>
63  #define TIXML_STRING std::string
64  #define TIXML_ISTREAM std::istream
65  #define TIXML_OSTREAM std::ostream
66 #else
67  #include "tinystr.h"
68  #define TIXML_STRING TiXmlString
69  #define TIXML_OSTREAM TiXmlOutStream
70 #endif
71 
72 
73 //fg: put it namespace gear
74 namespace gear {
75 
76 class TiXmlDocument;
77 class TiXmlElement;
78 class TiXmlComment;
79 class TiXmlUnknown;
80 class TiXmlAttribute;
81 class TiXmlText;
82 class TiXmlDeclaration;
83 class TiXmlParsingData;
84 
85 const int TIXML_MAJOR_VERSION = 2;
86 const int TIXML_MINOR_VERSION = 3;
87 const int TIXML_PATCH_VERSION = 4;
88 
89 /* Internal structure for tracking location of items
90  in the XML file.
91 */
93 {
94  TiXmlCursor() { Clear(); }
95  void Clear() { row = col = -1; }
96 
97  int row{}; // 0 based.
98  int col{}; // 0 based.
99 };
100 
101 
102 // Only used by Attribute::Query functions
103 enum
104 {
105  TIXML_SUCCESS,
106  TIXML_NO_ATTRIBUTE,
107  TIXML_WRONG_TYPE
108 };
109 
110 
111 // Used by the parsing routines.
112 enum TiXmlEncoding
113 {
114  TIXML_ENCODING_UNKNOWN,
115  TIXML_ENCODING_UTF8,
116  TIXML_ENCODING_LEGACY
117 };
118 
119 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
120 
144 {
145  friend class TiXmlNode;
146  friend class TiXmlElement;
147  friend class TiXmlDocument;
148 
149 public:
150  TiXmlBase() : userData(0) {}
151  virtual ~TiXmlBase() {}
152 
158  virtual void Print( FILE* cfile, int depth ) const = 0;
159 
166  static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
167 
169  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
170 
189  int Row() const { return location.row + 1; }
190  int Column() const { return location.col + 1; }
191 
192  void SetUserData( void* user ) { userData = user; }
193  void* GetUserData() { return userData; }
194 
195  // Table that returs, for a given lead byte, the total number of bytes
196  // in the UTF-8 sequence.
197  static const int utf8ByteTable[256];
198 
199  virtual const char* Parse( const char* p,
200  TiXmlParsingData* data,
201  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
202 
203  enum
204  {
205  TIXML_NO_ERROR = 0,
206  TIXML_ERROR,
207  TIXML_ERROR_OPENING_FILE,
208  TIXML_ERROR_OUT_OF_MEMORY,
209  TIXML_ERROR_PARSING_ELEMENT,
210  TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
211  TIXML_ERROR_READING_ELEMENT_VALUE,
212  TIXML_ERROR_READING_ATTRIBUTES,
213  TIXML_ERROR_PARSING_EMPTY,
214  TIXML_ERROR_READING_END_TAG,
215  TIXML_ERROR_PARSING_UNKNOWN,
216  TIXML_ERROR_PARSING_COMMENT,
217  TIXML_ERROR_PARSING_DECLARATION,
218  TIXML_ERROR_DOCUMENT_EMPTY,
219  TIXML_ERROR_EMBEDDED_NULL,
220 
221  TIXML_ERROR_STRING_COUNT
222  };
223 
224 protected:
225 
226  // See STL_STRING_BUG
227  // Utility class to overcome a bug.
229  {
230  public:
231  StringToBuffer(const StringToBuffer&) = default ;
232  StringToBuffer& operator=(const StringToBuffer&) = default ;
233  StringToBuffer( const TIXML_STRING& str );
234  ~StringToBuffer();
235  char* buffer{};
236  };
237 
238  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
239  inline static bool IsWhiteSpace( char c )
240  {
241  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
242  }
243 
244  virtual void StreamOut (TIXML_OSTREAM *) const = 0;
245 
246  #ifdef TIXML_USE_STL
247  static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
248  static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
249  #endif
250 
251  /* Reads an XML name into the string provided. Returns
252  a pointer just past the last character of the name,
253  or 0 if the function has an error.
254  */
255  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
256 
257  /* Reads text. Returns a pointer past the given end tag.
258  Wickedly complex options, but it keeps the (sensitive) code in one place.
259  */
260  static const char* ReadText( const char* in, // where to start
261  TIXML_STRING* text, // the string read
262  bool ignoreWhiteSpace, // whether to keep the white space
263  const char* endTag, // what ends this text
264  bool ignoreCase, // whether to ignore case in the end tag
265  TiXmlEncoding encoding ); // the current encoding
266 
267  // If an entity has been found, transform it into a character.
268  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
269 
270  // Get a character, while interpreting entities.
271  // The length can be from 0 to 4 bytes.
272  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
273  {
274  assert( p );
275  if ( encoding == TIXML_ENCODING_UTF8 )
276  {
277  *length = utf8ByteTable[ *((unsigned char*)p) ];
278  assert( *length >= 0 && *length < 5 );
279  }
280  else
281  {
282  *length = 1;
283  }
284 
285  if ( *length == 1 )
286  {
287  if ( *p == '&' )
288  return GetEntity( p, _value, length, encoding );
289  *_value = *p;
290  return p+1;
291  }
292  else if ( *length )
293  {
294  strncpy( _value, p, *length );
295  return p + (*length);
296  }
297  else
298  {
299  // Not valid text.
300  return 0;
301  }
302  }
303 
304  // Puts a string to a stream, expanding entities as it goes.
305  // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
306  static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
307 
308  static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
309 
310  // Return true if the next characters in the stream are any of the endTag sequences.
311  // Ignore case only works for english, and should only be relied on when comparing
312  // to Engilish words: StringEqual( p, "version", true ) is fine.
313  static bool StringEqual( const char* p,
314  const char* endTag,
315  bool ignoreCase,
316  TiXmlEncoding encoding );
317 
318  static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
319 
320  TiXmlCursor location{};
321 
323  void* userData;
324 
325  // None of these methods are reliable for any language except English.
326  // Good for approximation, not great for accuracy.
327  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
328  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
329  inline static int ToLower( int v, TiXmlEncoding encoding )
330  {
331  if ( encoding == TIXML_ENCODING_UTF8 )
332  {
333  if ( v < 128 ) return tolower( v );
334  return v;
335  }
336  else
337  {
338  return tolower( v );
339  }
340  }
341  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
342 
343 private:
344  TiXmlBase( const TiXmlBase& ); // not implemented.
345  void operator=( const TiXmlBase& base ); // not allowed.
346 
347  struct Entity
348  {
349  const char* str;
350  unsigned int strLength;
351  char chr;
352  };
353  enum
354  {
355  NUM_ENTITY = 5,
356  MAX_ENTITY_LENGTH = 6
357 
358  };
359  static Entity entity[ NUM_ENTITY ];
360  static bool condenseWhiteSpace;
361 };
362 
363 
370 class TiXmlNode : public TiXmlBase
371 {
372  friend class TiXmlDocument;
373  friend class TiXmlElement;
374 
375 public:
376  #ifdef TIXML_USE_STL
377 
381  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
382 
399  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
400 
402  friend std::string& operator<< (std::string& out, const TiXmlNode& base );
403 
404  #else
405  // Used internally, not part of the public API.
406  friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
407  #endif
408 
412  enum NodeType
413  {
414  DOCUMENT,
415  ELEMENT,
416  COMMENT,
417  UNKNOWN,
418  TEXT,
419  DECLARATION,
420  TYPECOUNT
421  };
422 
423  virtual ~TiXmlNode();
424 
437  const char * Value() const { return value.c_str (); }
438 
448  void SetValue(const char * _value) { value = _value;}
449 
450  #ifdef TIXML_USE_STL
451  void SetValue( const std::string& _value )
453  {
454  StringToBuffer buf( _value );
455  SetValue( buf.buffer ? buf.buffer : "" );
456  }
457  #endif
458 
460  void Clear();
461 
463  TiXmlNode* Parent() { return parent; }
464  const TiXmlNode* Parent() const { return parent; }
465 
466  const TiXmlNode* FirstChild() const { return firstChild; }
467  TiXmlNode* FirstChild() { return firstChild; }
468  const TiXmlNode* FirstChild( const char * value ) const;
469  TiXmlNode* FirstChild( const char * value );
470 
471  const TiXmlNode* LastChild() const { return lastChild; }
472  TiXmlNode* LastChild() { return lastChild; }
473  const TiXmlNode* LastChild( const char * value ) const;
474  TiXmlNode* LastChild( const char * value );
475 
476  #ifdef TIXML_USE_STL
477  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
478  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
479  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
480  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
481  #endif
482 
499  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
500  TiXmlNode* IterateChildren( TiXmlNode* previous );
501 
503  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
504  TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous );
505 
506  #ifdef TIXML_USE_STL
507  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
508  TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
509  #endif
510 
514  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
515 
516 
526  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
527 
531  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
532 
536  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
537 
541  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
542 
544  bool RemoveChild( TiXmlNode* removeThis );
545 
547  const TiXmlNode* PreviousSibling() const { return prev; }
548  TiXmlNode* PreviousSibling() { return prev; }
549 
551  const TiXmlNode* PreviousSibling( const char * ) const;
552  TiXmlNode* PreviousSibling( const char * );
553 
554  #ifdef TIXML_USE_STL
555  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
556  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
557  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
558  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
559  #endif
560 
562  const TiXmlNode* NextSibling() const { return next; }
563  TiXmlNode* NextSibling() { return next; }
564 
566  const TiXmlNode* NextSibling( const char * ) const;
567  TiXmlNode* NextSibling( const char * );
568 
573  const TiXmlElement* NextSiblingElement() const;
574  TiXmlElement* NextSiblingElement();
575 
580  const TiXmlElement* NextSiblingElement( const char * ) const;
581  TiXmlElement* NextSiblingElement( const char * );
582 
583  #ifdef TIXML_USE_STL
584  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
585  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
586  #endif
587 
589  const TiXmlElement* FirstChildElement() const;
591 
593  const TiXmlElement* FirstChildElement( const char * value ) const;
594  TiXmlElement* FirstChildElement( const char * value );
595 
596  #ifdef TIXML_USE_STL
597  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
598  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
599  #endif
600 
605  virtual int Type() const { return type; }
606 
610  const TiXmlDocument* GetDocument() const;
612 
614  bool NoChildren() const { return !firstChild; }
615 
616  const TiXmlDocument* ToDocument() const { return ( type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; }
617  const TiXmlElement* ToElement() const { return ( type == ELEMENT ) ? (const TiXmlElement*) this : 0; }
618  const TiXmlComment* ToComment() const { return ( type == COMMENT ) ? (const TiXmlComment*) this : 0; }
619  const TiXmlUnknown* ToUnknown() const { return ( type == UNKNOWN ) ? (const TiXmlUnknown*) this : 0; }
620  const TiXmlText* ToText() const { return ( type == TEXT ) ? (const TiXmlText*) this : 0; }
621  const TiXmlDeclaration* ToDeclaration() const { return ( type == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; }
622 
623  TiXmlDocument* ToDocument() { return ( type == DOCUMENT ) ? (TiXmlDocument*) this : 0; }
624  TiXmlElement* ToElement() { return ( type == ELEMENT ) ? (TiXmlElement*) this : 0; }
625  TiXmlComment* ToComment() { return ( type == COMMENT ) ? (TiXmlComment*) this : 0; }
626  TiXmlUnknown* ToUnknown() { return ( type == UNKNOWN ) ? (TiXmlUnknown*) this : 0; }
627  TiXmlText* ToText() { return ( type == TEXT ) ? (TiXmlText*) this : 0; }
628  TiXmlDeclaration* ToDeclaration() { return ( type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; }
629 
633  virtual TiXmlNode* Clone() const = 0;
634 
635 protected:
636  TiXmlNode( NodeType _type );
637 
638  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
639  // and the assignment operator.
640  void CopyTo( TiXmlNode* target ) const;
641 
642  #ifdef TIXML_USE_STL
643  // The real work of the input operator.
644  virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
645  #endif
646 
647  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
648  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
649 
650  // Internal Value function returning a TIXML_STRING
651  const TIXML_STRING& SValue() const { return value ; }
652 
653  TiXmlNode* parent{};
654  NodeType type{};
655 
656  TiXmlNode* firstChild{};
657  TiXmlNode* lastChild{};
658 
659  TIXML_STRING value{};
660 
661  TiXmlNode* prev{};
662  TiXmlNode* next{};
663 
664 private:
665  TiXmlNode( const TiXmlNode& ); // not implemented.
666  void operator=( const TiXmlNode& base ); // not allowed.
667 };
668 
669 
677 class TiXmlAttribute : public TiXmlBase
678 {
679  friend class TiXmlAttributeSet;
680 
681 public:
684  {
685  document = 0;
686  prev = next = 0;
687  }
688 
689  #ifdef TIXML_USE_STL
690  TiXmlAttribute( const std::string& _name, const std::string& _value )
692  {
693  name = _name;
694  value = _value;
695  document = 0;
696  prev = next = 0;
697  }
698  #endif
699 
701  TiXmlAttribute( const char * _name, const char * _value )
702  {
703  name = _name;
704  value = _value;
705  document = 0;
706  prev = next = 0;
707  }
708 
709  const char* Name() const { return name.c_str (); }
710  const char* Value() const { return value.c_str (); }
711  int IntValue() const;
712  double DoubleValue() const;
713 
723  int QueryIntValue( int* value ) const;
725  int QueryDoubleValue( double* value ) const;
726 
727  void SetName( const char* _name ) { name = _name; }
728  void SetValue( const char* _value ) { value = _value; }
729 
730  void SetIntValue( int value );
731  void SetDoubleValue( double value );
732 
733  #ifdef TIXML_USE_STL
734  void SetName( const std::string& _name )
736  {
737  StringToBuffer buf( _name );
738  SetName ( buf.buffer ? buf.buffer : "error" );
739  }
741  void SetValue( const std::string& _value )
742  {
743  StringToBuffer buf( _value );
744  SetValue( buf.buffer ? buf.buffer : "error" );
745  }
746  #endif
747 
749  const TiXmlAttribute* Next() const;
750  TiXmlAttribute* Next();
752  const TiXmlAttribute* Previous() const;
754 
755  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
756  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
757  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
758 
759  /* Attribute parsing starts: first letter of the name
760  returns: the next char after the value end quote
761  */
762  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
763 
764  // Prints this Attribute to a FILE stream.
765  virtual void Print( FILE* cfile, int depth ) const;
766 
767  virtual void StreamOut( TIXML_OSTREAM * out ) const;
768  // [internal use]
769  // Set the document pointer so the attribute can report errors.
770  void SetDocument( TiXmlDocument* doc ) { document = doc; }
771 
772 private:
773  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
774  void operator=( const TiXmlAttribute& base ); // not allowed.
775 
776  TiXmlDocument* document{}; // A pointer back to a document, for error reporting.
777  TIXML_STRING name{};
778  TIXML_STRING value{};
779  TiXmlAttribute* prev{};
780  TiXmlAttribute* next{};
781 };
782 
783 
784 /* A class used to manage a group of attributes.
785  It is only used internally, both by the ELEMENT and the DECLARATION.
786 
787  The set can be changed transparent to the Element and Declaration
788  classes that use it, but NOT transparent to the Attribute
789  which has to implement a next() and previous() method. Which makes
790  it a bit problematic and prevents the use of STL.
791 
792  This version is implemented with circular lists because:
793  - I like circular lists
794  - it demonstrates some independence from the (typical) doubly linked list.
795 */
797 {
798 public:
801 
802  void Add( TiXmlAttribute* attribute );
803  void Remove( TiXmlAttribute* attribute );
804 
805  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
806  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
807  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
808  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
809 
810  const TiXmlAttribute* Find( const char * name ) const;
811  TiXmlAttribute* Find( const char * name );
812 
813 private:
814  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
815  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
816  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
817  void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
818 
819  TiXmlAttribute sentinel{};
820 };
821 
822 
827 class TiXmlElement : public TiXmlNode
828 {
829 public:
831  TiXmlElement (const char * in_value);
832 
833  #ifdef TIXML_USE_STL
834  TiXmlElement( const std::string& _value );
836  #endif
837 
838  TiXmlElement( const TiXmlElement& );
839 
840  TiXmlElement& operator=( const TiXmlElement& base );
841 
842  virtual ~TiXmlElement();
843 
847  const char* Attribute( const char* name ) const;
848 
855  const char* Attribute( const char* name, int* i ) const;
856 
863  const char* Attribute( const char* name, double* d ) const;
864 
872  int QueryIntAttribute( const char* name, int* value ) const;
874  int QueryDoubleAttribute( const char* name, double* value ) const;
876  int QueryDoubleAttribute( const char* name, float* val ) const {
877  double d;
878  int result = QueryDoubleAttribute( name, &d );
879  *val = (float)d;
880  return result;
881  }
882 
886  void SetAttribute( const char* name, const char * value );
887 
888  #ifdef TIXML_USE_STL
889  const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
890  const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
891  const char* Attribute( const std::string& name, double* d ) const { return Attribute( name.c_str(), d ); }
892  int QueryIntAttribute( const std::string& name, int* val ) const { return QueryIntAttribute( name.c_str(), val ); }
893  int QueryDoubleAttribute( const std::string& name, double* val ) const { return QueryDoubleAttribute( name.c_str(), val ); }
894 
896  void SetAttribute( const std::string& name, const std::string& _value )
897  {
898  StringToBuffer n( name );
899  StringToBuffer v( _value );
900  if ( n.buffer && v.buffer )
901  SetAttribute (n.buffer, v.buffer );
902  }
904  void SetAttribute( const std::string& name, int _value )
905  {
906  StringToBuffer n( name );
907  if ( n.buffer )
908  SetAttribute (n.buffer, _value);
909  }
910  #endif
911 
915  void SetAttribute( const char * name, int value );
916 
920  void SetDoubleAttribute( const char * name, double value );
921 
924  void RemoveAttribute( const char * name );
925  #ifdef TIXML_USE_STL
926  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
927  #endif
928 
929  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
930  TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
931  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
932  TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
933 
935  virtual TiXmlNode* Clone() const;
936  // Print the Element to a FILE stream.
937  virtual void Print( FILE* cfile, int depth ) const;
938 
939  /* Attribtue parsing starts: next char past '<'
940  returns: next char past '>'
941  */
942  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
943 
944 protected:
945 
946  void CopyTo( TiXmlElement* target ) const;
947  void ClearThis(); // like clear, but initializes 'this' object as well
948 
949  // Used to be public [internal use]
950  #ifdef TIXML_USE_STL
951  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
952  #endif
953  virtual void StreamOut( TIXML_OSTREAM * out ) const;
954 
955  /* [internal use]
956  Reads the "value" of the element -- another element, or text.
957  This should terminate with the current end tag.
958  */
959  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
960 
961 private:
962 
963  TiXmlAttributeSet attributeSet{};
964 };
965 
966 
969 class TiXmlComment : public TiXmlNode
970 {
971 public:
973  TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
974  TiXmlComment( const TiXmlComment& );
975  TiXmlComment& operator=( const TiXmlComment& base );
976 
977  virtual ~TiXmlComment() {}
978 
980  virtual TiXmlNode* Clone() const;
982  virtual void Print( FILE* cfile, int depth ) const;
983 
984  /* Attribtue parsing starts: at the ! of the !--
985  returns: next char past '>'
986  */
987  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
988 
989 protected:
990  void CopyTo( TiXmlComment* target ) const;
991 
992  // used to be public
993  #ifdef TIXML_USE_STL
994  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
995  #endif
996  virtual void StreamOut( TIXML_OSTREAM * out ) const;
997 
998 private:
999 
1000 };
1001 
1002 
1005 class TiXmlText : public TiXmlNode
1006 {
1007  friend class TiXmlElement;
1008 public:
1010  TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
1011  {
1012  SetValue( initValue );
1013  }
1014  virtual ~TiXmlText() {}
1015 
1016  #ifdef TIXML_USE_STL
1017  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
1019  {
1020  SetValue( initValue );
1021  }
1022  #endif
1023 
1024  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
1025  TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this ;}
1026 
1028  virtual void Print( FILE* cfile, int depth ) const;
1029 
1030  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1031 
1032 protected :
1034  virtual TiXmlNode* Clone() const;
1035  void CopyTo( TiXmlText* target ) const;
1036 
1037  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1038  bool Blank() const; // returns true if all white space and new lines
1039  // [internal use]
1040  #ifdef TIXML_USE_STL
1041  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1042  #endif
1043 
1044 private:
1045 };
1046 
1047 
1062 {
1063 public:
1065  TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
1066 
1067 #ifdef TIXML_USE_STL
1068  TiXmlDeclaration( const std::string& _version,
1070  const std::string& _encoding,
1071  const std::string& _standalone );
1072 #endif
1073 
1075  TiXmlDeclaration( const char* _version,
1076  const char* _encoding,
1077  const char* _standalone );
1078 
1079  TiXmlDeclaration( const TiXmlDeclaration& copy );
1080  TiXmlDeclaration& operator=( const TiXmlDeclaration& copy );
1081 
1082  virtual ~TiXmlDeclaration() {}
1083 
1085  const char *Version() const { return version.c_str (); }
1087  const char *Encoding() const { return encoding.c_str (); }
1089  const char *Standalone() const { return standalone.c_str (); }
1090 
1092  virtual TiXmlNode* Clone() const;
1094  virtual void Print( FILE* cfile, int depth ) const;
1095 
1096  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1097 
1098 protected:
1099  void CopyTo( TiXmlDeclaration* target ) const;
1100  // used to be public
1101  #ifdef TIXML_USE_STL
1102  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1103  #endif
1104  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1105 
1106 private:
1107 
1108  TIXML_STRING version{};
1109  TIXML_STRING encoding{};
1110  TIXML_STRING standalone{};
1111 };
1112 
1113 
1121 class TiXmlUnknown : public TiXmlNode
1122 {
1123 public:
1124  TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
1125  virtual ~TiXmlUnknown() {}
1126 
1127  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
1128  TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this ;}
1129 
1131  virtual TiXmlNode* Clone() const;
1133  virtual void Print( FILE* cfile, int depth ) const;
1134 
1135  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1136 
1137 protected:
1138  void CopyTo( TiXmlUnknown* target ) const;
1139 
1140  #ifdef TIXML_USE_STL
1141  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1142  #endif
1143  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1144 
1145 private:
1146 
1147 };
1148 
1149 
1154 class TiXmlDocument : public TiXmlNode
1155 {
1156 public:
1158  TiXmlDocument();
1160  TiXmlDocument( const char * documentName );
1161 
1162  #ifdef TIXML_USE_STL
1163  TiXmlDocument( const std::string& documentName );
1165  #endif
1166 
1167  TiXmlDocument( const TiXmlDocument& copy );
1168  TiXmlDocument& operator=( const TiXmlDocument& copy );
1169 
1170  virtual ~TiXmlDocument() {}
1171 
1176  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1178  bool SaveFile() const;
1180  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1182  bool SaveFile( const char * filename ) const;
1183 
1184  #ifdef TIXML_USE_STL
1185  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1186  {
1187  StringToBuffer f( filename );
1188  return ( f.buffer && LoadFile( f.buffer, encoding ));
1189  }
1190  bool SaveFile( const std::string& filename ) const
1191  {
1192  StringToBuffer f( filename );
1193  return ( f.buffer && SaveFile( f.buffer ));
1194  }
1195  #endif
1196 
1201  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1202 
1207  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1208  TiXmlElement* RootElement() { return FirstChildElement(); }
1209 
1215  bool Error() const { return error; }
1216 
1218  const char * ErrorDesc() const { return errorDesc.c_str (); }
1219 
1223  int ErrorId() const { return errorId; }
1224 
1232  int ErrorRow() { return errorLocation.row+1; }
1233  int ErrorCol() { return errorLocation.col+1; }
1234 
1255  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1256 
1257  int TabSize() const { return tabsize; }
1258 
1262  void ClearError() { error = false;
1263  errorId = 0;
1264  errorDesc = "";
1265  errorLocation.row = errorLocation.col = 0;
1266  //errorLocation.last = 0;
1267  }
1268 
1270  void Print() const { Print( stdout, 0 ); }
1271 
1273  virtual void Print( FILE* cfile, int depth = 0 ) const;
1274  // [internal use]
1275  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1276 
1277 protected :
1278  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1279  // [internal use]
1280  virtual TiXmlNode* Clone() const;
1281  #ifdef TIXML_USE_STL
1282  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1283  #endif
1284 
1285 private:
1286  void CopyTo( TiXmlDocument* target ) const;
1287 
1288  bool error{};
1289  int errorId{};
1290  TIXML_STRING errorDesc{};
1291  int tabsize{};
1292  TiXmlCursor errorLocation{};
1293 };
1294 
1295 
1377 {
1378 public:
1380  TiXmlHandle( TiXmlNode* aNode ) { this->node = aNode; }
1382  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1383  TiXmlHandle& operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
1384 
1386  TiXmlHandle FirstChild() const;
1388  TiXmlHandle FirstChild( const char * value ) const;
1392  TiXmlHandle FirstChildElement( const char * value ) const;
1393 
1397  TiXmlHandle Child( const char* value, int index ) const;
1401  TiXmlHandle Child( int index ) const;
1406  TiXmlHandle ChildElement( const char* value, int index ) const;
1411  TiXmlHandle ChildElement( int index ) const;
1412 
1413  #ifdef TIXML_USE_STL
1414  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1415  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1416 
1417  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1418  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1419  #endif
1420 
1422  TiXmlNode* Node() const { return node; }
1424  TiXmlElement* Element() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1426  TiXmlText* Text() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1428  TiXmlUnknown* Unknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1429 
1430 private:
1431  TiXmlNode* node{};
1432 };
1433 
1434 
1435 
1436 //fg: put it namespace gear
1437 } // end namespace gear {
1438 
1439 
1440 
1441 #ifdef _MSC_VER
1442 #pragma warning( default : 4530 )
1443 #pragma warning( default : 4786 )
1444 #endif
1445 
1446 #endif
1447 
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition: tinyxml.cc:933
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1065
void SetDoubleValue(double value)
Set the value from a double.
Definition: tinyxml.cc:1157
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:614
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:728
int Column() const
See Row()
Definition: tinyxml.h:190
bool SaveFile(const std::string &filename) const
&lt; STL std::string version.
Definition: tinyxml.h:1190
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cc:1166
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:557
friend std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)
An output stream operator, for every class.
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cc:872
TiXmlElement(const char *in_value)
Construct an element.
Definition: tinyxml.cc:619
int ErrorRow()
Returns the location (if known) of the error.
Definition: tinyxml.h:1232
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition: tinyxml.cc:201
TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:626
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
void SetValue(const char *_value)
Changes the value of the node.
Definition: tinyxml.h:448
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:480
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:973
virtual void Print(FILE *cfile, int depth) const
Print this declaration to a FILE stream.
Definition: tinyxml.cc:1299
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition: tinyxml.cc:921
void Clear()
Delete all the children of this node. Does not affect &#39;this&#39;.
Definition: tinyxml.cc:184
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1061
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:585
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:169
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:479
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:597
void SetTabSize(int _tabsize)
By calling this method, with a tab size greater than 0, the row and column of each node and attribute...
Definition: tinyxml.h:1255
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1085
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1087
An attribute is a name-value pair.
Definition: tinyxml.h:677
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cc:1380
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:562
virtual void Print(FILE *cfile, int depth) const
Write this text object to a FILE stream.
Definition: tinyxml.cc:1227
void SetIntValue(int value)
Set the value from an integer.
Definition: tinyxml.cc:1150
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:437
TiXmlNode * Node() const
Return the handle as a TiXmlNode. This may return null.
Definition: tinyxml.h:1422
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:709
int QueryDoubleAttribute(const char *name, float *val) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:876
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition: tinyxml.h:1376
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition: tinyxml.h:507
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1218
const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:616
const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:619
virtual void Print(FILE *cfile, int depth) const
Print this Unknown to a FILE stream.
Definition: tinyxml.cc:1360
TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:628
TiXmlBase is a base class for every class in TinyXml.
Definition: tinyxml.h:143
int ErrorCol()
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1233
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:477
TiXmlNode * IterateChildren(const std::string &_value, TiXmlNode *previous)
STL std::string form.
Definition: tinyxml.h:508
friend std::istream & operator>>(std::istream &in, TiXmlNode &base)
An input stream operator, for every class.
TiXmlUnknown * Unknown() const
Return the handle as a TiXmlUnknown. This may return null;.
Definition: tinyxml.h:1428
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:929
Always the top level node.
Definition: tinyxml.h:1154
void SetAttribute(const std::string &name, const std::string &_value)
STL std::string form.
Definition: tinyxml.h:896
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cc:1171
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:228
const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:618
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition: tinyxml.cc:1215
int QueryDoubleAttribute(const char *name, double *value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cc:720
Any tag that tinyXml doesn&#39;t recognize is saved as an unknown.
Definition: tinyxml.h:1121
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:683
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:727
TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:627
void SetValue(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:741
const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:621
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:370
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:671
TiXmlText * Text() const
Return the handle as a TiXmlText. This may return null.
Definition: tinyxml.h:1426
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the &quot;index&quot; child element with the given name.
Definition: tinyxml.cc:1596
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
Definition: tinyxml.cc:280
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:931
int QueryDoubleValue(double *value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cc:1143
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
Definition: tinyxml.cc:1031
const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:617
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:323
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
Definition: tinyxml.h:1207
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1089
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:710
NodeType
The types of XML nodes supported by TinyXml.
Definition: tinyxml.h:412
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cc:1348
An XML comment.
Definition: tinyxml.h:969
The element is a container class.
Definition: tinyxml.h:827
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
Definition: tinyxml.h:1223
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:547
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:218
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:555
bool Error() const
If an error occurs, Error will be set to true.
Definition: tinyxml.h:1215
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cc:308
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:478
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:558
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:738
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition: tinyxml.h:926
XML text.
Definition: tinyxml.h:1005
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:584
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:463
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
Definition: tinyxml.cc:472
TiXmlHandle(TiXmlNode *aNode)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1380
TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:623
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:767
void ClearError()
If you have handled the error, it can be reset with this call.
Definition: tinyxml.h:1262
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1382
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:466
TiXmlHandle Child(const char *value, int index) const
Return a handle to the &quot;index&quot; child with the given name.
Definition: tinyxml.cc:1558
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:710
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cc:883
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cc:1247
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:538
virtual void Print(FILE *cfile, int depth) const
Write this Comment to a FILE stream.
Definition: tinyxml.cc:1191
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition: tinyxml.cc:254
TiXmlElement * Element() const
Return the handle as a TiXmlElement. This may return null.
Definition: tinyxml.h:1424
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cc:1515
int QueryIntValue(int *value) const
QueryIntValue examines the value string.
Definition: tinyxml.cc:1136
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
Definition: tinyxml.cc:376
const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:620
void SetAttribute(const char *name, const char *value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:746
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
Definition: tinyxml.h:166
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:701
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:1104
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition: tinyxml.cc:595
void Print() const
Dump the document to standard out.
Definition: tinyxml.h:1270
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:556
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cc:1068
TiXmlText(const char *initValue)
Constructor.
Definition: tinyxml.h:1010
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:598
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cc:1491
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.h:1185
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:482
int Row() const
Return the position, in the original source file, of this node or attribute.
Definition: tinyxml.h:189
TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:625
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:472
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cc:1086
TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:624
virtual int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:605