FEDRA emulsion software from the OPERA Collaboration
tinyxml.h
Go to the documentation of this file.
1 /*
2 www.sourceforge.net/projects/tinyxml
3 Original code by Lee Thomason (www.grinninglizard.com)
4 
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any
7 damages arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any
10 purpose, including commercial applications, and to alter it and
11 redistribute it freely, subject to the following restrictions:
12 
13 1. The origin of this software must not be misrepresented; you must
14 not claim that you wrote the original software. If you use this
15 software in a product, an acknowledgment in the product documentation
16 would be appreciated but is not required.
17 
18 2. Altered source versions must be plainly marked as such, and
19 must not be misrepresented as being the original software.
20 
21 3. This notice may not be removed or altered from any source
22 distribution.
23 */
24 
25 
26 #ifndef TINYXML_INCLUDED
27 #define TINYXML_INCLUDED
28 
29 #ifdef _MSC_VER
30 #pragma warning( push )
31 #pragma warning( disable : 4530 )
32 #pragma warning( disable : 4786 )
33 #endif
34 
35 #include <ctype.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <assert.h>
40 
41 // Help out windows:
42 #if defined( _DEBUG ) && !defined( DEBUG )
43 #define DEBUG
44 #endif
45 
46 #ifdef TIXML_USE_STL
47  #include <string>
48  #include <iostream>
49  #include <sstream>
50  #define TIXML_STRING std::string
51 #else
52  #include "tinystr.h"
53  #define TIXML_STRING TiXmlString
54 #endif
55 
56 // Deprecated library function hell. Compilers want to use the
57 // new safe versions. This probably doesn't fully address the problem,
58 // but it gets closer. There are too many compilers for me to fully
59 // test. If you get compilation troubles, undefine TIXML_SAFE
60 #define TIXML_SAFE
61 
62 #ifdef TIXML_SAFE
63  #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
64  // Microsoft visual studio, version 2005 and higher.
65  #define TIXML_SNPRINTF _snprintf_s
66  #define TIXML_SSCANF sscanf_s
67  #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
68  // Microsoft visual studio, version 6 and higher.
69  //#pragma message( "Using _sn* functions." )
70  #define TIXML_SNPRINTF _snprintf
71  #define TIXML_SSCANF sscanf
72  #elif defined(__GNUC__) && (__GNUC__ >= 3 )
73  // GCC version 3 and higher.s
74  //#warning( "Using sn* functions." )
75  #define TIXML_SNPRINTF snprintf
76  #define TIXML_SSCANF sscanf
77  #else
78  #define TIXML_SNPRINTF snprintf
79  #define TIXML_SSCANF sscanf
80  #endif
81 #endif
82 
83 class TiXmlDocument;
84 class TiXmlElement;
85 class TiXmlComment;
86 class TiXmlUnknown;
87 class TiXmlAttribute;
88 class TiXmlText;
89 class TiXmlDeclaration;
90 class TiXmlParsingData;
91 
92 const int TIXML_MAJOR_VERSION = 2;
93 const int TIXML_MINOR_VERSION = 6;
94 const int TIXML_PATCH_VERSION = 2;
95 
96 /* Internal structure for tracking location of items
97  in the XML file.
98 */
100 {
102  void Clear() { row = col = -1; }
103 
104  int row; // 0 based.
105  int col; // 0 based.
106 };
107 
108 
129 {
130 public:
131  virtual ~TiXmlVisitor() {}
132 
134  virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; }
136  virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; }
137 
139  virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; }
141  virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; }
142 
144  virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; }
146  virtual bool Visit( const TiXmlText& /*text*/ ) { return true; }
148  virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; }
150  virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; }
151 };
152 
153 // Only used by Attribute::Query functions
154 enum
155 {
159 };
160 
161 
162 // Used by the parsing routines.
164 {
168 };
169 
171 
195 {
196  friend class TiXmlNode;
197  friend class TiXmlElement;
198  friend class TiXmlDocument;
199 
200 public:
201  TiXmlBase() : userData(0) {}
202  virtual ~TiXmlBase() {}
203 
213  virtual void Print( FILE* cfile, int depth ) const = 0;
214 
221  static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
222 
224  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
225 
244  int Row() const { return location.row + 1; }
245  int Column() const { return location.col + 1; }
246 
247  void SetUserData( void* user ) { userData = user; }
248  void* GetUserData() { return userData; }
249  const void* GetUserData() const { return userData; }
250 
251  // Table that returs, for a given lead byte, the total number of bytes
252  // in the UTF-8 sequence.
253  static const int utf8ByteTable[256];
254 
255  virtual const char* Parse( const char* p,
256  TiXmlParsingData* data,
257  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
258 
262  static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
263 
264  enum
265  {
282 
284  };
285 
286 protected:
287 
288  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
289 
290  inline static bool IsWhiteSpace( char c )
291  {
292  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
293  }
294  inline static bool IsWhiteSpace( int c )
295  {
296  if ( c < 256 )
297  return IsWhiteSpace( (char) c );
298  return false; // Again, only truly correct for English/Latin...but usually works.
299  }
300 
301  #ifdef TIXML_USE_STL
302  static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
303  static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
304  #endif
305 
306  /* Reads an XML name into the string provided. Returns
307  a pointer just past the last character of the name,
308  or 0 if the function has an error.
309  */
310  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
311 
312  /* Reads text. Returns a pointer past the given end tag.
313  Wickedly complex options, but it keeps the (sensitive) code in one place.
314  */
315  static const char* ReadText( const char* in, // where to start
316  TIXML_STRING* text, // the string read
317  bool ignoreWhiteSpace, // whether to keep the white space
318  const char* endTag, // what ends this text
319  bool ignoreCase, // whether to ignore case in the end tag
320  TiXmlEncoding encoding ); // the current encoding
321 
322  // If an entity has been found, transform it into a character.
323  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
324 
325  // Get a character, while interpreting entities.
326  // The length can be from 0 to 4 bytes.
327  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
328  {
329  assert( p );
330  if ( encoding == TIXML_ENCODING_UTF8 )
331  {
332  *length = utf8ByteTable[ *((const unsigned char*)p) ];
333  assert( *length >= 0 && *length < 5 );
334  }
335  else
336  {
337  *length = 1;
338  }
339 
340  if ( *length == 1 )
341  {
342  if ( *p == '&' )
343  return GetEntity( p, _value, length, encoding );
344  *_value = *p;
345  return p+1;
346  }
347  else if ( *length )
348  {
349  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
350  // and the null terminator isn't needed
351  for( int i=0; p[i] && i<*length; ++i ) {
352  _value[i] = p[i];
353  }
354  return p + (*length);
355  }
356  else
357  {
358  // Not valid text.
359  return 0;
360  }
361  }
362 
363  // Return true if the next characters in the stream are any of the endTag sequences.
364  // Ignore case only works for english, and should only be relied on when comparing
365  // to English words: StringEqual( p, "version", true ) is fine.
366  static bool StringEqual( const char* p,
367  const char* endTag,
368  bool ignoreCase,
369  TiXmlEncoding encoding );
370 
371  static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
372 
374 
376  void* userData;
377 
378  // None of these methods are reliable for any language except English.
379  // Good for approximation, not great for accuracy.
380  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
381  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
382  inline static int ToLower( int v, TiXmlEncoding encoding )
383  {
384  if ( encoding == TIXML_ENCODING_UTF8 )
385  {
386  if ( v < 128 ) return tolower( v );
387  return v;
388  }
389  else
390  {
391  return tolower( v );
392  }
393  }
394  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
395 
396 private:
397  TiXmlBase( const TiXmlBase& ); // not implemented.
398  void operator=( const TiXmlBase& base ); // not allowed.
399 
400  struct Entity
401  {
402  const char* str;
403  unsigned int strLength;
404  char chr;
405  };
406  enum
407  {
410 
411  };
413  static bool condenseWhiteSpace;
414 };
415 
416 
423 class TiXmlNode : public TiXmlBase
424 {
425  friend class TiXmlDocument;
426  friend class TiXmlElement;
427 
428 public:
429  #ifdef TIXML_USE_STL
430 
434  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
435 
452  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
453 
455  friend std::string& operator<< (std::string& out, const TiXmlNode& base );
456 
457  #endif
458 
462  enum NodeType
463  {
471  };
472 
473  virtual ~TiXmlNode();
474 
487  const char *Value() const { return value.c_str (); }
488 
489  #ifdef TIXML_USE_STL
494  const std::string& ValueStr() const { return value; }
495  #endif
496 
497  const TIXML_STRING& ValueTStr() const { return value; }
498 
508  void SetValue(const char * _value) { value = _value;}
509 
510  #ifdef TIXML_USE_STL
512  void SetValue( const std::string& _value ) { value = _value; }
513  #endif
514 
516  void Clear();
517 
519  TiXmlNode* Parent() { return parent; }
520  const TiXmlNode* Parent() const { return parent; }
521 
522  const TiXmlNode* FirstChild() const { return firstChild; }
524  const TiXmlNode* FirstChild( const char * value ) const;
526  TiXmlNode* FirstChild( const char * _value ) {
527  // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
528  // call the method, cast the return back to non-const.
529  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
530  }
531  const TiXmlNode* LastChild() const { return lastChild; }
533 
534  const TiXmlNode* LastChild( const char * value ) const;
535  TiXmlNode* LastChild( const char * _value ) {
536  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
537  }
538 
539  #ifdef TIXML_USE_STL
540  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
541  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
542  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
543  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
544  #endif
545 
562  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
563  TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
564  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
565  }
566 
568  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
569  TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
570  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
571  }
572 
573  #ifdef TIXML_USE_STL
574  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
575  TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
576  #endif
577 
581  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
582 
583 
593  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
594 
598  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
599 
603  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
604 
608  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
609 
611  bool RemoveChild( TiXmlNode* removeThis );
612 
614  const TiXmlNode* PreviousSibling() const { return prev; }
616 
618  const TiXmlNode* PreviousSibling( const char * ) const;
619  TiXmlNode* PreviousSibling( const char *_prev ) {
620  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
621  }
622 
623  #ifdef TIXML_USE_STL
624  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
625  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
626  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
627  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
628  #endif
629 
631  const TiXmlNode* NextSibling() const { return next; }
632  TiXmlNode* NextSibling() { return next; }
633 
635  const TiXmlNode* NextSibling( const char * ) const;
636  TiXmlNode* NextSibling( const char* _next ) {
637  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
638  }
639 
644  const TiXmlElement* NextSiblingElement() const;
646  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
647  }
648 
653  const TiXmlElement* NextSiblingElement( const char * ) const;
654  TiXmlElement* NextSiblingElement( const char *_next ) {
655  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
656  }
657 
658  #ifdef TIXML_USE_STL
659  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
660  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
661  #endif
662 
664  const TiXmlElement* FirstChildElement() const;
666  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
667  }
668 
670  const TiXmlElement* FirstChildElement( const char * _value ) const;
671  TiXmlElement* FirstChildElement( const char * _value ) {
672  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
673  }
674 
675  #ifdef TIXML_USE_STL
676  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
677  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
678  #endif
679 
684  int Type() const { return type; }
685 
689  const TiXmlDocument* GetDocument() const;
691  return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
692  }
693 
695  bool NoChildren() const { return !firstChild; }
696 
697  virtual const TiXmlDocument* ToDocument() const { return 0; }
698  virtual const TiXmlElement* ToElement() const { return 0; }
699  virtual const TiXmlComment* ToComment() const { return 0; }
700  virtual const TiXmlUnknown* ToUnknown() const { return 0; }
701  virtual const TiXmlText* ToText() const { return 0; }
702  virtual const TiXmlDeclaration* ToDeclaration() const { return 0; }
703 
704  virtual TiXmlDocument* ToDocument() { return 0; }
705  virtual TiXmlElement* ToElement() { return 0; }
706  virtual TiXmlComment* ToComment() { return 0; }
707  virtual TiXmlUnknown* ToUnknown() { return 0; }
708  virtual TiXmlText* ToText() { return 0; }
709  virtual TiXmlDeclaration* ToDeclaration() { return 0; }
710 
714  virtual TiXmlNode* Clone() const = 0;
715 
738  virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
739 
740 protected:
741  TiXmlNode( NodeType _type );
742 
743  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
744  // and the assignment operator.
745  void CopyTo( TiXmlNode* target ) const;
746 
747  #ifdef TIXML_USE_STL
748  // The real work of the input operator.
749  virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
750  #endif
751 
752  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
753  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
754 
757 
760 
762 
765 
766 private:
767  TiXmlNode( const TiXmlNode& ); // not implemented.
768  void operator=( const TiXmlNode& base ); // not allowed.
769 };
770 
771 
779 class TiXmlAttribute : public TiXmlBase
780 {
781  friend class TiXmlAttributeSet;
782 
783 public:
786  {
787  document = 0;
788  prev = next = 0;
789  }
790 
791  #ifdef TIXML_USE_STL
793  TiXmlAttribute( const std::string& _name, const std::string& _value )
794  {
795  name = _name;
796  value = _value;
797  document = 0;
798  prev = next = 0;
799  }
800  #endif
801 
803  TiXmlAttribute( const char * _name, const char * _value )
804  {
805  name = _name;
806  value = _value;
807  document = 0;
808  prev = next = 0;
809  }
810 
811  const char* Name() const { return name.c_str(); }
812  const char* Value() const { return value.c_str(); }
813  #ifdef TIXML_USE_STL
814  const std::string& ValueStr() const { return value; }
815  #endif
816  int IntValue() const;
817  double DoubleValue() const;
818 
819  // Get the tinyxml string representation
820  const TIXML_STRING& NameTStr() const { return name; }
821 
831  int QueryIntValue( int* _value ) const;
833  int QueryDoubleValue( double* _value ) const;
834 
835  void SetName( const char* _name ) { name = _name; }
836  void SetValue( const char* _value ) { value = _value; }
837 
838  void SetIntValue( int _value );
839  void SetDoubleValue( double _value );
840 
841  #ifdef TIXML_USE_STL
843  void SetName( const std::string& _name ) { name = _name; }
845  void SetValue( const std::string& _value ) { value = _value; }
846  #endif
847 
849  const TiXmlAttribute* Next() const;
851  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
852  }
853 
855  const TiXmlAttribute* Previous() const;
857  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
858  }
859 
860  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
861  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
862  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
863 
864  /* Attribute parsing starts: first letter of the name
865  returns: the next char after the value end quote
866  */
867  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
868 
869  // Prints this Attribute to a FILE stream.
870  virtual void Print( FILE* cfile, int depth ) const {
871  Print( cfile, depth, 0 );
872  }
873  void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
874 
875  // [internal use]
876  // Set the document pointer so the attribute can report errors.
877  void SetDocument( TiXmlDocument* doc ) { document = doc; }
878 
879 private:
880  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
881  void operator=( const TiXmlAttribute& base ); // not allowed.
882 
883  TiXmlDocument* document; // A pointer back to a document, for error reporting.
888 };
889 
890 
891 /* A class used to manage a group of attributes.
892  It is only used internally, both by the ELEMENT and the DECLARATION.
893 
894  The set can be changed transparent to the Element and Declaration
895  classes that use it, but NOT transparent to the Attribute
896  which has to implement a next() and previous() method. Which makes
897  it a bit problematic and prevents the use of STL.
898 
899  This version is implemented with circular lists because:
900  - I like circular lists
901  - it demonstrates some independence from the (typical) doubly linked list.
902 */
904 {
905 public:
908 
909  void Add( TiXmlAttribute* attribute );
910  void Remove( TiXmlAttribute* attribute );
911 
912  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
913  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
914  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
915  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
916 
917  TiXmlAttribute* Find( const char* _name ) const;
918  TiXmlAttribute* FindOrCreate( const char* _name );
919 
920 # ifdef TIXML_USE_STL
921  TiXmlAttribute* Find( const std::string& _name ) const;
922  TiXmlAttribute* FindOrCreate( const std::string& _name );
923 # endif
924 
925 
926 private:
927  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
928  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
929  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
930  void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
931 
933 };
934 
935 
940 class TiXmlElement : public TiXmlNode
941 {
942 public:
944  TiXmlElement (const char * in_value);
945 
946  #ifdef TIXML_USE_STL
948  TiXmlElement( const std::string& _value );
949  #endif
950 
951  TiXmlElement( const TiXmlElement& );
952 
953  TiXmlElement& operator=( const TiXmlElement& base );
954 
955  virtual ~TiXmlElement();
956 
960  const char* Attribute( const char* name ) const;
961 
968  const char* Attribute( const char* name, int* i ) const;
969 
976  const char* Attribute( const char* name, double* d ) const;
977 
985  int QueryIntAttribute( const char* name, int* _value ) const;
987  int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
992  int QueryBoolAttribute( const char* name, bool* _value ) const;
994  int QueryDoubleAttribute( const char* name, double* _value ) const;
996  int QueryFloatAttribute( const char* name, float* _value ) const {
997  double d;
998  int result = QueryDoubleAttribute( name, &d );
999  if ( result == TIXML_SUCCESS ) {
1000  *_value = (float)d;
1001  }
1002  return result;
1003  }
1004 
1005  #ifdef TIXML_USE_STL
1007  int QueryStringAttribute( const char* name, std::string* _value ) const {
1008  const char* cstr = Attribute( name );
1009  if ( cstr ) {
1010  *_value = std::string( cstr );
1011  return TIXML_SUCCESS;
1012  }
1013  return TIXML_NO_ATTRIBUTE;
1014  }
1015 
1024  template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
1025  {
1026  const TiXmlAttribute* node = attributeSet.Find( name );
1027  if ( !node )
1028  return TIXML_NO_ATTRIBUTE;
1029 
1030  std::stringstream sstream( node->ValueStr() );
1031  sstream >> *outValue;
1032  if ( !sstream.fail() )
1033  return TIXML_SUCCESS;
1034  return TIXML_WRONG_TYPE;
1035  }
1036 
1037  int QueryValueAttribute( const std::string& name, std::string* outValue ) const
1038  {
1039  const TiXmlAttribute* node = attributeSet.Find( name );
1040  if ( !node )
1041  return TIXML_NO_ATTRIBUTE;
1042  *outValue = node->ValueStr();
1043  return TIXML_SUCCESS;
1044  }
1045  #endif
1046 
1050  void SetAttribute( const char* name, const char * _value );
1051 
1052  #ifdef TIXML_USE_STL
1053  const std::string* Attribute( const std::string& name ) const;
1054  const std::string* Attribute( const std::string& name, int* i ) const;
1055  const std::string* Attribute( const std::string& name, double* d ) const;
1056  int QueryIntAttribute( const std::string& name, int* _value ) const;
1057  int QueryDoubleAttribute( const std::string& name, double* _value ) const;
1058 
1060  void SetAttribute( const std::string& name, const std::string& _value );
1062  void SetAttribute( const std::string& name, int _value );
1064  void SetDoubleAttribute( const std::string& name, double value );
1065  #endif
1066 
1070  void SetAttribute( const char * name, int value );
1071 
1075  void SetDoubleAttribute( const char * name, double value );
1076 
1079  void RemoveAttribute( const char * name );
1080  #ifdef TIXML_USE_STL
1081  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
1082  #endif
1083 
1084  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
1086  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
1088 
1121  const char* GetText() const;
1122 
1124  virtual TiXmlNode* Clone() const;
1125  // Print the Element to a FILE stream.
1126  virtual void Print( FILE* cfile, int depth ) const;
1127 
1128  /* Attribtue parsing starts: next char past '<'
1129  returns: next char past '>'
1130  */
1131  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1132 
1133  virtual const TiXmlElement* ToElement() const { return this; }
1134  virtual TiXmlElement* ToElement() { return this; }
1135 
1138  virtual bool Accept( TiXmlVisitor* visitor ) const;
1139 
1140 protected:
1141 
1142  void CopyTo( TiXmlElement* target ) const;
1143  void ClearThis(); // like clear, but initializes 'this' object as well
1144 
1145  // Used to be public [internal use]
1146  #ifdef TIXML_USE_STL
1147  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1148  #endif
1149  /* [internal use]
1150  Reads the "value" of the element -- another element, or text.
1151  This should terminate with the current end tag.
1152  */
1153  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1154 
1155 private:
1157 };
1158 
1159 
1162 class TiXmlComment : public TiXmlNode
1163 {
1164 public:
1168  TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {
1169  SetValue( _value );
1170  }
1171  TiXmlComment( const TiXmlComment& );
1172  TiXmlComment& operator=( const TiXmlComment& base );
1173 
1174  virtual ~TiXmlComment() {}
1175 
1177  virtual TiXmlNode* Clone() const;
1178  // Write this Comment to a FILE stream.
1179  virtual void Print( FILE* cfile, int depth ) const;
1180 
1181  /* Attribtue parsing starts: at the ! of the !--
1182  returns: next char past '>'
1183  */
1184  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1185 
1186  virtual const TiXmlComment* ToComment() const { return this; }
1187  virtual TiXmlComment* ToComment() { return this; }
1188 
1191  virtual bool Accept( TiXmlVisitor* visitor ) const;
1192 
1193 protected:
1194  void CopyTo( TiXmlComment* target ) const;
1195 
1196  // used to be public
1197  #ifdef TIXML_USE_STL
1198  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1199  #endif
1200 // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1201 
1202 private:
1203 
1204 };
1205 
1206 
1212 class TiXmlText : public TiXmlNode
1213 {
1214  friend class TiXmlElement;
1215 public:
1220  TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
1221  {
1222  SetValue( initValue );
1223  cdata = false;
1224  }
1225  virtual ~TiXmlText() {}
1226 
1227  #ifdef TIXML_USE_STL
1229  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
1230  {
1231  SetValue( initValue );
1232  cdata = false;
1233  }
1234  #endif
1235 
1236  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); }
1237  TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; }
1238 
1239  // Write this text object to a FILE stream.
1240  virtual void Print( FILE* cfile, int depth ) const;
1241 
1243  bool CDATA() const { return cdata; }
1245  void SetCDATA( bool _cdata ) { cdata = _cdata; }
1246 
1247  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1248 
1249  virtual const TiXmlText* ToText() const { return this; }
1250  virtual TiXmlText* ToText() { return this; }
1251 
1254  virtual bool Accept( TiXmlVisitor* content ) const;
1255 
1256 protected :
1258  virtual TiXmlNode* Clone() const;
1259  void CopyTo( TiXmlText* target ) const;
1260 
1261  bool Blank() const; // returns true if all white space and new lines
1262  // [internal use]
1263  #ifdef TIXML_USE_STL
1264  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1265  #endif
1266 
1267 private:
1268  bool cdata; // true if this should be input and output as a CDATA style text element
1269 };
1270 
1271 
1286 {
1287 public:
1290 
1291 #ifdef TIXML_USE_STL
1293  TiXmlDeclaration( const std::string& _version,
1294  const std::string& _encoding,
1295  const std::string& _standalone );
1296 #endif
1297 
1299  TiXmlDeclaration( const char* _version,
1300  const char* _encoding,
1301  const char* _standalone );
1302 
1303  TiXmlDeclaration( const TiXmlDeclaration& copy );
1305 
1306  virtual ~TiXmlDeclaration() {}
1307 
1309  const char *Version() const { return version.c_str (); }
1311  const char *Encoding() const { return encoding.c_str (); }
1313  const char *Standalone() const { return standalone.c_str (); }
1314 
1316  virtual TiXmlNode* Clone() const;
1317  // Print this declaration to a FILE stream.
1318  virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
1319  virtual void Print( FILE* cfile, int depth ) const {
1320  Print( cfile, depth, 0 );
1321  }
1322 
1323  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1324 
1325  virtual const TiXmlDeclaration* ToDeclaration() const { return this; }
1326  virtual TiXmlDeclaration* ToDeclaration() { return this; }
1327 
1330  virtual bool Accept( TiXmlVisitor* visitor ) const;
1331 
1332 protected:
1333  void CopyTo( TiXmlDeclaration* target ) const;
1334  // used to be public
1335  #ifdef TIXML_USE_STL
1336  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1337  #endif
1338 
1339 private:
1340 
1344 };
1345 
1346 
1354 class TiXmlUnknown : public TiXmlNode
1355 {
1356 public:
1358  virtual ~TiXmlUnknown() {}
1359 
1360  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); }
1361  TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; }
1362 
1364  virtual TiXmlNode* Clone() const;
1365  // Print this Unknown to a FILE stream.
1366  virtual void Print( FILE* cfile, int depth ) const;
1367 
1368  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1369 
1370  virtual const TiXmlUnknown* ToUnknown() const { return this; }
1371  virtual TiXmlUnknown* ToUnknown() { return this; }
1372 
1375  virtual bool Accept( TiXmlVisitor* content ) const;
1376 
1377 protected:
1378  void CopyTo( TiXmlUnknown* target ) const;
1379 
1380  #ifdef TIXML_USE_STL
1381  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1382  #endif
1383 
1384 private:
1385 
1386 };
1387 
1388 
1393 class TiXmlDocument : public TiXmlNode
1394 {
1395 public:
1397  TiXmlDocument();
1399  TiXmlDocument( const char * documentName );
1400 
1401  #ifdef TIXML_USE_STL
1403  TiXmlDocument( const std::string& documentName );
1404  #endif
1405 
1406  TiXmlDocument( const TiXmlDocument& copy );
1407  TiXmlDocument& operator=( const TiXmlDocument& copy );
1408 
1409  virtual ~TiXmlDocument() {}
1410 
1415  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1417  bool SaveFile() const;
1419  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1421  bool SaveFile( const char * filename ) const;
1427  bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1429  bool SaveFile( FILE* ) const;
1430 
1431  #ifdef TIXML_USE_STL
1432  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1433  {
1434  return LoadFile( filename.c_str(), encoding );
1435  }
1436  bool SaveFile( const std::string& filename ) const
1437  {
1438  return SaveFile( filename.c_str() );
1439  }
1440  #endif
1441 
1446  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1447 
1452  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1454 
1460  bool Error() const { return error; }
1461 
1463  const char * ErrorDesc() const { return errorDesc.c_str (); }
1464 
1468  int ErrorId() const { return errorId; }
1469 
1477  int ErrorRow() const { return errorLocation.row+1; }
1478  int ErrorCol() const { return errorLocation.col+1; }
1479 
1504  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1505 
1506  int TabSize() const { return tabsize; }
1507 
1511  void ClearError() { error = false;
1512  errorId = 0;
1513  errorDesc = "";
1515  //errorLocation.last = 0;
1516  }
1517 
1519  void Print() const { Print( stdout, 0 ); }
1520 
1521  /* Write the document to a string using formatted printing ("pretty print"). This
1522  will allocate a character array (new char[]) and return it as a pointer. The
1523  calling code pust call delete[] on the return char* to avoid a memory leak.
1524  */
1525  //char* PrintToMemory() const;
1526 
1528  virtual void Print( FILE* cfile, int depth = 0 ) const;
1529  // [internal use]
1530  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1531 
1532  virtual const TiXmlDocument* ToDocument() const { return this; }
1533  virtual TiXmlDocument* ToDocument() { return this; }
1534 
1537  virtual bool Accept( TiXmlVisitor* content ) const;
1538 
1539 protected :
1540  // [internal use]
1541  virtual TiXmlNode* Clone() const;
1542  #ifdef TIXML_USE_STL
1543  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1544  #endif
1545 
1546 private:
1547  void CopyTo( TiXmlDocument* target ) const;
1548 
1549  bool error;
1550  int errorId;
1552  int tabsize;
1554  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1555 };
1556 
1557 
1639 {
1640 public:
1642  TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
1644  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1645  TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; }
1646 
1648  TiXmlHandle FirstChild() const;
1650  TiXmlHandle FirstChild( const char * value ) const;
1654  TiXmlHandle FirstChildElement( const char * value ) const;
1655 
1659  TiXmlHandle Child( const char* value, int index ) const;
1663  TiXmlHandle Child( int index ) const;
1668  TiXmlHandle ChildElement( const char* value, int index ) const;
1673  TiXmlHandle ChildElement( int index ) const;
1674 
1675  #ifdef TIXML_USE_STL
1676  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1677  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1678 
1679  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1680  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1681  #endif
1682 
1685  TiXmlNode* ToNode() const { return node; }
1688  TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1691  TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1694  TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1695 
1699  TiXmlNode* Node() const { return ToNode(); }
1703  TiXmlElement* Element() const { return ToElement(); }
1707  TiXmlText* Text() const { return ToText(); }
1711  TiXmlUnknown* Unknown() const { return ToUnknown(); }
1712 
1713 private:
1715 };
1716 
1717 
1738 {
1739 public:
1740  TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
1741  buffer(), indent( " " ), lineBreak( "\n" ) {}
1742 
1743  virtual bool VisitEnter( const TiXmlDocument& doc );
1744  virtual bool VisitExit( const TiXmlDocument& doc );
1745 
1746  virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
1747  virtual bool VisitExit( const TiXmlElement& element );
1748 
1749  virtual bool Visit( const TiXmlDeclaration& declaration );
1750  virtual bool Visit( const TiXmlText& text );
1751  virtual bool Visit( const TiXmlComment& comment );
1752  virtual bool Visit( const TiXmlUnknown& unknown );
1753 
1757  void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
1759  const char* Indent() { return indent.c_str(); }
1764  void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; }
1766  const char* LineBreak() { return lineBreak.c_str(); }
1767 
1771  void SetStreamPrinting() { indent = "";
1772  lineBreak = "";
1773  }
1775  const char* CStr() { return buffer.c_str(); }
1777  size_t Size() { return buffer.size(); }
1778 
1779  #ifdef TIXML_USE_STL
1781  const std::string& Str() { return buffer; }
1782  #endif
1783 
1784 private:
1785  void DoIndent() {
1786  for( int i=0; i<depth; ++i )
1787  buffer += indent;
1788  }
1789  void DoLineBreak() {
1790  buffer += lineBreak;
1791  }
1792 
1793  int depth;
1798 };
1799 
1800 
1801 #ifdef _MSC_VER
1802 #pragma warning( pop )
1803 #endif
1804 
1805 #endif
TText * text
Definition: Canv_SYSTEMATICS_ALLCOMBINED__RMSEnergy__vs__Energy__ELECTRON.C:164
std::ostream & operator<<(std::ostream &os, const Expr< A, T, D1, D2 > &rhs)
Definition: Expression.hh:99
void d()
Definition: RecDispEX.C:381
FILE * stdout
Definition: tinyxml.h:904
TiXmlAttribute sentinel
Definition: tinyxml.h:932
TiXmlAttributeSet()
Definition: tinyxml.cpp:1500
const TiXmlAttribute * Last() const
Definition: tinyxml.h:914
TiXmlAttribute * FindOrCreate(const char *_name)
Definition: tinyxml.cpp:1583
TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1572
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1514
const TiXmlAttribute * First() const
Definition: tinyxml.h:912
void Remove(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1529
void operator=(const TiXmlAttributeSet &)
TiXmlAttribute * First()
Definition: tinyxml.h:913
TiXmlAttribute * Last()
Definition: tinyxml.h:915
TiXmlAttributeSet(const TiXmlAttributeSet &)
~TiXmlAttributeSet()
Definition: tinyxml.cpp:1507
Definition: tinyxml.h:780
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:811
void SetDoubleValue(double _value)
Set the value from a double.
Definition: tinyxml.cpp:1261
TiXmlAttribute * Next()
Definition: tinyxml.h:850
const TIXML_STRING & NameTStr() const
Definition: tinyxml.h:820
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:836
bool operator==(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:860
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:870
bool operator>(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:862
int QueryIntValue(int *_value) const
Definition: tinyxml.cpp:1236
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cpp:1243
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:803
void SetIntValue(int _value)
Set the value from an integer.
Definition: tinyxml.cpp:1250
bool operator<(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:861
void operator=(const TiXmlAttribute &base)
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cpp:1277
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:785
TiXmlAttribute * prev
Definition: tinyxml.h:886
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:835
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:877
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cpp:1272
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:812
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1392
TiXmlDocument * document
Definition: tinyxml.h:883
TiXmlAttribute * Previous()
Definition: tinyxml.h:856
TiXmlAttribute * next
Definition: tinyxml.h:887
TIXML_STRING value
Definition: tinyxml.h:885
TiXmlAttribute(const TiXmlAttribute &)
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cpp:1170
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cpp:1190
TIXML_STRING name
Definition: tinyxml.h:884
Definition: tinyxml.h:195
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
Definition: tinyxmlparser.cpp:88
TiXmlCursor location
Definition: tinyxml.h:373
virtual void Print(FILE *cfile, int depth) const =0
static void SetCondenseWhiteSpace(bool condense)
Definition: tinyxml.h:221
void operator=(const TiXmlBase &base)
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:401
friend class TiXmlNode
Definition: tinyxml.h:196
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:150
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
Definition: tinyxml.cpp:52
static bool IsWhiteSpace(int c)
Definition: tinyxml.h:294
static bool condenseWhiteSpace
Definition: tinyxml.h:413
@ NUM_ENTITY
Definition: tinyxml.h:408
@ MAX_ENTITY_LENGTH
Definition: tinyxml.h:409
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:534
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:327
TiXmlBase(const TiXmlBase &)
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:248
@ TIXML_ERROR_STRING_COUNT
Definition: tinyxml.h:283
@ TIXML_ERROR_READING_END_TAG
Definition: tinyxml.h:274
@ TIXML_ERROR_PARSING_UNKNOWN
Definition: tinyxml.h:275
@ TIXML_ERROR_PARSING_DECLARATION
Definition: tinyxml.h:277
@ TIXML_ERROR_PARSING_ELEMENT
Definition: tinyxml.h:269
@ TIXML_ERROR_PARSING_EMPTY
Definition: tinyxml.h:273
@ TIXML_ERROR_READING_ATTRIBUTES
Definition: tinyxml.h:272
@ TIXML_ERROR_DOCUMENT_TOP_ONLY
Definition: tinyxml.h:281
@ TIXML_ERROR_PARSING_COMMENT
Definition: tinyxml.h:276
@ TIXML_NO_ERROR
Definition: tinyxml.h:266
@ TIXML_ERROR_PARSING_CDATA
Definition: tinyxml.h:280
@ TIXML_ERROR_DOCUMENT_EMPTY
Definition: tinyxml.h:278
@ TIXML_ERROR_OPENING_FILE
Definition: tinyxml.h:268
@ TIXML_ERROR
Definition: tinyxml.h:267
@ TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME
Definition: tinyxml.h:270
@ TIXML_ERROR_EMBEDDED_NULL
Definition: tinyxml.h:279
@ TIXML_ERROR_READING_ELEMENT_VALUE
Definition: tinyxml.h:271
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:382
static const char * errorString[TIXML_ERROR_STRING_COUNT]
Definition: tinyxml.h:371
static const char * ReadText(const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:574
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:249
static Entity entity[NUM_ENTITY]
Definition: tinyxml.h:412
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:376
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:314
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:438
TiXmlBase()
Definition: tinyxml.h:201
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:247
static const int utf8ByteTable[256]
Definition: tinyxml.h:253
int Row() const
Definition: tinyxml.h:244
virtual ~TiXmlBase()
Definition: tinyxml.h:202
int Column() const
See Row()
Definition: tinyxml.h:245
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:224
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:129
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:290
Definition: tinyxml.h:1163
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1186
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition: tinyxml.cpp:1320
virtual ~TiXmlComment()
Definition: tinyxml.h:1174
TiXmlComment(const char *_value)
Construct a comment from text.
Definition: tinyxml.h:1168
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1337
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:1297
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1166
void CopyTo(TiXmlComment *target) const
Definition: tinyxml.cpp:1308
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cpp:1314
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1187
TiXmlComment & operator=(const TiXmlComment &base)
Definition: tinyxml.cpp:1289
Definition: tinyxml.h:1286
void CopyTo(TiXmlDeclaration *target) const
Definition: tinyxml.cpp:1440
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1313
TIXML_STRING encoding
Definition: tinyxml.h:1342
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cpp:1456
TiXmlDeclaration & operator=(const TiXmlDeclaration &copy)
Definition: tinyxml.cpp:1410
TIXML_STRING standalone
Definition: tinyxml.h:1343
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1326
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1311
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1309
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1572
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1289
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cpp:1450
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1325
TIXML_STRING version
Definition: tinyxml.h:1341
virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const
Definition: tinyxml.cpp:1418
virtual ~TiXmlDeclaration()
Definition: tinyxml.h:1306
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:1319
Definition: tinyxml.h:1394
int ErrorRow() const
Definition: tinyxml.h:1477
TiXmlElement * RootElement()
Definition: tinyxml.h:1453
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1533
virtual ~TiXmlDocument()
Definition: tinyxml.h:1409
bool error
Definition: tinyxml.h:1549
TIXML_STRING errorDesc
Definition: tinyxml.h:1551
bool Error() const
Definition: tinyxml.h:1460
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1532
virtual TiXmlNode * Clone() const
Definition: tinyxml.cpp:1134
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.cpp:954
bool useMicrosoftBOM
Definition: tinyxml.h:1554
void SetTabSize(int _tabsize)
Definition: tinyxml.h:1504
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:798
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxmlparser.cpp:704
int TabSize() const
Definition: tinyxml.h:1506
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cpp:1156
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cpp:913
TiXmlCursor errorLocation
Definition: tinyxml.h:1553
void Print() const
Definition: tinyxml.h:1519
TiXmlDocument & operator=(const TiXmlDocument &copy)
Definition: tinyxml.cpp:946
void CopyTo(TiXmlDocument *target) const
Definition: tinyxml.cpp:1115
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1463
const TiXmlElement * RootElement() const
Definition: tinyxml.h:1452
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition: tinyxml.cpp:960
int ErrorId() const
Definition: tinyxml.h:1468
void ClearError()
Definition: tinyxml.h:1511
int errorId
Definition: tinyxml.h:1550
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1478
int tabsize
Definition: tinyxml.h:1552
Definition: tinyxml.h:941
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:1084
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cpp:875
void SetDoubleAttribute(const char *name, double value)
Definition: tinyxml.cpp:760
TiXmlAttribute * LastAttribute()
Definition: tinyxml.h:1087
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:1086
TiXmlAttribute * FirstAttribute()
Definition: tinyxml.h:1085
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:996
void ClearThis()
Definition: tinyxml.cpp:565
void RemoveAttribute(const char *name)
Definition: tinyxml.cpp:437
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1156
int QueryBoolAttribute(const char *name, bool *_value) const
Definition: tinyxml.cpp:683
int QueryIntAttribute(const char *name, int *_value) const
Definition: tinyxml.cpp:661
const char * Attribute(const char *name) const
Definition: tinyxml.cpp:577
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cpp:889
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1133
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1134
virtual ~TiXmlElement()
Definition: tinyxml.cpp:559
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:800
int QueryUnsignedAttribute(const char *name, unsigned *_value) const
QueryUnsignedAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cpp:670
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:853
void SetAttribute(const char *name, const char *_value)
Definition: tinyxml.cpp:780
const char * ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1179
TiXmlElement & operator=(const TiXmlElement &base)
Definition: tinyxml.cpp:551
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cpp:720
const char * GetText() const
Definition: tinyxml.cpp:900
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1043
Definition: tinyxml.h:1639
TiXmlElement * ToElement() const
Definition: tinyxml.h:1688
TiXmlNode * ToNode() const
Definition: tinyxml.h:1685
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1711
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1644
TiXmlUnknown * ToUnknown() const
Definition: tinyxml.h:1694
TiXmlHandle Child(const char *value, int index) const
Definition: tinyxml.cpp:1699
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1642
TiXmlText * ToText() const
Definition: tinyxml.h:1691
TiXmlNode * node
Definition: tinyxml.h:1714
TiXmlText * Text() const
Definition: tinyxml.h:1707
TiXmlHandle operator=(const TiXmlHandle &ref)
Definition: tinyxml.h:1645
TiXmlElement * Element() const
Definition: tinyxml.h:1703
TiXmlNode * Node() const
Definition: tinyxml.h:1699
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cpp:1656
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cpp:1632
TiXmlHandle ChildElement(const char *value, int index) const
Definition: tinyxml.cpp:1737
Definition: tinyxml.h:424
virtual ~TiXmlNode()
Definition: tinyxml.cpp:147
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:707
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:702
int Type() const
Definition: tinyxml.h:684
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cpp:452
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Definition: tinyxml.cpp:186
TiXmlElement * NextSiblingElement()
Definition: tinyxml.h:645
TiXmlNode * IterateChildren(const TiXmlNode *previous)
Definition: tinyxml.h:563
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:701
NodeType type
Definition: tinyxml.h:756
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:263
void SetValue(const char *_value)
Definition: tinyxml.h:508
TiXmlNode * next
Definition: tinyxml.h:764
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:706
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:708
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:709
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:698
TiXmlNode * NextSibling(const char *_next)
Definition: tinyxml.h:636
virtual TiXmlNode * Clone() const =0
TiXmlNode * NextSibling()
Definition: tinyxml.h:632
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Definition: tinyxml.cpp:296
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:699
TiXmlNode * lastChild
Definition: tinyxml.h:759
TiXmlNode(const TiXmlNode &)
TiXmlNode * FirstChild()
Definition: tinyxml.h:523
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:532
TiXmlNode * parent
Definition: tinyxml.h:755
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
Definition: tinyxml.h:569
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
Definition: tinyxml.cpp:385
TiXmlElement * FirstChildElement(const char *_value)
Definition: tinyxml.h:671
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:704
TiXmlNode * PreviousSibling(const char *_prev)
Definition: tinyxml.h:619
TiXmlElement * NextSiblingElement(const char *_next)
Definition: tinyxml.h:654
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition: tinyxml.cpp:169
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:230
const TIXML_STRING & ValueTStr() const
Definition: tinyxml.h:497
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:697
TiXmlDocument * GetDocument()
Definition: tinyxml.h:690
NodeType
Definition: tinyxml.h:463
@ TINYXML_DECLARATION
Definition: tinyxml.h:469
@ TINYXML_UNKNOWN
Definition: tinyxml.h:467
@ TINYXML_COMMENT
Definition: tinyxml.h:466
@ TINYXML_DOCUMENT
Definition: tinyxml.h:464
@ TINYXML_TYPECOUNT
Definition: tinyxml.h:470
@ TINYXML_ELEMENT
Definition: tinyxml.h:465
@ TINYXML_TEXT
Definition: tinyxml.h:468
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:614
TiXmlNode * prev
Definition: tinyxml.h:763
void operator=(const TiXmlNode &base)
TiXmlElement * FirstChildElement()
Definition: tinyxml.h:665
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:705
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:522
void CopyTo(TiXmlNode *target) const
Definition: tinyxml.cpp:161
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:700
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:519
friend class TiXmlElement
Definition: tinyxml.h:426
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
Definition: tinyxml.h:535
TiXmlNode * FirstChild(const char *_value)
The first child of this node with the matching 'value'. Will be null if none found.
Definition: tinyxml.h:526
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:695
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:818
const TiXmlElement * NextSiblingElement() const
Definition: tinyxml.cpp:482
virtual bool Accept(TiXmlVisitor *visitor) const =0
const char * Value() const
Definition: tinyxml.h:487
const TiXmlDocument * GetDocument() const
Definition: tinyxml.cpp:512
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cpp:335
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:631
TIXML_STRING value
Definition: tinyxml.h:761
const TiXmlNode * Parent() const
Definition: tinyxml.h:520
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Definition: tinyxml.cpp:214
const TiXmlNode * LastChild() const
Definition: tinyxml.h:531
TiXmlNode * firstChild
Definition: tinyxml.h:758
TiXmlNode * PreviousSibling()
Definition: tinyxml.h:615
Definition: tinyxmlparser.cpp:172
Definition: tinyxml.h:1738
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cpp:1761
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:1766
void SetIndent(const char *_indent)
Definition: tinyxml.h:1757
void DoLineBreak()
Definition: tinyxml.h:1789
TIXML_STRING lineBreak
Definition: tinyxml.h:1797
bool simpleTextPrint
Definition: tinyxml.h:1794
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cpp:1756
void DoIndent()
Definition: tinyxml.h:1785
void SetLineBreak(const char *_lineBreak)
Definition: tinyxml.h:1764
TiXmlPrinter()
Definition: tinyxml.h:1740
TIXML_STRING indent
Definition: tinyxml.h:1796
int depth
Definition: tinyxml.h:1793
const char * CStr()
Return the result.
Definition: tinyxml.h:1775
void SetStreamPrinting()
Definition: tinyxml.h:1771
const char * Indent()
Query the indention string.
Definition: tinyxml.h:1759
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:1777
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
Definition: tinyxml.cpp:1857
TIXML_STRING buffer
Definition: tinyxml.h:1795
Definition: tinyxml.h:1213
bool Blank() const
Definition: tinyxmlparser.cpp:1631
bool cdata
Definition: tinyxml.h:1268
void CopyTo(TiXmlText *target) const
Definition: tinyxml.cpp:1353
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:1332
virtual ~TiXmlText()
Definition: tinyxml.h:1225
TiXmlText(const TiXmlText &copy)
Definition: tinyxml.h:1236
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1497
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cpp:1366
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1243
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1245
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1250
TiXmlText & operator=(const TiXmlText &base)
Definition: tinyxml.h:1237
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cpp:1360
TiXmlText(const char *initValue)
Definition: tinyxml.h:1220
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1249
Definition: tinyxml.h:1355
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1370
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cpp:1488
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:1468
TiXmlUnknown & operator=(const TiXmlUnknown &copy)
Definition: tinyxml.h:1361
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1371
TiXmlUnknown()
Definition: tinyxml.h:1357
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
Definition: tinyxmlparser.cpp:1275
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cpp:1482
TiXmlUnknown(const TiXmlUnknown &copy)
Definition: tinyxml.h:1360
virtual ~TiXmlUnknown()
Definition: tinyxml.h:1358
void CopyTo(TiXmlUnknown *target) const
Definition: tinyxml.cpp:1476
Definition: tinyxml.h:129
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:134
virtual ~TiXmlVisitor()
Definition: tinyxml.h:131
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition: tinyxml.h:146
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition: tinyxml.h:148
virtual bool Visit(const TiXmlUnknown &)
Visit an unknown node.
Definition: tinyxml.h:150
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:136
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition: tinyxml.h:141
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition: tinyxml.h:139
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition: tinyxml.h:144
string filename
Definition: emthickness.cpp:34
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24
Definition: tinyxml.h:401
unsigned int strLength
Definition: tinyxml.h:403
char chr
Definition: tinyxml.h:404
const char * str
Definition: tinyxml.h:402
Definition: tinyxml.h:100
void Clear()
Definition: tinyxml.h:102
int col
Definition: tinyxml.h:105
int row
Definition: tinyxml.h:104
TiXmlCursor()
Definition: tinyxml.h:101
p
Definition: testBGReduction_AllMethods.C:8
@ TIXML_WRONG_TYPE
Definition: tinyxml.h:158
@ TIXML_SUCCESS
Definition: tinyxml.h:156
@ TIXML_NO_ATTRIBUTE
Definition: tinyxml.h:157
const int TIXML_PATCH_VERSION
Definition: tinyxml.h:94
const int TIXML_MAJOR_VERSION
Definition: tinyxml.h:92
const int TIXML_MINOR_VERSION
Definition: tinyxml.h:93
TiXmlEncoding
Definition: tinyxml.h:164
@ TIXML_ENCODING_UNKNOWN
Definition: tinyxml.h:165
@ TIXML_ENCODING_LEGACY
Definition: tinyxml.h:167
@ TIXML_ENCODING_UTF8
Definition: tinyxml.h:166
#define TIXML_STRING
Definition: tinyxml.h:53
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:170