Orocos Real-Time Toolkit  2.8.3
tinyxml.h
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens do nov 2 13:06:00 CET 2006 tinyxml.h
3 
4  tinyxml.h - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 Peter Soetens
8  email : peter.soetens@gmail.com
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 /*
40 www.sourceforge.net/projects/tinyxml
41 Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
42 
43 This software is provided 'as-is', without any express or implied
44 warranty. In no event will the authors be held liable for any
45 damages arising from the use of this software.
46 
47 Permission is granted to anyone to use this software for any
48 purpose, including commercial applications, and to alter it and
49 redistribute it freely, subject to the following restrictions:
50 
51 1. The origin of this software must not be misrepresented; you must
52 not claim that you wrote the original software. If you use this
53 software in a product, an acknowledgment in the product documentation
54 would be appreciated but is not required.
55 
56 2. Altered source versions must be plainly marked as such, and
57 must not be misrepresented as being the original software.
58 
59 3. This notice may not be removed or altered from any source
60 distribution.
61 */
62 
63 
64 #ifndef TINYXML_INCLUDED
65 #define TINYXML_INCLUDED
66 
67 #ifdef _MSC_VER
68 #pragma warning( push )
69 #pragma warning( disable : 4530 )
70 #pragma warning( disable : 4786 )
71 #endif
72 
73 #include <ctype.h>
74 #include <stdio.h>
75 #include <stdlib.h>
76 #include <string.h>
77 #include <assert.h>
78 
79 // Help out windows:
80 #if defined( _DEBUG ) && !defined( DEBUG )
81 #define DEBUG
82 #endif
83 
84 #ifdef TIXML_USE_STL
85  #include <string>
86  #include <iostream>
87  #define TIXML_STRING std::string
88  #define TIXML_ISTREAM std::istream
89  #define TIXML_OSTREAM std::ostream
90 #else
91  #include "tinystr.h"
92  #define TIXML_STRING TiXmlString
93  #define TIXML_OSTREAM TiXmlOutStream
94 #endif
95 
96 // Deprecated library function hell. Compilers want to use the
97 // new safe versions. This probably doesn't fully address the problem,
98 // but it gets closer. There are too many compilers for me to fully
99 // test. If you get compilation troubles, undefine TIXML_SAFE
100 
101 #define TIXML_SAFE // TinyXml isn't fully buffer overrun protected, safe code. This is work in progress.
102 #ifdef TIXML_SAFE
103  #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
104  // Microsoft visual studio, version 2005 and higher.
105  #define TIXML_SNPRINTF _snprintf_s
106  #define TIXML_SNSCANF _snscanf_s
107  #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
108  // Microsoft visual studio, version 6 and higher.
109  //#pragma message( "Using _sn* functions." )
110  #define TIXML_SNPRINTF _snprintf
111  #define TIXML_SNSCANF _snscanf
112  #elif defined(__GNUC__) && (__GNUC__ >= 3 )
113  // GCC version 3 and higher.s
114  //#warning( "Using sn* functions." )
115  #define TIXML_SNPRINTF snprintf
116  #define TIXML_SNSCANF snscanf
117  #endif
118 #endif
119 
120 namespace RTT { namespace marsh {
121 
122 class TiXmlDocument;
123 class TiXmlElement;
124 class TiXmlComment;
125 class TiXmlUnknown;
126 class TiXmlAttribute;
127 class TiXmlText;
128 class TiXmlDeclaration;
129 class TiXmlParsingData;
130 
131 const int TIXML_MAJOR_VERSION = 2;
132 const int TIXML_MINOR_VERSION = 4;
133 const int TIXML_PATCH_VERSION = 3;
134 
135 /* Internal structure for tracking location of items
136  in the XML file.
137 */
139 {
141  void Clear() { row = col = -1; }
142 
143  int row; // 0 based.
144  int col; // 0 based.
145 };
146 
147 
148 // Only used by Attribute::Query functions
149 enum
150 {
154 };
155 
156 
157 // Used by the parsing routines.
159 {
163 };
164 
166 
190 {
191  friend class TiXmlNode;
192  friend class TiXmlElement;
193  friend class TiXmlDocument;
194 
195 public:
196  TiXmlBase() : userData(0) {}
197  virtual ~TiXmlBase() {}
198 
204  virtual void Print( FILE* cfile, int depth ) const = 0;
205 
212  static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
213 
215  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
216 
235  int Row() const { return location.row + 1; }
236  int Column() const { return location.col + 1; }
237 
238  void SetUserData( void* user ) { userData = user; }
239  void* GetUserData() { return userData; }
240 
241  // Table that returs, for a given lead byte, the total number of bytes
242  // in the UTF-8 sequence.
243  static const int utf8ByteTable[256];
244 
245  virtual const char* Parse( const char* p,
246  TiXmlParsingData* data,
247  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
248 
249  enum
250  {
251  TIXML_NO_ERROR = 0,
267 
268  TIXML_ERROR_STRING_COUNT
269  };
270 
271 protected:
272 
273  // See STL_STRING_BUG
274  // Utility class to overcome a bug.
276  {
277  public:
278  StringToBuffer( const TIXML_STRING& str );
279  ~StringToBuffer();
280  char* buffer;
281  };
282 
283  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
284  inline static bool IsWhiteSpace( char c )
285  {
286  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
287  }
288  inline static bool IsWhiteSpace( int c )
289  {
290  if ( c < 256 )
291  return IsWhiteSpace( (char) c );
292  return false; // Again, only truly correct for English/Latin...but usually works.
293  }
294 
295  virtual void StreamOut (TIXML_OSTREAM *) const = 0;
296 
297  #ifdef TIXML_USE_STL
298  static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
299  static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
300  #endif
301 
302  /* Reads an XML name into the string provided. Returns
303  a pointer just past the last character of the name,
304  or 0 if the function has an error.
305  */
306  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
307 
308  /* Reads text. Returns a pointer past the given end tag.
309  Wickedly complex options, but it keeps the (sensitive) code in one place.
310  */
311  static const char* ReadText( const char* in, // where to start
312  TIXML_STRING* text, // the string read
313  bool ignoreWhiteSpace, // whether to keep the white space
314  const char* endTag, // what ends this text
315  bool ignoreCase, // whether to ignore case in the end tag
316  TiXmlEncoding encoding ); // the current encoding
317 
318  // If an entity has been found, transform it into a character.
319  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
320 
321  // Get a character, while interpreting entities.
322  // The length can be from 0 to 4 bytes.
323  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
324  {
325  assert( p );
326  if ( encoding == TIXML_ENCODING_UTF8 )
327  {
328  *length = utf8ByteTable[ *((unsigned char*)p) ];
329  assert( *length >= 0 && *length < 5 );
330  }
331  else
332  {
333  *length = 1;
334  }
335 
336  if ( *length == 1 )
337  {
338  if ( *p == '&' )
339  return GetEntity( p, _value, length, encoding );
340  *_value = *p;
341  return p+1;
342  }
343  else if ( *length )
344  {
345  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
346  // and the null terminator isn't needed
347  for( int i=0; p[i] && i<*length; ++i ) {
348  _value[i] = p[i];
349  }
350  return p + (*length);
351  }
352  else
353  {
354  // Not valid text.
355  return 0;
356  }
357  }
358 
359  // Puts a string to a stream, expanding entities as it goes.
360  // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
361  static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
362 
363  static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
364 
365  // Return true if the next characters in the stream are any of the endTag sequences.
366  // Ignore case only works for english, and should only be relied on when comparing
367  // to English words: StringEqual( p, "version", true ) is fine.
368  static bool StringEqual( const char* p,
369  const char* endTag,
370  bool ignoreCase,
371  TiXmlEncoding encoding );
372 
373  static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
374 
376 
378  void* userData;
379 
380  // None of these methods are reliable for any language except English.
381  // Good for approximation, not great for accuracy.
382  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
383  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
384  inline static int ToLower( int v, TiXmlEncoding encoding )
385  {
386  if ( encoding == TIXML_ENCODING_UTF8 )
387  {
388  if ( v < 128 ) return tolower( v );
389  return v;
390  }
391  else
392  {
393  return tolower( v );
394  }
395  }
396  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
397 
398 private:
399  TiXmlBase( const TiXmlBase& ); // not implemented.
400  void operator=( const TiXmlBase& base ); // not allowed.
401 
402  struct Entity
403  {
404  const char* str;
405  unsigned int strLength;
406  char chr;
407  };
408  enum
409  {
410  NUM_ENTITY = 5,
411  MAX_ENTITY_LENGTH = 6
412 
413  };
414  static Entity entity[ NUM_ENTITY ];
415  static bool condenseWhiteSpace;
416 };
417 
418 
425 class TiXmlNode : public TiXmlBase
426 {
427  friend class TiXmlDocument;
428  friend class TiXmlElement;
429 
430 public:
431  #ifdef TIXML_USE_STL
432 
436  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
437 
454  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
455 
457  friend std::string& operator<< (std::string& out, const TiXmlNode& base );
458 
459  #else
460  // Used internally, not part of the public API.
461  friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
462  #endif
463 
467  enum NodeType
468  {
475  TYPECOUNT
476  };
477 
478  virtual ~TiXmlNode();
479 
492  const char *Value() const { return value.c_str (); }
493 
494  #ifdef TIXML_USE_STL
495 
499  const std::string& ValueStr() const { return value; }
500  #endif
501 
511  void SetValue(const char * _value) { value = _value;}
512 
513  #ifdef TIXML_USE_STL
514  void SetValue( const std::string& _value ) { value = _value; }
516  #endif
517 
519  void Clear();
520 
522  TiXmlNode* Parent() { return parent; }
523  const TiXmlNode* Parent() const { return parent; }
524 
525  const TiXmlNode* FirstChild() const { return firstChild; }
526  TiXmlNode* FirstChild() { return firstChild; }
527  const TiXmlNode* FirstChild( const char * value ) const;
528  TiXmlNode* FirstChild( const char * value );
529 
530  const TiXmlNode* LastChild() const { return lastChild; }
531  TiXmlNode* LastChild() { return lastChild; }
532  const TiXmlNode* LastChild( const char * value ) const;
533  TiXmlNode* LastChild( const char * value );
534 
535  #ifdef TIXML_USE_STL
536  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
537  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
538  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
539  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
540  #endif
541 
558  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
559  TiXmlNode* IterateChildren( TiXmlNode* previous );
560 
562  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
563  TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous );
564 
565  #ifdef TIXML_USE_STL
566  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
567  TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
568  #endif
569 
573  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
574 
575 
585  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
586 
590  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
591 
595  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
596 
600  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
601 
603  bool RemoveChild( TiXmlNode* removeThis );
604 
606  const TiXmlNode* PreviousSibling() const { return prev; }
607  TiXmlNode* PreviousSibling() { return prev; }
608 
610  const TiXmlNode* PreviousSibling( const char * ) const;
611  TiXmlNode* PreviousSibling( const char * );
612 
613  #ifdef TIXML_USE_STL
614  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
615  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
616  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
617  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
618  #endif
619 
621  const TiXmlNode* NextSibling() const { return next; }
622  TiXmlNode* NextSibling() { return next; }
623 
625  const TiXmlNode* NextSibling( const char * ) const;
626  TiXmlNode* NextSibling( const char * );
627 
632  const TiXmlElement* NextSiblingElement() const;
633  TiXmlElement* NextSiblingElement();
634 
639  const TiXmlElement* NextSiblingElement( const char * ) const;
640  TiXmlElement* NextSiblingElement( const char * );
641 
642  #ifdef TIXML_USE_STL
643  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
644  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
645  #endif
646 
648  const TiXmlElement* FirstChildElement() const;
649  TiXmlElement* FirstChildElement();
650 
652  const TiXmlElement* FirstChildElement( const char * value ) const;
653  TiXmlElement* FirstChildElement( const char * value );
654 
655  #ifdef TIXML_USE_STL
656  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
657  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
658  #endif
659 
664  int Type() const { return type; }
665 
669  const TiXmlDocument* GetDocument() const;
670  TiXmlDocument* GetDocument();
671 
673  bool NoChildren() const { return !firstChild; }
674 
675  virtual const TiXmlDocument* ToDocument() const { return 0; }
676  virtual const TiXmlElement* ToElement() const { return 0; }
677  virtual const TiXmlComment* ToComment() const { return 0; }
678  virtual const TiXmlUnknown* ToUnknown() const { return 0; }
679  virtual const TiXmlText* ToText() const { return 0; }
680  virtual const TiXmlDeclaration* ToDeclaration() const { return 0; }
681 
682  virtual TiXmlDocument* ToDocument() { return 0; }
683  virtual TiXmlElement* ToElement() { return 0; }
684  virtual TiXmlComment* ToComment() { return 0; }
685  virtual TiXmlUnknown* ToUnknown() { return 0; }
686  virtual TiXmlText* ToText() { return 0; }
687  virtual TiXmlDeclaration* ToDeclaration() { return 0; }
688 
692  virtual TiXmlNode* Clone() const = 0;
693 
694 protected:
695  TiXmlNode( NodeType _type );
696 
697  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
698  // and the assignment operator.
699  void CopyTo( TiXmlNode* target ) const;
700 
701  #ifdef TIXML_USE_STL
702  // The real work of the input operator.
703  virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
704  #endif
705 
706  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
707  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
708 
711 
714 
716 
719 
720 private:
721  TiXmlNode( const TiXmlNode& ); // not implemented.
722  void operator=( const TiXmlNode& base ); // not allowed.
723 };
724 
725 
733 class TiXmlAttribute : public TiXmlBase
734 {
735  friend class TiXmlAttributeSet;
736 
737 public:
740  {
741  document = 0;
742  prev = next = 0;
743  }
744 
745  #ifdef TIXML_USE_STL
746  TiXmlAttribute( const std::string& _name, const std::string& _value )
748  {
749  name = _name;
750  value = _value;
751  document = 0;
752  prev = next = 0;
753  }
754  #endif
755 
757  TiXmlAttribute( const char * _name, const char * _value )
758  {
759  name = _name;
760  value = _value;
761  document = 0;
762  prev = next = 0;
763  }
764 
765  const char* Name() const { return name.c_str (); }
766  const char* Value() const { return value.c_str (); }
767  int IntValue() const;
768  double DoubleValue() const;
769 
770  // Get the tinyxml string representation
771  const TIXML_STRING& NameTStr() const { return name; }
772 
782  int QueryIntValue( int* _value ) const;
784  int QueryDoubleValue( double* _value ) const;
785 
786  void SetName( const char* _name ) { name = _name; }
787  void SetValue( const char* _value ) { value = _value; }
788 
789  void SetIntValue( int _value );
790  void SetDoubleValue( double _value );
791 
792  #ifdef TIXML_USE_STL
793  void SetName( const std::string& _name ) { name = _name; }
796  void SetValue( const std::string& _value ) { value = _value; }
797  #endif
798 
800  const TiXmlAttribute* Next() const;
801  TiXmlAttribute* Next();
803  const TiXmlAttribute* Previous() const;
804  TiXmlAttribute* Previous();
805 
806  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
807  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
808  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
809 
810  /* Attribute parsing starts: first letter of the name
811  returns: the next char after the value end quote
812  */
813  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
814 
815  // Prints this Attribute to a FILE stream.
816  virtual void Print( FILE* cfile, int depth ) const;
817 
818  virtual void StreamOut( TIXML_OSTREAM * out ) const;
819  // [internal use]
820  // Set the document pointer so the attribute can report errors.
821  void SetDocument( TiXmlDocument* doc ) { document = doc; }
822 
823 private:
824  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
825  void operator=( const TiXmlAttribute& base ); // not allowed.
826 
827  TiXmlDocument* document; // A pointer back to a document, for error reporting.
828  TIXML_STRING name;
829  TIXML_STRING value;
830  TiXmlAttribute* prev;
831  TiXmlAttribute* next;
832 };
833 
834 
835 /* A class used to manage a group of attributes.
836  It is only used internally, both by the ELEMENT and the DECLARATION.
837 
838  The set can be changed transparent to the Element and Declaration
839  classes that use it, but NOT transparent to the Attribute
840  which has to implement a next() and previous() method. Which makes
841  it a bit problematic and prevents the use of STL.
842 
843  This version is implemented with circular lists because:
844  - I like circular lists
845  - it demonstrates some independence from the (typical) doubly linked list.
846 */
848 {
849 public:
852 
853  void Add( TiXmlAttribute* attribute );
854  void Remove( TiXmlAttribute* attribute );
855 
856  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
857  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
858  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
859  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
860 
861  const TiXmlAttribute* Find( const TIXML_STRING& name ) const;
862  TiXmlAttribute* Find( const TIXML_STRING& name );
863 
864 private:
865  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
866  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
867  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
868  void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
869 
870  TiXmlAttribute sentinel;
871 };
872 
873 
878 class TiXmlElement : public TiXmlNode
879 {
880 public:
882  TiXmlElement (const char * in_value);
883 
884  #ifdef TIXML_USE_STL
885  TiXmlElement( const std::string& _value );
887  #endif
888 
889  TiXmlElement( const TiXmlElement& );
890 
891  void operator=( const TiXmlElement& base );
892 
893  virtual ~TiXmlElement();
894 
898  const char* Attribute( const char* name ) const;
899 
906  const char* Attribute( const char* name, int* i ) const;
907 
914  const char* Attribute( const char* name, double* d ) const;
915 
923  int QueryIntAttribute( const char* name, int* _value ) const;
925  int QueryDoubleAttribute( const char* name, double* _value ) const;
927  int QueryFloatAttribute( const char* name, float* _value ) const {
928  double d;
929  int result = QueryDoubleAttribute( name, &d );
930  if ( result == TIXML_SUCCESS ) {
931  *_value = (float)d;
932  }
933  return result;
934  }
935 
939  void SetAttribute( const char* name, const char * _value );
940 
941  #ifdef TIXML_USE_STL
942  const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
943  const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
944  const char* Attribute( const std::string& name, double* d ) const { return Attribute( name.c_str(), d ); }
945  int QueryIntAttribute( const std::string& name, int* _value ) const { return QueryIntAttribute( name.c_str(), _value ); }
946  int QueryDoubleAttribute( const std::string& name, double* _value ) const { return QueryDoubleAttribute( name.c_str(), _value ); }
947 
949  void SetAttribute( const std::string& name, const std::string& _value );
951  void SetAttribute( const std::string& name, int _value );
952  #endif
953 
957  void SetAttribute( const char * name, int value );
958 
962  void SetDoubleAttribute( const char * name, double value );
963 
966  void RemoveAttribute( const char * name );
967  #ifdef TIXML_USE_STL
968  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
969  #endif
970 
971  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
972  TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
973  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
974  TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
975 
1008  const char* GetText() const;
1009 
1011  virtual TiXmlNode* Clone() const;
1012  // Print the Element to a FILE stream.
1013  virtual void Print( FILE* cfile, int depth ) const;
1014 
1015  /* Attribtue parsing starts: next char past '<'
1016  returns: next char past '>'
1017  */
1018  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1019 
1020  virtual const TiXmlElement* ToElement() const { return this; }
1021  virtual TiXmlElement* ToElement() { return this; }
1022 
1023 protected:
1024 
1025  void CopyTo( TiXmlElement* target ) const;
1026  void ClearThis(); // like clear, but initializes 'this' object as well
1027 
1028  // Used to be public [internal use]
1029  #ifdef TIXML_USE_STL
1030  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1031  #endif
1032  virtual void StreamOut( TIXML_OSTREAM * out ) const;
1033 
1034  /* [internal use]
1035  Reads the "value" of the element -- another element, or text.
1036  This should terminate with the current end tag.
1037  */
1038  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1039 
1040 private:
1041 
1042  TiXmlAttributeSet attributeSet;
1043 };
1044 
1045 
1048 class TiXmlComment : public TiXmlNode
1049 {
1050 public:
1052  TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
1053  TiXmlComment( const TiXmlComment& );
1054  void operator=( const TiXmlComment& base );
1055 
1056  virtual ~TiXmlComment() {}
1057 
1059  virtual TiXmlNode* Clone() const;
1061  virtual void Print( FILE* cfile, int depth ) const;
1062 
1063  /* Attribtue parsing starts: at the ! of the !--
1064  returns: next char past '>'
1065  */
1066  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1067 
1068  virtual const TiXmlComment* ToComment() const { return this; }
1069  virtual TiXmlComment* ToComment() { return this; }
1070 
1071 protected:
1072  void CopyTo( TiXmlComment* target ) const;
1073 
1074  // used to be public
1075  #ifdef TIXML_USE_STL
1076  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1077  #endif
1078  virtual void StreamOut( TIXML_OSTREAM * out ) const;
1079 
1080 private:
1081 
1082 };
1083 
1084 
1090 class TiXmlText : public TiXmlNode
1091 {
1092  friend class TiXmlElement;
1093 public:
1098  TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
1099  {
1100  SetValue( initValue );
1101  cdata = false;
1102  }
1103  virtual ~TiXmlText() {}
1104 
1105  #ifdef TIXML_USE_STL
1106  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
1108  {
1109  SetValue( initValue );
1110  cdata = false;
1111  }
1112  #endif
1113 
1114  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
1115  void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
1116 
1118  virtual void Print( FILE* cfile, int depth ) const;
1119 
1121  bool CDATA() { return cdata; }
1123  void SetCDATA( bool _cdata ) { cdata = _cdata; }
1124 
1125  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1126 
1127  virtual const TiXmlText* ToText() const { return this; }
1128  virtual TiXmlText* ToText() { return this; }
1129 
1130 protected :
1132  virtual TiXmlNode* Clone() const;
1133  void CopyTo( TiXmlText* target ) const;
1134 
1135  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1136  bool Blank() const; // returns true if all white space and new lines
1137  // [internal use]
1138  #ifdef TIXML_USE_STL
1139  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1140  #endif
1141 
1142 private:
1143  bool cdata; // true if this should be input and output as a CDATA style text element
1144 };
1145 
1146 
1161 {
1162 public:
1164  TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
1165 
1166 #ifdef TIXML_USE_STL
1167  TiXmlDeclaration( const std::string& _version,
1169  const std::string& _encoding,
1170  const std::string& _standalone );
1171 #endif
1172 
1174  TiXmlDeclaration( const char* _version,
1175  const char* _encoding,
1176  const char* _standalone );
1177 
1178  TiXmlDeclaration( const TiXmlDeclaration& copy );
1179  void operator=( const TiXmlDeclaration& copy );
1180 
1181  virtual ~TiXmlDeclaration() {}
1182 
1184  const char *Version() const { return version.c_str (); }
1186  const char *Encoding() const { return encoding.c_str (); }
1188  const char *Standalone() const { return standalone.c_str (); }
1189 
1191  virtual TiXmlNode* Clone() const;
1193  virtual void Print( FILE* cfile, int depth ) const;
1194 
1195  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1196 
1197  virtual const TiXmlDeclaration* ToDeclaration() const { return this; }
1198  virtual TiXmlDeclaration* ToDeclaration() { return this; }
1199 
1200 protected:
1201  void CopyTo( TiXmlDeclaration* target ) const;
1202  // used to be public
1203  #ifdef TIXML_USE_STL
1204  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1205  #endif
1206  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1207 
1208 private:
1209 
1210  TIXML_STRING version;
1211  TIXML_STRING encoding;
1212  TIXML_STRING standalone;
1213 };
1214 
1215 
1223 class TiXmlUnknown : public TiXmlNode
1224 {
1225 public:
1226  TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
1227  virtual ~TiXmlUnknown() {}
1228 
1229  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
1230  void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
1231 
1233  virtual TiXmlNode* Clone() const;
1235  virtual void Print( FILE* cfile, int depth ) const;
1236 
1237  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1238 
1239  virtual const TiXmlUnknown* ToUnknown() const { return this; }
1240  virtual TiXmlUnknown* ToUnknown() { return this; }
1241 
1242 protected:
1243  void CopyTo( TiXmlUnknown* target ) const;
1244 
1245  #ifdef TIXML_USE_STL
1246  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1247  #endif
1248  virtual void StreamOut ( TIXML_OSTREAM * out ) const;
1249 
1250 private:
1251 
1252 };
1253 
1254 
1259 class TiXmlDocument : public TiXmlNode
1260 {
1261 public:
1263  TiXmlDocument();
1265  TiXmlDocument( const char * documentName );
1266 
1267  #ifdef TIXML_USE_STL
1268  TiXmlDocument( const std::string& documentName );
1270  #endif
1271 
1272  TiXmlDocument( const TiXmlDocument& copy );
1273  void operator=( const TiXmlDocument& copy );
1274 
1275  virtual ~TiXmlDocument() {}
1276 
1281  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1283  bool SaveFile() const;
1285  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1287  bool SaveFile( const char * filename ) const;
1293  bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1295  bool SaveFile( FILE* ) const;
1296 
1297  #ifdef TIXML_USE_STL
1298  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1299  {
1300  StringToBuffer f( filename );
1301  return ( f.buffer && LoadFile( f.buffer, encoding ));
1302  }
1303  bool SaveFile( const std::string& filename ) const
1304  {
1305  StringToBuffer f( filename );
1306  return ( f.buffer && SaveFile( f.buffer ));
1307  }
1308  #endif
1309 
1314  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1315 
1320  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1321  TiXmlElement* RootElement() { return FirstChildElement(); }
1322 
1328  bool Error() const { return error; }
1329 
1331  const char * ErrorDesc() const { return errorDesc.c_str (); }
1332 
1336  int ErrorId() const { return errorId; }
1337 
1345  int ErrorRow() { return errorLocation.row+1; }
1346  int ErrorCol() { return errorLocation.col+1; }
1347 
1372  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1373 
1374  int TabSize() const { return tabsize; }
1375 
1379  void ClearError() { error = false;
1380  errorId = 0;
1381  errorDesc = "";
1382  errorLocation.row = errorLocation.col = 0;
1383  //errorLocation.last = 0;
1384  }
1385 
1387  void Print() const { Print( stdout, 0 ); }
1388 
1390  virtual void Print( FILE* cfile, int depth = 0 ) const;
1391  // [internal use]
1392  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1393 
1394  virtual const TiXmlDocument* ToDocument() const { return this; }
1395  virtual TiXmlDocument* ToDocument() { return this; }
1396 
1397 protected :
1398  virtual void StreamOut ( TIXML_OSTREAM * out) const;
1399  // [internal use]
1400  virtual TiXmlNode* Clone() const;
1401  #ifdef TIXML_USE_STL
1402  virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
1403  #endif
1404 
1405 private:
1406  void CopyTo( TiXmlDocument* target ) const;
1407 
1408  bool error;
1409  int errorId;
1410  TIXML_STRING errorDesc;
1411  int tabsize;
1412  TiXmlCursor errorLocation;
1413  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1414 };
1415 
1416 
1498 {
1499 public:
1501  TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
1503  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1504  TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
1505 
1507  TiXmlHandle FirstChild() const;
1509  TiXmlHandle FirstChild( const char * value ) const;
1511  TiXmlHandle FirstChildElement() const;
1513  TiXmlHandle FirstChildElement( const char * value ) const;
1514 
1518  TiXmlHandle Child( const char* value, int index ) const;
1522  TiXmlHandle Child( int index ) const;
1527  TiXmlHandle ChildElement( const char* value, int index ) const;
1532  TiXmlHandle ChildElement( int index ) const;
1533 
1534  #ifdef TIXML_USE_STL
1535  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1536  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1537 
1538  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1539  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1540  #endif
1541 
1543  TiXmlNode* Node() const { return node; }
1545  TiXmlElement* Element() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1547  TiXmlText* Text() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1549  TiXmlUnknown* Unknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1550 
1551 private:
1552  TiXmlNode* node;
1553 };
1554 
1555 }}
1556 
1557 #ifdef _MSC_VER
1558 #pragma warning( pop )
1559 #endif
1560 
1561 #endif
1562 
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition: tinyxml.h:1497
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:606
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1186
virtual ~TiXmlBase()
Definition: tinyxml.h:197
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:673
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:765
bool operator<(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:807
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:384
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:766
int ErrorRow()
Returns the location (if known) of the error.
Definition: tinyxml.h:1345
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition: tinyxml.h:664
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1020
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1052
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:786
void CopyTo(TiXmlUnknown *target) const
Definition: tinyxml.cpp:1600
TiXmlHandle operator=(const TiXmlHandle &ref)
Definition: tinyxml.h:1504
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:284
void SetTabSize(int _tabsize)
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct v...
Definition: tinyxml.h:1372
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:679
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1197
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:525
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:971
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1128
bool operator>(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:808
const TIXML_STRING & NameTStr() const
Definition: tinyxml.h:771
void operator=(const TiXmlUnknown &copy)
Definition: tinyxml.h:1230
void SetUserData(void *user)
Definition: tinyxml.h:238
bool CDATA()
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1121
An attribute is a name-value pair.
Definition: tinyxml.h:733
Always the top level node.
Definition: tinyxml.h:1259
void * GetUserData()
Definition: tinyxml.h:239
TiXmlNode * parent
Definition: tinyxml.h:709
TiXmlNode * FirstChild()
Definition: tinyxml.h:526
int ErrorCol()
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1346
TiXmlNode * firstChild
Definition: tinyxml.h:712
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1395
virtual ~TiXmlText()
Definition: tinyxml.h:1103
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:378
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:973
TiXmlUnknown * Unknown() const
Return the handle as a TiXmlUnknown. This may return null;.
Definition: tinyxml.h:1549
TiXmlAttribute * LastAttribute()
Definition: tinyxml.h:974
TiXmlAttribute * First()
Definition: tinyxml.h:857
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1164
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1331
TiXmlUnknown(const TiXmlUnknown &copy)
Definition: tinyxml.h:1229
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:683
TiXmlNode * Node() const
Return the handle as a TiXmlNode. This may return null.
Definition: tinyxml.h:1543
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1069
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:927
An XML comment.
Definition: tinyxml.h:1048
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
Definition: tinyxml.h:1320
int Column() const
See Row()
Definition: tinyxml.h:236
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1394
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1240
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1068
bool operator==(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:806
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1198
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:757
TiXmlAttribute * Last()
Definition: tinyxml.h:859
#define TIXML_OSTREAM
Definition: tinyxml.h:93
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1127
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1184
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:685
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
Definition: tinyxml.h:212
void operator=(const TiXmlText &base)
Definition: tinyxml.h:1115
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1501
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1188
TiXmlText(const TiXmlText &copy)
Definition: tinyxml.h:1114
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:531
const int TIXML_PATCH_VERSION
Definition: tinyxml.h:133
TiXmlNode * NextSibling()
Definition: tinyxml.h:622
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1239
void SetValue(const char *_value)
Changes the value of the node.
Definition: tinyxml.h:511
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1123
TiXmlText(const char *initValue)
Constructor for text element.
Definition: tinyxml.h:1098
TIXML_STRING value
Definition: tinyxml.h:715
void Print() const
Dump the document to standard out.
Definition: tinyxml.h:1387
TIXML_OSTREAM & operator<<(TIXML_OSTREAM &out, const TiXmlNode &base)
Definition: tinyxml.cpp:1698
const int TIXML_MAJOR_VERSION
Definition: tinyxml.h:131
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:425
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:687
const TiXmlAttribute * First() const
Definition: tinyxml.h:856
TiXmlBase is a base class for every class in TinyXml.
Definition: tinyxml.h:189
std::istream & operator>>(std::istream &is, FlowStatus &fs)
Definition: FlowStatus.cpp:61
TiXmlNode * prev
Definition: tinyxml.h:717
const int TIXML_MINOR_VERSION
Definition: tinyxml.h:132
TiXmlElement * RootElement()
Definition: tinyxml.h:1321
TiXmlNode * next
Definition: tinyxml.h:718
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:686
TiXmlCursor location
Definition: tinyxml.h:375
The element is a container class.
Definition: tinyxml.h:878
TiXmlAttribute * FirstAttribute()
Definition: tinyxml.h:972
TiXmlText * Text() const
Return the handle as a TiXmlText. This may return null.
Definition: tinyxml.h:1547
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:678
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:680
void ClearError()
If you have handled the error, it can be reset with this call.
Definition: tinyxml.h:1379
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:675
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:677
TiXmlNode * PreviousSibling()
Definition: tinyxml.h:607
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:821
static bool IsWhiteSpace(int c)
Definition: tinyxml.h:288
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:165
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:684
const TiXmlNode * LastChild() const
Definition: tinyxml.h:530
bool Error() const
If an error occurs, Error will be set to true.
Definition: tinyxml.h:1328
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:522
const TiXmlNode * Parent() const
Definition: tinyxml.h:523
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:787
int TabSize() const
Definition: tinyxml.h:1374
void CopyTo(TiXmlText *target) const
Definition: tinyxml.cpp:1467
An Attribute has a name and contains data which can be set and get.
Definition: Attribute.hpp:56
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:676
In correct XML the declaration is the first entry in the file.
Definition: tinyxml.h:1160
TiXmlNode * lastChild
Definition: tinyxml.h:713
NodeType
The types of XML nodes supported by TinyXml.
Definition: tinyxml.h:467
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1503
Any tag that tinyXml doesn&#39;t recognize is saved as an unknown.
Definition: tinyxml.h:1223
const char * Value() const
The meaning of &#39;value&#39; changes for the specific type of TiXmlNode.
Definition: tinyxml.h:492
const TiXmlAttribute * Last() const
Definition: tinyxml.h:858
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:682
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:621
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:323
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:215
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1021
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
Definition: tinyxml.h:1336
#define TIXML_STRING
Definition: tinyxml.h:92
int Row() const
Return the position, in the original source file, of this node or attribute.
Definition: tinyxml.h:235
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:739
TiXmlElement * Element() const
Return the handle as a TiXmlElement. This may return null.
Definition: tinyxml.h:1545