CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
tinyxml.h
Go to the documentation of this file.
1 /*
2 www.sourceforge.net/projects/tinyxml
3 Original code (2.0 and earlier )copyright (c) 2000-2006 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 THIS FILE WAS ALTERED BY Bill Tanenbaum, 10 November 2011.
26 Coverity complains about assignment operators returning void,
27 so fixed them to return a reference to the object.
28 
29 */
30 
31 #define TIXML_USE_STL
32 
33 #ifndef TINYXML_INCLUDED
34 #define TINYXML_INCLUDED
35 
36 #ifdef _MSC_VER
37 #pragma warning( push )
38 #pragma warning( disable : 4530 )
39 #pragma warning( disable : 4786 )
40 #endif
41 
42 #include <ctype.h>
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 #include <assert.h>
47 
48 // Help out windows:
49 #if defined( _DEBUG ) && !defined( DEBUG )
50 #define DEBUG
51 #endif
52 
53 #ifdef TIXML_USE_STL
54  #include <string>
55  #include <iostream>
56  #include <sstream>
57  #define TIXML_STRING std::string
58 #else
59  #include "tinystr.h"
60  #define TIXML_STRING TiXmlString
61 #endif
62 
63 // Deprecated library function hell. Compilers want to use the
64 // new safe versions. This probably doesn't fully address the problem,
65 // but it gets closer. There are too many compilers for me to fully
66 // test. If you get compilation troubles, undefine TIXML_SAFE
67 #define TIXML_SAFE
68 
69 #ifdef TIXML_SAFE
70  #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
71  // Microsoft visual studio, version 2005 and higher.
72  #define TIXML_SNPRINTF _snprintf_s
73  #define TIXML_SNSCANF _snscanf_s
74  #define TIXML_SSCANF sscanf_s
75  #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
76  // Microsoft visual studio, version 6 and higher.
77  //#pragma message( "Using _sn* functions." )
78  #define TIXML_SNPRINTF _snprintf
79  #define TIXML_SNSCANF _snscanf
80  #elif defined(__GNUC__) && (__GNUC__ >= 3 )
81  // GCC version 3 and higher.s
82  //#warning( "Using sn* functions." )
83  #define TIXML_SNPRINTF snprintf
84  #define TIXML_SNSCANF snscanf
85  #endif
86 #endif
87 
88 class TiXmlDocument;
89 class TiXmlElement;
90 class TiXmlComment;
91 class TiXmlUnknown;
92 class TiXmlAttribute;
93 class TiXmlText;
94 class TiXmlDeclaration;
95 class TiXmlParsingData;
96 
97 const int TIXML_MAJOR_VERSION = 2;
98 const int TIXML_MINOR_VERSION = 5;
99 const int TIXML_PATCH_VERSION = 3;
100 
101 /* Internal structure for tracking location of items
102  in the XML file.
103 */
105 {
107  void Clear() { row = col = -1; }
108 
109  int row; // 0 based.
110  int col; // 0 based.
111 };
112 
113 
133 {
134 public:
135  virtual ~TiXmlVisitor() {}
136 
138  virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; }
140  virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; }
141 
143  virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; }
145  virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; }
146 
148  virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; }
150  virtual bool Visit( const TiXmlText& /*text*/ ) { return true; }
152  virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; }
154  virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; }
155 };
156 
157 // Only used by Attribute::Query functions
158 enum
159 {
163 };
164 
165 
166 // Used by the parsing routines.
168 {
172 };
173 
175 
199 {
200  friend class TiXmlNode;
201  friend class TiXmlElement;
202  friend class TiXmlDocument;
203 
204 public:
205  TiXmlBase() : userData(0) {}
206  virtual ~TiXmlBase() {}
207 
217  virtual void Print( FILE* cfile, int depth ) const = 0;
218 
225  static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
226 
228  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
229 
248  int Row() const { return location.row + 1; }
249  int Column() const { return location.col + 1; }
250 
251  void SetUserData( void* user ) { userData = user; }
252  void* GetUserData() { return userData; }
253  const void* GetUserData() const { return userData; }
254 
255  // Table that returs, for a given lead byte, the total number of bytes
256  // in the UTF-8 sequence.
257  static const int utf8ByteTable[256];
258 
259  virtual const char* Parse( const char* p,
261  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
262 
266  static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
267 
268  enum
269  {
287 
289  };
290 
291 protected:
292 
293  static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
294  inline static bool IsWhiteSpace( char c )
295  {
296  return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
297  }
298  inline static bool IsWhiteSpace( int c )
299  {
300  if ( c < 256 )
301  return IsWhiteSpace( (char) c );
302  return false; // Again, only truly correct for English/Latin...but usually works.
303  }
304 
305  #ifdef TIXML_USE_STL
306  static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
307  static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
308  #endif
309 
310  /* Reads an XML name into the string provided. Returns
311  a pointer just past the last character of the name,
312  or 0 if the function has an error.
313  */
314  static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
315 
316  /* Reads text. Returns a pointer past the given end tag.
317  Wickedly complex options, but it keeps the (sensitive) code in one place.
318  */
319  static const char* ReadText( const char* in, // where to start
320  TIXML_STRING* text, // the string read
321  bool ignoreWhiteSpace, // whether to keep the white space
322  const char* endTag, // what ends this text
323  bool ignoreCase, // whether to ignore case in the end tag
324  TiXmlEncoding encoding ); // the current encoding
325 
326  // If an entity has been found, transform it into a character.
327  static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
328 
329  // Get a character, while interpreting entities.
330  // The length can be from 0 to 4 bytes.
331  inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
332  {
333  assert( p );
334  if ( encoding == TIXML_ENCODING_UTF8 )
335  {
336  *length = utf8ByteTable[ *((const unsigned char*)p) ];
337  assert( *length >= 0 && *length < 5 );
338  }
339  else
340  {
341  *length = 1;
342  }
343 
344  if ( *length == 1 )
345  {
346  if ( *p == '&' )
347  return GetEntity( p, _value, length, encoding );
348  *_value = *p;
349  return p+1;
350  }
351  else if ( *length )
352  {
353  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
354  // and the null terminator isn't needed
355  for( int i=0; p[i] && i<*length; ++i ) {
356  _value[i] = p[i];
357  }
358  return p + (*length);
359  }
360  else
361  {
362  // Not valid text.
363  return 0;
364  }
365  }
366 
367  // Return true if the next characters in the stream are any of the endTag sequences.
368  // Ignore case only works for english, and should only be relied on when comparing
369  // to English words: StringEqual( p, "version", true ) is fine.
370  static bool StringEqual( const char* p,
371  const char* endTag,
372  bool ignoreCase,
373  TiXmlEncoding encoding );
374 
375  static const char* const errorString[ TIXML_ERROR_STRING_COUNT ];
376 
378 
380  void* userData;
381 
382  // None of these methods are reliable for any language except English.
383  // Good for approximation, not great for accuracy.
384  static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
385  static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
386  inline static int ToLower( int v, TiXmlEncoding encoding )
387  {
388  if ( encoding == TIXML_ENCODING_UTF8 )
389  {
390  if ( v < 128 ) return tolower( v );
391  return v;
392  }
393  else
394  {
395  return tolower( v );
396  }
397  }
398  static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
399 
400 private:
401  TiXmlBase( const TiXmlBase& ); // not implemented.
402  TiXmlBase& operator=( const TiXmlBase& base ); // not allowed.
403 
404  struct Entity
405  {
406  const char* str;
407  unsigned int strLength;
408  char chr;
409  };
410  enum
411  {
414 
415  };
417  static bool condenseWhiteSpace;
418 };
419 
420 
427 class TiXmlNode : public TiXmlBase
428 {
429  friend class TiXmlDocument;
430  friend class TiXmlElement;
431 
432 public:
433  #ifdef TIXML_USE_STL
434 
438  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
439 
456  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
457 
460 
461  #endif
462 
466  enum NodeType
467  {
475  };
476 
477  virtual ~TiXmlNode();
478 
491  const char *Value() const { return value.c_str (); }
492 
493  #ifdef TIXML_USE_STL
494 
498  const std::string& ValueStr() const { return value; }
499  #endif
500 
501  const TIXML_STRING& ValueTStr() const { return value; }
502 
512  void SetValue(const char * _value) { value = _value;}
513 
514  #ifdef TIXML_USE_STL
515  void SetValue( const std::string& _value ) { value = _value; }
517  #endif
518 
520  void Clear();
521 
523  TiXmlNode* Parent() { return parent; }
524  const TiXmlNode* Parent() const { return parent; }
525 
526  const TiXmlNode* FirstChild() const { return firstChild; }
528  const TiXmlNode* FirstChild( const char * value ) const;
529  TiXmlNode* FirstChild( const char * _value ) {
531  // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
532  // call the method, cast the return back to non-const.
533  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
534  }
535  const TiXmlNode* LastChild() const { return lastChild; }
537 
538  const TiXmlNode* LastChild( const char * value ) const;
539  TiXmlNode* LastChild( const char * _value ) {
540  return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
541  }
542 
543  #ifdef TIXML_USE_STL
544  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
545  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
546  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
547  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
548  #endif
549 
566  const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
567  TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
568  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
569  }
570 
572  const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
573  TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
574  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
575  }
576 
577  #ifdef TIXML_USE_STL
578  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
579  TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
580  #endif
581 
585  TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
586 
587 
597  TiXmlNode* LinkEndChild( TiXmlNode* addThis );
598 
602  TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
603 
607  TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
608 
612  TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
613 
615  bool RemoveChild( TiXmlNode* removeThis );
616 
618  const TiXmlNode* PreviousSibling() const { return prev; }
620 
622  const TiXmlNode* PreviousSibling( const char * ) const;
623  TiXmlNode* PreviousSibling( const char *_prev ) {
624  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
625  }
626 
627  #ifdef TIXML_USE_STL
628  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
629  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
630  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
631  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
632  #endif
633 
635  const TiXmlNode* NextSibling() const { return next; }
636  TiXmlNode* NextSibling() { return next; }
637 
639  const TiXmlNode* NextSibling( const char * ) const;
640  TiXmlNode* NextSibling( const char* _next ) {
641  return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
642  }
643 
648  const TiXmlElement* NextSiblingElement() const;
650  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
651  }
652 
657  const TiXmlElement* NextSiblingElement( const char * ) const;
658  TiXmlElement* NextSiblingElement( const char *_next ) {
659  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
660  }
661 
662  #ifdef TIXML_USE_STL
663  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
664  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
665  #endif
666 
668  const TiXmlElement* FirstChildElement() const;
670  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
671  }
672 
674  const TiXmlElement* FirstChildElement( const char * _value ) const;
675  TiXmlElement* FirstChildElement( const char * _value ) {
676  return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
677  }
678 
679  #ifdef TIXML_USE_STL
680  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
681  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
682  #endif
683 
688  int Type() const { return type; }
689 
693  const TiXmlDocument* GetDocument() const;
695  return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
696  }
697 
699  bool NoChildren() const { return !firstChild; }
700 
701  virtual const TiXmlDocument* ToDocument() const { return 0; }
702  virtual const TiXmlElement* ToElement() const { return 0; }
703  virtual const TiXmlComment* ToComment() const { return 0; }
704  virtual const TiXmlUnknown* ToUnknown() const { return 0; }
705  virtual const TiXmlText* ToText() const { return 0; }
706  virtual const TiXmlDeclaration* ToDeclaration() const { return 0; }
707 
708  virtual TiXmlDocument* ToDocument() { return 0; }
709  virtual TiXmlElement* ToElement() { return 0; }
710  virtual TiXmlComment* ToComment() { return 0; }
711  virtual TiXmlUnknown* ToUnknown() { return 0; }
712  virtual TiXmlText* ToText() { return 0; }
713  virtual TiXmlDeclaration* ToDeclaration() { return 0; }
714 
718  virtual TiXmlNode* Clone() const = 0;
719 
742  virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
743 
744 protected:
745  TiXmlNode( NodeType _type );
746 
747  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
748  // and the assignment operator.
749  void CopyTo( TiXmlNode* target ) const;
750 
751  #ifdef TIXML_USE_STL
752  // The real work of the input operator.
753  virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
754  #endif
755 
756  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
757  TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
758 
761 
764 
766 
769 
770 private:
771  TiXmlNode( const TiXmlNode& ); // not implemented.
772  TiXmlNode& operator=( const TiXmlNode& base ); // not allowed.
773 };
774 
775 
783 class TiXmlAttribute : public TiXmlBase
784 {
785  friend class TiXmlAttributeSet;
786 
787 public:
790  {
791  document = 0;
792  prev = next = 0;
793  }
794 
795  #ifdef TIXML_USE_STL
796  TiXmlAttribute( const std::string& _name, const std::string& _value )
798  {
799  name = _name;
800  value = _value;
801  document = 0;
802  prev = next = 0;
803  }
804  #endif
805 
807  TiXmlAttribute( const char * _name, const char * _value )
808  {
809  name = _name;
810  value = _value;
811  document = 0;
812  prev = next = 0;
813  }
814 
815  const char* Name() const { return name.c_str(); }
816  const char* Value() const { return value.c_str(); }
817  #ifdef TIXML_USE_STL
818  const std::string& ValueStr() const { return value; }
819  #endif
820  int IntValue() const;
821  double DoubleValue() const;
822 
823  // Get the tinyxml string representation
824  const TIXML_STRING& NameTStr() const { return name; }
825 
835  int QueryIntValue( int* _value ) const;
837  int QueryDoubleValue( double* _value ) const;
838 
839  void SetName( const char* _name ) { name = _name; }
840  void SetValue( const char* _value ) { value = _value; }
841 
842  void SetIntValue( int _value );
843  void SetDoubleValue( double _value );
844 
845  #ifdef TIXML_USE_STL
846  void SetName( const std::string& _name ) { name = _name; }
849  void SetValue( const std::string& _value ) { value = _value; }
850  #endif
851 
853  const TiXmlAttribute* Next() const;
855  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
856  }
857 
859  const TiXmlAttribute* Previous() const;
861  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
862  }
863 
864  bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
865  bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
866  bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
867 
868  /* Attribute parsing starts: first letter of the name
869  returns: the next char after the value end quote
870  */
871  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
872 
873  // Prints this Attribute to a FILE stream.
874  virtual void Print( FILE* cfile, int depth ) const {
875  Print( cfile, depth, 0 );
876  }
877  void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
878 
879  // [internal use]
880  // Set the document pointer so the attribute can report errors.
882 
883 private:
884  TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
885  TiXmlAttribute& operator=( const TiXmlAttribute& base ); // not allowed.
886 
887  TiXmlDocument* document; // A pointer back to a document, for error reporting.
892 };
893 
894 
895 /* A class used to manage a group of attributes.
896  It is only used internally, both by the ELEMENT and the DECLARATION.
897 
898  The set can be changed transparent to the Element and Declaration
899  classes that use it, but NOT transparent to the Attribute
900  which has to implement a next() and previous() method. Which makes
901  it a bit problematic and prevents the use of STL.
902 
903  This version is implemented with circular lists because:
904  - I like circular lists
905  - it demonstrates some independence from the (typical) doubly linked list.
906 */
908 {
909 public:
912 
913  void Add( TiXmlAttribute* attribute );
914  void Remove( TiXmlAttribute* attribute );
915 
916  const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
917  TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
918  const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
919  TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
920 
921  const TiXmlAttribute* Find( const char* _name ) const;
922  TiXmlAttribute* Find( const char* _name ) {
923  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
924  }
925  #ifdef TIXML_USE_STL
926  const TiXmlAttribute* Find( const std::string& _name ) const;
927  TiXmlAttribute* Find( const std::string& _name ) {
928  return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
929  }
930 
931  #endif
932 
933 private:
934  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
935  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
936  TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
937  TiXmlAttributeSet& operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
938 
940 };
941 
942 
947 class TiXmlElement : public TiXmlNode
948 {
949 public:
951  TiXmlElement (const char * in_value);
952 
953  #ifdef TIXML_USE_STL
954  TiXmlElement( const std::string& _value );
956  #endif
957 
958  TiXmlElement( const TiXmlElement& );
959 
961 
962  virtual ~TiXmlElement();
963 
967  const char* Attribute( const char* name ) const;
968 
975  const char* Attribute( const char* name, int* i ) const;
976 
983  const char* Attribute( const char* name, double* d ) const;
984 
992  int QueryIntAttribute( const char* name, int* _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
1006 
1014  template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
1015  {
1016  const TiXmlAttribute* node = attributeSet.Find( name );
1017  if ( !node )
1018  return TIXML_NO_ATTRIBUTE;
1019 
1020  std::stringstream sstream( node->ValueStr() );
1021  sstream >> *outValue;
1022  if ( !sstream.fail() )
1023  return TIXML_SUCCESS;
1024  return TIXML_WRONG_TYPE;
1025  }
1026  /*
1027  This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
1028  but template specialization is hard to get working cross-compiler. Leaving the bug for now.
1029 
1030  // The above will fail for std::string because the space character is used as a seperator.
1031  // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
1032  template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
1033  {
1034  const TiXmlAttribute* node = attributeSet.Find( name );
1035  if ( !node )
1036  return TIXML_NO_ATTRIBUTE;
1037  *outValue = node->ValueStr();
1038  return TIXML_SUCCESS;
1039  }
1040  */
1041  #endif
1042 
1046  void SetAttribute( const char* name, const char * _value );
1047 
1048  #ifdef TIXML_USE_STL
1049  const std::string* Attribute( const std::string& name ) const;
1050  const std::string* Attribute( const std::string& name, int* i ) const;
1051  const std::string* Attribute( const std::string& name, double* d ) const;
1052  int QueryIntAttribute( const std::string& name, int* _value ) const;
1053  int QueryDoubleAttribute( const std::string& name, double* _value ) const;
1054 
1056  void SetAttribute( const std::string& name, const std::string& _value );
1058  void SetAttribute( const std::string& name, int _value );
1059  #endif
1060 
1064  void SetAttribute( const char * name, int value );
1065 
1069  void SetDoubleAttribute( const char * name, double value );
1070 
1073  void RemoveAttribute( const char * name );
1074  #ifdef TIXML_USE_STL
1075  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
1076  #endif
1077 
1078  const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); }
1080  const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); }
1082 
1115  const char* GetText() const;
1116 
1118  virtual TiXmlNode* Clone() const;
1119  // Print the Element to a FILE stream.
1120  virtual void Print( FILE* cfile, int depth ) const;
1121 
1122  /* Attribtue parsing starts: next char past '<'
1123  returns: next char past '>'
1124  */
1125  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1126 
1127  virtual const TiXmlElement* ToElement() const { return this; }
1128  virtual TiXmlElement* ToElement() { return this; }
1129 
1132  virtual bool Accept( TiXmlVisitor* visitor ) const;
1133 
1134 protected:
1135 
1136  void CopyTo( TiXmlElement* target ) const;
1137  void ClearThis(); // like clear, but initializes 'this' object as well
1138 
1139  // Used to be public [internal use]
1140  #ifdef TIXML_USE_STL
1141  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1142  #endif
1143  /* [internal use]
1144  Reads the "value" of the element -- another element, or text.
1145  This should terminate with the current end tag.
1146  */
1147  const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1148 
1149 private:
1150 
1152 };
1153 
1154 
1157 class TiXmlComment : public TiXmlNode
1158 {
1159 public:
1163  TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
1164  SetValue( _value );
1165  }
1166  TiXmlComment( const TiXmlComment& );
1168 
1169  virtual ~TiXmlComment() {}
1170 
1172  virtual TiXmlNode* Clone() const;
1173  // Write this Comment to a FILE stream.
1174  virtual void Print( FILE* cfile, int depth ) const;
1175 
1176  /* Attribtue parsing starts: at the ! of the !--
1177  returns: next char past '>'
1178  */
1179  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1180 
1181  virtual const TiXmlComment* ToComment() const { return this; }
1182  virtual TiXmlComment* ToComment() { return this; }
1183 
1186  virtual bool Accept( TiXmlVisitor* visitor ) const;
1187 
1188 protected:
1189  void CopyTo( TiXmlComment* target ) const;
1190 
1191  // used to be public
1192  #ifdef TIXML_USE_STL
1193  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1194  #endif
1195 // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1196 
1197 private:
1198 
1199 };
1200 
1201 
1207 class TiXmlText : public TiXmlNode
1208 {
1209  friend class TiXmlElement;
1210 public:
1215  TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
1216  {
1217  SetValue( initValue );
1218  cdata = false;
1219  }
1220  virtual ~TiXmlText() {}
1221 
1222  #ifdef TIXML_USE_STL
1223  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
1225  {
1226  SetValue( initValue );
1227  cdata = false;
1228  }
1229  #endif
1230 
1231  TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
1232  TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this;}
1233 
1234  // Write this text object to a FILE stream.
1235  virtual void Print( FILE* cfile, int depth ) const;
1236 
1238  bool CDATA() const { return cdata; }
1240  void SetCDATA( bool _cdata ) { cdata = _cdata; }
1241 
1242  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1243 
1244  virtual const TiXmlText* ToText() const { return this; }
1245  virtual TiXmlText* ToText() { return this; }
1246 
1249  virtual bool Accept( TiXmlVisitor* content ) const;
1250 
1251 protected :
1253  virtual TiXmlNode* Clone() const;
1254  void CopyTo( TiXmlText* target ) const;
1255 
1256  bool Blank() const; // returns true if all white space and new lines
1257  // [internal use]
1258  #ifdef TIXML_USE_STL
1259  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1260  #endif
1261 
1262 private:
1263  bool cdata; // true if this should be input and output as a CDATA style text element
1264 };
1265 
1266 
1281 {
1282 public:
1285 
1286 #ifdef TIXML_USE_STL
1287  TiXmlDeclaration( const std::string& _version,
1289  const std::string& _encoding,
1290  const std::string& _standalone );
1291 #endif
1292 
1294  TiXmlDeclaration( const char* _version,
1295  const char* _encoding,
1296  const char* _standalone );
1297 
1300 
1301  virtual ~TiXmlDeclaration() {}
1302 
1304  const char *Version() const { return version.c_str (); }
1306  const char *Encoding() const { return encoding.c_str (); }
1308  const char *Standalone() const { return standalone.c_str (); }
1309 
1311  virtual TiXmlNode* Clone() const;
1312  // Print this declaration to a FILE stream.
1313  virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
1314  virtual void Print( FILE* cfile, int depth ) const {
1315  Print( cfile, depth, 0 );
1316  }
1317 
1318  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1319 
1320  virtual const TiXmlDeclaration* ToDeclaration() const { return this; }
1321  virtual TiXmlDeclaration* ToDeclaration() { return this; }
1322 
1325  virtual bool Accept( TiXmlVisitor* visitor ) const;
1326 
1327 protected:
1328  void CopyTo( TiXmlDeclaration* target ) const;
1329  // used to be public
1330  #ifdef TIXML_USE_STL
1331  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1332  #endif
1333 
1334 private:
1335 
1339 };
1340 
1341 
1349 class TiXmlUnknown : public TiXmlNode
1350 {
1351 public:
1353  virtual ~TiXmlUnknown() {}
1354 
1355  TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
1356  TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this;}
1357 
1359  virtual TiXmlNode* Clone() const;
1360  // Print this Unknown to a FILE stream.
1361  virtual void Print( FILE* cfile, int depth ) const;
1362 
1363  virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
1364 
1365  virtual const TiXmlUnknown* ToUnknown() const { return this; }
1366  virtual TiXmlUnknown* ToUnknown() { return this; }
1367 
1370  virtual bool Accept( TiXmlVisitor* content ) const;
1371 
1372 protected:
1373  void CopyTo( TiXmlUnknown* target ) const;
1374 
1375  #ifdef TIXML_USE_STL
1376  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1377  #endif
1378 
1379 private:
1380 
1381 };
1382 
1383 
1388 class TiXmlDocument : public TiXmlNode
1389 {
1390 public:
1392  TiXmlDocument();
1394  TiXmlDocument( const char * documentName );
1395 
1396  #ifdef TIXML_USE_STL
1397  TiXmlDocument( const std::string& documentName );
1399  #endif
1400 
1401  TiXmlDocument( const TiXmlDocument& copy );
1402  TiXmlDocument& operator=( const TiXmlDocument& copy );
1403 
1404  virtual ~TiXmlDocument() {}
1405 
1410  bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1412  bool SaveFile() const;
1414  bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1416  bool SaveFile( const char * filename ) const;
1422  bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1424  bool SaveFile( FILE* ) const;
1425 
1426  #ifdef TIXML_USE_STL
1428  {
1429 // StringToBuffer f( filename );
1430 // return ( f.buffer && LoadFile( f.buffer, encoding ));
1431  return LoadFile( filename.c_str(), encoding );
1432  }
1433  bool SaveFile( const std::string& filename ) const
1434  {
1435 // StringToBuffer f( filename );
1436 // return ( f.buffer && SaveFile( f.buffer ));
1437  return SaveFile( filename.c_str() );
1438  }
1439  #endif
1440 
1445  virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
1446 
1451  const TiXmlElement* RootElement() const { return FirstChildElement(); }
1453 
1459  bool Error() const { return error; }
1460 
1462  const char * ErrorDesc() const { return errorDesc.c_str (); }
1463 
1467  int ErrorId() const { return errorId; }
1468 
1476  int ErrorRow() const { return errorLocation.row+1; }
1477  int ErrorCol() const { return errorLocation.col+1; }
1478 
1503  void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
1504 
1505  int TabSize() const { return tabsize; }
1506 
1510  void ClearError() { error = false;
1511  errorId = 0;
1512  errorDesc = "";
1514  //errorLocation.last = 0;
1515  }
1516 
1518  void Print() const { Print( stdout, 0 ); }
1519 
1520  /* Write the document to a string using formatted printing ("pretty print"). This
1521  will allocate a character array (new char[]) and return it as a pointer. The
1522  calling code pust call delete[] on the return char* to avoid a memory leak.
1523  */
1524  //char* PrintToMemory() const;
1525 
1527  virtual void Print( FILE* cfile, int depth = 0 ) const;
1528  // [internal use]
1529  void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
1530 
1531  virtual const TiXmlDocument* ToDocument() const { return this; }
1532  virtual TiXmlDocument* ToDocument() { return this; }
1533 
1536  virtual bool Accept( TiXmlVisitor* content ) const;
1537 
1538 protected :
1539  // [internal use]
1540  virtual TiXmlNode* Clone() const;
1541  #ifdef TIXML_USE_STL
1542  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1543  #endif
1544 
1545 private:
1546  void CopyTo( TiXmlDocument* target ) const;
1547 
1548  bool error;
1549  int errorId;
1551  int tabsize;
1553  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1554 };
1555 
1556 
1638 {
1639 public:
1641  TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
1643  TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
1644  TiXmlHandle& operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
1645 
1647  TiXmlHandle FirstChild() const;
1649  TiXmlHandle FirstChild( const char * value ) const;
1653  TiXmlHandle FirstChildElement( const char * value ) const;
1654 
1658  TiXmlHandle Child( const char* value, int index ) const;
1662  TiXmlHandle Child( int index ) const;
1667  TiXmlHandle ChildElement( const char* value, int index ) const;
1672  TiXmlHandle ChildElement( int index ) const;
1673 
1674  #ifdef TIXML_USE_STL
1675  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1676  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1677 
1678  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1679  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1680  #endif
1681 
1684  TiXmlNode* ToNode() const { return node; }
1687  TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
1690  TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
1693  TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
1694 
1698  TiXmlNode* Node() const { return ToNode(); }
1702  TiXmlElement* Element() const { return ToElement(); }
1706  TiXmlText* Text() const { return ToText(); }
1710  TiXmlUnknown* Unknown() const { return ToUnknown(); }
1711 
1712 private:
1714 };
1715 
1716 
1737 {
1738 public:
1740  buffer(), indent( " " ), lineBreak( "\n" ) {}
1741 
1742  virtual bool VisitEnter( const TiXmlDocument& doc );
1743  virtual bool VisitExit( const TiXmlDocument& doc );
1744 
1745  virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
1746  virtual bool VisitExit( const TiXmlElement& element );
1747 
1748  virtual bool Visit( const TiXmlDeclaration& declaration );
1749  virtual bool Visit( const TiXmlText& text );
1750  virtual bool Visit( const TiXmlComment& comment );
1751  virtual bool Visit( const TiXmlUnknown& unknown );
1752 
1756  void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
1758  const char* Indent() { return indent.c_str(); }
1763  void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; }
1765  const char* LineBreak() { return lineBreak.c_str(); }
1766 
1770  void SetStreamPrinting() { indent = "";
1771  lineBreak = "";
1772  }
1774  const char* CStr() { return buffer.c_str(); }
1776  size_t Size() { return buffer.size(); }
1777 
1778  #ifdef TIXML_USE_STL
1779  const std::string& Str() { return buffer; }
1781  #endif
1782 
1783 private:
1784  void DoIndent() {
1785  for( int i=0; i<depth; ++i )
1786  buffer += indent;
1787  }
1788  void DoLineBreak() {
1789  buffer += lineBreak;
1790  }
1791 
1792  int depth;
1797 };
1798 
1799 
1800 #ifdef _MSC_VER
1801 #pragma warning( pop )
1802 #endif
1803 
1804 #endif
1805 
virtual ~TiXmlVisitor()
Definition: tinyxml.h:135
virtual void StreamIn(std::istream *in, std::string *tag)
static const int utf8ByteTable[256]
Definition: tinyxml.h:257
TiXmlHandle Child(const std::string &_value, int index) const
Definition: tinyxml.h:1678
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1181
TiXmlAttribute sentinel
Definition: tinyxml.h:939
const TiXmlAttribute * First() const
Definition: tinyxml.h:916
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
tuple base
Main Program
Definition: newFWLiteAna.py:92
void DoLineBreak()
Definition: tinyxml.h:1788
TiXmlNode * LastChild(const char *_value)
The last child of this node matching &#39;value&#39;. Will be null if there are no children.
Definition: tinyxml.h:539
std::string errorDesc
Definition: tinyxml.h:1550
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1641
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition: tinyxml.cc:1476
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1710
TiXmlBase & operator=(const TiXmlBase &base)
int i
Definition: DBlmapReader.cc:9
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:545
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cc:855
virtual ~TiXmlElement()
Definition: tinyxml.cc:546
friend std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)
Definition: tinyxml.cc:1629
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:251
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1531
const std::string & ValueTStr() const
Definition: tinyxml.h:501
virtual void StreamIn(std::istream *in, std::string *tag)
TiXmlUnknown(const TiXmlUnknown &copy)
Definition: tinyxml.h:1355
const TiXmlNode * Parent() const
Definition: tinyxml.h:524
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
const std::string & ValueStr() const
Definition: tinyxml.h:498
const TiXmlElement * RootElement() const
Definition: tinyxml.h:1451
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1161
void SetLineBreak(const char *_lineBreak)
Definition: tinyxml.h:1763
TiXmlElement * NextSiblingElement()
Definition: tinyxml.h:649
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1127
static bool StreamWhiteSpace(std::istream *in, std::string *tag)
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1643
TiXmlNode * PreviousSibling(const char *_prev)
Definition: tinyxml.h:623
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:536
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:1765
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cc:869
bool Error() const
Definition: tinyxml.h:1459
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:709
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition: tinyxml.cc:1297
virtual bool Visit(const TiXmlUnknown &)
Visit an unknow node.
Definition: tinyxml.h:154
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:807
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition: tinyxml.cc:1292
TiXmlNode * prev
Definition: tinyxml.h:767
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1244
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition: tinyxml.cc:1652
void CopyTo(TiXmlUnknown *target) const
Definition: tinyxml.cc:1496
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:253
void CopyTo(TiXmlDocument *target) const
Definition: tinyxml.cc:1129
int Type() const
Definition: tinyxml.h:688
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:386
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
Definition: tinyxml.h:579
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:680
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
Definition: tinyxml.h:573
TiXmlNode * firstChild
Definition: tinyxml.h:762
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlElement & operator=(const TiXmlElement &base)
Definition: tinyxml.cc:538
void SetDoubleAttribute(const char *name, double value)
Definition: tinyxml.cc:714
int TabSize() const
Definition: tinyxml.h:1505
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cc:1488
static void EncodeString(const std::string &str, std::string *out)
Definition: tinyxml.cc:59
assert(m_qm.get())
TiXmlDocument * document
Definition: tinyxml.h:887
int ErrorId() const
Definition: tinyxml.h:1467
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:1314
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:664
virtual void StreamIn(std::istream *in, std::string *tag)
TiXmlAttribute * FirstAttribute()
Definition: tinyxml.h:1079
virtual void StreamIn(std::istream *in, std::string *tag)
TiXmlElement * FirstChildElement(const char *_value)
Definition: tinyxml.h:675
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition: tinyxml.cc:1386
void SetValue(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:849
TiXmlAttribute * Next()
Definition: tinyxml.h:854
void ClearThis()
Definition: tinyxml.cc:552
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Definition: tinyxml.cc:298
bool SaveFile(const std::string &filename) const
&lt; STL std::string version.
Definition: tinyxml.h:1433
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:1080
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition: tinyxml.h:145
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:839
TiXmlNode * NextSibling()
Definition: tinyxml.h:636
virtual void Print(FILE *cfile, int depth, std::string *str) const
Definition: tinyxml.cc:1438
void CopyTo(TiXmlComment *target) const
Definition: tinyxml.cc:1328
void SetTabSize(int _tabsize)
Definition: tinyxml.h:1503
TiXmlDocument()
Create an empty document, that has no name.
Definition: tinyxml.cc:893
void DoIndent()
Definition: tinyxml.h:1784
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:789
TiXmlHandle & operator=(const TiXmlHandle &ref)
Definition: tinyxml.h:1644
const int TIXML_PATCH_VERSION
Definition: tinyxml.h:99
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1308
static const char *const errorString[TIXML_ERROR_STRING_COUNT]
Definition: tinyxml.h:375
TiXmlElement * ToElement() const
Definition: tinyxml.h:1687
TiXmlElement * NextSiblingElement(const char *_next)
Definition: tinyxml.h:658
std::string value
Definition: tinyxml.h:765
virtual ~TiXmlText()
Definition: tinyxml.h:1220
TiXmlElement * FirstChildElement()
Definition: tinyxml.h:669
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:708
void ClearError()
Definition: tinyxml.h:1510
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:816
TiXmlComment & operator=(const TiXmlComment &base)
Definition: tinyxml.cc:1309
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:703
int QueryIntValue(int *_value) const
Definition: tinyxml.cc:1250
void Clear()
Definition: tinyxml.h:107
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cc:780
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1182
friend std::istream & operator>>(std::istream &in, TiXmlNode &base)
Definition: tinyxml.cc:1616
virtual ~TiXmlComment()
Definition: tinyxml.h:1169
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.cc:934
void SetValue(const char *_value)
Definition: tinyxml.h:512
int ErrorCol() const
The column where the error occurred. See ErrorRow()
Definition: tinyxml.h:1477
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Definition: tinyxml.cc:219
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cc:1781
tuple node
Definition: Node.py:50
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
const std::string & NameTStr() const
Definition: tinyxml.h:824
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1128
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Definition: tinyxml.cc:234
static bool condenseWhiteSpace
Definition: tinyxml.h:417
virtual ~TiXmlDocument()
Definition: tinyxml.h:1404
static std::string const input
Definition: EdmProvDump.cc:43
TiXmlNode * PreviousSibling()
Definition: tinyxml.h:619
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:706
TiXmlAttribute * Find(const char *_name)
Definition: tinyxml.h:922
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:138
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition: tinyxml.cc:1676
TiXmlHandle ChildElement(const std::string &_value, int index) const
Definition: tinyxml.h:1679
TiXmlAttribute & operator=(const TiXmlAttribute &base)
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1306
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Definition: tinyxml.cc:192
bool Blank() const
tuple d
Definition: ztail.py:151
const TiXmlNode * LastChild() const
Definition: tinyxml.h:535
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:815
void SetDoubleValue(double _value)
Set the value from a double.
Definition: tinyxml.cc:1281
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:380
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cc:1317
virtual bool Accept(TiXmlVisitor *visitor) const =0
TiXmlAttribute * prev
Definition: tinyxml.h:890
TiXmlDocument * GetDocument()
Definition: tinyxml.h:694
void Print() const
Definition: tinyxml.h:1518
const char * str
Definition: tinyxml.h:406
bool cdata
Definition: tinyxml.h:1263
const TiXmlAttribute * Last() const
Definition: tinyxml.h:918
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:294
TiXmlCursor()
Definition: tinyxml.h:106
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1151
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition: tinyxml.h:150
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:174
int ErrorRow() const
Definition: tinyxml.h:1476
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1304
std::string buffer
Definition: tinyxml.h:1794
TiXmlNode * NextSibling(const char *_next)
Definition: tinyxml.h:640
TiXmlNode * FirstChild()
Definition: tinyxml.h:527
TiXmlHandle ChildElement(const char *value, int index) const
Definition: tinyxml.cc:1757
TiXmlAttribute * next
Definition: tinyxml.h:891
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cc:1502
int Column() const
See Row()
Definition: tinyxml.h:249
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:228
TiXmlText(const TiXmlText &copy)
Definition: tinyxml.h:1231
TiXmlCursor location
Definition: tinyxml.h:377
const int TIXML_MAJOR_VERSION
Definition: tinyxml.h:97
static const char * ReadName(const char *p, std::string *name, TiXmlEncoding encoding)
void SetIndent(const char *_indent)
Definition: tinyxml.h:1756
virtual ~TiXmlUnknown()
Definition: tinyxml.h:1353
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:526
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1462
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.h:1427
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1365
tuple result
Definition: query.py:137
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1532
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition: tinyxml.cc:1184
void RemoveAttribute(const char *name)
Definition: tinyxml.cc:424
virtual TiXmlNode * Clone() const
Definition: tinyxml.cc:1148
void SetAttribute(const char *name, const char *_value)
Definition: tinyxml.cc:726
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlAttribute * Last()
Definition: tinyxml.h:919
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cc:1352
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:874
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1240
const char * Indent()
Query the indention string.
Definition: tinyxml.h:1758
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:681
virtual void StreamIn(std::istream *in, std::string *tag)=0
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition: tinyxml.cc:943
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1321
tuple text
Definition: runonSM.py:42
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:439
TiXmlEncoding
Definition: tinyxml.h:167
virtual void StreamIn(std::istream *in, std::string *tag)
tuple doc
Definition: asciidump.py:381
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1320
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition: tinyxml.cc:1260
TiXmlElement(const char *in_value)
Construct an element.
Definition: tinyxml.cc:512
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:546
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:996
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:618
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:630
const TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cc:1593
static Entity entity[NUM_ENTITY]
Definition: tinyxml.h:416
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
virtual void StreamIn(std::istream *in, std::string *tag)
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Definition: tinyxml.cc:266
TiXmlText & operator=(const TiXmlText &base)
Definition: tinyxml.h:1232
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:713
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:702
const char * ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
TiXmlHandle Child(const char *value, int index) const
Definition: tinyxml.cc:1719
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cc:1534
const std::string & ValueStr() const
Return the value of this attribute.
Definition: tinyxml.h:818
const TiXmlDocument * GetDocument() const
Definition: tinyxml.cc:499
TiXmlNode * node
Definition: tinyxml.h:1713
tuple out
Definition: dbtoconf.py:99
TiXmlNode & operator=(const TiXmlNode &base)
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1238
std::string version
Definition: tinyxml.h:1336
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cc:1334
static bool IsWhiteSpace(int c)
Definition: tinyxml.h:298
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:710
bool operator>(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:866
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition: tinyxml.h:578
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
TiXmlText * Text() const
Definition: tinyxml.h:1706
TiXmlNode * Node() const
Definition: tinyxml.h:1698
TiXmlNode * ToNode() const
Definition: tinyxml.h:1684
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition: tinyxml.cc:1204
static void SetCondenseWhiteSpace(bool condense)
Definition: tinyxml.h:225
bool operator<(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:865
const TiXmlElement * NextSiblingElement() const
Definition: tinyxml.cc:469
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:523
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:711
std::string value
Definition: tinyxml.h:889
bool operator==(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:864
TiXmlDeclaration & operator=(const TiXmlDeclaration &copy)
Definition: tinyxml.cc:1430
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:704
std::string encoding
Definition: tinyxml.h:1337
TiXmlComment(const char *_value)
Construct a comment from text.
Definition: tinyxml.h:1163
virtual ~TiXmlBase()
Definition: tinyxml.h:206
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
static bool StreamTo(std::istream *in, int character, std::string *tag)
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.cc:1776
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
TiXmlNode * parent
Definition: tinyxml.h:759
std::string standalone
Definition: tinyxml.h:1338
TiXmlNode * IterateChildren(const TiXmlNode *previous)
Definition: tinyxml.h:567
int QueryIntAttribute(const char *name, int *_value) const
Definition: tinyxml.cc:652
int Row() const
Definition: tinyxml.h:248
TiXmlHandle FirstChild(const std::string &_value) const
Definition: tinyxml.h:1675
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
TiXmlAttribute * Previous()
Definition: tinyxml.h:860
TiXmlElement * Element() const
Definition: tinyxml.h:1702
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cc:1170
TiXmlNode(NodeType _type)
Definition: tinyxml.cc:143
TiXmlElement * RootElement()
Definition: tinyxml.h:1452
int QueryValueAttribute(const std::string &name, T *outValue) const
Definition: tinyxml.h:1014
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:252
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:705
void CopyTo(TiXmlNode *target) const
Definition: tinyxml.cc:168
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:547
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:1776
void SetIntValue(int _value)
Set the value from an integer.
Definition: tinyxml.cc:1270
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:629
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition: tinyxml.cc:1508
std::string indent
Definition: tinyxml.h:1795
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:544
TiXmlNode * next
Definition: tinyxml.h:768
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:140
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition: tinyxml.h:152
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:331
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.cc:672
TiXmlText(const char *initValue)
Definition: tinyxml.h:1215
bool useMicrosoftBOM
Definition: tinyxml.h:1553
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
Definition: tinyxml.cc:372
tuple filename
Definition: lut2db_cfg.py:20
const char * Value() const
Definition: tinyxml.h:491
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition: tinyxml.h:631
TiXmlDocument & operator=(const TiXmlDocument &copy)
Definition: tinyxml.cc:926
void CopyTo(TiXmlText *target) const
Definition: tinyxml.cc:1373
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition: tinyxml.cc:1340
TiXmlUnknown & operator=(const TiXmlUnknown &copy)
Definition: tinyxml.h:1356
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:699
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cc:833
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cc:1470
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:1078
unsigned int strLength
Definition: tinyxml.h:407
NodeType type
Definition: tinyxml.h:760
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cc:326
std::string name
Definition: tinyxml.h:888
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition: tinyxml.h:1075
volatile std::atomic< bool > shutdown_flag false
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:881
const char * GetText() const
Definition: tinyxml.cc:880
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1366
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:701
void Remove(TiXmlAttribute *attribute)
Definition: tinyxml.cc:1549
void Clear()
Delete all the children of this node. Does not affect &#39;this&#39;.
Definition: tinyxml.cc:175
TiXmlHandle FirstChildElement(const std::string &_value) const
Definition: tinyxml.h:1676
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:840
const std::string & Str()
Return the result.
Definition: tinyxml.h:1780
virtual ~TiXmlDeclaration()
Definition: tinyxml.h:1301
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:635
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1245
TiXmlAttribute * LastAttribute()
Definition: tinyxml.h:1081
TiXmlNode * lastChild
Definition: tinyxml.h:763
TiXmlText * ToText() const
Definition: tinyxml.h:1690
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1284
long double T
void SetStreamPrinting()
Definition: tinyxml.h:1770
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
const char * Attribute(const char *name) const
Definition: tinyxml.cc:564
TiXmlAttribute * First()
Definition: tinyxml.h:917
virtual void Print(FILE *cfile, int depth) const =0
std::string lineBreak
Definition: tinyxml.h:1796
static const char * ReadText(const char *in, std::string *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
virtual ~TiXmlNode()
Definition: tinyxml.cc:154
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml.cc:1380
virtual TiXmlNode * Clone() const =0
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:663
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
Definition: tinyxml.cc:1877
void CopyTo(TiXmlDeclaration *target) const
Definition: tinyxml.cc:1460
TiXmlUnknown * ToUnknown() const
Definition: tinyxml.h:1693
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
Definition: tinyxml.h:628
const char * CStr()
Return the result.
Definition: tinyxml.h:1774
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:712
#define TIXML_STRING
Definition: tinyxml.h:57
const int TIXML_MINOR_VERSION
Definition: tinyxml.h:98
bool simpleTextPrint
Definition: tinyxml.h:1793
TiXmlCursor errorLocation
Definition: tinyxml.h:1552
TiXmlAttributeSet & operator=(const TiXmlAttributeSet &)
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition: tinyxml.h:143
TiXmlBase()
Definition: tinyxml.h:205
#define comment(par)
Definition: vmac.h:161
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition: tinyxml.h:148
TiXmlAttribute * Find(const std::string &_name)
Definition: tinyxml.h:927