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 
53 #include "tinystr.h"
54 
55 #define TIXML_STRING TiXmlString
56 #endif
57 
58 // Deprecated library function hell. Compilers want to use the
59 // new safe versions. This probably doesn't fully address the problem,
60 // but it gets closer. There are too many compilers for me to fully
61 // test. If you get compilation troubles, undefine TIXML_SAFE
62 #define TIXML_SAFE
63 
64 #ifdef TIXML_SAFE
65 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
66 // Microsoft visual studio, version 2005 and higher.
67 #define TIXML_SNPRINTF _snprintf_s
68 #define TIXML_SSCANF sscanf_s
69 #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
70 // Microsoft visual studio, version 6 and higher.
71 //#pragma message( "Using _sn* functions." )
72 #define TIXML_SNPRINTF _snprintf
73 #define TIXML_SSCANF sscanf
74 #elif defined(__GNUC__) && (__GNUC__ >= 3)
75 // GCC version 3 and higher.s
76 //#warning( "Using sn* functions." )
77 #define TIXML_SNPRINTF snprintf
78 #define TIXML_SSCANF sscanf
79 #else
80 #define TIXML_SNPRINTF snprintf
81 #define TIXML_SSCANF sscanf
82 #endif
83 #endif
84 
85 class TiXmlDocument;
86 
87 class TiXmlElement;
88 
89 class TiXmlComment;
90 
91 class TiXmlUnknown;
92 
93 class TiXmlAttribute;
94 
95 class TiXmlText;
96 
97 class TiXmlDeclaration;
98 
99 class TiXmlParsingData;
100 
101 const int TIXML_MAJOR_VERSION = 2;
102 const int TIXML_MINOR_VERSION = 6;
103 const int TIXML_PATCH_VERSION = 2;
104 
105 /* Internal structure for tracking location of items
106  in the XML file.
107 */
109 {
111  { Clear(); }
112 
113  void Clear()
114  { row = col = -1; }
115 
116  int row; // 0 based.
117  int col; // 0 based.
118 };
119 
120 
141 {
142 public:
143  virtual ~TiXmlVisitor()
144  {}
145 
147  virtual bool VisitEnter(const TiXmlDocument & /*doc*/ )
148  { return true; }
149 
151  virtual bool VisitExit(const TiXmlDocument & /*doc*/ )
152  { return true; }
153 
155  virtual bool VisitEnter(const TiXmlElement & /*element*/, const TiXmlAttribute * /*firstAttribute*/ )
156  { return true; }
157 
159  virtual bool VisitExit(const TiXmlElement & /*element*/ )
160  { return true; }
161 
163  virtual bool Visit(const TiXmlDeclaration & /*declaration*/ )
164  { return true; }
165 
167  virtual bool Visit(const TiXmlText & /*text*/ )
168  { return true; }
169 
171  virtual bool Visit(const TiXmlComment & /*comment*/ )
172  { return true; }
173 
175  virtual bool Visit(const TiXmlUnknown & /*unknown*/ )
176  { return true; }
177 };
178 
179 // Only used by Attribute::Query functions
180 enum
181 {
185 };
186 
187 
188 // Used by the parsing routines.
190 {
194 };
195 
197 
221 {
222  friend class TiXmlNode;
223 
224  friend class TiXmlElement;
225 
226  friend class TiXmlDocument;
227 
228 public:
230  {}
231 
232  virtual ~TiXmlBase()
233  {}
234 
244  virtual void Print(FILE *cfile, int depth) const = 0;
245 
252  static void SetCondenseWhiteSpace(bool condense)
253  { condenseWhiteSpace = condense; }
254 
256  static bool IsWhiteSpaceCondensed()
257  { return condenseWhiteSpace; }
258 
277  int Row() const
278  { return location.row + 1; }
279 
280  int Column() const
281  { return location.col + 1; }
282 
283  void SetUserData(void *user)
284  { userData = user; }
285  void *GetUserData()
286  { return userData; }
287  const void *GetUserData() const
288  { return userData; }
289 
290  // Table that returs, for a given lead byte, the total number of bytes
291  // in the UTF-8 sequence.
292  static const int utf8ByteTable[256];
293 
294  virtual const char *Parse(const char *p,
295  TiXmlParsingData *data,
296  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
297 
301  static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out);
302 
303  enum
304  {
321 
323  };
324 
325 protected:
326 
327  static const char *SkipWhiteSpace(const char *, TiXmlEncoding encoding);
328 
329  inline static bool IsWhiteSpace(char c)
330  {
331  return (isspace((unsigned char) c) || c == '\n' || c == '\r');
332  }
333 
334  inline static bool IsWhiteSpace(int c)
335  {
336  if (c < 256)
337  {
338  return IsWhiteSpace((char) c);
339  }
340  return false; // Again, only truly correct for English/Latin...but usually works.
341  }
342 
343 #ifdef TIXML_USE_STL
344  static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
345  static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
346 #endif
347 
348  /* Reads an XML name into the string provided. Returns
349  a pointer just past the last character of the name,
350  or 0 if the function has an error.
351  */
352  static const char *ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding);
353 
354  /* Reads text. Returns a pointer past the given end tag.
355  Wickedly complex options, but it keeps the (sensitive) code in one place.
356  */
357  static const char *ReadText(const char *in, // where to start
358  TIXML_STRING *text, // the string read
359  bool ignoreWhiteSpace, // whether to keep the white space
360  const char *endTag, // what ends this text
361  bool ignoreCase, // whether to ignore case in the end tag
362  TiXmlEncoding encoding); // the current encoding
363 
364  // If an entity has been found, transform it into a character.
365  static const char *GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding);
366 
367  // Get a character, while interpreting entities.
368  // The length can be from 0 to 4 bytes.
369  inline static const char *GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
370  {
371  assert(p);
372  if (encoding == TIXML_ENCODING_UTF8)
373  {
374  *length = utf8ByteTable[*((const unsigned char *) p)];
375  assert(*length >= 0 && *length < 5);
376  }
377  else
378  {
379  *length = 1;
380  }
381 
382  if (*length == 1)
383  {
384  if (*p == '&')
385  {
386  return GetEntity(p, _value, length, encoding);
387  }
388  *_value = *p;
389  return p + 1;
390  }
391  else if (*length)
392  {
393  //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
394  // and the null terminator isn't needed
395  for (int i = 0; p[i] && i < *length; ++i)
396  {
397  _value[i] = p[i];
398  }
399  return p + (*length);
400  }
401  else
402  {
403  // Not valid text.
404  return 0;
405  }
406  }
407 
408  // Return true if the next characters in the stream are any of the endTag sequences.
409  // Ignore case only works for english, and should only be relied on when comparing
410  // to English words: StringEqual( p, "version", true ) is fine.
411  static bool StringEqual(const char *p,
412  const char *endTag,
413  bool ignoreCase,
414  TiXmlEncoding encoding);
415 
417 
419 
421  void *userData;
422 
423  // None of these methods are reliable for any language except English.
424  // Good for approximation, not great for accuracy.
425  static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding);
426 
427  static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding);
428 
429  inline static int ToLower(int v, TiXmlEncoding encoding)
430  {
431  if (encoding == TIXML_ENCODING_UTF8)
432  {
433  if (v < 128)
434  { return tolower(v); }
435  return v;
436  }
437  else
438  {
439  return tolower(v);
440  }
441  }
442 
443  static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length);
444 
445 private:
446  TiXmlBase(const TiXmlBase &); // not implemented.
447  void operator=(const TiXmlBase &base); // not allowed.
448 
449  struct Entity
450  {
451  const char *str;
452  unsigned int strLength;
453  char chr;
454  };
455  enum
456  {
457  NUM_ENTITY = 5,
458  MAX_ENTITY_LENGTH = 6
459 
460  };
461  static Entity entity[NUM_ENTITY];
462  static bool condenseWhiteSpace;
463 };
464 
465 
472 class TiXmlNode : public TiXmlBase
473 {
474  friend class TiXmlDocument;
475 
476  friend class TiXmlElement;
477 
478 public:
479 #ifdef TIXML_USE_STL
480 
484  friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
485 
502  friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
503 
505 friend std::string& operator<< (std::string& out, const TiXmlNode& base );
506 
507 #endif
508 
512  enum NodeType
513  {
521  };
522 
523  virtual ~TiXmlNode();
524 
537  const char *Value() const
538  { return value.c_str(); }
539 
540 #ifdef TIXML_USE_STL
541 
545  const std::string& ValueStr() const { return value; }
546 #endif
547 
548  const TIXML_STRING &ValueTStr() const
549  { return value; }
550 
560  void SetValue(const char *_value)
561  { value = _value; }
562 
563 #ifdef TIXML_USE_STL
564  void SetValue( const std::string& _value ) { value = _value; }
566 #endif
567 
569  void Clear();
570 
573  { return parent; }
574 
575  const TiXmlNode *Parent() const
576  { return parent; }
577 
578  const TiXmlNode *FirstChild() const
579  { return firstChild; }
581  { return firstChild; }
582 
583  const TiXmlNode *FirstChild(
584  const char *value) const;
585  TiXmlNode *FirstChild(const char *_value)
587  {
588  // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
589  // call the method, cast the return back to non-const.
590  return const_cast< TiXmlNode * > ((const_cast< const TiXmlNode * >(this))->FirstChild(_value));
591  }
592 
593  const TiXmlNode *LastChild() const
594  { return lastChild; }
596  { return lastChild; }
597 
598  const TiXmlNode *LastChild(
599  const char *value) const;
600  TiXmlNode *LastChild(const char *_value)
601  {
602  return const_cast< TiXmlNode * > ((const_cast< const TiXmlNode * >(this))->LastChild(_value));
603  }
604 
605 #ifdef TIXML_USE_STL
606  const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
607  TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); }
608  const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
609  TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
610 #endif
611 
628  const TiXmlNode *IterateChildren(const TiXmlNode *previous) const;
629 
631  {
632  return const_cast< TiXmlNode * >((const_cast< const TiXmlNode * >(this))->IterateChildren(previous));
633  }
634 
636  const TiXmlNode *IterateChildren(const char *value, const TiXmlNode *previous) const;
637 
638  TiXmlNode *IterateChildren(const char *_value, const TiXmlNode *previous)
639  {
640  return const_cast< TiXmlNode * >((const_cast< const TiXmlNode * >(this))->IterateChildren(_value, previous));
641  }
642 
643 #ifdef TIXML_USE_STL
644  const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); }
645  TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); }
646 #endif
647 
651  TiXmlNode *InsertEndChild(const TiXmlNode &addThis);
652 
653 
663  TiXmlNode *LinkEndChild(TiXmlNode *addThis);
664 
668  TiXmlNode *InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis);
669 
673  TiXmlNode *InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis);
674 
678  TiXmlNode *ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis);
679 
681  bool RemoveChild(TiXmlNode *removeThis);
682 
684  const TiXmlNode *PreviousSibling() const
685  { return prev; }
686 
688  { return prev; }
689 
691  const TiXmlNode *PreviousSibling(const char *) const;
692 
693  TiXmlNode *PreviousSibling(const char *_prev)
694  {
695  return const_cast< TiXmlNode * >((const_cast< const TiXmlNode * >(this))->PreviousSibling(_prev));
696  }
697 
698 #ifdef TIXML_USE_STL
699  const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
700  TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
701  const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); }
702  TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); }
703 #endif
704 
706  const TiXmlNode *NextSibling() const
707  { return next; }
708 
710  { return next; }
711 
713  const TiXmlNode *NextSibling(const char *) const;
714 
715  TiXmlNode *NextSibling(const char *_next)
716  {
717  return const_cast< TiXmlNode * >((const_cast< const TiXmlNode * >(this))->NextSibling(_next));
718  }
719 
724  const TiXmlElement *NextSiblingElement() const;
725 
727  {
728  return const_cast< TiXmlElement * >((const_cast< const TiXmlNode * >(this))->NextSiblingElement());
729  }
730 
735  const TiXmlElement *NextSiblingElement(const char *) const;
736 
737  TiXmlElement *NextSiblingElement(const char *_next)
738  {
739  return const_cast< TiXmlElement * >((const_cast< const TiXmlNode * >(this))->NextSiblingElement(_next));
740  }
741 
742 #ifdef TIXML_USE_STL
743  const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
744  TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
745 #endif
746 
748  const TiXmlElement *FirstChildElement() const;
749 
751  {
752  return const_cast< TiXmlElement * >((const_cast< const TiXmlNode * >(this))->FirstChildElement());
753  }
754 
756  const TiXmlElement *FirstChildElement(const char *_value) const;
757 
758  TiXmlElement *FirstChildElement(const char *_value)
759  {
760  return const_cast< TiXmlElement * >((const_cast< const TiXmlNode * >(this))->FirstChildElement(_value));
761  }
762 
763 #ifdef TIXML_USE_STL
764  const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
765  TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
766 #endif
767 
772  int Type() const
773  { return type; }
774 
778  const TiXmlDocument *GetDocument() const;
779 
781  {
782  return const_cast< TiXmlDocument * >((const_cast< const TiXmlNode * >(this))->GetDocument());
783  }
784 
786  bool NoChildren() const
787  { return !firstChild; }
788 
789  virtual const TiXmlDocument *ToDocument() const
790  { return 0; }
791  virtual const TiXmlElement *ToElement() const
792  { return 0; }
793  virtual const TiXmlComment *ToComment() const
794  { return 0; }
795  virtual const TiXmlUnknown *ToUnknown() const
796  { return 0; }
797  virtual const TiXmlText *ToText() const
798  { return 0; }
799  virtual const TiXmlDeclaration *ToDeclaration() const
800  { return 0; }
801 
803  { return 0; }
805  { return 0; }
807  { return 0; }
809  { return 0; }
810  virtual TiXmlText *ToText()
811  { return 0; }
813  { return 0; }
814 
818  virtual TiXmlNode *Clone() const = 0;
819 
842  virtual bool Accept(TiXmlVisitor *visitor) const = 0;
843 
844 protected:
845  TiXmlNode(NodeType _type);
846 
847  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
848  // and the assignment operator.
849  void CopyTo(TiXmlNode *target) const;
850 
851 #ifdef TIXML_USE_STL
852  // The real work of the input operator.
853 virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
854 #endif
855 
856  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
857  TiXmlNode *Identify(const char *start, TiXmlEncoding encoding);
858 
861 
864 
866 
869 
870 private:
871  TiXmlNode(const TiXmlNode &); // not implemented.
872  void operator=(const TiXmlNode &base); // not allowed.
873 };
874 
875 
883 class TiXmlAttribute : public TiXmlBase
884 {
885  friend class TiXmlAttributeSet;
886 
887 public:
890  {
891  document = 0;
892  prev = next = 0;
893  }
894 
895 #ifdef TIXML_USE_STL
896  TiXmlAttribute( const std::string& _name, const std::string& _value )
898  {
899  name = _name;
900  value = _value;
901  document = 0;
902  prev = next = 0;
903  }
904 #endif
905 
907  TiXmlAttribute(const char *_name, const char *_value)
908  {
909  name = _name;
910  value = _value;
911  document = 0;
912  prev = next = 0;
913  }
914 
915  const char *Name() const
916  { return name.c_str(); }
917  const char *Value() const
918  { return value.c_str(); }
919 #ifdef TIXML_USE_STL
920  const std::string& ValueStr() const { return value; }
921 #endif
922 
923  int IntValue() const;
924  double DoubleValue() const;
925 
926  // Get the tinyxml string representation
927  const TIXML_STRING &NameTStr() const
928  { return name; }
929 
939  int QueryIntValue(int *_value) const;
940 
942  int QueryDoubleValue(double *_value) const;
943 
944  void SetName(const char *_name)
945  { name = _name; }
946  void SetValue(const char *_value)
947  { value = _value; }
948 
949  void SetIntValue(int _value);
950  void SetDoubleValue(double _value);
951 
952 #ifdef TIXML_USE_STL
953  void SetName( const std::string& _name ) { name = _name; }
956  void SetValue( const std::string& _value ) { value = _value; }
957 #endif
958 
960  const TiXmlAttribute *Next() const;
961 
963  {
964  return const_cast< TiXmlAttribute * >((const_cast< const TiXmlAttribute * >(this))->Next());
965  }
966 
968  const TiXmlAttribute *Previous() const;
969 
971  {
972  return const_cast< TiXmlAttribute * >((const_cast< const TiXmlAttribute * >(this))->Previous());
973  }
974 
975  bool operator==(const TiXmlAttribute &rhs) const
976  { return rhs.name == name; }
977 
978  bool operator<(const TiXmlAttribute &rhs) const
979  { return name < rhs.name; }
980 
981  bool operator>(const TiXmlAttribute &rhs) const
982  { return name > rhs.name; }
983 
984  /* Attribute parsing starts: first letter of the name
985  returns: the next char after the value end quote
986  */
987  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
988 
989  // Prints this Attribute to a FILE stream.
990  virtual void Print(FILE *cfile, int depth) const
991  {
992  Print(cfile, depth, 0);
993  }
994 
995  void Print(FILE *cfile, int depth, TIXML_STRING *str) const;
996 
997  // [internal use]
998  // Set the document pointer so the attribute can report errors.
1000  { document = doc; }
1001 
1002 private:
1003  TiXmlAttribute(const TiXmlAttribute &); // not implemented.
1004  void operator=(const TiXmlAttribute &base); // not allowed.
1005 
1006  TiXmlDocument *document; // A pointer back to a document, for error reporting.
1011 };
1012 
1013 
1014 /* A class used to manage a group of attributes.
1015  It is only used internally, both by the ELEMENT and the DECLARATION.
1016 
1017  The set can be changed transparent to the Element and Declaration
1018  classes that use it, but NOT transparent to the Attribute
1019  which has to implement a next() and previous() method. Which makes
1020  it a bit problematic and prevents the use of STL.
1021 
1022  This version is implemented with circular lists because:
1023  - I like circular lists
1024  - it demonstrates some independence from the (typical) doubly linked list.
1025 */
1027 {
1028 public:
1030 
1031  ~TiXmlAttributeSet();
1032 
1033  void Add(TiXmlAttribute *attribute);
1034 
1035  void Remove(TiXmlAttribute *attribute);
1036 
1037  const TiXmlAttribute *First() const
1038  { return (sentinel.next == &sentinel) ? 0 : sentinel.next; }
1039 
1041  { return (sentinel.next == &sentinel) ? 0 : sentinel.next; }
1042 
1043  const TiXmlAttribute *Last() const
1044  { return (sentinel.prev == &sentinel) ? 0 : sentinel.prev; }
1045 
1047  { return (sentinel.prev == &sentinel) ? 0 : sentinel.prev; }
1048 
1049  TiXmlAttribute *Find(const char *_name) const;
1050 
1051  TiXmlAttribute *FindOrCreate(const char *_name);
1052 
1053 # ifdef TIXML_USE_STL
1054  TiXmlAttribute* Find( const std::string& _name ) const;
1055  TiXmlAttribute* FindOrCreate( const std::string& _name );
1056 # endif
1057 
1058 
1059 private:
1060  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
1061  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
1062  TiXmlAttributeSet(const TiXmlAttributeSet &); // not allowed
1063  void operator=(const TiXmlAttributeSet &); // not allowed (as TiXmlAttribute)
1064 
1066 };
1067 
1068 
1073 class TiXmlElement : public TiXmlNode
1074 {
1075 public:
1077  TiXmlElement(const char *in_value);
1078 
1079 #ifdef TIXML_USE_STL
1080  TiXmlElement( const std::string& _value );
1082 #endif
1083 
1084  TiXmlElement(const TiXmlElement &);
1085 
1086  TiXmlElement &operator=(const TiXmlElement &base);
1087 
1088  virtual ~TiXmlElement();
1089 
1093  const char *Attribute(const char *name) const;
1094 
1101  const char *Attribute(const char *name, int *i) const;
1102 
1109  const char *Attribute(const char *name, double *d) const;
1110 
1118  int QueryIntAttribute(const char *name, int *_value) const;
1119 
1121  int QueryUnsignedAttribute(const char *name, unsigned *_value) const;
1122 
1127  int QueryBoolAttribute(const char *name, bool *_value) const;
1128 
1130  int QueryDoubleAttribute(const char *name, double *_value) const;
1131 
1133  int QueryFloatAttribute(const char *name, float *_value) const
1134  {
1135  double d;
1136  int result = QueryDoubleAttribute(name, &d);
1137  if (result == TIXML_SUCCESS)
1138  {
1139  *_value = (float) d;
1140  }
1141  return result;
1142  }
1143 
1144 #ifdef TIXML_USE_STL
1145  int QueryStringAttribute( const char* name, std::string* _value ) const {
1147  const char* cstr = Attribute( name );
1148  if ( cstr ) {
1149  *_value = std::string( cstr );
1150  return TIXML_SUCCESS;
1151  }
1152  return TIXML_NO_ATTRIBUTE;
1153  }
1154 
1163  template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
1164  {
1165  const TiXmlAttribute* node = attributeSet.Find( name );
1166  if ( !node )
1167  return TIXML_NO_ATTRIBUTE;
1168 
1169  std::stringstream sstream( node->ValueStr() );
1170  sstream >> *outValue;
1171  if ( !sstream.fail() )
1172  return TIXML_SUCCESS;
1173  return TIXML_WRONG_TYPE;
1174  }
1175 
1176  int QueryValueAttribute( const std::string& name, std::string* outValue ) const
1177  {
1178  const TiXmlAttribute* node = attributeSet.Find( name );
1179  if ( !node )
1180  return TIXML_NO_ATTRIBUTE;
1181  *outValue = node->ValueStr();
1182  return TIXML_SUCCESS;
1183  }
1184 #endif
1185 
1189  void SetAttribute(const char *name, const char *_value);
1190 
1191 #ifdef TIXML_USE_STL
1192  const std::string* Attribute( const std::string& name ) const;
1193  const std::string* Attribute( const std::string& name, int* i ) const;
1194  const std::string* Attribute( const std::string& name, double* d ) const;
1195  int QueryIntAttribute( const std::string& name, int* _value ) const;
1196  int QueryDoubleAttribute( const std::string& name, double* _value ) const;
1197 
1199  void SetAttribute( const std::string& name, const std::string& _value );
1201  void SetAttribute( const std::string& name, int _value );
1203  void SetDoubleAttribute( const std::string& name, double value );
1204 #endif
1205 
1209  void SetAttribute(const char *name, int value);
1210 
1214  void SetDoubleAttribute(const char *name, double value);
1215 
1218  void RemoveAttribute(const char *name);
1219 
1220 #ifdef TIXML_USE_STL
1221  void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); }
1222 #endif
1223 
1225  { return attributeSet.First(); }
1227  { return attributeSet.First(); }
1228 
1230  { return attributeSet.Last(); }
1232  { return attributeSet.Last(); }
1233 
1266  const char *GetText() const;
1267 
1269  virtual TiXmlNode *Clone() const;
1270 
1271  // Print the Element to a FILE stream.
1272  virtual void Print(FILE *cfile, int depth) const;
1273 
1274  /* Attribtue parsing starts: next char past '<'
1275  returns: next char past '>'
1276  */
1277  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1278 
1279  virtual const TiXmlElement *ToElement() const
1280  { return this; }
1282  { return this; }
1283 
1286  virtual bool Accept(TiXmlVisitor *visitor) const;
1287 
1288 protected:
1289 
1290  void CopyTo(TiXmlElement *target) const;
1291 
1292  void ClearThis(); // like clear, but initializes 'this' object as well
1293 
1294  // Used to be public [internal use]
1295 #ifdef TIXML_USE_STL
1296  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1297 #endif
1298 
1299  /* [internal use]
1300  Reads the "value" of the element -- another element, or text.
1301  This should terminate with the current end tag.
1302  */
1303  const char *ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding);
1304 
1305 private:
1307 };
1308 
1309 
1312 class TiXmlComment : public TiXmlNode
1313 {
1314 public:
1316  TiXmlComment() : TiXmlNode(TiXmlNode::TINYXML_COMMENT)
1317  {}
1318 
1320  TiXmlComment(const char *_value) : TiXmlNode(TiXmlNode::TINYXML_COMMENT)
1321  {
1322  SetValue(_value);
1323  }
1324 
1325  TiXmlComment(const TiXmlComment &);
1326 
1327  TiXmlComment &operator=(const TiXmlComment &base);
1328 
1329  virtual ~TiXmlComment()
1330  {}
1331 
1333  virtual TiXmlNode *Clone() const;
1334 
1335  // Write this Comment to a FILE stream.
1336  virtual void Print(FILE *cfile, int depth) const;
1337 
1338  /* Attribtue parsing starts: at the ! of the !--
1339  returns: next char past '>'
1340  */
1341  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1342 
1343  virtual const TiXmlComment *ToComment() const
1344  { return this; }
1346  { return this; }
1347 
1350  virtual bool Accept(TiXmlVisitor *visitor) const;
1351 
1352 protected:
1353  void CopyTo(TiXmlComment *target) const;
1354 
1355  // used to be public
1356 #ifdef TIXML_USE_STL
1357  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1358 #endif
1359 // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1360 
1361 private:
1362 
1363 };
1364 
1365 
1371 class TiXmlText : public TiXmlNode
1372 {
1373  friend class TiXmlElement;
1374 
1375 public:
1380  TiXmlText(const char *initValue) : TiXmlNode(TiXmlNode::TINYXML_TEXT)
1381  {
1382  SetValue(initValue);
1383  cdata = false;
1384  }
1385 
1386  virtual ~TiXmlText()
1387  {}
1388 
1389 #ifdef TIXML_USE_STL
1390  TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
1392  {
1393  SetValue( initValue );
1394  cdata = false;
1395  }
1396 #endif
1397 
1399  { copy.CopyTo(this); }
1400 
1402  {
1403  base.CopyTo(this);
1404  return *this;
1405  }
1406 
1407  // Write this text object to a FILE stream.
1408  virtual void Print(FILE *cfile, int depth) const;
1409 
1411  bool CDATA() const
1412  { return cdata; }
1413 
1415  void SetCDATA(bool _cdata)
1416  { cdata = _cdata; }
1417 
1418  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1419 
1420  virtual const TiXmlText *ToText() const
1421  { return this; }
1422  virtual TiXmlText *ToText()
1423  { return this; }
1424 
1427  virtual bool Accept(TiXmlVisitor *content) const;
1428 
1429 protected :
1431  virtual TiXmlNode *Clone() const;
1432 
1433  void CopyTo(TiXmlText *target) const;
1434 
1435  bool Blank() const; // returns true if all white space and new lines
1436  // [internal use]
1437 #ifdef TIXML_USE_STL
1438  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1439 #endif
1440 
1441 private:
1442  bool cdata; // true if this should be input and output as a CDATA style text element
1443 };
1444 
1445 
1460 {
1461 public:
1463  TiXmlDeclaration() : TiXmlNode(TiXmlNode::TINYXML_DECLARATION)
1464  {}
1465 
1466 #ifdef TIXML_USE_STL
1467  TiXmlDeclaration( const std::string& _version,
1469  const std::string& _encoding,
1470  const std::string& _standalone );
1471 #endif
1472 
1474  TiXmlDeclaration(const char *_version,
1475  const char *_encoding,
1476  const char *_standalone);
1477 
1478  TiXmlDeclaration(const TiXmlDeclaration &copy);
1479 
1480  TiXmlDeclaration &operator=(const TiXmlDeclaration &copy);
1481 
1483  {}
1484 
1486  const char *Version() const
1487  { return version.c_str(); }
1488 
1490  const char *Encoding() const
1491  { return encoding.c_str(); }
1492 
1494  const char *Standalone() const
1495  { return standalone.c_str(); }
1496 
1498  virtual TiXmlNode *Clone() const;
1499 
1500  // Print this declaration to a FILE stream.
1501  virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const;
1502 
1503  virtual void Print(FILE *cfile, int depth) const
1504  {
1505  Print(cfile, depth, 0);
1506  }
1507 
1508  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1509 
1510  virtual const TiXmlDeclaration *ToDeclaration() const
1511  { return this; }
1513  { return this; }
1514 
1517  virtual bool Accept(TiXmlVisitor *visitor) const;
1518 
1519 protected:
1520  void CopyTo(TiXmlDeclaration *target) const;
1521  // used to be public
1522 #ifdef TIXML_USE_STL
1523  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1524 #endif
1525 
1526 private:
1527 
1531 };
1532 
1533 
1541 class TiXmlUnknown : public TiXmlNode
1542 {
1543 public:
1544  TiXmlUnknown() : TiXmlNode(TiXmlNode::TINYXML_UNKNOWN)
1545  {}
1546 
1547  virtual ~TiXmlUnknown()
1548  {}
1549 
1550  TiXmlUnknown(const TiXmlUnknown &copy) : TiXmlNode(TiXmlNode::TINYXML_UNKNOWN)
1551  { copy.CopyTo(this); }
1552 
1554  {
1555  copy.CopyTo(this);
1556  return *this;
1557  }
1558 
1560  virtual TiXmlNode *Clone() const;
1561 
1562  // Print this Unknown to a FILE stream.
1563  virtual void Print(FILE *cfile, int depth) const;
1564 
1565  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1566 
1567  virtual const TiXmlUnknown *ToUnknown() const
1568  { return this; }
1570  { return this; }
1571 
1574  virtual bool Accept(TiXmlVisitor *content) const;
1575 
1576 protected:
1577  void CopyTo(TiXmlUnknown *target) const;
1578 
1579 #ifdef TIXML_USE_STL
1580  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1581 #endif
1582 
1583 private:
1584 
1585 };
1586 
1587 
1592 class TiXmlDocument : public TiXmlNode
1593 {
1594 public:
1596  TiXmlDocument();
1597 
1599  TiXmlDocument(const char *documentName);
1600 
1601 #ifdef TIXML_USE_STL
1602  TiXmlDocument( const std::string& documentName );
1604 #endif
1605 
1606  TiXmlDocument(const TiXmlDocument &copy);
1607 
1608  TiXmlDocument &operator=(const TiXmlDocument &copy);
1609 
1610  virtual ~TiXmlDocument()
1611  {}
1612 
1617  bool LoadFile(TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1618 
1620  bool SaveFile() const;
1621 
1623  bool LoadFile(const char *filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1624 
1626  bool SaveFile(const char *filename) const;
1627 
1633  bool LoadFile(FILE *, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1634 
1636  bool SaveFile(FILE *) const;
1637 
1638 #ifdef TIXML_USE_STL
1639  bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
1640  {
1641  return LoadFile( filename.c_str(), encoding );
1642  }
1643  bool SaveFile( const std::string& filename ) const
1644  {
1645  return SaveFile( filename.c_str() );
1646  }
1647 #endif
1648 
1653  virtual const char *Parse(const char *p, TiXmlParsingData *data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1654 
1659  const TiXmlElement *RootElement() const
1660  { return FirstChildElement(); }
1661 
1663  { return FirstChildElement(); }
1664 
1670  bool Error() const
1671  { return error; }
1672 
1674  const char *ErrorDesc() const
1675  { return errorDesc.c_str(); }
1676 
1680  int ErrorId() const
1681  { return errorId; }
1682 
1690  int ErrorRow() const
1691  { return errorLocation.row + 1; }
1692 
1693  int ErrorCol() const
1694  { return errorLocation.col + 1; }
1695 
1720  void SetTabSize(int _tabsize)
1721  { tabsize = _tabsize; }
1722 
1723  int TabSize() const
1724  { return tabsize; }
1725 
1729  void ClearError()
1730  {
1731  error = false;
1732  errorId = 0;
1733  errorDesc = "";
1734  errorLocation.row = errorLocation.col = 0;
1735  //errorLocation.last = 0;
1736  }
1737 
1739  void Print() const
1740  { Print(stdout, 0); }
1741 
1742  /* Write the document to a string using formatted printing ("pretty print"). This
1743  will allocate a character array (new char[]) and return it as a pointer. The
1744  calling code pust call delete[] on the return char* to avoid a memory leak.
1745  */
1746  //char* PrintToMemory() const;
1747 
1749  virtual void Print(FILE *cfile, int depth = 0) const;
1750 
1751  // [internal use]
1752  void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding);
1753 
1754  virtual const TiXmlDocument *ToDocument() const
1755  { return this; }
1757  { return this; }
1758 
1761  virtual bool Accept(TiXmlVisitor *content) const;
1762 
1763 protected :
1764  // [internal use]
1765  virtual TiXmlNode *Clone() const;
1766 
1767 #ifdef TIXML_USE_STL
1768  virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
1769 #endif
1770 
1771 private:
1772  void CopyTo(TiXmlDocument *target) const;
1773 
1774  bool error;
1775  int errorId;
1777  int tabsize;
1779  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1780 };
1781 
1782 
1864 {
1865 public:
1868  { this->node = _node; }
1869 
1872  { this->node = ref.node; }
1873 
1875  {
1876  if (&ref != this)
1877  { this->node = ref.node; }
1878  return *this;
1879  }
1880 
1882  TiXmlHandle FirstChild() const;
1883 
1885  TiXmlHandle FirstChild(const char *value) const;
1886 
1888  TiXmlHandle FirstChildElement() const;
1889 
1891  TiXmlHandle FirstChildElement(const char *value) const;
1892 
1896  TiXmlHandle Child(const char *value, int index) const;
1897 
1901  TiXmlHandle Child(int index) const;
1902 
1907  TiXmlHandle ChildElement(const char *value, int index) const;
1908 
1913  TiXmlHandle ChildElement(int index) const;
1914 
1915 #ifdef TIXML_USE_STL
1916  TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
1917  TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
1918 
1919  TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
1920  TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
1921 #endif
1922 
1926  { return node; }
1927 
1931  { return ((node && node->ToElement()) ? node->ToElement() : 0); }
1932 
1936  { return ((node && node->ToText()) ? node->ToText() : 0); }
1937 
1941  { return ((node && node->ToUnknown()) ? node->ToUnknown() : 0); }
1942 
1946  TiXmlNode *Node() const
1947  { return ToNode(); }
1948 
1953  { return ToElement(); }
1954 
1958  TiXmlText *Text() const
1959  { return ToText(); }
1960 
1965  { return ToUnknown(); }
1966 
1967 private:
1969 };
1970 
1971 
1992 {
1993 public:
1994  TiXmlPrinter() : depth(0), simpleTextPrint(false),
1995  buffer(), indent(" "), lineBreak("\n")
1996  {}
1997 
1998  virtual bool VisitEnter(const TiXmlDocument &doc);
1999 
2000  virtual bool VisitExit(const TiXmlDocument &doc);
2001 
2002  virtual bool VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute);
2003 
2004  virtual bool VisitExit(const TiXmlElement &element);
2005 
2006  virtual bool Visit(const TiXmlDeclaration &declaration);
2007 
2008  virtual bool Visit(const TiXmlText &text);
2009 
2010  virtual bool Visit(const TiXmlComment &comment);
2011 
2012  virtual bool Visit(const TiXmlUnknown &unknown);
2013 
2017  void SetIndent(const char *_indent)
2018  { indent = _indent ? _indent : ""; }
2019 
2021  const char *Indent()
2022  { return indent.c_str(); }
2023 
2028  void SetLineBreak(const char *_lineBreak)
2029  { lineBreak = _lineBreak ? _lineBreak : ""; }
2030 
2032  const char *LineBreak()
2033  { return lineBreak.c_str(); }
2034 
2039  {
2040  indent = "";
2041  lineBreak = "";
2042  }
2043 
2045  const char *CStr()
2046  { return buffer.c_str(); }
2047 
2049  size_t Size()
2050  { return buffer.size(); }
2051 
2052 #ifdef TIXML_USE_STL
2053  const std::string& Str() { return buffer; }
2055 #endif
2056 
2057 private:
2058  void DoIndent()
2059  {
2060  for (int i = 0; i < depth; ++i)
2061  buffer += indent;
2062  }
2063 
2065  {
2066  buffer += lineBreak;
2067  }
2068 
2069  int depth;
2074 };
2075 
2076 
2077 #ifdef _MSC_VER
2078 #pragma warning( pop )
2079 #endif
2080 
2081 #endif
TIXML_STRING standalone
Definition: tinyxml.h:1530
virtual ~TiXmlVisitor()
Definition: tinyxml.h:143
static const int utf8ByteTable[256]
Definition: tinyxml.h:292
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1343
d
TiXmlAttribute sentinel
Definition: tinyxml.h:1065
const TiXmlAttribute * First() const
Definition: tinyxml.h:1037
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TIXML_STRING errorDesc
Definition: tinyxml.h:1776
void DoLineBreak()
Definition: tinyxml.h:2064
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:600
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1867
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1964
virtual bool Accept(TiXmlVisitor *visitor) const
Definition: tinyxml.cpp:875
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:283
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1754
filename
TiXmlUnknown(const TiXmlUnknown &copy)
Definition: tinyxml.h:1550
const TiXmlNode * Parent() const
Definition: tinyxml.h:575
const TiXmlElement * RootElement() const
Definition: tinyxml.h:1659
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1316
void SetLineBreak(const char *_lineBreak)
Definition: tinyxml.h:2028
const TIXML_STRING & ValueTStr() const
Definition: tinyxml.h:548
TiXmlElement * NextSiblingElement()
Definition: tinyxml.h:726
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1279
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1871
TiXmlNode * PreviousSibling(const char *_prev)
Definition: tinyxml.h:693
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:595
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:2032
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition: tinyxml.cpp:889
bool Error() const
Definition: tinyxml.h:1670
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:804
virtual bool Visit(const TiXmlUnknown &)
Visit an unknown node.
Definition: tinyxml.h:175
TIXML_STRING version
Definition: tinyxml.h:1528
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:907
TiXmlNode * prev
Definition: tinyxml.h:867
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1420
void CopyTo(TiXmlUnknown *target) const
Definition: tinyxml.cpp:1476
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:287
int Type() const
Definition: tinyxml.h:772
static int ToLower(int v, TiXmlEncoding encoding)
Definition: tinyxml.h:429
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
Definition: tinyxml.h:638
TiXmlNode * firstChild
Definition: tinyxml.h:862
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
TiXmlElement & operator=(const TiXmlElement &base)
Definition: tinyxml.cpp:551
TIXML_STRING lineBreak
Definition: tinyxml.h:2073
int TabSize() const
Definition: tinyxml.h:1723
TIXML_STRING name
Definition: tinyxml.h:1007
TiXmlDocument * document
Definition: tinyxml.h:1006
int ErrorId() const
Definition: tinyxml.h:1680
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:1503
const TIXML_STRING & NameTStr() const
Definition: tinyxml.h:927
TiXmlAttribute * FirstAttribute()
Definition: tinyxml.h:1226
void operator=(const TiXmlAttributeSet &)
TiXmlElement * FirstChildElement(const char *_value)
Definition: tinyxml.h:758
TiXmlAttribute * Next()
Definition: tinyxml.h:962
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Definition: tinyxml.cpp:296
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:1229
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition: tinyxml.h:159
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:944
TiXmlNode * NextSibling()
Definition: tinyxml.h:709
void SetTabSize(int _tabsize)
Definition: tinyxml.h:1720
void DoIndent()
Definition: tinyxml.h:2058
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:889
TIXML_STRING buffer
Definition: tinyxml.h:2071
const int TIXML_PATCH_VERSION
Definition: tinyxml.h:103
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1494
TiXmlElement * ToElement() const
Definition: tinyxml.h:1930
data
TiXmlElement * NextSiblingElement(const char *_next)
Definition: tinyxml.h:737
virtual ~TiXmlText()
Definition: tinyxml.h:1386
TiXmlElement * FirstChildElement()
Definition: tinyxml.h:750
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:802
void ClearError()
Definition: tinyxml.h:1729
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:917
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:793
void Clear()
Definition: tinyxml.h:113
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.cpp:800
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1345
virtual ~TiXmlComment()
Definition: tinyxml.h:1329
static const char * errorString[TIXML_ERROR_STRING_COUNT]
Definition: tinyxml.h:416
void SetValue(const char *_value)
Definition: tinyxml.h:560
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1693
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Definition: tinyxml.cpp:214
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1281
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:230
static bool condenseWhiteSpace
Definition: tinyxml.h:462
virtual ~TiXmlDocument()
Definition: tinyxml.h:1610
TiXmlNode * PreviousSibling()
Definition: tinyxml.h:687
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:799
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:147
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1490
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Definition: tinyxml.cpp:186
const TiXmlNode * LastChild() const
Definition: tinyxml.h:593
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:915
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:421
TiXmlAttribute * prev
Definition: tinyxml.h:1009
TiXmlDocument * GetDocument()
Definition: tinyxml.h:780
void Print() const
Definition: tinyxml.h:1739
const char * str
Definition: tinyxml.h:451
bool cdata
Definition: tinyxml.h:1442
const TiXmlAttribute * Last() const
Definition: tinyxml.h:1043
static bool IsWhiteSpace(char c)
Definition: tinyxml.h:329
TiXmlCursor()
Definition: tinyxml.h:110
TiXmlAttributeSet attributeSet
Definition: tinyxml.h:1306
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition: tinyxml.h:167
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition: tinyxml.h:196
int ErrorRow() const
Definition: tinyxml.h:1690
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1486
TiXmlNode * NextSibling(const char *_next)
Definition: tinyxml.h:715
TiXmlNode * FirstChild()
Definition: tinyxml.h:580
TiXmlAttribute * next
Definition: tinyxml.h:1010
int Column() const
See Row()
Definition: tinyxml.h:280
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:256
TiXmlText(const TiXmlText &copy)
Definition: tinyxml.h:1398
static const char * ReadText(const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
TiXmlCursor location
Definition: tinyxml.h:418
const int TIXML_MAJOR_VERSION
Definition: tinyxml.h:101
void SetIndent(const char *_indent)
Definition: tinyxml.h:2017
virtual ~TiXmlUnknown()
Definition: tinyxml.h:1547
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:578
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1674
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1567
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1756
TiXmlAttribute * Last()
Definition: tinyxml.h:1046
virtual void Print(FILE *cfile, int depth) const
Definition: tinyxml.h:990
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1415
const char * Indent()
Query the indention string.
Definition: tinyxml.h:2021
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1512
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cpp:452
TiXmlEncoding
Definition: tinyxml.h:189
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1510
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:1133
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:684
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Definition: tinyxml.cpp:263
TiXmlText & operator=(const TiXmlText &base)
Definition: tinyxml.h:1401
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:812
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:791
std::istream & operator>>(std::istream &str, CSVRow &data)
Definition: softwarePLL.cpp:62
const TiXmlDocument * GetDocument() const
Definition: tinyxml.cpp:512
TiXmlNode * node
Definition: tinyxml.h:1968
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1411
static bool IsWhiteSpace(int c)
Definition: tinyxml.h:334
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:806
TIXML_STRING value
Definition: tinyxml.h:1008
bool operator>(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:981
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
TiXmlText * Text() const
Definition: tinyxml.h:1958
TiXmlNode * Node() const
Definition: tinyxml.h:1946
TiXmlNode * ToNode() const
Definition: tinyxml.h:1925
static void SetCondenseWhiteSpace(bool condense)
Definition: tinyxml.h:252
bool operator<(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:978
const TiXmlElement * NextSiblingElement() const
Definition: tinyxml.cpp:482
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:572
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:808
bool operator==(const TiXmlAttribute &rhs) const
Definition: tinyxml.h:975
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:795
TiXmlComment(const char *_value)
Construct a comment from text.
Definition: tinyxml.h:1320
virtual ~TiXmlBase()
Definition: tinyxml.h:232
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
TiXmlHandle operator=(const TiXmlHandle &ref)
Definition: tinyxml.h:1874
TiXmlNode * parent
Definition: tinyxml.h:859
TiXmlNode * IterateChildren(const TiXmlNode *previous)
Definition: tinyxml.h:630
int Row() const
Definition: tinyxml.h:277
TiXmlAttribute * Previous()
Definition: tinyxml.h:970
TiXmlElement * Element() const
Definition: tinyxml.h:1952
TIXML_STRING indent
Definition: tinyxml.h:2072
TiXmlNode(NodeType _type)
Definition: tinyxml.cpp:136
TiXmlElement * RootElement()
Definition: tinyxml.h:1662
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
Definition: tinyxml.cpp:52
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:285
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:797
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:2049
TiXmlNode * next
Definition: tinyxml.h:868
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition: tinyxml.h:151
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition: tinyxml.h:171
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition: tinyxml.h:369
TiXmlText(const char *initValue)
Definition: tinyxml.h:1380
bool useMicrosoftBOM
Definition: tinyxml.h:1779
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
Definition: tinyxml.cpp:385
const char * Value() const
Definition: tinyxml.h:537
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
TiXmlDocument & operator=(const TiXmlDocument &copy)
Definition: tinyxml.cpp:946
void CopyTo(TiXmlText *target) const
Definition: tinyxml.cpp:1353
TiXmlUnknown & operator=(const TiXmlUnknown &copy)
Definition: tinyxml.h:1553
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:786
void CopyTo(TiXmlElement *target) const
Definition: tinyxml.cpp:853
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:1224
unsigned int strLength
Definition: tinyxml.h:452
NodeType type
Definition: tinyxml.h:860
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition: tinyxml.cpp:335
TIXML_STRING value
Definition: tinyxml.h:865
void SetDocument(TiXmlDocument *doc)
Definition: tinyxml.h:999
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1569
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:789
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:946
virtual ~TiXmlDeclaration()
Definition: tinyxml.h:1482
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:706
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1422
TiXmlAttribute * LastAttribute()
Definition: tinyxml.h:1231
TiXmlNode * lastChild
Definition: tinyxml.h:863
TiXmlText * ToText() const
Definition: tinyxml.h:1935
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1463
void SetStreamPrinting()
Definition: tinyxml.h:2038
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
TiXmlAttribute * First()
Definition: tinyxml.h:1040
virtual ~TiXmlNode()
Definition: tinyxml.cpp:147
TiXmlUnknown * ToUnknown() const
Definition: tinyxml.h:1940
const char * CStr()
Return the result.
Definition: tinyxml.h:2045
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:810
#define TIXML_STRING
Definition: tinyxml.h:55
const int TIXML_MINOR_VERSION
Definition: tinyxml.h:102
bool simpleTextPrint
Definition: tinyxml.h:2070
TiXmlCursor errorLocation
Definition: tinyxml.h:1778
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition: tinyxml.h:155
TIXML_STRING encoding
Definition: tinyxml.h:1529
TiXmlBase()
Definition: tinyxml.h:229
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition: tinyxml.h:163


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Wed May 5 2021 03:05:48