aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
tinyxml.h
Go to the documentation of this file.
1/*
2www.sourceforge.net/projects/tinyxml
3Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason
4(www.grinninglizard.com)
5
6This software is provided 'as-is', without any express or implied
7warranty. In no event will the authors be held liable for any
8damages arising from the use of this software.
9
10Permission is granted to anyone to use this software for any
11purpose, including commercial applications, and to alter it and
12redistribute it freely, subject to the following restrictions:
13
141. The origin of this software must not be misrepresented; you must
15not claim that you wrote the original software. If you use this
16software in a product, an acknowledgment in the product documentation
17would be appreciated but is not required.
18
192. Altered source versions must be plainly marked as such, and
20must not be misrepresented as being the original software.
21
223. This notice may not be removed or altered from any source
23distribution.
24*/
25
26#ifndef TINYXML_INCLUDED
27#define TINYXML_INCLUDED
28
29#define TIXML_USE_TICPP
30
31#ifdef _MSC_VER
32#pragma warning(push)
33#pragma warning(disable : 4530)
34#pragma warning(disable : 4786)
35#endif
36
37#include <cctype>
38
39#include <assert.h>
40#include <ctype.h>
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
45// Help out windows:
46#if defined(_DEBUG) && !defined(DEBUG)
47#define DEBUG
48#endif
49
50#ifdef TIXML_USE_TICPP
51#ifndef TIXML_USE_STL
52#define TIXML_USE_STL
53#endif
54#endif
55
56#ifdef TIXML_USE_STL
57#include <iostream>
58#include <sstream>
59#include <string>
60#define TIXML_STRING std::string
61#else
62#include "tinystr.h"
63#define TIXML_STRING TiXmlString
64#endif
65
66// Deprecated library function hell. Compilers want to use the
67// new safe versions. This probably doesn't fully address the problem,
68// but it gets closer. There are too many compilers for me to fully
69// test. If you get compilation troubles, undefine TIXML_SAFE
70#define TIXML_SAFE
71
72#ifdef TIXML_SAFE
73#if defined(_MSC_VER) && (_MSC_VER >= 1400)
74// Microsoft visual studio, version 2005 and higher.
75#define TIXML_SNPRINTF _snprintf_s
76#define TIXML_SNSCANF _snscanf_s
77#define TIXML_SSCANF sscanf_s
78#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
79// Microsoft visual studio, version 6 and higher.
80//#pragma message( "Using _sn* functions." )
81#define TIXML_SNPRINTF _snprintf
82#define TIXML_SNSCANF _snscanf
83#define TIXML_SSCANF sscanf
84#elif defined( __GNUC__) && ( __GNUC__ >= 3)
85// GCC version 3 and higher.s
86//#warning( "Using sn* functions." )
87#define TIXML_SNPRINTF snprintf
88#define TIXML_SNSCANF snscanf
89#define TIXML_SSCANF sscanf
90#else
91#define TIXML_SSCANF sscanf
92#endif
93#endif
94
95class TiXmlDocument;
96class TiXmlElement;
97class TiXmlComment;
98class TiXmlUnknown;
99class TiXmlAttribute;
100class TiXmlText;
101class TiXmlDeclaration;
103class TiXmlParsingData;
104
108
109/* Internal structure for tracking location of items
110 in the XML file.
111*/
114 void Clear() { row = col = -1; }
115
116 int row; // 0 based.
117 int col; // 0 based.
118};
119
145 public:
146 virtual ~TiXmlVisitor() {}
147
149 virtual bool VisitEnter(const TiXmlDocument& /*doc*/) { return true; }
151 virtual bool VisitExit(const TiXmlDocument& /*doc*/) { return true; }
152
154 virtual bool VisitEnter(const TiXmlElement& /*element*/,
155 const TiXmlAttribute* /*firstAttribute*/) {
156 return true;
157 }
158
159 virtual bool VisitExit(const TiXmlElement& /*element*/) { return true; }
160
162 virtual bool Visit(const TiXmlDeclaration& /*declaration*/) { return true; }
164 virtual bool Visit(const TiXmlStylesheetReference& /*stylesheet*/) {
165 return true;
166 }
167
168 virtual bool Visit(const TiXmlText& /*text*/) { return true; }
170 virtual bool Visit(const TiXmlComment& /*comment*/) { return true; }
172 virtual bool Visit(const TiXmlUnknown& /*unknown*/) { return true; }
173};
174
175// Only used by Attribute::Query functions
177
178// Used by the parsing routines.
184
186
209#ifdef TIXML_USE_TICPP
210#include "ticpprc.h"
211class TiXmlBase : public TiCppRC
212#else
213class TiXmlBase
214#endif
215{
216 friend class TiXmlNode;
217 friend class TiXmlElement;
218 friend class TiXmlDocument;
219
220 public:
222 : userData(0) {}
223 virtual ~TiXmlBase() {}
224
234 virtual void Print(FILE* cfile, int depth) const = 0;
235
242 static void SetCondenseWhiteSpace(bool condense) {
243 condenseWhiteSpace = condense;
244 }
245
248
275 int Row() const { return location.row + 1; }
276 int Column() const { return location.col + 1; }
277
278 void SetUserData(void* user) {
279 userData = user;
280 }
281 void* GetUserData() {
282 return userData;
283 }
284 const void* GetUserData() const {
285 return userData;
286 }
287
288 // Table that returs, for a given lead byte, the total number of bytes
289 // in the UTF-8 sequence.
290 static const int utf8ByteTable[256];
291
292 virtual const char*
293 Parse(const char* p,
294 TiXmlParsingData* data,
295 TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */) = 0;
296
302 static void EncodeString(const TIXML_STRING& str, TIXML_STRING* out);
303
304 enum {
322
324 };
325
326 protected:
327 static const char* SkipWhiteSpace(const char*, TiXmlEncoding encoding);
328 inline static bool IsWhiteSpace(char c) {
329 return (std::isspace((unsigned char)c) || c == '\n' || c == '\r');
330 }
331 inline static bool IsWhiteSpace(int c) {
332 if (c < 256) return IsWhiteSpace((char)c);
333
334 return false; // Again, only truly correct for English/Latin...but usually
335 // works.
336 }
337
338#ifdef TIXML_USE_STL
339 static bool StreamWhiteSpace(std::istream* in, TIXML_STRING* tag);
340 static bool StreamTo(std::istream* in, int character, TIXML_STRING* tag);
341#endif
342
343 /* Reads an XML name into the string provided. Returns
344 a pointer just past the last character of the name,
345 or 0 if the function has an error.
346 */
347 static const char*
348 ReadName(const char* p, TIXML_STRING* name, TiXmlEncoding encoding);
349
350 /* Reads text. Returns a pointer past the given end tag.
351 Wickedly complex options, but it keeps the (sensitive) code in one place.
352 */
353 static const char*
354 ReadText(const char* in, // where to start
355 TIXML_STRING* text, // the string read
356 bool ignoreWhiteSpace, // whether to keep the white space
357 const char* endTag, // what ends this text
358 bool ignoreCase, // whether to ignore case in the end tag
359 TiXmlEncoding encoding); // the current encoding
360
361 // If an entity has been found, transform it into a character.
362 static const char*
363 GetEntity(const char* in, char* value, int* length, TiXmlEncoding encoding);
364
365 // Get a character, while interpreting entities.
366 // The length can be from 0 to 4 bytes.
367 inline static const char*
368 GetChar(const char* p, char* _value, int* length, TiXmlEncoding encoding) {
369 assert(p);
370
371 if (encoding == TIXML_ENCODING_UTF8) {
372 *length = utf8ByteTable[*((const unsigned char*)p)];
373 assert(*length >= 0 && *length < 5);
374 } else {
375 *length = 1;
376 }
377
378 if (*length == 1) {
379 if (*p == '&') return GetEntity(p, _value, length, encoding);
380
381 *_value = *p;
382 return p + 1;
383 } else if (*length) {
384 // strncpy( _value, p, *length ); // lots of compilers don't like this
385 // function (unsafe),
386 // and the null terminator isn't needed
387 for (int i = 0; p[i] && i < *length; ++i) {
388 _value[i] = p[i];
389 }
390
391 return p + (*length);
392 } else {
393 // Not valid text.
394 return 0;
395 }
396 }
397
398 // Return true if the next characters in the stream are any of the endTag
399 // sequences.
400 // Ignore case only works for english, and should only be relied on when
401 // comparing
402 // to English words: StringEqual( p, "version", true ) is fine.
403 static bool StringEqual(const char* p,
404 const char* endTag,
405 bool ignoreCase,
406 TiXmlEncoding encoding);
407
408 static const char* errorString[TIXML_ERROR_STRING_COUNT];
409
411
413 void* userData;
414
415 // None of these methods are reliable for any language except English.
416 // Good for approximation, not great for accuracy.
417 static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding);
418 static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding);
419 inline static int ToLower(int v, TiXmlEncoding encoding) {
420 if (encoding == TIXML_ENCODING_UTF8) {
421 if (v < 128) return std::tolower(v);
422
423 return v;
424 } else {
425 return std::tolower(v);
426 }
427 }
428 static void ConvertUTF32ToUTF8(unsigned long input, char* output, int* length);
429
430 private:
431 TiXmlBase(const TiXmlBase&); // not implemented.
432 void operator=(const TiXmlBase& base); // not allowed.
433
434 struct Entity {
435 const char* str;
436 unsigned int strLength;
437 char chr;
438 };
439 enum {
442
443 };
444 static Entity entity[NUM_ENTITY];
446};
447
454class TiXmlNode : public TiXmlBase {
455 friend class TiXmlDocument;
456 friend class TiXmlElement;
457
458 public:
459#ifdef TIXML_USE_STL
460
464 friend std::istream& operator>>(std::istream& in, TiXmlNode& base);
465
482 friend std::ostream& operator<<(std::ostream& out, const TiXmlNode& base);
483
485 friend std::string& operator<<(std::string& out, const TiXmlNode& base);
486
487#endif
488
502
503 virtual ~TiXmlNode();
504
517 const char* Value() const { return value.c_str(); }
518
519#ifdef TIXML_USE_STL
524 const std::string& ValueStr() const { return value; }
525#endif
526
527 const TIXML_STRING& ValueTStr() const { return value; }
528
538 void SetValue(const char* _value) { value = _value; }
539
540#ifdef TIXML_USE_STL
542 void SetValue(const std::string& _value) { value = _value; }
543#endif
544
546 void Clear();
547
549 TiXmlNode* Parent() { return parent; }
550 const TiXmlNode* Parent() const { return parent; }
551
552 const TiXmlNode* FirstChild() const {
553 return firstChild;
554 }
556 const TiXmlNode*
557 FirstChild(const char* value) const;
564 TiXmlNode* FirstChild(const char* _value) {
565 // Call through to the const version - safe since nothing is changed.
566 // Exiting
567 // syntax: cast this to a const (always safe)
568 // call the method, cast the return back to non-const.
569 return const_cast< TiXmlNode* >(
570 (const_cast< const TiXmlNode* >(this))->FirstChild(_value));
571 }
572 const TiXmlNode* LastChild() const {
573 return lastChild;
574 }
576
577 const TiXmlNode* LastChild(const char* value) const;
581 TiXmlNode* LastChild(const char* _value) {
582 return const_cast< TiXmlNode* >(
583 (const_cast< const TiXmlNode* >(this))->LastChild(_value));
584 }
585
586#ifdef TIXML_USE_STL
587 const TiXmlNode* FirstChild(const std::string& _value) const {
588 return FirstChild(_value.c_str());
589 }
590 TiXmlNode* FirstChild(const std::string& _value) {
591 return FirstChild(_value.c_str());
592 }
593 const TiXmlNode* LastChild(const std::string& _value) const {
594 return LastChild(_value.c_str());
595 }
596 TiXmlNode* LastChild(const std::string& _value) {
597 return LastChild(_value.c_str());
598 }
599#endif
600
617 const TiXmlNode* IterateChildren(const TiXmlNode* previous) const;
619 return const_cast< TiXmlNode* >(
620 (const_cast< const TiXmlNode* >(this))->IterateChildren(previous));
621 }
622
625 const TiXmlNode* IterateChildren(const char* value,
626 const TiXmlNode* previous) const;
627 TiXmlNode* IterateChildren(const char* _value, const TiXmlNode* previous) {
628 return const_cast< TiXmlNode* >(
629 (const_cast< const TiXmlNode* >(this))->IterateChildren(_value, previous));
630 }
631
632#ifdef TIXML_USE_STL
633 const TiXmlNode* IterateChildren(const std::string& _value,
634 const TiXmlNode* previous) const {
635 return IterateChildren(_value.c_str(), previous);
636 }
637 TiXmlNode* IterateChildren(const std::string& _value,
638 const TiXmlNode* previous) {
639 return IterateChildren(_value.c_str(), previous);
640 }
641#endif
642
646 TiXmlNode* InsertEndChild(const TiXmlNode& addThis);
647
658
662 TiXmlNode* InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis);
663
667 TiXmlNode* InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis);
668
672 TiXmlNode* ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis);
673
675 bool RemoveChild(TiXmlNode* removeThis);
676
678 const TiXmlNode* PreviousSibling() const { return prev; }
680
682 const TiXmlNode* PreviousSibling(const char*) const;
683 TiXmlNode* PreviousSibling(const char* _prev) {
684 return const_cast< TiXmlNode* >(
685 (const_cast< const TiXmlNode* >(this))->PreviousSibling(_prev));
686 }
687
688#ifdef TIXML_USE_STL
689 const TiXmlNode* PreviousSibling(const std::string& _value) const {
690 return PreviousSibling(_value.c_str());
691 }
692 TiXmlNode* PreviousSibling(const std::string& _value) {
693 return PreviousSibling(_value.c_str());
694 }
695 const TiXmlNode* NextSibling(const std::string& _value) const {
696 return NextSibling(_value.c_str());
697 }
698 TiXmlNode* NextSibling(const std::string& _value) {
699 return NextSibling(_value.c_str());
700 }
701#endif
702
704 const TiXmlNode* NextSibling() const { return next; }
706
708 const TiXmlNode* NextSibling(const char*) const;
709 TiXmlNode* NextSibling(const char* _next) {
710 return const_cast< TiXmlNode* >(
711 (const_cast< const TiXmlNode* >(this))->NextSibling(_next));
712 }
713
718 const TiXmlElement* NextSiblingElement() const;
720 return const_cast< TiXmlElement* >(
721 (const_cast< const TiXmlNode* >(this))->NextSiblingElement());
722 }
723
728 const TiXmlElement* NextSiblingElement(const char*) const;
729 TiXmlElement* NextSiblingElement(const char* _next) {
730 return const_cast< TiXmlElement* >(
731 (const_cast< const TiXmlNode* >(this))->NextSiblingElement(_next));
732 }
733
734#ifdef TIXML_USE_STL
735 const TiXmlElement* NextSiblingElement(const std::string& _value) const {
736 return NextSiblingElement(_value.c_str());
737 }
738 TiXmlElement* NextSiblingElement(const std::string& _value) {
739 return NextSiblingElement(_value.c_str());
740 }
741#endif
742
744 const TiXmlElement* FirstChildElement() const;
746 return const_cast< TiXmlElement* >(
747 (const_cast< const TiXmlNode* >(this))->FirstChildElement());
748 }
749
751 const TiXmlElement* FirstChildElement(const char* _value) const;
752 TiXmlElement* FirstChildElement(const char* _value) {
753 return const_cast< TiXmlElement* >(
754 (const_cast< const TiXmlNode* >(this))->FirstChildElement(_value));
755 }
756
757#ifdef TIXML_USE_STL
758 const TiXmlElement* FirstChildElement(const std::string& _value) const {
759 return FirstChildElement(_value.c_str());
760 }
761 TiXmlElement* FirstChildElement(const std::string& _value) {
762 return FirstChildElement(_value.c_str());
763 }
764#endif
765
770 int Type() const { return type; }
771
775 const TiXmlDocument* GetDocument() const;
777 return const_cast< TiXmlDocument* >(
778 (const_cast< const TiXmlNode* >(this))->GetDocument());
779 }
780
782 bool NoChildren() const { return !firstChild; }
783
784 virtual const TiXmlDocument* ToDocument() const {
785 return 0;
786 }
788 virtual const TiXmlElement* ToElement() const {
789 return 0;
790 }
792 virtual const TiXmlComment* ToComment() const {
793 return 0;
794 }
796 virtual const TiXmlUnknown* ToUnknown() const {
797 return 0;
798 }
800 virtual const TiXmlText* ToText() const {
801 return 0;
802 }
804 virtual const TiXmlDeclaration* ToDeclaration() const {
805 return 0;
806 }
809 return 0;
810 }
812
814 return 0;
815 }
818 return 0;
819 }
822 return 0;
823 }
826 return 0;
827 }
829 virtual TiXmlText* ToText() {
830 return 0;
831 }
834 return 0;
835 }
838 return 0;
839 }
841
846 virtual TiXmlNode* Clone() const = 0;
847
873 virtual bool Accept(TiXmlVisitor* visitor) const = 0;
874
875 protected:
876 TiXmlNode(NodeType _type);
877
878 // Copy to the allocated object. Shared functionality between Clone, Copy
879 // constructor,
880 // and the assignment operator.
881 void CopyTo(TiXmlNode* target) const;
882
883#ifdef TIXML_USE_STL
884 // The real work of the input operator.
885 virtual void StreamIn(std::istream* in, TIXML_STRING* tag) = 0;
886#endif
887
888 // Figure out what is at *p, and parse it. Returns null if it is not an xml
889 // node.
890 TiXmlNode* Identify(const char* start, TiXmlEncoding encoding);
891
894
897
899
902
903 private:
904 TiXmlNode(const TiXmlNode&); // not implemented.
905 void operator=(const TiXmlNode& base); // not allowed.
906};
907
915class TiXmlAttribute : public TiXmlBase {
916 friend class TiXmlAttributeSet;
917
918 public:
921 : TiXmlBase() {
922 document = 0;
923 prev = next = 0;
924 }
925
926#ifdef TIXML_USE_STL
928 TiXmlAttribute(const std::string& _name, const std::string& _value) {
929 name = _name;
930 value = _value;
931 document = 0;
932 prev = next = 0;
933 }
934#endif
935
937 TiXmlAttribute(const char* _name, const char* _value) {
938 name = _name;
939 value = _value;
940 document = 0;
941 prev = next = 0;
942 }
943
944 const char* Name() const {
945 return name.c_str();
946 }
947 const char* Value() const {
948 return value.c_str();
949 }
950#ifdef TIXML_USE_STL
951 const std::string& ValueStr() const {
952 return value;
953 }
954#endif
955 int IntValue()
956 const;
957 double DoubleValue()
958 const;
959
960 // Get the tinyxml string representation
961 const TIXML_STRING& NameTStr() const { return name; }
962
972 int QueryIntValue(int* _value) const;
974 int QueryDoubleValue(double* _value) const;
975
976 void SetName(const char* _name) {
977 name = _name;
978 }
979 void SetValue(const char* _value) { value = _value; }
980
981 void SetIntValue(int _value);
982 void SetDoubleValue(double _value);
983
984#ifdef TIXML_USE_STL
986 void SetName(const std::string& _name) { name = _name; }
988 void SetValue(const std::string& _value) { value = _value; }
989#endif
990
992 const TiXmlAttribute* Next() const;
994 return const_cast< TiXmlAttribute* >(
995 (const_cast< const TiXmlAttribute* >(this))->Next());
996 }
997
999 const TiXmlAttribute* Previous() const;
1001 return const_cast< TiXmlAttribute* >(
1002 (const_cast< const TiXmlAttribute* >(this))->Previous());
1003 }
1004
1005 bool operator==(const TiXmlAttribute& rhs) const { return rhs.name == name; }
1006 bool operator<(const TiXmlAttribute& rhs) const { return name < rhs.name; }
1007 bool operator>(const TiXmlAttribute& rhs) const { return name > rhs.name; }
1008
1009 /* Attribute parsing starts: first letter of the name
1010 returns: the next char after the value end quote
1011 */
1012 virtual const char*
1013 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1014
1015 // Prints this Attribute to a FILE stream.
1016 virtual void Print(FILE* cfile, int depth) const { Print(cfile, depth, 0); }
1017 void Print(FILE* cfile, int depth, TIXML_STRING* str) const;
1018
1019 // [internal use]
1020 // Set the document pointer so the attribute can report errors.
1021 void SetDocument(TiXmlDocument* doc) { document = doc; }
1022
1023 private:
1024 TiXmlAttribute(const TiXmlAttribute&); // not implemented.
1025 void operator=(const TiXmlAttribute& base); // not allowed.
1026
1027 TiXmlDocument* document; // A pointer back to a document, for error reporting.
1032};
1033
1034/* A class used to manage a group of attributes.
1035 It is only used internally, both by the ELEMENT and the DECLARATION.
1036
1037 The set can be changed transparent to the Element and Declaration
1038 classes that use it, but NOT transparent to the Attribute
1039 which has to implement a next() and previous() method. Which makes
1040 it a bit problematic and prevents the use of STL.
1041
1042 This version is implemented with circular lists because:
1043 - I like circular lists
1044 - it demonstrates some independence from the (typical) doubly linked list.
1045*/
1047 public:
1050
1051 void Add(TiXmlAttribute* attribute);
1052 void Remove(TiXmlAttribute* attribute);
1053
1054 const TiXmlAttribute* First() const {
1055 return (sentinel.next == &sentinel) ? 0 : sentinel.next;
1056 }
1058 return (sentinel.next == &sentinel) ? 0 : sentinel.next;
1059 }
1060 const TiXmlAttribute* Last() const {
1061 return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
1062 }
1064 return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
1065 }
1066
1067 const TiXmlAttribute* Find(const char* _name) const;
1068 TiXmlAttribute* Find(const char* _name) {
1069 return const_cast< TiXmlAttribute* >(
1070 (const_cast< const TiXmlAttributeSet* >(this))->Find(_name));
1071 }
1072#ifdef TIXML_USE_STL
1073 const TiXmlAttribute* Find(const std::string& _name) const;
1074 TiXmlAttribute* Find(const std::string& _name) {
1075 return const_cast< TiXmlAttribute* >(
1076 (const_cast< const TiXmlAttributeSet* >(this))->Find(_name));
1077 }
1078
1079#endif
1080
1081 private:
1082 //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute
1083 //(sentinel-element),
1084 //*ME: this class must be also use a hidden/disabled copy-constructor !!!
1085 TiXmlAttributeSet(const TiXmlAttributeSet&); // not allowed
1086 void operator=(const TiXmlAttributeSet&); // not allowed (as TiXmlAttribute)
1087
1089};
1090
1095class TiXmlElement : public TiXmlNode {
1096 public:
1098 TiXmlElement(const char* in_value);
1099
1100#ifdef TIXML_USE_STL
1102 TiXmlElement(const std::string& _value);
1103#endif
1104
1105 TiXmlElement(const TiXmlElement&);
1106
1107 void operator=(const TiXmlElement& base);
1108
1109 virtual ~TiXmlElement();
1110
1114 const char* Attribute(const char* name) const;
1115
1122 const char* Attribute(const char* name, int* i) const;
1123
1130 const char* Attribute(const char* name, double* d) const;
1131
1139 int QueryIntAttribute(const char* name, int* _value) const;
1141 int QueryDoubleAttribute(const char* name, double* _value) const;
1143 int QueryFloatAttribute(const char* name, float* _value) const {
1144 double d;
1145 int result = QueryDoubleAttribute(name, &d);
1146
1147 if (result == TIXML_SUCCESS) {
1148 *_value = (float)d;
1149 }
1150
1151 return result;
1152 }
1153
1154#ifdef TIXML_USE_STL
1163 template < typename T >
1164 int QueryValueAttribute(const std::string& name, T* outValue) const {
1165 const TiXmlAttribute* node = attributeSet.Find(name);
1166
1167 if (!node) return TIXML_NO_ATTRIBUTE;
1168
1169 std::stringstream sstream(node->ValueStr());
1170 sstream >> *outValue;
1171
1172 if (!sstream.fail()) return TIXML_SUCCESS;
1173
1174 return TIXML_WRONG_TYPE;
1175 }
1176/*
1177 This is - in theory - a bug fix for "QueryValueAtribute returns truncated
1178std::string"
1179 but template specialization is hard to get working cross-compiler. Leaving the
1180bug
1181for now.
1182
1183// The above will fail for std::string because the space character is used as a
1184seperator.
1185// Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated
1186std::string
1187template<> int QueryValueAttribute( const std::string& name, std::string*
1188outValue )
1189const
1190{
1191 const TiXmlAttribute* node = attributeSet.Find( name );
1192 if ( !node )
1193 return TIXML_NO_ATTRIBUTE;
1194 *outValue = node->ValueStr();
1195 return TIXML_SUCCESS;
1196}
1197*/
1198#endif
1199
1203 void SetAttribute(const char* name, const char* _value);
1204
1205#ifdef TIXML_USE_STL
1206 const std::string* Attribute(const std::string& name) const;
1207 const std::string* Attribute(const std::string& name, int* i) const;
1208 const std::string* Attribute(const std::string& name, double* d) const;
1209 int QueryIntAttribute(const std::string& name, int* _value) const;
1210 int QueryDoubleAttribute(const std::string& name, double* _value) const;
1211
1213 void SetAttribute(const std::string& name, const std::string& _value);
1215 void SetAttribute(const std::string& name, int _value);
1216#endif
1217
1221 void SetAttribute(const char* name, int value);
1222
1226 void SetDoubleAttribute(const char* name, double value);
1227
1230 void RemoveAttribute(const char* name);
1231#ifdef TIXML_USE_STL
1232 void RemoveAttribute(const std::string& name) {
1233 RemoveAttribute(name.c_str());
1234 }
1235#endif
1236
1238 return attributeSet.First();
1239 }
1242 return attributeSet.Last();
1243 }
1245
1283 const char* GetText() const;
1284
1286 virtual TiXmlNode* Clone() const;
1287 // Print the Element to a FILE stream.
1288 virtual void Print(FILE* cfile, int depth) const;
1289
1290 /* Attribtue parsing starts: next char past '<'
1291 returns: next char past '>'
1292 */
1293 virtual const char*
1294 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1295
1296 virtual const TiXmlElement* ToElement() const {
1297 return this;
1298 }
1301 return this;
1302 }
1304
1307 virtual bool Accept(TiXmlVisitor* visitor) const;
1308
1309 protected:
1310 void CopyTo(TiXmlElement* target) const;
1311 void ClearThis(); // like clear, but initializes 'this' object as well
1312
1313// Used to be public [internal use]
1314#ifdef TIXML_USE_STL
1315 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1316#endif
1317 /* [internal use]
1318 Reads the "value" of the element -- another element, or text.
1319 This should terminate with the current end tag.
1320 */
1321 const char*
1322 ReadValue(const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding);
1323
1324 private:
1326};
1327
1330class TiXmlComment : public TiXmlNode {
1331 public:
1335
1336 TiXmlComment(const char* _value)
1338 SetValue(_value);
1339 }
1340 TiXmlComment(const TiXmlComment&);
1341 void operator=(const TiXmlComment& base);
1342
1343 virtual ~TiXmlComment() {}
1344
1346 virtual TiXmlNode* Clone() const;
1347 // Write this Comment to a FILE stream.
1348 virtual void Print(FILE* cfile, int depth) const;
1349
1350 /* Attribtue parsing starts: at the ! of the !--
1351 returns: next char past '>'
1352 */
1353 virtual const char*
1354 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1355
1356 virtual const TiXmlComment* ToComment() const {
1357 return this;
1358 }
1361 return this;
1362 }
1364
1367 virtual bool Accept(TiXmlVisitor* visitor) const;
1368
1369 protected:
1370 void CopyTo(TiXmlComment* target) const;
1371
1372// used to be public
1373#ifdef TIXML_USE_STL
1374 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1375#endif
1376 // virtual void StreamOut( TIXML_OSTREAM * out ) const;
1377
1378 private:
1379};
1380
1386class TiXmlText : public TiXmlNode {
1387 friend class TiXmlElement;
1388
1389 public:
1394 TiXmlText(const char* initValue)
1396 SetValue(initValue);
1397 cdata = false;
1398 }
1399 virtual ~TiXmlText() {}
1400
1401#ifdef TIXML_USE_STL
1403 TiXmlText(const std::string& initValue)
1405 SetValue(initValue);
1406 cdata = false;
1407 }
1408#endif
1409
1412 copy.CopyTo(this);
1413 }
1414 void operator=(const TiXmlText& base) { base.CopyTo(this); }
1415
1416 // Write this text object to a FILE stream.
1417 virtual void Print(FILE* cfile, int depth) const;
1418
1420 bool CDATA() const { return cdata; }
1422 void SetCDATA(bool _cdata) { cdata = _cdata; }
1423
1424 virtual const char*
1425 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1426
1427 virtual const TiXmlText* ToText() const {
1428 return this;
1429 }
1431 virtual TiXmlText* ToText() {
1432 return this;
1433 }
1435
1438 virtual bool Accept(TiXmlVisitor* content) const;
1439
1440 protected:
1442 virtual TiXmlNode* Clone() const;
1443 void CopyTo(TiXmlText* target) const;
1444
1445 bool Blank() const; // returns true if all white space and new lines
1446 // [internal use]
1447#ifdef TIXML_USE_STL
1448 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1449#endif
1450
1451 private:
1452 bool cdata; // true if this should be input and output as a CDATA style text
1453 // element
1454};
1455
1470 public:
1474
1475#ifdef TIXML_USE_STL
1477 TiXmlDeclaration(const std::string& _version,
1478 const std::string& _encoding,
1479 const std::string& _standalone);
1480#endif
1481
1483 TiXmlDeclaration(const char* _version,
1484 const char* _encoding,
1485 const char* _standalone);
1486
1488 void operator=(const TiXmlDeclaration& copy);
1489
1491
1493 const char* Version() const { return version.c_str(); }
1495 const char* Encoding() const { return encoding.c_str(); }
1497 const char* Standalone() const { return standalone.c_str(); }
1498
1500 virtual TiXmlNode* Clone() const;
1501 // Print this declaration to a FILE stream.
1502 virtual void Print(FILE* cfile, int depth, TIXML_STRING* str) const;
1503 virtual void Print(FILE* cfile, int depth) const { Print(cfile, depth, 0); }
1504
1505 virtual const char*
1506 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1507
1508 virtual const TiXmlDeclaration* ToDeclaration() const {
1509 return this;
1510 }
1513 return this;
1514 }
1516
1519 virtual bool Accept(TiXmlVisitor* visitor) const;
1520
1521 protected:
1522 void CopyTo(TiXmlDeclaration* target) const;
1523// used to be public
1524#ifdef TIXML_USE_STL
1525 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1526#endif
1527
1528 private:
1532};
1533
1544 public:
1548
1549#ifdef TIXML_USE_STL
1551 TiXmlStylesheetReference(const std::string& _type, const std::string& _href);
1552#endif
1553
1555 TiXmlStylesheetReference(const char* _type, const char* _href);
1556
1558 void operator=(const TiXmlStylesheetReference& copy);
1559
1561
1563 const char* Type() const { return type.c_str(); }
1565 const char* Href() const { return href.c_str(); }
1566
1568 virtual TiXmlNode* Clone() const;
1569 // Print this declaration to a FILE stream.
1570 virtual void Print(FILE* cfile, int depth, TIXML_STRING* str) const;
1571 virtual void Print(FILE* cfile, int depth) const { Print(cfile, depth, 0); }
1572
1573 virtual const char*
1574 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1575
1577 return this;
1578 }
1581 return this;
1582 }
1584
1587 virtual bool Accept(TiXmlVisitor* visitor) const;
1588
1589 protected:
1590 void CopyTo(TiXmlStylesheetReference* target) const;
1591// used to be public
1592#ifdef TIXML_USE_STL
1593 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1594#endif
1595
1596 private:
1599};
1600
1608class TiXmlUnknown : public TiXmlNode {
1609 public:
1612 virtual ~TiXmlUnknown() {}
1613
1616 copy.CopyTo(this);
1617 }
1618 void operator=(const TiXmlUnknown& copy) { copy.CopyTo(this); }
1619
1621 virtual TiXmlNode* Clone() const;
1622 // Print this Unknown to a FILE stream.
1623 virtual void Print(FILE* cfile, int depth) const;
1624
1625 virtual const char*
1626 Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding);
1627
1628 virtual const TiXmlUnknown* ToUnknown() const {
1629 return this;
1630 }
1633 return this;
1634 }
1636
1639 virtual bool Accept(TiXmlVisitor* content) const;
1640
1641 protected:
1642 void CopyTo(TiXmlUnknown* target) const;
1643
1644#ifdef TIXML_USE_STL
1645 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1646#endif
1647
1648 private:
1649};
1650
1655class TiXmlDocument : public TiXmlNode {
1656 public:
1658 TiXmlDocument();
1662 TiXmlDocument(const char* documentName);
1663
1664#ifdef TIXML_USE_STL
1666 TiXmlDocument(const std::string& documentName);
1667#endif
1668
1669 TiXmlDocument(const TiXmlDocument& copy);
1670 void operator=(const TiXmlDocument& copy);
1671
1672 virtual ~TiXmlDocument() {}
1673
1680 bool SaveFile() const;
1682 bool LoadFile(const char* filename,
1685 bool SaveFile(const char* filename) const;
1694 bool LoadFile(FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
1696 bool SaveFile(FILE*) const;
1697
1698#ifdef TIXML_USE_STL
1699 bool LoadFile(const std::string& filename,
1700 TiXmlEncoding encoding =
1702 // StringToBuffer f( filename );
1703 // return ( f.buffer && LoadFile( f.buffer, encoding ));
1704 return LoadFile(filename.c_str(), encoding);
1705 }
1706 bool SaveFile(const std::string& filename) const {
1707 // StringToBuffer f( filename );
1708 // return ( f.buffer && SaveFile( f.buffer ));
1709 return SaveFile(filename.c_str());
1710 }
1711#endif
1712
1721 virtual const char* Parse(const char* p,
1722 TiXmlParsingData* data = 0,
1724
1729 const TiXmlElement* RootElement() const { return FirstChildElement(); }
1731
1740 bool Error() const { return error; }
1741
1743 const char* ErrorDesc() const { return errorDesc.c_str(); }
1744
1748 int ErrorId() const { return errorId; }
1749
1761 int ErrorRow() const { return errorLocation.row + 1; }
1762 int ErrorCol() const {
1763 return errorLocation.col + 1;
1764 }
1765
1792 void SetTabSize(int _tabsize) { tabsize = _tabsize; }
1793
1794 int TabSize() const { return tabsize; }
1795
1799 void ClearError() {
1800 error = false;
1801 errorId = 0;
1802 errorDesc = "";
1803 errorLocation.row = errorLocation.col = 0;
1804 // errorLocation.last = 0;
1805 }
1806
1810 void Print() const { Print(stdout, 0); }
1811
1812 /* Write the document to a string using formatted printing ("pretty print").
1813 This
1814 will allocate a character array (new char[]) and return it as a pointer. The
1815 calling code pust call delete[] on the return char* to avoid a memory leak.
1816 */
1817 // char* PrintToMemory() const;
1818
1820 virtual void Print(FILE* cfile, int depth = 0) const;
1821 // [internal use]
1822 void SetError(int err,
1823 const char* errorLocation,
1824 TiXmlParsingData* prevData,
1825 TiXmlEncoding encoding);
1826
1827 virtual const TiXmlDocument* ToDocument() const {
1828 return this;
1829 }
1832 return this;
1833 }
1835
1838 virtual bool Accept(TiXmlVisitor* content) const;
1839
1840 protected:
1841 // [internal use]
1842 virtual TiXmlNode* Clone() const;
1843#ifdef TIXML_USE_STL
1844 virtual void StreamIn(std::istream* in, TIXML_STRING* tag);
1845#endif
1846
1847 private:
1848 void CopyTo(TiXmlDocument* target) const;
1849
1850 bool error;
1855 bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and
1856 // try to
1857 // write.
1858};
1859
1952 public:
1956 TiXmlHandle(TiXmlNode* _node) { this->node = _node; }
1958 TiXmlHandle(const TiXmlHandle& ref) { this->node = ref.node; }
1960 this->node = ref.node;
1961 return *this;
1962 }
1963
1965 TiXmlHandle FirstChild() const;
1967 TiXmlHandle FirstChild(const char* value) const;
1971 TiXmlHandle FirstChildElement(const char* value) const;
1972
1976 TiXmlHandle Child(const char* value, int index) const;
1980 TiXmlHandle Child(int index) const;
1986 TiXmlHandle ChildElement(const char* value, int index) const;
1992 TiXmlHandle ChildElement(int index) const;
1993
1994#ifdef TIXML_USE_STL
1995 TiXmlHandle FirstChild(const std::string& _value) const {
1996 return FirstChild(_value.c_str());
1997 }
1998 TiXmlHandle FirstChildElement(const std::string& _value) const {
1999 return FirstChildElement(_value.c_str());
2000 }
2001
2002 TiXmlHandle Child(const std::string& _value, int index) const {
2003 return Child(_value.c_str(), index);
2004 }
2005 TiXmlHandle ChildElement(const std::string& _value, int index) const {
2006 return ChildElement(_value.c_str(), index);
2007 }
2008#endif
2009
2012 TiXmlNode* ToNode() const { return node; }
2016 return ((node && node->ToElement()) ? node->ToElement() : 0);
2017 }
2018
2021 return ((node && node->ToText()) ? node->ToText() : 0);
2022 }
2023
2026 return ((node && node->ToUnknown()) ? node->ToUnknown() : 0);
2027 }
2028
2032 TiXmlNode* Node() const { return ToNode(); }
2036 TiXmlElement* Element() const { return ToElement(); }
2040 TiXmlText* Text() const { return ToText(); }
2044 TiXmlUnknown* Unknown() const { return ToUnknown(); }
2045
2046 private:
2048};
2049
2071 public:
2073 : depth(0)
2074 , simpleTextPrint(false)
2075 , buffer()
2076 , indent(" ")
2077 , lineBreak("\n") {}
2078
2079 virtual bool VisitEnter(const TiXmlDocument& doc);
2080 virtual bool VisitExit(const TiXmlDocument& doc);
2081
2082 virtual bool VisitEnter(const TiXmlElement& element,
2083 const TiXmlAttribute* firstAttribute);
2084 virtual bool VisitExit(const TiXmlElement& element);
2085
2086 virtual bool Visit(const TiXmlDeclaration& declaration);
2087 virtual bool Visit(const TiXmlText& text);
2088 virtual bool Visit(const TiXmlComment& comment);
2089 virtual bool Visit(const TiXmlUnknown& unknown);
2090 virtual bool Visit(const TiXmlStylesheetReference& stylesheet);
2091
2095 void SetIndent(const char* _indent) { indent = _indent ? _indent : ""; }
2097 const char* Indent() { return indent.c_str(); }
2102 void SetLineBreak(const char* _lineBreak) {
2103 lineBreak = _lineBreak ? _lineBreak : "";
2104 }
2105
2106 const char* LineBreak() { return lineBreak.c_str(); }
2107
2113 indent = "";
2114 lineBreak = "";
2115 }
2116
2117 const char* CStr() { return buffer.c_str(); }
2119 size_t Size() { return buffer.size(); }
2120
2121#ifdef TIXML_USE_STL
2123 const std::string& Str() { return buffer; }
2124#endif
2125
2126 private:
2127 void DoIndent() {
2128 for (int i = 0; i < depth; ++i)
2129 buffer += indent;
2130 }
2132
2138};
2139
2140#ifdef _MSC_VER
2141#pragma warning(pop)
2142#endif
2143
2144#endif
TiCppRC()
Constructor Spawns new reference counter with a pointer to this.
Definition ticpp.cpp:924
TiXmlAttribute sentinel
Definition tinyxml.h:1088
TiXmlAttribute * First()
Definition tinyxml.h:1057
const TiXmlAttribute * Find(const char *_name) const
Definition tinyxml.cpp:1482
TiXmlAttribute * Find(const std::string &_name)
Definition tinyxml.h:1074
TiXmlAttribute * Last()
Definition tinyxml.h:1063
void Add(TiXmlAttribute *attribute)
Definition tinyxml.cpp:1427
TiXmlAttribute * Find(const char *_name)
Definition tinyxml.h:1068
void Remove(TiXmlAttribute *attribute)
Definition tinyxml.cpp:1442
void operator=(const TiXmlAttributeSet &)
const TiXmlAttribute * First() const
Definition tinyxml.h:1054
TiXmlAttributeSet(const TiXmlAttributeSet &)
const TiXmlAttribute * Last() const
Definition tinyxml.h:1060
An attribute is a name-value pair.
Definition tinyxml.h:915
void SetDoubleValue(double _value)
Set the value from a double.
Definition tinyxml.cpp:1134
TiXmlAttribute(const std::string &_name, const std::string &_value)
std::string constructor.
Definition tinyxml.h:928
const char * Value() const
Return the value of this attribute.
Definition tinyxml.h:947
TiXmlAttribute * Previous()
Definition tinyxml.h:1000
void SetValue(const char *_value)
Set the value.
Definition tinyxml.h:979
const TIXML_STRING & NameTStr() const
Definition tinyxml.h:961
friend class TiXmlAttributeSet
Definition tinyxml.h:916
bool operator==(const TiXmlAttribute &rhs) const
Definition tinyxml.h:1005
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.h:1016
bool operator>(const TiXmlAttribute &rhs) const
Definition tinyxml.h:1007
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
Definition tinyxml.cpp:1112
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
Definition tinyxml.cpp:1118
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
Definition tinyxml.h:937
void SetIntValue(int _value)
Set the value from an integer.
Definition tinyxml.cpp:1124
bool operator<(const TiXmlAttribute &rhs) const
Definition tinyxml.h:1006
const char * Name() const
Return the name of this attribute.
Definition tinyxml.h:944
void operator=(const TiXmlAttribute &base)
TiXmlAttribute * Next()
Definition tinyxml.h:993
double DoubleValue() const
Return the value of this attribute, converted to a double.
Definition tinyxml.cpp:1146
TiXmlAttribute()
Construct an empty attribute.
Definition tinyxml.h:920
TiXmlAttribute * prev
Definition tinyxml.h:1030
void SetName(const std::string &_name)
STL std::string form.
Definition tinyxml.h:986
void SetValue(const std::string &_value)
STL std::string form.
Definition tinyxml.h:988
void SetName(const char *_name)
Set the name of this attribute.
Definition tinyxml.h:976
void SetDocument(TiXmlDocument *doc)
Definition tinyxml.h:1021
int IntValue() const
Return the value of this attribute, converted to an integer.
Definition tinyxml.cpp:1144
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlDocument * document
Definition tinyxml.h:1027
const std::string & ValueStr() const
Return the value of this attribute.
Definition tinyxml.h:951
TiXmlAttribute * next
Definition tinyxml.h:1031
TIXML_STRING value
Definition tinyxml.h:1029
TiXmlAttribute(const TiXmlAttribute &)
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
Definition tinyxml.cpp:1043
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
Definition tinyxml.cpp:1062
TIXML_STRING name
Definition tinyxml.h:1028
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
@ NUM_ENTITY
Definition tinyxml.h:440
@ MAX_ENTITY_LENGTH
Definition tinyxml.h:441
TiXmlCursor location
Definition tinyxml.h:410
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
Definition tinyxml.h:242
friend class TiXmlDocument
Definition tinyxml.h:218
void operator=(const TiXmlBase &base)
static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag)
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
friend class TiXmlNode
Definition tinyxml.h:216
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
Expands entities in a string.
Definition tinyxml.cpp:50
static bool IsWhiteSpace(int c)
Definition tinyxml.h:331
void * GetUserData()
Get a pointer to arbitrary user data.
Definition tinyxml.h:281
static bool condenseWhiteSpace
Definition tinyxml.h:445
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
Definition tinyxml.h:368
TiXmlBase(const TiXmlBase &)
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
@ TIXML_ERROR_STRING_COUNT
Definition tinyxml.h:323
@ TIXML_ERROR_READING_END_TAG
Definition tinyxml.h:314
@ TIXML_ERROR_PARSING_UNKNOWN
Definition tinyxml.h:315
@ TIXML_ERROR_PARSING_DECLARATION
Definition tinyxml.h:317
@ TIXML_ERROR_PARSING_ELEMENT
Definition tinyxml.h:309
@ TIXML_ERROR_PARSING_EMPTY
Definition tinyxml.h:313
@ TIXML_ERROR_READING_ATTRIBUTES
Definition tinyxml.h:312
@ TIXML_ERROR_DOCUMENT_TOP_ONLY
Definition tinyxml.h:321
@ TIXML_ERROR_PARSING_COMMENT
Definition tinyxml.h:316
@ TIXML_NO_ERROR
Definition tinyxml.h:305
@ TIXML_ERROR_OUT_OF_MEMORY
Definition tinyxml.h:308
@ TIXML_ERROR_PARSING_CDATA
Definition tinyxml.h:320
@ TIXML_ERROR_DOCUMENT_EMPTY
Definition tinyxml.h:318
@ TIXML_ERROR_OPENING_FILE
Definition tinyxml.h:307
@ TIXML_ERROR
Definition tinyxml.h:306
@ TIXML_ERROR_EMBEDDED_nullptr
Definition tinyxml.h:319
@ TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME
Definition tinyxml.h:310
@ TIXML_ERROR_READING_ELEMENT_VALUE
Definition tinyxml.h:311
static int ToLower(int v, TiXmlEncoding encoding)
Definition tinyxml.h:419
static const char * errorString[TIXML_ERROR_STRING_COUNT]
Definition tinyxml.h:35
const void * GetUserData() const
Get a pointer to arbitrary user data.
Definition tinyxml.h:284
static const char * ReadText(const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
static bool StreamTo(std::istream *in, int character, TIXML_STRING *tag)
static Entity entity[NUM_ENTITY]
Definition tinyxml.h:44
void * userData
Field containing a generic user pointer.
Definition tinyxml.h:413
friend class TiXmlElement
Definition tinyxml.h:217
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
TiXmlBase()
Definition tinyxml.h:221
void SetUserData(void *user)
Set a pointer to arbitrary user data.
Definition tinyxml.h:278
static const int utf8ByteTable[256]
Definition tinyxml.h:64
int Row() const
Return the position, in the original source file, of this node or attribute.
Definition tinyxml.h:275
virtual ~TiXmlBase()
Definition tinyxml.h:223
int Column() const
See Row().
Definition tinyxml.h:276
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
Definition tinyxml.h:247
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
static bool IsWhiteSpace(char c)
Definition tinyxml.h:328
An XML comment.
Definition tinyxml.h:1330
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1356
virtual TiXmlNode * Clone() const
Returns a copy of this Comment.
Definition tinyxml.cpp:1176
virtual ~TiXmlComment()
Definition tinyxml.h:1343
TiXmlComment(const char *_value)
Construct a comment from text.
Definition tinyxml.h:1336
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
void operator=(const TiXmlComment &base)
Definition tinyxml.cpp:1153
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.cpp:1158
TiXmlComment()
Constructs an empty comment.
Definition tinyxml.h:1333
void CopyTo(TiXmlComment *target) const
Definition tinyxml.cpp:1168
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1172
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1360
In correct XML the declaration is the first entry in the file.
Definition tinyxml.h:1469
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1512
void operator=(const TiXmlDeclaration &copy)
Definition tinyxml.cpp:1248
const char * Standalone() const
Is this a standalone document?
Definition tinyxml.h:1497
void CopyTo(TiXmlDeclaration *target) const
Definition tinyxml.cpp:1293
TIXML_STRING encoding
Definition tinyxml.h:1530
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
Definition tinyxml.cpp:1305
TIXML_STRING standalone
Definition tinyxml.h:1531
const char * Encoding() const
Encoding. Will return an empty string if none was found.
Definition tinyxml.h:1495
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlDeclaration()
Construct an empty declaration.
Definition tinyxml.h:1472
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1301
const char * Version() const
Version. Will return an empty string if none was found.
Definition tinyxml.h:1493
TIXML_STRING version
Definition tinyxml.h:1529
virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const
Definition tinyxml.cpp:1253
virtual ~TiXmlDeclaration()
Definition tinyxml.h:1490
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.h:1503
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1508
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
Always the top level node.
Definition tinyxml.h:1655
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition tinyxml.h:1743
int ErrorRow() const
Returns the location (if known) of the error.
Definition tinyxml.h:1761
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition tinyxml.h:1699
virtual ~TiXmlDocument()
Definition tinyxml.h:1672
bool SaveFile(const std::string &filename) const
Definition tinyxml.h:1706
TIXML_STRING errorDesc
Definition tinyxml.h:1852
bool Error() const
If an error occurs, Error will be set to true.
Definition tinyxml.h:1740
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
Definition tinyxml.cpp:1015
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition tinyxml.cpp:804
bool useMicrosoftBOM
Definition tinyxml.h:1855
void SetTabSize(int _tabsize)
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct v...
Definition tinyxml.h:1792
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1831
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1827
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
int TabSize() const
Definition tinyxml.h:1794
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1033
TiXmlDocument()
Create an empty document, that has no name.
Definition tinyxml.cpp:769
TiXmlCursor errorLocation
Definition tinyxml.h:1854
void Print() const
Write the document to standard out using formatted printing ("prettyprint").
Definition tinyxml.h:1810
void CopyTo(TiXmlDocument *target) const
Definition tinyxml.cpp:998
void operator=(const TiXmlDocument &copy)
Definition tinyxml.cpp:799
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
Definition tinyxml.cpp:811
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
Definition tinyxml.h:1729
TiXmlElement * RootElement()
Definition tinyxml.h:1730
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
Definition tinyxml.h:1748
void ClearError()
If you have handled the error, it can be reset with this call.
Definition tinyxml.h:1799
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
int ErrorCol() const
The column where the error occured. See ErrorRow().
Definition tinyxml.h:1762
The element is a container class.
Definition tinyxml.h:1095
TiXmlAttribute * FirstAttribute()
Definition tinyxml.h:1240
TiXmlElement(const char *in_value)
Construct an element.
Definition tinyxml.cpp:434
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:736
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
Definition tinyxml.cpp:605
void RemoveAttribute(const std::string &name)
STL std::string form.
Definition tinyxml.h:1232
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
Definition tinyxml.h:1143
void ClearThis()
Definition tinyxml.cpp:461
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
Definition tinyxml.cpp:370
TiXmlAttributeSet attributeSet
Definition tinyxml.h:1325
int QueryIntAttribute(const char *name, int *_value) const
QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer...
Definition tinyxml.cpp:550
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name,...
Definition tinyxml.cpp:471
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlAttribute * LastAttribute()
Definition tinyxml.h:1244
int QueryValueAttribute(const std::string &name, T *outValue) const
Template form of the attribute query which will try to read the attribute into the specified type.
Definition tinyxml.h:1164
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
Definition tinyxml.cpp:746
virtual ~TiXmlElement()
Definition tinyxml.cpp:459
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.cpp:666
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1296
void CopyTo(TiXmlElement *target) const
Definition tinyxml.cpp:716
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
Definition tinyxml.cpp:615
const char * ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
Definition tinyxml.h:1237
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
Definition tinyxml.h:1241
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
Definition tinyxml.cpp:568
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1300
const char * GetText() const
Convenience function for easy access to the text inside an element.
Definition tinyxml.cpp:755
void operator=(const TiXmlElement &base)
Definition tinyxml.cpp:454
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
Definition tinyxml.h:1951
TiXmlUnknown * ToUnknown() const
Return the handle as a TiXmlUnknown.
Definition tinyxml.h:2025
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
Definition tinyxml.h:1958
TiXmlNode * ToNode() const
Return the handle as a TiXmlNode.
Definition tinyxml.h:2012
TiXmlText * Text() const
Definition tinyxml.h:2040
TiXmlText * ToText() const
Return the handle as a TiXmlText.
Definition tinyxml.h:2020
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
Definition tinyxml.cpp:1590
TiXmlUnknown * Unknown() const
Definition tinyxml.h:2044
TiXmlElement * ToElement() const
Return the handle as a TiXmlElement.
Definition tinyxml.h:2015
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition tinyxml.h:1956
TiXmlHandle Child(const std::string &_value, int index) const
Definition tinyxml.h:2002
TiXmlNode * node
Definition tinyxml.h:2047
TiXmlElement * Element() const
Definition tinyxml.h:2036
TiXmlHandle FirstChildElement(const std::string &_value) const
Definition tinyxml.h:1998
TiXmlHandle operator=(const TiXmlHandle &ref)
Definition tinyxml.h:1959
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
Definition tinyxml.cpp:1555
TiXmlNode * Node() const
Definition tinyxml.h:2032
TiXmlHandle ChildElement(const std::string &_value, int index) const
Definition tinyxml.h:2005
TiXmlHandle FirstChild() const
Return a handle to the first child node.
Definition tinyxml.cpp:1535
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
Definition tinyxml.cpp:1620
TiXmlHandle FirstChild(const std::string &_value) const
Definition tinyxml.h:1995
The parent class for everything in the Document Object Model.
Definition tinyxml.h:454
virtual ~TiXmlNode()
Definition tinyxml.cpp:123
TiXmlDocument * GetDocument()
Definition tinyxml.h:776
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition tinyxml.h:770
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:792
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition tinyxml.cpp:384
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:695
friend class TiXmlDocument
Definition tinyxml.h:455
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
Definition tinyxml.cpp:153
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:689
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
Definition tinyxml.h:627
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:800
void SetValue(const std::string &_value)
STL std::string form.
Definition tinyxml.h:542
NodeType type
Definition tinyxml.h:893
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:231
void SetValue(const char *_value)
Changes the value of the node.
Definition tinyxml.h:538
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
Definition tinyxml.h:596
TiXmlNode * next
Definition tinyxml.h:901
const TiXmlNode * Parent() const
Definition tinyxml.h:550
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
Definition tinyxml.h:761
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition tinyxml.h:678
TiXmlElement * FirstChildElement(const char *_value)
Definition tinyxml.h:752
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Definition tinyxml.h:517
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
Definition tinyxml.h:704
TiXmlNode(NodeType _type)
Definition tinyxml.cpp:113
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
Definition tinyxml.h:575
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:758
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
Definition tinyxml.cpp:265
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
Definition tinyxml.h:692
TiXmlElement * NextSiblingElement(const char *_next)
Definition tinyxml.h:729
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:804
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
Definition tinyxml.h:590
TiXmlNode * lastChild
Definition tinyxml.h:896
TiXmlNode(const TiXmlNode &)
TiXmlElement * FirstChildElement()
Definition tinyxml.h:745
const std::string & ValueStr() const
Return Value() as a std::string.
Definition tinyxml.h:524
TiXmlNode * parent
Definition tinyxml.h:892
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
Definition tinyxml.cpp:331
TiXmlNode * PreviousSibling(const char *_prev)
Definition tinyxml.h:683
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:821
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition tinyxml.cpp:139
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:197
TiXmlNode * IterateChildren(const TiXmlNode *previous)
Definition tinyxml.h:618
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
Definition tinyxml.h:633
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:813
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:808
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:784
NodeType
The types of XML nodes supported by TinyXml.
Definition tinyxml.h:492
@ TYPECOUNT
Definition tinyxml.h:500
@ STYLESHEETREFERENCE
Definition tinyxml.h:499
@ DECLARATION
Definition tinyxml.h:498
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:833
TiXmlNode * NextSibling(const char *_next)
Definition tinyxml.h:709
TiXmlNode * FirstChild()
Definition tinyxml.h:555
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
Definition tinyxml.h:698
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:829
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:735
virtual TiXmlStylesheetReference * ToStylesheetReference()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:837
const TiXmlNode * LastChild() const
Definition tinyxml.h:572
TiXmlNode * Parent()
One step up the DOM.
Definition tinyxml.h:549
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:587
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:796
TiXmlNode * prev
Definition tinyxml.h:900
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
Definition tinyxml.h:738
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:825
void operator=(const TiXmlNode &base)
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
Definition tinyxml.h:637
void CopyTo(TiXmlNode *target) const
Definition tinyxml.cpp:134
TiXmlNode * FirstChild(const char *_value)
Definition tinyxml.h:564
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)=0
friend class TiXmlElement
Definition tinyxml.h:456
bool NoChildren() const
Returns true if this node has no children.
Definition tinyxml.h:782
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Definition tinyxml.cpp:404
virtual bool Accept(TiXmlVisitor *visitor) const =0
Accept a hierchical visit the nodes in the TinyXML DOM.
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:817
TiXmlNode * PreviousSibling()
Definition tinyxml.h:679
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:788
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:593
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition tinyxml.cpp:424
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
Definition tinyxml.cpp:291
friend std::istream & operator>>(std::istream &in, TiXmlNode &base)
An input stream operator, for every class.
Definition tinyxml.cpp:1505
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition tinyxml.h:552
TIXML_STRING value
Definition tinyxml.h:898
TiXmlNode * NextSibling()
Definition tinyxml.h:705
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:181
const TIXML_STRING & ValueTStr() const
Definition tinyxml.h:527
TiXmlNode * firstChild
Definition tinyxml.h:895
TiXmlElement * NextSiblingElement()
Definition tinyxml.h:719
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
Definition tinyxml.h:581
friend std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)
An output stream operator, for every class.
Definition tinyxml.cpp:1516
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
Definition tinyxml.cpp:1638
const char * Indent()
Query the indention string.
Definition tinyxml.h:2097
void SetIndent(const char *_indent)
Set the indent characters for printing.
Definition tinyxml.h:2095
void DoLineBreak()
Definition tinyxml.h:2131
TIXML_STRING lineBreak
Definition tinyxml.h:2137
bool simpleTextPrint
Definition tinyxml.h:2134
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
Definition tinyxml.cpp:1636
void DoIndent()
Definition tinyxml.h:2127
void SetLineBreak(const char *_lineBreak)
Set the line breaking string.
Definition tinyxml.h:2102
TIXML_STRING indent
Definition tinyxml.h:2136
const char * LineBreak()
Query the current line breaking string.
Definition tinyxml.h:2106
void SetStreamPrinting()
Switch over to "stream printing" which is the most dense formatting without linebreaks.
Definition tinyxml.h:2112
size_t Size()
Return the length of the result string.
Definition tinyxml.h:2119
const std::string & Str()
Return the result.
Definition tinyxml.h:2123
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
Definition tinyxml.cpp:1715
TIXML_STRING buffer
Definition tinyxml.h:2135
const char * CStr()
Return the result.
Definition tinyxml.h:2117
A stylesheet reference looks like this:
Definition tinyxml.h:1543
void CopyTo(TiXmlStylesheetReference *target) const
Definition tinyxml.cpp:1373
virtual TiXmlStylesheetReference * ToStylesheetReference()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1580
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlStylesheetReference()
Construct an empty declaration.
Definition tinyxml.h:1546
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1380
const char * Href() const
Href. Will return an empty string if none was found.
Definition tinyxml.h:1565
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1576
virtual ~TiXmlStylesheetReference()
Definition tinyxml.h:1560
void operator=(const TiXmlStylesheetReference &copy)
Definition tinyxml.cpp:1336
virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const
Definition tinyxml.cpp:1341
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.h:1571
const char * Type() const
Type. Will return an empty string if none was found.
Definition tinyxml.h:1563
virtual TiXmlNode * Clone() const
Creates a copy of this StylesheetReference and returns it.
Definition tinyxml.cpp:1384
XML text.
Definition tinyxml.h:1386
bool Blank() const
bool cdata
Definition tinyxml.h:1452
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1431
TiXmlText(const std::string &initValue)
Constructor.
Definition tinyxml.h:1403
void CopyTo(TiXmlText *target) const
Definition tinyxml.cpp:1204
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1427
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.cpp:1185
virtual ~TiXmlText()
Definition tinyxml.h:1399
TiXmlText(const TiXmlText &copy)
Definition tinyxml.h:1410
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
Definition tinyxml.cpp:1213
bool CDATA() const
Queries whether this represents text using a CDATA section.
Definition tinyxml.h:1420
friend class TiXmlElement
Definition tinyxml.h:1387
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
Definition tinyxml.h:1422
void operator=(const TiXmlText &base)
Definition tinyxml.h:1414
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1209
TiXmlText(const char *initValue)
Constructor for text element.
Definition tinyxml.h:1394
Any tag that tinyXml doesn't recognize is saved as an unknown.
Definition tinyxml.h:1608
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
Definition tinyxml.cpp:1408
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1632
void operator=(const TiXmlUnknown &copy)
Definition tinyxml.h:1618
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
Definition tinyxml.cpp:1393
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
Definition tinyxml.h:1628
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
Definition tinyxml.cpp:1404
TiXmlUnknown(const TiXmlUnknown &copy)
Definition tinyxml.h:1614
virtual ~TiXmlUnknown()
Definition tinyxml.h:1612
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
void CopyTo(TiXmlUnknown *target) const
Definition tinyxml.cpp:1400
If you call the Accept() method, it requires being passed a TiXmlVisitor class to handle callbacks.
Definition tinyxml.h:144
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
Definition tinyxml.h:149
virtual ~TiXmlVisitor()
Definition tinyxml.h:146
virtual bool Visit(const TiXmlText &)
Visit a text node.
Definition tinyxml.h:168
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
Definition tinyxml.h:170
virtual bool Visit(const TiXmlUnknown &)
Visit an unknow node.
Definition tinyxml.h:172
virtual bool Visit(const TiXmlStylesheetReference &)
Visit a stylesheet reference.
Definition tinyxml.h:164
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
Definition tinyxml.h:151
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
Definition tinyxml.h:159
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
Definition tinyxml.h:154
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
Definition tinyxml.h:162
unsigned int strLength
Definition tinyxml.h:436
const char * str
Definition tinyxml.h:435
void Clear()
Definition tinyxml.h:114
const int TIXML_PATCH_VERSION
Definition tinyxml.h:107
const int TIXML_MAJOR_VERSION
Definition tinyxml.h:105
const int TIXML_MINOR_VERSION
Definition tinyxml.h:106
TiXmlEncoding
Definition tinyxml.h:179
@ TIXML_ENCODING_UNKNOWN
Definition tinyxml.h:180
@ TIXML_ENCODING_LEGACY
Definition tinyxml.h:182
@ TIXML_ENCODING_UTF8
Definition tinyxml.h:181
#define TIXML_STRING
Definition tinyxml.h:60
@ TIXML_WRONG_TYPE
Definition tinyxml.h:176
@ TIXML_SUCCESS
Definition tinyxml.h:176
@ TIXML_NO_ATTRIBUTE
Definition tinyxml.h:176
const TiXmlEncoding TIXML_DEFAULT_ENCODING
Definition tinyxml.h:185