ScummVM API documentation
tinyxml.h
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 #ifndef TINYXML_INCLUDED
26 #define TINYXML_INCLUDED
27 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable : 4530)
31 #pragma warning(disable : 4786)
32 #endif
33 
34 #include "common/file.h"
35 #include "common/str.h"
36 #include "common/util.h"
37 
38 // Help out windows:
39 #if defined(_DEBUG) && !defined(DEBUG)
40 #define DEBUG
41 #endif
42 
43 #define TIXML_STRING Common::String
44 
45 class TiXmlDocument;
46 class TiXmlElement;
47 class TiXmlComment;
48 class TiXmlUnknown;
49 class TiXmlAttribute;
50 class TiXmlText;
51 class TiXmlDeclaration;
52 class TiXmlParsingData;
53 
54 const int TIXML_MAJOR_VERSION = 2;
55 const int TIXML_MINOR_VERSION = 5;
56 const int TIXML_PATCH_VERSION = 2;
57 
58 /* Internal structure for tracking location of items
59  in the XML file.
60 */
61 struct TiXmlCursor {
62  TiXmlCursor() { Clear(); }
63  void Clear() { row = col = -1; }
64 
65  int row; // 0 based.
66  int col; // 0 based.
67 };
68 
87 class TiXmlVisitor {
88 public:
89  virtual ~TiXmlVisitor() {}
90 
92  virtual bool VisitEnter(const TiXmlDocument &doc) { return true; }
94  virtual bool VisitExit(const TiXmlDocument &doc) { return true; }
95 
97  virtual bool VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute) { return true; }
99  virtual bool VisitExit(const TiXmlElement &element) { return true; }
100 
102  virtual bool Visit(const TiXmlDeclaration &declaration) { return true; }
104  virtual bool Visit(const TiXmlText &text) { return true; }
106  virtual bool Visit(const TiXmlComment &comment) { return true; }
108  virtual bool Visit(const TiXmlUnknown &unknown) { return true; }
109 };
110 
111 // Only used by Attribute::Query functions
112 enum {
113  TIXML_SUCCESS,
114  TIXML_NO_ATTRIBUTE,
115  TIXML_WRONG_TYPE
116 };
117 
118 // Used by the parsing routines.
119 enum TiXmlEncoding {
120  TIXML_ENCODING_UNKNOWN,
121  TIXML_ENCODING_UTF8,
122  TIXML_ENCODING_LEGACY
123 };
124 
125 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
126 
149 class TiXmlBase {
150  friend class TiXmlNode;
151  friend class TiXmlElement;
152  friend class TiXmlDocument;
153 
154 public:
155  TiXmlBase() : userData(0) {}
156  virtual ~TiXmlBase() {}
157 
167  virtual void Print(Common::WriteStream &file, int depth) const = 0;
168 
175  static void SetCondenseWhiteSpace(bool condense) { condenseWhiteSpace = condense; }
176 
178  static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
179 
198  int Row() const { return location.row + 1; }
199  int Column() const { return location.col + 1; }
200 
201  void SetUserData(void *user) { userData = user; }
202  void *GetUserData() { return userData; }
203  const void *GetUserData() const { return userData; }
204 
205  // Table that returs, for a given lead byte, the total number of bytes
206  // in the UTF-8 sequence.
207  static const int utf8ByteTable[256];
208 
209  virtual const char *Parse(const char *p,
210  TiXmlParsingData *data,
211  TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */) = 0;
212 
213  enum {
214  TIXML_NO_ERROR = 0,
215  TIXML_ERROR,
216  TIXML_ERROR_OPENING_FILE,
217  TIXML_ERROR_OUT_OF_MEMORY,
218  TIXML_ERROR_PARSING_ELEMENT,
219  TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
220  TIXML_ERROR_READING_ELEMENT_VALUE,
221  TIXML_ERROR_READING_ATTRIBUTES,
222  TIXML_ERROR_PARSING_EMPTY,
223  TIXML_ERROR_READING_END_TAG,
224  TIXML_ERROR_PARSING_UNKNOWN,
225  TIXML_ERROR_PARSING_COMMENT,
226  TIXML_ERROR_PARSING_DECLARATION,
227  TIXML_ERROR_DOCUMENT_EMPTY,
228  TIXML_ERROR_EMBEDDED_NULL,
229  TIXML_ERROR_PARSING_CDATA,
230  TIXML_ERROR_DOCUMENT_TOP_ONLY,
231 
232  TIXML_ERROR_STRING_COUNT
233  };
234 
235 protected:
236  static const char *SkipWhiteSpace(const char *, TiXmlEncoding encoding);
237  inline static bool IsWhiteSpace(char c) {
238  return (Common::isSpace((unsigned char)c) || c == '\n' || c == '\r');
239  }
240  inline static bool IsWhiteSpace(int c) {
241  if (c < 256)
242  return IsWhiteSpace((char)c);
243  return false; // Again, only truly correct for English/Latin...but usually works.
244  }
245 
246 #ifdef TIXML_USE_STL
247  static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag);
248  static bool StreamTo(std::istream *in, int character, TIXML_STRING *tag);
249 #endif
250 
251  /* Reads an XML name into the string provided. Returns
252  a pointer just past the last character of the name,
253  or 0 if the function has an error.
254  */
255  static const char *ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding);
256 
257  /* Reads text. Returns a pointer past the given end tag.
258  Wickedly complex options, but it keeps the (sensitive) code in one place.
259  */
260  static const char *ReadText(const char *in, // where to start
261  TIXML_STRING *text, // the string read
262  bool ignoreWhiteSpace, // whether to keep the white space
263  const char *endTag, // what ends this text
264  bool ignoreCase, // whether to ignore case in the end tag
265  TiXmlEncoding encoding); // the current encoding
266 
267  // If an entity has been found, transform it into a character.
268  static const char *GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding);
269 
270  // Get a character, while interpreting entities.
271  // The length can be from 0 to 4 bytes.
272  inline static const char *GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding) {
273  assert(p);
274  if (encoding == TIXML_ENCODING_UTF8) {
275  *length = utf8ByteTable[*((const unsigned char *)p)];
276  assert(*length >= 0 && *length < 5);
277  } else {
278  *length = 1;
279  }
280 
281  if (*length == 1) {
282  if (*p == '&')
283  return GetEntity(p, _value, length, encoding);
284  *_value = *p;
285  return p + 1;
286  } else if (*length) {
287  // strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe),
288  // and the null terminator isn't needed
289  for (int i = 0; p[i] && i < *length; ++i) {
290  _value[i] = p[i];
291  }
292  return p + (*length);
293  } else {
294  // Not valid text.
295  return 0;
296  }
297  }
298 
299  // Puts a string to a stream, expanding entities as it goes.
300  // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
301  static void PutString(const TIXML_STRING &str, TIXML_STRING *out);
302 
303  // Return true if the next characters in the stream are any of the endTag sequences.
304  // Ignore case only works for english, and should only be relied on when comparing
305  // to English words: StringEqual( p, "version", true ) is fine.
306  static bool StringEqual(const char *p,
307  const char *endTag,
308  bool ignoreCase,
309  TiXmlEncoding encoding);
310 
311  static const char *errorString[TIXML_ERROR_STRING_COUNT];
312 
313  TiXmlCursor location;
314 
316  void *userData;
317 
318  // None of these methods are reliable for any language except English.
319  // Good for approximation, not great for accuracy.
320  static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding);
321  static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding);
322  inline static int ToLower(int v, TiXmlEncoding encoding) {
323  if (encoding == TIXML_ENCODING_UTF8) {
324  if (v < 128)
325  return tolower(v);
326  return v;
327  } else {
328  return tolower(v);
329  }
330  }
331  static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length);
332 
333 private:
334  TiXmlBase(const TiXmlBase &); // not implemented.
335  void operator=(const TiXmlBase &base); // not allowed.
336 
337  struct Entity {
338  const char *str;
339  unsigned int strLength;
340  char chr;
341  };
342  enum {
343  NUM_ENTITY = 5,
344  MAX_ENTITY_LENGTH = 6
345 
346  };
347  static Entity entity[NUM_ENTITY];
348  static bool condenseWhiteSpace;
349 };
350 
357 class TiXmlNode : public TiXmlBase {
358  friend class TiXmlDocument;
359  friend class TiXmlElement;
360 
361 public:
362 #ifdef TIXML_USE_STL
363 
367  friend std::istream &operator>>(std::istream &in, TiXmlNode &base);
368 
385  friend std::ostream &operator<<(std::ostream &out, const TiXmlNode &base);
386 
388  friend std::string &operator<<(std::string &out, const TiXmlNode &base);
389 
390 #endif
391 
395  enum NodeType {
396  DOCUMENT,
397  ELEMENT,
398  COMMENT,
399  UNKNOWN,
400  TEXT,
401  DECLARATION,
402  TYPECOUNT
403  };
404 
405  virtual ~TiXmlNode();
406 
419  const char *Value() const { return value.c_str(); }
420 
421 #ifdef TIXML_USE_STL
422 
426  const std::string &ValueStr() const { return value; }
427 #endif
428 
438  void SetValue(const char *_value) { value = _value; }
439 
440 #ifdef TIXML_USE_STL
441  void SetValue(const std::string &_value) { value = _value; }
443 #endif
444 
446  void Clear();
447 
449  TiXmlNode *Parent() { return parent; }
450  const TiXmlNode *Parent() const { return parent; }
451 
452  const TiXmlNode *FirstChild() const { return firstChild; }
453  TiXmlNode *FirstChild() { return firstChild; }
454  const TiXmlNode *FirstChild(const char *value) const;
455  TiXmlNode *FirstChild(const char *_value) {
457  // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
458  // call the method, cast the return back to non-const.
459  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->FirstChild(_value));
460  }
461  const TiXmlNode *LastChild() const { return lastChild; }
462  TiXmlNode *LastChild() { return lastChild; }
463 
464  const TiXmlNode *LastChild(const char *value) const;
465  TiXmlNode *LastChild(const char *_value) {
466  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->LastChild(_value));
467  }
468 
469 #ifdef TIXML_USE_STL
470  const TiXmlNode *FirstChild(const std::string &_value) const { return FirstChild(_value.c_str()); }
471  TiXmlNode *FirstChild(const std::string &_value) { return FirstChild(_value.c_str()); }
472  const TiXmlNode *LastChild(const std::string &_value) const { return LastChild(_value.c_str()); }
473  TiXmlNode *LastChild(const std::string &_value) { return LastChild(_value.c_str()); }
474 #endif
475 
492  const TiXmlNode *IterateChildren(const TiXmlNode *previous) const;
493  TiXmlNode *IterateChildren(const TiXmlNode *previous) {
494  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->IterateChildren(previous));
495  }
496 
498  const TiXmlNode *IterateChildren(const char *value, const TiXmlNode *previous) const;
499  TiXmlNode *IterateChildren(const char *_value, const TiXmlNode *previous) {
500  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->IterateChildren(_value, previous));
501  }
502 
503 #ifdef TIXML_USE_STL
504  const TiXmlNode *IterateChildren(const std::string &_value, const TiXmlNode *previous) const { return IterateChildren(_value.c_str(), previous); }
505  TiXmlNode *IterateChildren(const std::string &_value, const TiXmlNode *previous) { return IterateChildren(_value.c_str(), previous); }
506 #endif
507 
511  TiXmlNode *InsertEndChild(const TiXmlNode &addThis);
512 
522  TiXmlNode *LinkEndChild(TiXmlNode *addThis);
523 
527  TiXmlNode *InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis);
528 
532  TiXmlNode *InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis);
533 
537  TiXmlNode *ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis);
538 
540  bool RemoveChild(TiXmlNode *removeThis);
541 
543  const TiXmlNode *PreviousSibling() const { return prev; }
544  TiXmlNode *PreviousSibling() { return prev; }
545 
547  const TiXmlNode *PreviousSibling(const char *) const;
548  TiXmlNode *PreviousSibling(const char *_prev) {
549  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->PreviousSibling(_prev));
550  }
551 
552 #ifdef TIXML_USE_STL
553  const TiXmlNode *PreviousSibling(const std::string &_value) const { return PreviousSibling(_value.c_str()); }
554  TiXmlNode *PreviousSibling(const std::string &_value) { return PreviousSibling(_value.c_str()); }
555  const TiXmlNode *NextSibling(const std::string &_value) const { return NextSibling(_value.c_str()); }
556  TiXmlNode *NextSibling(const std::string &_value) { return NextSibling(_value.c_str()); }
557 #endif
558 
560  const TiXmlNode *NextSibling() const { return next; }
561  TiXmlNode *NextSibling() { return next; }
562 
564  const TiXmlNode *NextSibling(const char *) const;
565  TiXmlNode *NextSibling(const char *_next) {
566  return const_cast<TiXmlNode *>((const_cast<const TiXmlNode *>(this))->NextSibling(_next));
567  }
568 
573  const TiXmlElement *NextSiblingElement() const;
575  return const_cast<TiXmlElement *>((const_cast<const TiXmlNode *>(this))->NextSiblingElement());
576  }
577 
582  const TiXmlElement *NextSiblingElement(const char *) const;
583  TiXmlElement *NextSiblingElement(const char *_next) {
584  return const_cast<TiXmlElement *>((const_cast<const TiXmlNode *>(this))->NextSiblingElement(_next));
585  }
586 
587 #ifdef TIXML_USE_STL
588  const TiXmlElement *NextSiblingElement(const std::string &_value) const { return NextSiblingElement(_value.c_str()); }
589  TiXmlElement *NextSiblingElement(const std::string &_value) { return NextSiblingElement(_value.c_str()); }
590 #endif
591 
593  const TiXmlElement *FirstChildElement() const;
595  return const_cast<TiXmlElement *>((const_cast<const TiXmlNode *>(this))->FirstChildElement());
596  }
597 
599  const TiXmlElement *FirstChildElement(const char *_value) const;
600  TiXmlElement *FirstChildElement(const char *_value) {
601  return const_cast<TiXmlElement *>((const_cast<const TiXmlNode *>(this))->FirstChildElement(_value));
602  }
603 
604 #ifdef TIXML_USE_STL
605  const TiXmlElement *FirstChildElement(const std::string &_value) const { return FirstChildElement(_value.c_str()); }
606  TiXmlElement *FirstChildElement(const std::string &_value) { return FirstChildElement(_value.c_str()); }
607 #endif
608 
613  int Type() const { return type; }
614 
618  const TiXmlDocument *GetDocument() const;
620  return const_cast<TiXmlDocument *>((const_cast<const TiXmlNode *>(this))->GetDocument());
621  }
622 
624  bool NoChildren() const { return !firstChild; }
625 
626  virtual const TiXmlDocument *ToDocument() const { return 0; }
627  virtual const TiXmlElement *ToElement() const { return 0; }
628  virtual const TiXmlComment *ToComment() const { return 0; }
629  virtual const TiXmlUnknown *ToUnknown() const { return 0; }
630  virtual const TiXmlText *ToText() const { return 0; }
631  virtual const TiXmlDeclaration *ToDeclaration() const { return 0; }
632 
633  virtual TiXmlDocument *ToDocument() { return 0; }
634  virtual TiXmlElement *ToElement() { return 0; }
635  virtual TiXmlComment *ToComment() { return 0; }
636  virtual TiXmlUnknown *ToUnknown() { return 0; }
637  virtual TiXmlText *ToText() { return 0; }
638  virtual TiXmlDeclaration *ToDeclaration() { return 0; }
639 
643  virtual TiXmlNode *Clone() const = 0;
644 
667  virtual bool Accept(TiXmlVisitor *visitor) const = 0;
668 
669 protected:
670  TiXmlNode(NodeType _type);
671 
672  // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
673  // and the assignment operator.
674  void CopyTo(TiXmlNode *target) const;
675 
676 #ifdef TIXML_USE_STL
677  // The real work of the input operator.
678  virtual void StreamIn(std::istream *in, TIXML_STRING *tag) = 0;
679 #endif
680 
681  // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
682  TiXmlNode *Identify(const char *start, TiXmlEncoding encoding);
683 
684  TiXmlNode *parent;
685  NodeType type;
686 
687  TiXmlNode *firstChild;
688  TiXmlNode *lastChild;
689 
690  TIXML_STRING value;
691 
692  TiXmlNode *prev;
693  TiXmlNode *next;
694 
695 private:
696  TiXmlNode(const TiXmlNode &); // not implemented.
697  void operator=(const TiXmlNode &base); // not allowed.
698 };
699 
707 class TiXmlAttribute : public TiXmlBase {
708  friend class TiXmlAttributeSet;
709 
710 public:
713  document = 0;
714  prev = next = 0;
715  }
716 
717 #ifdef TIXML_USE_STL
718  TiXmlAttribute(const std::string &_name, const std::string &_value) {
720  name = _name;
721  value = _value;
722  document = 0;
723  prev = next = 0;
724  }
725 #endif
726 
728  TiXmlAttribute(const char *_name, const char *_value) {
729  name = _name;
730  value = _value;
731  document = 0;
732  prev = next = 0;
733  }
734 
735  const char *Name() const { return name.c_str(); }
736  const char *Value() const { return value.c_str(); }
737 #ifdef TIXML_USE_STL
738  const std::string &ValueStr() const { return value; }
739 #endif
740  int IntValue() const;
741  double DoubleValue() const;
742 
743  // Get the tinyxml string representation
744  const TIXML_STRING &NameTStr() const { return name; }
745 
755  int QueryIntValue(int *_value) const;
757  int QueryDoubleValue(double *_value) const;
758 
759  void SetName(const char *_name) { name = _name; }
760  void SetValue(const char *_value) { value = _value; }
761 
762  void SetIntValue(int _value);
763  void SetDoubleValue(double _value);
764 
765 #ifdef TIXML_USE_STL
766  void SetName(const std::string &_name) { name = _name; }
769  void SetValue(const std::string &_value) { value = _value; }
770 #endif
771 
773  const TiXmlAttribute *Next() const;
774  TiXmlAttribute *Next() {
775  return const_cast<TiXmlAttribute *>((const_cast<const TiXmlAttribute *>(this))->Next());
776  }
777 
779  const TiXmlAttribute *Previous() const;
780  TiXmlAttribute *Previous() {
781  return const_cast<TiXmlAttribute *>((const_cast<const TiXmlAttribute *>(this))->Previous());
782  }
783 
784  bool operator==(const TiXmlAttribute &rhs) const { return rhs.name == name; }
785  bool operator<(const TiXmlAttribute &rhs) const { return name < rhs.name; }
786  bool operator>(const TiXmlAttribute &rhs) const { return name > rhs.name; }
787 
788  /* Attribute parsing starts: first letter of the name
789  returns: the next char after the value end quote
790  */
791  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
792 
793  // Prints this Attribute to a FILE stream.
794  virtual void Print(Common::WriteStream &file, int depth) const {
795  Print(&file, depth, 0);
796  }
797  void Print(Common::WriteStream *cfile, int depth, TIXML_STRING *str) const;
798 
799  // [internal use]
800  // Set the document pointer so the attribute can report errors.
801  void SetDocument(TiXmlDocument *doc) { document = doc; }
802 
803 private:
804  TiXmlAttribute(const TiXmlAttribute &); // not implemented.
805  void operator=(const TiXmlAttribute &base); // not allowed.
806 
807  TiXmlDocument *document; // A pointer back to a document, for error reporting.
808  TIXML_STRING name;
809  TIXML_STRING value;
810  TiXmlAttribute *prev;
811  TiXmlAttribute *next;
812 };
813 
814 /* A class used to manage a group of attributes.
815  It is only used internally, both by the ELEMENT and the DECLARATION.
816 
817  The set can be changed transparent to the Element and Declaration
818  classes that use it, but NOT transparent to the Attribute
819  which has to implement a next() and previous() method. Which makes
820  it a bit problematic and prevents the use of STL.
821 
822  This version is implemented with circular lists because:
823  - I like circular lists
824  - it demonstrates some independence from the (typical) doubly linked list.
825 */
827 public:
830 
831  void Add(TiXmlAttribute *attribute);
832  void Remove(TiXmlAttribute *attribute);
833 
834  const TiXmlAttribute *First() const { return (sentinel.next == &sentinel) ? 0 : sentinel.next; }
835  TiXmlAttribute *First() { return (sentinel.next == &sentinel) ? 0 : sentinel.next; }
836  const TiXmlAttribute *Last() const { return (sentinel.prev == &sentinel) ? 0 : sentinel.prev; }
837  TiXmlAttribute *Last() { return (sentinel.prev == &sentinel) ? 0 : sentinel.prev; }
838 
839  const TiXmlAttribute *Find(const char *_name) const;
840  TiXmlAttribute *Find(const char *_name) {
841  return const_cast<TiXmlAttribute *>((const_cast<const TiXmlAttributeSet *>(this))->Find(_name));
842  }
843 #ifdef TIXML_USE_STL
844  const TiXmlAttribute *Find(const std::string &_name) const;
845  TiXmlAttribute *Find(const std::string &_name) {
846  return const_cast<TiXmlAttribute *>((const_cast<const TiXmlAttributeSet *>(this))->Find(_name));
847  }
848 
849 #endif
850 
851 private:
852  //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
853  //*ME: this class must be also use a hidden/disabled copy-constructor !!!
854  TiXmlAttributeSet(const TiXmlAttributeSet &); // not allowed
855  void operator=(const TiXmlAttributeSet &); // not allowed (as TiXmlAttribute)
856 
857  TiXmlAttribute sentinel;
858 };
859 
864 class TiXmlElement : public TiXmlNode {
865 public:
867  TiXmlElement(const char *in_value);
868 
869 #ifdef TIXML_USE_STL
870  TiXmlElement(const std::string &_value);
872 #endif
873 
874  TiXmlElement(const TiXmlElement &);
875 
876  void operator=(const TiXmlElement &base);
877 
878  virtual ~TiXmlElement();
879 
883  const char *Attribute(const char *name) const;
884 
891  const char *Attribute(const char *name, int *i) const;
892 
899  const char *Attribute(const char *name, double *d) const;
900 
908  int QueryIntAttribute(const char *name, int *_value) const;
910  int QueryDoubleAttribute(const char *name, double *_value) const;
912  int QueryFloatAttribute(const char *name, float *_value) const {
913  double d;
914  int result = QueryDoubleAttribute(name, &d);
915  if (result == TIXML_SUCCESS) {
916  *_value = (float)d;
917  }
918  return result;
919  }
920 #ifdef TIXML_USE_STL
921 
927  template<typename T>
928  int QueryValueAttribute(const std::string &name, T *outValue) const {
929  const TiXmlAttribute *node = attributeSet.Find(name);
930  if (!node)
931  return TIXML_NO_ATTRIBUTE;
932 
933  std::stringstream sstream(node->ValueStr());
934  sstream >> *outValue;
935  if (!sstream.fail())
936  return TIXML_SUCCESS;
937  return TIXML_WRONG_TYPE;
938  }
939 #endif
940 
944  void SetAttribute(const char *name, const char *_value);
945 
946 #ifdef TIXML_USE_STL
947  const std::string *Attribute(const std::string &name) const;
948  const std::string *Attribute(const std::string &name, int *i) const;
949  const std::string *Attribute(const std::string &name, double *d) const;
950  int QueryIntAttribute(const std::string &name, int *_value) const;
951  int QueryDoubleAttribute(const std::string &name, double *_value) const;
952 
954  void SetAttribute(const std::string &name, const std::string &_value);
956  void SetAttribute(const std::string &name, int _value);
957 #endif
958 
962  void SetAttribute(const char *name, int value);
963 
967  void SetDoubleAttribute(const char *name, double value);
968 
971  void RemoveAttribute(const char *name);
972 #ifdef TIXML_USE_STL
973  void RemoveAttribute(const std::string &name) { RemoveAttribute(name.c_str()); }
974 #endif
975 
976  const TiXmlAttribute *FirstAttribute() const { return attributeSet.First(); }
977  TiXmlAttribute *FirstAttribute() { return attributeSet.First(); }
978  const TiXmlAttribute *LastAttribute() const { return attributeSet.Last(); }
979  TiXmlAttribute *LastAttribute() { return attributeSet.Last(); }
980 
1013  const char *GetText() const;
1014 
1016  virtual TiXmlNode *Clone() const;
1017  // Print the Element to a FILE stream.
1018  virtual void Print(Common::WriteStream &cfile, int depth) const;
1019 
1020  /* Attribtue parsing starts: next char past '<'
1021  returns: next char past '>'
1022  */
1023  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1024 
1025  virtual const TiXmlElement *ToElement() const { return this; }
1026  virtual TiXmlElement *ToElement() { return this; }
1027 
1030  virtual bool Accept(TiXmlVisitor *visitor) const;
1031 
1032 protected:
1033  void CopyTo(TiXmlElement *target) const;
1034  void ClearThis(); // like clear, but initializes 'this' object as well
1035 
1036 // Used to be public [internal use]
1037 #ifdef TIXML_USE_STL
1038  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1039 #endif
1040  /* [internal use]
1041  Reads the "value" of the element -- another element, or text.
1042  This should terminate with the current end tag.
1043  */
1044  const char *ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding);
1045 
1046 private:
1047  TiXmlAttributeSet attributeSet;
1048 };
1049 
1052 class TiXmlComment : public TiXmlNode {
1053 public:
1057  TiXmlComment(const char *_value) : TiXmlNode(TiXmlNode::COMMENT) {
1058  SetValue(_value);
1059  }
1060  TiXmlComment(const TiXmlComment &);
1061  void operator=(const TiXmlComment &base);
1062 
1063  virtual ~TiXmlComment() {}
1064 
1066  virtual TiXmlNode *Clone() const;
1067  // Write this Comment to a FILE stream.
1068  virtual void Print(Common::WriteStream &cfile, int depth) const;
1069 
1070  /* Attribtue parsing starts: at the ! of the !--
1071  returns: next char past '>'
1072  */
1073  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1074 
1075  virtual const TiXmlComment *ToComment() const { return this; }
1076  virtual TiXmlComment *ToComment() { return this; }
1077 
1080  virtual bool Accept(TiXmlVisitor *visitor) const;
1081 
1082 protected:
1083  void CopyTo(TiXmlComment *target) const;
1084 
1085 // used to be public
1086 #ifdef TIXML_USE_STL
1087  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1088 #endif
1089  // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1090 
1091 private:
1092 };
1093 
1099 class TiXmlText : public TiXmlNode {
1100  friend class TiXmlElement;
1101 
1102 public:
1107  TiXmlText(const char *initValue) : TiXmlNode(TiXmlNode::TEXT) {
1108  SetValue(initValue);
1109  cdata = false;
1110  }
1111  virtual ~TiXmlText() {}
1112 
1113 #ifdef TIXML_USE_STL
1114  TiXmlText(const std::string &initValue) : TiXmlNode(TiXmlNode::TEXT) {
1116  SetValue(initValue);
1117  cdata = false;
1118  }
1119 #endif
1120 
1121  TiXmlText(const TiXmlText &copy) : TiXmlNode(TiXmlNode::TEXT) { copy.CopyTo(this); }
1122  void operator=(const TiXmlText &base) { base.CopyTo(this); }
1123 
1124  // Write this text object to a FILE stream.
1125  virtual void Print(Common::WriteStream &cfile, int depth) const;
1126 
1128  bool CDATA() const { return cdata; }
1130  void SetCDATA(bool _cdata) { cdata = _cdata; }
1131 
1132  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1133 
1134  virtual const TiXmlText *ToText() const { return this; }
1135  virtual TiXmlText *ToText() { return this; }
1136 
1139  virtual bool Accept(TiXmlVisitor *content) const;
1140 
1141 protected:
1143  virtual TiXmlNode *Clone() const;
1144  void CopyTo(TiXmlText *target) const;
1145 
1146  bool Blank() const; // returns true if all white space and new lines
1147 // [internal use]
1148 #ifdef TIXML_USE_STL
1149  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1150 #endif
1151 
1152 private:
1153  bool cdata; // true if this should be input and output as a CDATA style text element
1154 };
1155 
1169 class TiXmlDeclaration : public TiXmlNode {
1170 public:
1172  TiXmlDeclaration() : TiXmlNode(TiXmlNode::DECLARATION) {}
1173 
1174 #ifdef TIXML_USE_STL
1175  TiXmlDeclaration(const std::string &_version,
1177  const std::string &_encoding,
1178  const std::string &_standalone);
1179 #endif
1180 
1182  TiXmlDeclaration(const char *_version,
1183  const char *_encoding,
1184  const char *_standalone);
1185 
1187  void operator=(const TiXmlDeclaration &copy);
1188 
1189  virtual ~TiXmlDeclaration() {}
1190 
1192  const char *Version() const { return version.c_str(); }
1194  const char *Encoding() const { return encoding.c_str(); }
1196  const char *Standalone() const { return standalone.c_str(); }
1197 
1199  virtual TiXmlNode *Clone() const;
1200  // Print this declaration to a FILE stream.
1201  virtual void Print(Common::WriteStream *cfile, int depth, TIXML_STRING *str) const;
1202  virtual void Print(Common::WriteStream &cfile, int depth) const {
1203  Print(&cfile, depth, 0);
1204  }
1205 
1206  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1207 
1208  virtual const TiXmlDeclaration *ToDeclaration() const { return this; }
1209  virtual TiXmlDeclaration *ToDeclaration() { return this; }
1210 
1213  virtual bool Accept(TiXmlVisitor *visitor) const;
1214 
1215 protected:
1216  void CopyTo(TiXmlDeclaration *target) const;
1217 // used to be public
1218 #ifdef TIXML_USE_STL
1219  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1220 #endif
1221 
1222 private:
1223  TIXML_STRING version;
1224  TIXML_STRING encoding;
1225  TIXML_STRING standalone;
1226 };
1227 
1235 class TiXmlUnknown : public TiXmlNode {
1236 public:
1237  TiXmlUnknown() : TiXmlNode(TiXmlNode::UNKNOWN) {}
1238  virtual ~TiXmlUnknown() {}
1239 
1240  TiXmlUnknown(const TiXmlUnknown &copy) : TiXmlNode(TiXmlNode::UNKNOWN) { copy.CopyTo(this); }
1241  void operator=(const TiXmlUnknown &copy) { copy.CopyTo(this); }
1242 
1244  virtual TiXmlNode *Clone() const;
1245  // Print this Unknown to a FILE stream.
1246  virtual void Print(Common::WriteStream &cfile, int depth) const;
1247 
1248  virtual const char *Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding);
1249 
1250  virtual const TiXmlUnknown *ToUnknown() const { return this; }
1251  virtual TiXmlUnknown *ToUnknown() { return this; }
1252 
1255  virtual bool Accept(TiXmlVisitor *content) const;
1256 
1257 protected:
1258  void CopyTo(TiXmlUnknown *target) const;
1259 
1260 #ifdef TIXML_USE_STL
1261  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1262 #endif
1263 
1264 private:
1265 };
1266 
1271 class TiXmlDocument : public TiXmlNode {
1272 public:
1274  TiXmlDocument();
1276  TiXmlDocument(const char *documentName);
1277 
1278 #ifdef TIXML_USE_STL
1279  TiXmlDocument(const std::string &documentName);
1281 #endif
1282 
1284  void operator=(const TiXmlDocument &copy);
1285 
1286  virtual ~TiXmlDocument() {}
1287 
1292  bool LoadFile(TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1294  bool SaveFile() const;
1296  bool LoadFile(const char *filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1298  bool SaveFile(const char *filename) const;
1304  bool LoadFile(Common::SeekableReadStream &file, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1306  bool SaveFile(Common::WriteStream &) const;
1307 
1308 #ifdef TIXML_USE_STL
1309  bool LoadFile(const std::string &filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING)
1310  {
1311  // StringToBuffer f( filename );
1312  // return ( f.buffer && LoadFile( f.buffer, encoding ));
1313  return LoadFile(filename.c_str(), encoding);
1314  }
1315  bool SaveFile(const std::string &filename) const
1316  {
1317  // StringToBuffer f( filename );
1318  // return ( f.buffer && SaveFile( f.buffer ));
1319  return SaveFile(filename.c_str());
1320  }
1321 #endif
1322 
1327  virtual const char *Parse(const char *p, TiXmlParsingData *data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1328 
1333  const TiXmlElement *RootElement() const { return FirstChildElement(); }
1334  TiXmlElement *RootElement() { return FirstChildElement(); }
1335 
1341  bool Error() const { return error; }
1342 
1344  const char *ErrorDesc() const { return errorDesc.c_str(); }
1345 
1349  int ErrorId() const { return errorId; }
1350 
1358  int ErrorRow() const { return errorLocation.row + 1; }
1359  int ErrorCol() const { return errorLocation.col + 1; }
1360 
1385  void SetTabSize(int _tabsize) { tabsize = _tabsize; }
1386 
1387  int TabSize() const { return tabsize; }
1388 
1392  void ClearError() {
1393  error = false;
1394  errorId = 0;
1395  errorDesc = "";
1396  errorLocation.row = errorLocation.col = 0;
1397  // errorLocation.last = 0;
1398  }
1399 
1401  // void Print() const { Print(stdout, 0); }
1402 
1403  /* Write the document to a string using formatted printing ("pretty print"). This
1404  will allocate a character array (new char[]) and return it as a pointer. The
1405  calling code pust call delete[] on the return char* to avoid a memory leak.
1406  */
1407  // char* PrintToMemory() const;
1408 
1410  virtual void Print(Common::WriteStream &file, int depth = 0) const;
1411  // [internal use]
1412  void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding);
1413 
1414  virtual const TiXmlDocument *ToDocument() const { return this; }
1415  virtual TiXmlDocument *ToDocument() { return this; }
1416 
1419  virtual bool Accept(TiXmlVisitor *content) const;
1420 
1421 protected:
1422  // [internal use]
1423  virtual TiXmlNode *Clone() const;
1424 #ifdef TIXML_USE_STL
1425  virtual void StreamIn(std::istream *in, TIXML_STRING *tag);
1426 #endif
1427 
1428 private:
1429  void CopyTo(TiXmlDocument *target) const;
1430 
1431  bool error;
1432  int errorId;
1433  TIXML_STRING errorDesc;
1434  int tabsize;
1435  TiXmlCursor errorLocation;
1436  bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
1437 };
1438 
1520 public:
1522  TiXmlHandle(TiXmlNode *_node) { this->node = _node; }
1524  TiXmlHandle(const TiXmlHandle &ref) { this->node = ref.node; }
1525  TiXmlHandle operator=(const TiXmlHandle &ref) {
1526  this->node = ref.node;
1527  return *this;
1528  }
1529 
1531  TiXmlHandle FirstChild() const;
1533  TiXmlHandle FirstChild(const char *value) const;
1535  TiXmlHandle FirstChildElement() const;
1537  TiXmlHandle FirstChildElement(const char *value) const;
1538 
1542  TiXmlHandle Child(const char *value, int index) const;
1546  TiXmlHandle Child(int index) const;
1551  TiXmlHandle ChildElement(const char *value, int index) const;
1556  TiXmlHandle ChildElement(int index) const;
1557 
1558 #ifdef TIXML_USE_STL
1559  TiXmlHandle FirstChild(const std::string &_value) const { return FirstChild(_value.c_str()); }
1560  TiXmlHandle FirstChildElement(const std::string &_value) const { return FirstChildElement(_value.c_str()); }
1561 
1562  TiXmlHandle Child(const std::string &_value, int index) const { return Child(_value.c_str(), index); }
1563  TiXmlHandle ChildElement(const std::string &_value, int index) const { return ChildElement(_value.c_str(), index); }
1564 #endif
1565 
1568  TiXmlNode *ToNode() const { return node; }
1571  TiXmlElement *ToElement() const { return ((node && node->ToElement()) ? node->ToElement() : 0); }
1574  TiXmlText *ToText() const { return ((node && node->ToText()) ? node->ToText() : 0); }
1577  TiXmlUnknown *ToUnknown() const { return ((node && node->ToUnknown()) ? node->ToUnknown() : 0); }
1578 
1582  TiXmlNode *Node() const { return ToNode(); }
1586  TiXmlElement *Element() const { return ToElement(); }
1590  TiXmlText *Text() const { return ToText(); }
1594  TiXmlUnknown *Unknown() const { return ToUnknown(); }
1595 
1596 private:
1597  TiXmlNode *node;
1598 };
1599 
1619 class TiXmlPrinter : public TiXmlVisitor {
1620 public:
1621  TiXmlPrinter() : depth(0), simpleTextPrint(false),
1622  buffer(), indent(" "), lineBreak("\n") {}
1623 
1624  virtual bool VisitEnter(const TiXmlDocument &doc);
1625  virtual bool VisitExit(const TiXmlDocument &doc);
1626 
1627  virtual bool VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute);
1628  virtual bool VisitExit(const TiXmlElement &element);
1629 
1630  virtual bool Visit(const TiXmlDeclaration &declaration);
1631  virtual bool Visit(const TiXmlText &text);
1632  virtual bool Visit(const TiXmlComment &comment);
1633  virtual bool Visit(const TiXmlUnknown &unknown);
1634 
1638  void SetIndent(const char *_indent) { indent = _indent ? _indent : ""; }
1640  const char *Indent() { return indent.c_str(); }
1645  void SetLineBreak(const char *_lineBreak) { lineBreak = _lineBreak ? _lineBreak : ""; }
1647  const char *LineBreak() { return lineBreak.c_str(); }
1648 
1653  indent = "";
1654  lineBreak = "";
1655  }
1657  const char *CStr() { return buffer.c_str(); }
1659  size_t Size() { return buffer.size(); }
1660 
1661 #ifdef TIXML_USE_STL
1662  const std::string &Str() { return buffer; }
1664 #endif
1665 
1666 private:
1667  void DoIndent() {
1668  for (int i = 0; i < depth; ++i)
1669  buffer += indent;
1670  }
1671  void DoLineBreak() {
1672  buffer += lineBreak;
1673  }
1674 
1675  int depth;
1676  bool simpleTextPrint;
1677  TIXML_STRING buffer;
1678  TIXML_STRING indent;
1679  TIXML_STRING lineBreak;
1680 };
1681 
1682 #ifdef _MSC_VER
1683 #pragma warning(pop)
1684 #endif
1685 
1686 #endif
void ClearError()
Definition: tinyxml.h:1392
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1251
int Row() const
Definition: tinyxml.h:198
Definition: tinyxml.h:1271
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.h:92
TiXmlNode * Parent()
One step up the DOM.
Definition: tinyxml.h:449
void SetTabSize(int _tabsize)
Definition: tinyxml.h:1385
int ErrorId() const
Definition: tinyxml.h:1349
TiXmlComment(const char *_value)
Construct a comment from text.
Definition: tinyxml.h:1057
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition: tinyxml.h:203
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition: tinyxml.h:1130
NodeType
Definition: tinyxml.h:395
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:628
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1359
Definition: stream.h:77
virtual bool Visit(const TiXmlComment &comment)
Visit a comment node.
Definition: tinyxml.h:106
TiXmlUnknown * ToUnknown() const
Definition: tinyxml.h:1577
Definition: tinyxml.h:1235
static void SetCondenseWhiteSpace(bool condense)
Definition: tinyxml.h:175
Definition: tinyxml.h:1519
size_t Size()
Return the length of the result string.
Definition: tinyxml.h:1659
bool isSpace(int c)
virtual bool Accept(TiXmlVisitor *visitor) const
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
virtual void Print(Common::WriteStream &cfile, int depth) const
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1075
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml.h:1522
virtual void Print(Common::WriteStream &file, int depth=0) const
Print this Document to file.
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
void SetIndent(const char *_indent)
Definition: tinyxml.h:1638
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1135
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:543
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:636
Definition: tinyxml.h:61
Definition: stream.h:745
const char * Name() const
Return the name of this attribute.
Definition: tinyxml.h:735
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:633
const TiXmlDocument * GetDocument() const
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
Definition: tinyxml.h:357
virtual bool Visit(const TiXmlUnknown &unknown)
Visit an unknow node.
Definition: tinyxml.h:108
TiXmlComment()
Constructs an empty comment.
Definition: tinyxml.h:1055
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:630
void SetStreamPrinting()
Definition: tinyxml.h:1652
TiXmlUnknown * Unknown() const
Definition: tinyxml.h:1594
virtual bool Visit(const TiXmlText &text)
Visit a text node.
Definition: tinyxml.h:104
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition: tinyxml.h:452
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:627
TiXmlText(const char *initValue)
Definition: tinyxml.h:1107
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:759
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1250
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1208
TiXmlAttribute()
Construct an empty attribute.
Definition: tinyxml.h:712
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition: tinyxml.h:1194
Definition: tinyxml.h:707
const TiXmlElement * RootElement() const
Definition: tinyxml.h:1333
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1209
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:638
int Column() const
See Row()
Definition: tinyxml.h:199
void Clear()
Delete all the children of this node. Does not affect &#39;this&#39;.
TiXmlText * ToText() const
Definition: tinyxml.h:1574
Definition: tinyxml.h:149
Definition: tinyxml.h:1052
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml.h:624
Definition: tinyxml.h:1169
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition: tinyxml.h:1128
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
TiXmlDeclaration()
Construct an empty declaration.
Definition: tinyxml.h:1172
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition: tinyxml.h:976
int Type() const
Definition: tinyxml.h:613
const TiXmlElement * NextSiblingElement() const
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
void * userData
Field containing a generic user pointer.
Definition: tinyxml.h:316
int ErrorRow() const
Definition: tinyxml.h:1358
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1025
bool Error() const
Definition: tinyxml.h:1341
void SetValue(const char *_value)
Set the value.
Definition: tinyxml.h:760
TiXmlElement * ToElement() const
Definition: tinyxml.h:1571
TiXmlNode * Node() const
Definition: tinyxml.h:1582
Definition: tinyxml.h:87
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:631
const char * Value() const
Definition: tinyxml.h:419
void * GetUserData()
Get a pointer to arbitrary user data.
Definition: tinyxml.h:202
const char * Standalone() const
Is this a standalone document?
Definition: tinyxml.h:1196
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1415
const char * CStr()
Return the result.
Definition: tinyxml.h:1657
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
TiXmlText * Text() const
Definition: tinyxml.h:1590
const char * Indent()
Query the indention string.
Definition: tinyxml.h:1640
void SetValue(const char *_value)
Definition: tinyxml.h:438
Definition: tinyxml.h:1099
TiXmlNode * ToNode() const
Definition: tinyxml.h:1568
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition: tinyxml.h:178
virtual void Print(Common::WriteStream &file, int depth) const
Definition: tinyxml.h:794
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
TiXmlElement * Element() const
Definition: tinyxml.h:1586
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1134
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:635
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1076
Definition: tinyxml.h:826
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
Definition: tinyxml.h:94
Definition: tinyxml.h:864
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition: tinyxml.h:978
const char * Version() const
Version. Will return an empty string if none was found.
Definition: tinyxml.h:1192
void SetLineBreak(const char *_lineBreak)
Definition: tinyxml.h:1645
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:465
virtual bool VisitExit(const TiXmlElement &element)
Visit an element.
Definition: tinyxml.h:99
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition: tinyxml.h:912
virtual void Print(Common::WriteStream &cfile, int depth) const
Definition: tinyxml.h:1202
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:637
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:629
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1414
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
const char * LineBreak()
Query the current line breaking string.
Definition: tinyxml.h:1647
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition: tinyxml.h:462
Definition: tinyxml.h:1619
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:626
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition: tinyxml.h:560
virtual bool VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute)
Visit an element.
Definition: tinyxml.h:97
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition: tinyxml.h:201
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition: tinyxml.h:634
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition: tinyxml.h:1524
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
const char * Value() const
Return the value of this attribute.
Definition: tinyxml.h:736
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1344
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition: tinyxml.h:1026
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
Definition: tinyxml.h:102
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition: tinyxml.h:728