GEAR  1.6.1
 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: tinyxml.h 429 2012-05-04 11:11:25Z gaede $
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 TIXML_STRING& str );
232  ~StringToBuffer();
233  char* buffer;
234  };
235 
236  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
237  inline static bool IsWhiteSpace( char c )
238  {
239  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
240  }
241 
242  virtual void StreamOut (TIXML_OSTREAM *) const = 0;
243 
244  #ifdef TIXML_USE_STL
245  static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
246  static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
247  #endif
248 
249  /* Reads an XML name into the string provided. Returns
250  a pointer just past the last character of the name,
251  or 0 if the function has an error.
252  */
253  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
254 
255  /* Reads text. Returns a pointer past the given end tag.
256  Wickedly complex options, but it keeps the (sensitive) code in one place.
257  */
258  static const char* ReadText( const char* in, // where to start
259  TIXML_STRING* text, // the string read
260  bool ignoreWhiteSpace, // whether to keep the white space
261  const char* endTag, // what ends this text
262  bool ignoreCase, // whether to ignore case in the end tag
263  TiXmlEncoding encoding ); // the current encoding
264 
265  // If an entity has been found, transform it into a character.
266  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
267 
268  // Get a character, while interpreting entities.
269  // The length can be from 0 to 4 bytes.
270  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
271  {
272  assert( p );
273  if ( encoding == TIXML_ENCODING_UTF8 )
274  {
275  *length = utf8ByteTable[ *((unsigned char*)p) ];
276  assert( *length >= 0 && *length < 5 );
277  }
278  else
279  {
280  *length = 1;
281  }
282 
283  if ( *length == 1 )
284  {
285  if ( *p == '&' )
286  return GetEntity( p, _value, length, encoding );
287  *_value = *p;
288  return p+1;
289  }
290  else if ( *length )
291  {
292  strncpy( _value, p, *length );
293  return p + (*length);
294  }
295  else
296  {
297  // Not valid text.
298  return 0;
299  }
300  }
301 
302  // Puts a string to a stream, expanding entities as it goes.
303  // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
304  static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
305 
306  static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
307 
308  // Return true if the next characters in the stream are any of the endTag sequences.
309  // Ignore case only works for english, and should only be relied on when comparing
310  // to Engilish words: StringEqual( p, "version", true ) is fine.
311  static bool StringEqual( const char* p,
312  const char* endTag,
313  bool ignoreCase,
314  TiXmlEncoding encoding );
315 
316  static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
317 
318  TiXmlCursor location;
319 
321  void* userData;
322 
323  // None of these methods are reliable for any language except English.
324  // Good for approximation, not great for accuracy.
325  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
326  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
327  inline static int ToLower( int v, TiXmlEncoding encoding )
328  {
329  if ( encoding == TIXML_ENCODING_UTF8 )
330  {
331  if ( v < 128 ) return tolower( v );
332  return v;
333  }
334  else
335  {
336  return tolower( v );
337  }
338  }
339  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
340 
341 private:
342  TiXmlBase( const TiXmlBase& ); // not implemented.
343  void operator=( const TiXmlBase& base ); // not allowed.
344 
345  struct Entity
346  {
347  const char* str;
348  unsigned int strLength;
349  char chr;
350  };
351  enum
352  {
353  NUM_ENTITY = 5,
354  MAX_ENTITY_LENGTH = 6
355 
356  };
357  static Entity entity[ NUM_ENTITY ];
358  static bool condenseWhiteSpace;
359 };
360 
361 
368 class TiXmlNode : public TiXmlBase
369 {
370  friend class TiXmlDocument;
371  friend class TiXmlElement;
372 
373 public:
374  #ifdef TIXML_USE_STL
375 
379  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
380 
397  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
398 
400  friend std::string& operator<< (std::string& out, const TiXmlNode& base );
401 
402  #else
403  // Used internally, not part of the public API.
404  friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
405  #endif
406 
410  enum NodeType
411  {
412  DOCUMENT,
413  ELEMENT,
414  COMMENT,
415  UNKNOWN,
416  TEXT,
417  DECLARATION,
418  TYPECOUNT
419  };
420 
421  virtual ~TiXmlNode();
422 
435  const char * Value() const { return value.c_str (); }
436 
446  void SetValue(const char * _value) { value = _value;}
447 
448  #ifdef TIXML_USE_STL
449  void SetValue( const std::string& _value )
451  {
452  StringToBuffer buf( _value );
453  SetValue( buf.buffer ? buf.buffer : "" );
454  }
455  #endif
456 
458  void Clear();
459 
461  TiXmlNode* Parent() { return parent; }
462  const TiXmlNode* Parent() const { return parent; }
463 
464  const TiXmlNode* FirstChild() const { return firstChild; }
465  TiXmlNode* FirstChild() { return firstChild; }
466  const TiXmlNode* FirstChild( const char * value ) const;
467  TiXmlNode* FirstChild( const char * value );
468 
469  const TiXmlNode* LastChild() const { return lastChild; }
470  TiXmlNode* LastChild() { return lastChild; }
471  const TiXmlNode* LastChild( const char * value ) const;
472  TiXmlNode* LastChild( const char * value );
473 
474  #ifdef TIXML_USE_STL
475  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
476  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
477  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
478  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
479  #endif
480 
497  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
498  TiXmlNode* IterateChildren( TiXmlNode* previous );
499 
501  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
502  TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous );
503 
504  #ifdef TIXML_USE_STL
505  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
506  TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
507  #endif
508 
512  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
513 
514 
524  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
525 
529  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
530 
534  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
535 
539  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
540 
542  bool RemoveChild( TiXmlNode* removeThis );
543 
545  const TiXmlNode* PreviousSibling() const { return prev; }
546  TiXmlNode* PreviousSibling() { return prev; }
547 
549  const TiXmlNode* PreviousSibling( const char * ) const;
550  TiXmlNode* PreviousSibling( const char * );
551 
552  #ifdef TIXML_USE_STL
553  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
554  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
555  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
556  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
557  #endif
558 
560  const TiXmlNode* NextSibling() const { return next; }
561  TiXmlNode* NextSibling() { return next; }
562 
564  const TiXmlNode* NextSibling( const char * ) const;
565  TiXmlNode* NextSibling( const char * );
566 
571  const TiXmlElement* NextSiblingElement() const;
572  TiXmlElement* NextSiblingElement();
573 
578  const TiXmlElement* NextSiblingElement( const char * ) const;
579  TiXmlElement* NextSiblingElement( const char * );
580 
581  #ifdef TIXML_USE_STL
582  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
583  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
584  #endif
585 
587  const TiXmlElement* FirstChildElement() const;
589 
591  const TiXmlElement* FirstChildElement( const char * value ) const;
592  TiXmlElement* FirstChildElement( const char * value );
593 
594  #ifdef TIXML_USE_STL
595  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
596  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
597  #endif
598 
603  virtual int Type() const { return type; }
604 
608  const TiXmlDocument* GetDocument() const;
610 
612  bool NoChildren() const { return !firstChild; }
613 
614  const TiXmlDocument* ToDocument() const { return ( this && type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; }
615  const TiXmlElement* ToElement() const { return ( this && type == ELEMENT ) ? (const TiXmlElement*) this : 0; }
616  const TiXmlComment* ToComment() const { return ( this && type == COMMENT ) ? (const TiXmlComment*) this : 0; }
617  const TiXmlUnknown* ToUnknown() const { return ( this && type == UNKNOWN ) ? (const TiXmlUnknown*) this : 0; }
618  const TiXmlText* ToText() const { return ( this && type == TEXT ) ? (const TiXmlText*) this : 0; }
619  const TiXmlDeclaration* ToDeclaration() const { return ( this && type == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; }
620 
621  TiXmlDocument* ToDocument() { return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; }
622  TiXmlElement* ToElement() { return ( this && type == ELEMENT ) ? (TiXmlElement*) this : 0; }
623  TiXmlComment* ToComment() { return ( this && type == COMMENT ) ? (TiXmlComment*) this : 0; }
624  TiXmlUnknown* ToUnknown() { return ( this && type == UNKNOWN ) ? (TiXmlUnknown*) this : 0; }
625  TiXmlText* ToText() { return ( this && type == TEXT ) ? (TiXmlText*) this : 0; }
626  TiXmlDeclaration* ToDeclaration() { return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; }
627 
631  virtual TiXmlNode* Clone() const = 0;
632 
633 protected:
634  TiXmlNode( NodeType _type );
635 
636  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
637  // and the assignment operator.
638  void CopyTo( TiXmlNode* target ) const;
639 
640  #ifdef TIXML_USE_STL
641  // The real work of the input operator.
642  virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
643  #endif
644 
645  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
646  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
647 
648  // Internal Value function returning a TIXML_STRING
649  const TIXML_STRING& SValue() const { return value ; }
650 
651  TiXmlNode* parent;
652  NodeType type;
653 
654  TiXmlNode* firstChild;
655  TiXmlNode* lastChild;
656 
657  TIXML_STRING value;
658 
659  TiXmlNode* prev;
660  TiXmlNode* next;
661 
662 private:
663  TiXmlNode( const TiXmlNode& ); // not implemented.
664  void operator=( const TiXmlNode& base ); // not allowed.
665 };
666 
667 
675 class TiXmlAttribute : public TiXmlBase
676 {
677  friend class TiXmlAttributeSet;
678 
679 public:
682  {
683  document = 0;
684  prev = next = 0;
685  }
686 
687  #ifdef TIXML_USE_STL
688  TiXmlAttribute( const std::string& _name, const std::string& _value )
690  {
691  name = _name;
692  value = _value;
693  document = 0;
694  prev = next = 0;
695  }
696  #endif
697 
699  TiXmlAttribute( const char * _name, const char * _value )
700  {
701  name = _name;
702  value = _value;
703  document = 0;
704  prev = next = 0;
705  }
706 
707  const char* Name() const { return name.c_str (); }
708  const char* Value() const { return value.c_str (); }
709  int IntValue() const;
710  double DoubleValue() const;
711 
721  int QueryIntValue( int* value ) const;
723  int QueryDoubleValue( double* value ) const;
724 
725  void SetName( const char* _name ) { name = _name; }
726  void SetValue( const char* _value ) { value = _value; }
727 
728  void SetIntValue( int value );
729  void SetDoubleValue( double value );
730 
731  #ifdef TIXML_USE_STL
732  void SetName( const std::string& _name )
734  {
735  StringToBuffer buf( _name );
736  SetName ( buf.buffer ? buf.buffer : "error" );
737  }
739  void SetValue( const std::string& _value )
740  {
741  StringToBuffer buf( _value );
742  SetValue( buf.buffer ? buf.buffer : "error" );
743  }
744  #endif
745 
747  const TiXmlAttribute* Next() const;
748  TiXmlAttribute* Next();
750  const TiXmlAttribute* Previous() const;
752 
753  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
754  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
755  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
756 
757  /* Attribute parsing starts: first letter of the name
758  returns: the next char after the value end quote
759  */
760  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
761 
762  // Prints this Attribute to a FILE stream.
763  virtual void Print( FILE* cfile, int depth ) const;
764 
765  virtual void StreamOut( TIXML_OSTREAM * out ) const;
766  // [internal use]
767  // Set the document pointer so the attribute can report errors.
768  void SetDocument( TiXmlDocument* doc ) { document = doc; }
769 
770 private:
771  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
772  void operator=( const TiXmlAttribute& base ); // not allowed.
773 
774  TiXmlDocument* document; // A pointer back to a document, for error reporting.
775  TIXML_STRING name;
776  TIXML_STRING value;
777  TiXmlAttribute* prev;
778  TiXmlAttribute* next;
779 };
780 
781 
782 /* A class used to manage a group of attributes.
783  It is only used internally, both by the ELEMENT and the DECLARATION.
784 
785  The set can be changed transparent to the Element and Declaration
786  classes that use it, but NOT transparent to the Attribute
787  which has to implement a next() and previous() method. Which makes
788  it a bit problematic and prevents the use of STL.
789 
790  This version is implemented with circular lists because:
791  - I like circular lists
792  - it demonstrates some independence from the (typical) doubly linked list.
793 */
795 {
796 public:
799 
800  void Add( TiXmlAttribute* attribute );
801  void Remove( TiXmlAttribute* attribute );
802 
803  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
804  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
805  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
806  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
807 
808  const TiXmlAttribute* Find( const char * name ) const;
809  TiXmlAttribute* Find( const char * name );
810 
811 private:
812  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
813  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
814  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
815  void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
816 
817  TiXmlAttribute sentinel;
818 };
819 
820 
825 class TiXmlElement : public TiXmlNode
826 {
827 public:
829  TiXmlElement (const char * in_value);
830 
831  #ifdef TIXML_USE_STL
832  TiXmlElement( const std::string& _value );
834  #endif
835 
836  TiXmlElement( const TiXmlElement& );
837 
838  void operator=( const TiXmlElement& base );
839 
840  virtual ~TiXmlElement();
841 
845  const char* Attribute( const char* name ) const;
846 
853  const char* Attribute( const char* name, int* i ) const;
854 
861  const char* Attribute( const char* name, double* d ) const;
862 
870  int QueryIntAttribute( const char* name, int* value ) const;
872  int QueryDoubleAttribute( const char* name, double* value ) const;
874  int QueryDoubleAttribute( const char* name, float* value ) const {
875  double d;
876  int result = QueryDoubleAttribute( name, &d );
877  *value = (float)d;
878  return result;
879  }
880 
884  void SetAttribute( const char* name, const char * value );
885 
886  #ifdef TIXML_USE_STL
887  const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
888  const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
889  const char* Attribute( const std::string& name, double* d ) const { return Attribute( name.c_str(), d ); }
890  int QueryIntAttribute( const std::string& name, int* value ) const { return QueryIntAttribute( name.c_str(), value ); }
891  int QueryDoubleAttribute( const std::string& name, double* value ) const { return QueryDoubleAttribute( name.c_str(), value ); }
892 
894  void SetAttribute( const std::string& name, const std::string& _value )
895  {
896  StringToBuffer n( name );
897  StringToBuffer v( _value );
898  if ( n.buffer && v.buffer )
899  SetAttribute (n.buffer, v.buffer );
900  }
902  void SetAttribute( const std::string& name, int _value )
903  {
904  StringToBuffer n( name );
905  if ( n.buffer )
906  SetAttribute (n.buffer, _value);
907  }
908  #endif
909 
913  void SetAttribute( const char * name, int value );
914 
918  void SetDoubleAttribute( const char * name, double value );
919 
922  void RemoveAttribute( const char * name );
923  #ifdef TIXML_USE_STL
924  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
925  #endif
926 
927  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
928  TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
929  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
930  TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
931 
933  virtual TiXmlNode* Clone() const;
934  // Print the Element to a FILE stream.
935  virtual void Print( FILE* cfile, int depth ) const;
936 
937  /* Attribtue parsing starts: next char past '<'
938  returns: next char past '>'
939  */
940  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
941 
942 protected:
943 
944  void CopyTo( TiXmlElement* target ) const;
945  void ClearThis(); // like clear, but initializes 'this' object as well
946 
947  // Used to be public [internal use]
948  #ifdef TIXML_USE_STL
949  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
950  #endif
951  virtual void StreamOut( TIXML_OSTREAM * out ) const;
952 
953  /* [internal use]
954  Reads the "value" of the element -- another element, or text.
955  This should terminate with the current end tag.
956  */
957  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
958 
959 private:
960 
961  TiXmlAttributeSet attributeSet;
962 };
963 
964 
967 class TiXmlComment : public TiXmlNode
968 {
969 public:
971  TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
972  TiXmlComment( const TiXmlComment& );
973  void operator=( const TiXmlComment& base );
974 
975  virtual ~TiXmlComment() {}
976 
978  virtual TiXmlNode* Clone() const;
980  virtual void Print( FILE* cfile, int depth ) const;
981 
982  /* Attribtue parsing starts: at the ! of the !--
983  returns: next char past '>'
984  */
985  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
986 
987 protected:
988  void CopyTo( TiXmlComment* target ) const;
989 
990  // used to be public
991  #ifdef TIXML_USE_STL
992  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
993  #endif
994  virtual void StreamOut( TIXML_OSTREAM * out ) const;
995 
996 private:
997 
998 };
999 
1000 
1003 class TiXmlText : public TiXmlNode
1004 {
1005  friend class TiXmlElement;
1006 public:
1008  TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
1009  {
1010  SetValue( initValue );
1011  }
1012  virtual ~TiXmlText() {}
1013 
1014  #ifdef TIXML_USE_STL
1015  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
1017  {
1018  SetValue( initValue );
1019  }
1020  #endif
1021 
1022  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
1023  void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
1024 
1026  virtual void Print( FILE* cfile, int depth ) const;
1027 
1028  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1029 
1030 protected :
1032  virtual TiXmlNode* Clone() const;
1033  void CopyTo( TiXmlText* target ) const;
1034 
1035  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1036  bool Blank() const; // returns true if all white space and new lines
1037  // [internal use]
1038  #ifdef TIXML_USE_STL
1039  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1040  #endif
1041 
1042 private:
1043 };
1044 
1045 
1060 {
1061 public:
1063  TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
1064 
1065 #ifdef TIXML_USE_STL
1066  TiXmlDeclaration( const std::string& _version,
1068  const std::string& _encoding,
1069  const std::string& _standalone );
1070 #endif
1071 
1073  TiXmlDeclaration( const char* _version,
1074  const char* _encoding,
1075  const char* _standalone );
1076 
1077  TiXmlDeclaration( const TiXmlDeclaration& copy );
1078  void operator=( const TiXmlDeclaration& copy );
1079 
1080  virtual ~TiXmlDeclaration() {}
1081 
1083  const char *Version() const { return version.c_str (); }
1085  const char *Encoding() const { return encoding.c_str (); }
1087  const char *Standalone() const { return standalone.c_str (); }
1088 
1090  virtual TiXmlNode* Clone() const;
1092  virtual void Print( FILE* cfile, int depth ) const;
1093 
1094  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1095 
1096 protected:
1097  void CopyTo( TiXmlDeclaration* target ) const;
1098  // used to be public
1099  #ifdef TIXML_USE_STL
1100  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1101  #endif
1102  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1103 
1104 private:
1105 
1106  TIXML_STRING version;
1107  TIXML_STRING encoding;
1108  TIXML_STRING standalone;
1109 };
1110 
1111 
1119 class TiXmlUnknown : public TiXmlNode
1120 {
1121 public:
1122  TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
1123  virtual ~TiXmlUnknown() {}
1124 
1125  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
1126  void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
1127 
1129  virtual TiXmlNode* Clone() const;
1131  virtual void Print( FILE* cfile, int depth ) const;
1132 
1133  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1134 
1135 protected:
1136  void CopyTo( TiXmlUnknown* target ) const;
1137 
1138  #ifdef TIXML_USE_STL
1139  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1140  #endif
1141  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1142 
1143 private:
1144 
1145 };
1146 
1147 
1152 class TiXmlDocument : public TiXmlNode
1153 {
1154 public:
1156  TiXmlDocument();
1158  TiXmlDocument( const char * documentName );
1159 
1160  #ifdef TIXML_USE_STL
1161  TiXmlDocument( const std::string& documentName );
1163  #endif
1164 
1165  TiXmlDocument( const TiXmlDocument& copy );
1166  void operator=( const TiXmlDocument& copy );
1167 
1168  virtual ~TiXmlDocument() {}
1169 
1174  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1176  bool SaveFile() const;
1178  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1180  bool SaveFile( const char * filename ) const;
1181 
1182  #ifdef TIXML_USE_STL
1183  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1184  {
1185  StringToBuffer f( filename );
1186  return ( f.buffer && LoadFile( f.buffer, encoding ));
1187  }
1188  bool SaveFile( const std::string& filename ) const
1189  {
1190  StringToBuffer f( filename );
1191  return ( f.buffer && SaveFile( f.buffer ));
1192  }
1193  #endif
1194 
1199  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1200 
1205  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1206  TiXmlElement* RootElement() { return FirstChildElement(); }
1207 
1213  bool Error() const { return error; }
1214 
1216  const char * ErrorDesc() const { return errorDesc.c_str (); }
1217 
1221  int ErrorId() const { return errorId; }
1222 
1230  int ErrorRow() { return errorLocation.row+1; }
1231  int ErrorCol() { return errorLocation.col+1; }
1232 
1253  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1254 
1255  int TabSize() const { return tabsize; }
1256 
1260  void ClearError() { error = false;
1261  errorId = 0;
1262  errorDesc = "";
1263  errorLocation.row = errorLocation.col = 0;
1264  //errorLocation.last = 0;
1265  }
1266 
1268  void Print() const { Print( stdout, 0 ); }
1269 
1271  virtual void Print( FILE* cfile, int depth = 0 ) const;
1272  // [internal use]
1273  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1274 
1275 protected :
1276  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1277  // [internal use]
1278  virtual TiXmlNode* Clone() const;
1279  #ifdef TIXML_USE_STL
1280  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1281  #endif
1282 
1283 private:
1284  void CopyTo( TiXmlDocument* target ) const;
1285 
1286  bool error;
1287  int errorId;
1288  TIXML_STRING errorDesc;
1289  int tabsize;
1290  TiXmlCursor errorLocation;
1291 };
1292 
1293 
1375 {
1376 public:
1378  TiXmlHandle( TiXmlNode* node ) { this->node = node; }
1380  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1381  TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
1382 
1384  TiXmlHandle FirstChild() const;
1386  TiXmlHandle FirstChild( const char * value ) const;
1390  TiXmlHandle FirstChildElement( const char * value ) const;
1391 
1395  TiXmlHandle Child( const char* value, int index ) const;
1399  TiXmlHandle Child( int index ) const;
1404  TiXmlHandle ChildElement( const char* value, int index ) const;
1409  TiXmlHandle ChildElement( int index ) const;
1410 
1411  #ifdef TIXML_USE_STL
1412  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1413  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1414 
1415  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1416  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1417  #endif
1418 
1420  TiXmlNode* Node() const { return node; }
1422  TiXmlElement* Element() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1424  TiXmlText* Text() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1426  TiXmlUnknown* Unknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1427 
1428 private:
1429  TiXmlNode* node;
1430 };
1431 
1432 
1433 
1434 //fg: put it namespace gear
1435 } // end namespace gear {
1436 
1437 
1438 
1439 #ifdef _MSC_VER
1440 #pragma warning( default : 4530 )
1441 #pragma warning( default : 4786 )
1442 #endif
1443 
1444 #endif
1445 
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:931
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1063
void SetDoubleValue(double value)
Set the value from a double.
Definition: tinyxml.cc:1155
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:612
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:726
int Column() const
See Row()
Definition: tinyxml.h:190
bool SaveFile(const std::string &filename) const
< STL std::string version.
Definition: tinyxml.h:1188
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cc:1164
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:555
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:871
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:1230
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:624
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:446
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:478
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:971
virtual void Print(FILE *cfile, int depth) const
Print this declaration to a FILE stream.
Definition: tinyxml.cc:1295
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition: tinyxml.cc:919
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition: tinyxml.cc:184
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1059
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:583
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:477
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:595
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:1253
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1083
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1085
An attribute is a name-value pair.
Definition: tinyxml.h:675
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cc:1376
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:560
virtual void Print(FILE *cfile, int depth) const
Write this text object to a FILE stream.
Definition: tinyxml.cc:1224
void SetIntValue(int value)
Set the value from an integer.
Definition: tinyxml.cc:1148
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Definition: tinyxml.h:435
TiXmlNode * Node() const
Return the handle as a TiXmlNode. This may return null.
Definition: tinyxml.h:1420
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:707
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition: tinyxml.h:1374
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition: tinyxml.h:505
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1216
const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:614
const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:617
virtual void Print(FILE *cfile, int depth) const
Print this Unknown to a FILE stream.
Definition: tinyxml.cc:1356
TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:626
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:1231
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:475
TiXmlNode * IterateChildren(const std::string &_value, TiXmlNode *previous)
STL std::string form.
Definition: tinyxml.h:506
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:1426
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:927
Always the top level node.
Definition: tinyxml.h:1152
void SetAttribute(const std::string &name, const std::string &_value)
STL std::string form.
Definition: tinyxml.h:894
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cc:1169
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:616
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition: tinyxml.cc:1212
int QueryDoubleAttribute(const char *name, double *value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cc:719
Any tag that tinyXml doesn't recognize is saved as an unknown.
Definition: tinyxml.h:1119
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:681
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:725
TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:625
void SetValue(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:739
const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:619
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:368
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:670
TiXmlText * Text() const
Return the handle as a TiXmlText. This may return null.
Definition: tinyxml.h:1424
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
Definition: tinyxml.cc:1592
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:929
int QueryDoubleValue(double *value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cc:1141
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
Definition: tinyxml.cc:1029
const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:615
int QueryDoubleAttribute(const char *name, float *value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:874
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:321
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
Definition: tinyxml.h:1205
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1087
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:709
NodeType
The types of XML nodes supported by TinyXml.
Definition: tinyxml.h:410
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cc:1344
An XML comment.
Definition: tinyxml.h:967
The element is a container class.
Definition: tinyxml.h:825
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
Definition: tinyxml.h:1221
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:545
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:553
bool Error() const
If an error occurs, Error will be set to true.
Definition: tinyxml.h:1213
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:476
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:556
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:737
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition: tinyxml.h:924
TiXmlHandle(TiXmlNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1378
XML text.
Definition: tinyxml.h:1003
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:582
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:461
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
Definition: tinyxml.cc:472
TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:621
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:766
void ClearError()
If you have handled the error, it can be reset with this call.
Definition: tinyxml.h:1260
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1380
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:464
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
Definition: tinyxml.cc:1554
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:708
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cc:882
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cc:1244
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:1188
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:1422
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cc:1511
int QueryIntValue(int *value) const
QueryIntValue examines the value string.
Definition: tinyxml.cc:1134
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:618
void SetAttribute(const char *name, const char *value)
Sets an attribute of name to a given value.
Definition: tinyxml.cc:745
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:699
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream.
Definition: tinyxml.cc:1102
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:1268
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:554
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cc:1066
TiXmlText(const char *initValue)
Constructor.
Definition: tinyxml.h:1008
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:596
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cc:1487
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.h:1183
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:623
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:470
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cc:1084
TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:622
virtual int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:603