tinyxml.h
Go to the documentation of this file.
00001 /*
00002    www.sourceforge.net/projects/tinyxml
00003    Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
00004 
00005    This software is provided 'as-is', without any express or implied
00006    warranty. In no event will the authors be held liable for any
00007    damages arising from the use of this software.
00008 
00009    Permission is granted to anyone to use this software for any
00010    purpose, including commercial applications, and to alter it and
00011    redistribute it freely, subject to the following restrictions:
00012 
00013    1. The origin of this software must not be misrepresented; you must
00014    not claim that you wrote the original software. If you use this
00015    software in a product, an acknowledgment in the product documentation
00016    would be appreciated but is not required.
00017 
00018    2. Altered source versions must be plainly marked as such, and
00019    must not be misrepresented as being the original software.
00020 
00021    3. This notice may not be removed or altered from any source
00022    distribution.
00023    */
00024 
00025 #ifndef TINYXML_INCLUDED
00026 #define TINYXML_INCLUDED
00027 
00028 #ifdef _MSC_VER
00029 #pragma warning( push )
00030 #pragma warning( disable : 4530 )
00031 #pragma warning( disable : 4786 )
00032 #endif
00033 
00034 #include <ctype.h>
00035 #include <stdio.h>
00036 #include <stdlib.h>
00037 #include <string.h>
00038 #include <assert.h>
00039 
00040 // Help out windows:
00041 #if defined( _DEBUG ) && !defined( DEBUG )
00042 #define DEBUG
00043 #endif
00044 
00045 #ifdef TIXML_USE_STL
00046 #include <string>
00047 #include <iostream>
00048 #include <sstream>
00049 #define TIXML_STRING            std::string
00050 #else
00051 #include "tinystr.h"
00052 #define TIXML_STRING            TiXmlString
00053 #endif
00054 
00055 // Deprecated library function hell. Compilers want to use the
00056 // new safe versions. This probably doesn't fully address the problem,
00057 // but it gets closer. There are too many compilers for me to fully
00058 // test. If you get compilation troubles, undefine TIXML_SAFE
00059 #define TIXML_SAFE
00060 
00061 #ifdef TIXML_SAFE
00062 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
00063 // Microsoft visual studio, version 2005 and higher.
00064 #define TIXML_SNPRINTF _snprintf_s
00065 #define TIXML_SNSCANF  _snscanf_s
00066 #define TIXML_SSCANF   sscanf_s
00067 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
00068 // Microsoft visual studio, version 6 and higher.
00069 //#pragma message( "Using _sn* functions." )
00070 #define TIXML_SNPRINTF _snprintf
00071 #define TIXML_SNSCANF  _snscanf
00072 #define TIXML_SSCANF   sscanf
00073 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
00074 // GCC version 3 and higher.s
00075 //#warning( "Using sn* functions." )
00076 #define TIXML_SNPRINTF snprintf
00077 #define TIXML_SNSCANF  snscanf
00078 #define TIXML_SSCANF   sscanf
00079 #else
00080 #define TIXML_SSCANF   sscanf
00081 #endif
00082 #endif
00083 
00084 class TiXmlDocument;
00085 class TiXmlElement;
00086 class TiXmlComment;
00087 class TiXmlUnknown;
00088 class TiXmlAttribute;
00089 class TiXmlText;
00090 class TiXmlDeclaration;
00091 class TiXmlParsingData;
00092 
00093 const int TIXML_MAJOR_VERSION = 2;
00094 const int TIXML_MINOR_VERSION = 5;
00095 const int TIXML_PATCH_VERSION = 3;
00096 
00097 /*      Internal structure for tracking location of items
00098     in the XML file.
00099     */
00100 struct TiXmlCursor {
00101     TiXmlCursor() {
00102         Clear();
00103     }
00104     void Clear() {
00105         row = col = -1;
00106     }
00107 
00108     int row; // 0 based.
00109     int col; // 0 based.
00110 };
00111 
00130 class TiXmlVisitor {
00131     public:
00132         virtual ~TiXmlVisitor() {
00133         }
00134 
00136         virtual bool VisitEnter(const TiXmlDocument& /*doc*/) {
00137             return true;
00138         }
00140         virtual bool VisitExit(const TiXmlDocument& /*doc*/) {
00141             return true;
00142         }
00143 
00145         virtual bool VisitEnter(const TiXmlElement& /*element*/,
00146                 const TiXmlAttribute* /*firstAttribute*/) {
00147             return true;
00148         }
00150         virtual bool VisitExit(const TiXmlElement& /*element*/) {
00151             return true;
00152         }
00153 
00155         virtual bool Visit(const TiXmlDeclaration& /*declaration*/) {
00156             return true;
00157         }
00159         virtual bool Visit(const TiXmlText& /*text*/) {
00160             return true;
00161         }
00163         virtual bool Visit(const TiXmlComment& /*comment*/) {
00164             return true;
00165         }
00167         virtual bool Visit(const TiXmlUnknown& /*unknown*/) {
00168             return true;
00169         }
00170 };
00171 
00172 // Only used by Attribute::Query functions
00173 enum {
00174     TIXML_SUCCESS, TIXML_NO_ATTRIBUTE, TIXML_WRONG_TYPE
00175 };
00176 
00177 // Used by the parsing routines.
00178 enum TiXmlEncoding {
00179     TIXML_ENCODING_UNKNOWN, TIXML_ENCODING_UTF8, TIXML_ENCODING_LEGACY
00180 };
00181 
00182 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00183 
00206 class TiXmlBase {
00207     friend class TiXmlNode;
00208     friend class TiXmlElement;
00209     friend class TiXmlDocument;
00210 
00211     public:
00212     TiXmlBase() :
00213         userData(0) {
00214         }
00215     virtual ~TiXmlBase() {
00216     }
00217 
00227     virtual void Print(FILE* cfile, int depth) const = 0;
00228 
00235     static void SetCondenseWhiteSpace(bool condense) {
00236         condenseWhiteSpace = condense;
00237     }
00238 
00240     static bool IsWhiteSpaceCondensed() {
00241         return condenseWhiteSpace;
00242     }
00243 
00262     int Row() const {
00263         return location.row + 1;
00264     }
00265     int Column() const {
00266         return location.col + 1;
00267     } 
00268 
00269     void SetUserData(void* user) {
00270         userData = user;
00271     } 
00272     void* GetUserData() {
00273         return userData;
00274     } 
00275     const void* GetUserData() const {
00276         return userData;
00277     } 
00278 
00279     // Table that returs, for a given lead byte, the total number of bytes
00280     // in the UTF-8 sequence.
00281     static const int utf8ByteTable[256];
00282 
00283     virtual const char* Parse(const char* p, TiXmlParsingData* data,
00284             TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */) = 0;
00285 
00289     static void EncodeString(const TIXML_STRING& str, TIXML_STRING* out);
00290 
00291     enum {
00292         TIXML_NO_ERROR = 0,
00293         TIXML_ERROR,
00294         TIXML_ERROR_OPENING_FILE,
00295         TIXML_ERROR_OUT_OF_MEMORY,
00296         TIXML_ERROR_PARSING_ELEMENT,
00297         TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00298         TIXML_ERROR_READING_ELEMENT_VALUE,
00299         TIXML_ERROR_READING_ATTRIBUTES,
00300         TIXML_ERROR_PARSING_EMPTY,
00301         TIXML_ERROR_READING_END_TAG,
00302         TIXML_ERROR_PARSING_UNKNOWN,
00303         TIXML_ERROR_PARSING_COMMENT,
00304         TIXML_ERROR_PARSING_DECLARATION,
00305         TIXML_ERROR_DOCUMENT_EMPTY,
00306         TIXML_ERROR_EMBEDDED_NULL,
00307         TIXML_ERROR_PARSING_CDATA,
00308         TIXML_ERROR_DOCUMENT_TOP_ONLY,
00309 
00310         TIXML_ERROR_STRING_COUNT
00311     };
00312 
00313     protected:
00314 
00315     static const char* SkipWhiteSpace(const char*, TiXmlEncoding encoding);
00316     inline static bool IsWhiteSpace(char c) {
00317         return (isspace((unsigned char) c) || c == '\n' || c == '\r');
00318     }
00319     inline static bool IsWhiteSpace(int c) {
00320         if (c < 256)
00321             return IsWhiteSpace((char) c);
00322         return false; // Again, only truly correct for English/Latin...but usually works.
00323     }
00324 
00325 #ifdef TIXML_USE_STL
00326     static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
00327     static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
00328 #endif
00329 
00330     /*  Reads an XML name into the string provided. Returns
00331         a pointer just past the last character of the name,
00332         or 0 if the function has an error.
00333         */
00334     static const char* ReadName(const char* p, TIXML_STRING* name,
00335             TiXmlEncoding encoding);
00336 
00337     /*  Reads text. Returns a pointer past the given end tag.
00338         Wickedly complex options, but it keeps the (sensitive) code in one place.
00339         */
00340     static const char* ReadText(const char* in, // where to start
00341             TIXML_STRING* text, // the string read
00342             bool ignoreWhiteSpace, // whether to keep the white space
00343             const char* endTag, // what ends this text
00344             bool ignoreCase, // whether to ignore case in the end tag
00345             TiXmlEncoding encoding); // the current encoding
00346 
00347     // If an entity has been found, transform it into a character.
00348     static const char* GetEntity(const char* in, char* value, int* length,
00349             TiXmlEncoding encoding);
00350 
00351     // Get a character, while interpreting entities.
00352     // The length can be from 0 to 4 bytes.
00353     inline static const char* GetChar(const char* p, char* _value, int* length,
00354             TiXmlEncoding encoding) {
00355         assert( p );
00356         if (encoding == TIXML_ENCODING_UTF8) {
00357             *length = utf8ByteTable[*((const unsigned char*) p)];
00358             assert( *length >= 0 && *length < 5 );
00359         } else {
00360             *length = 1;
00361         }
00362 
00363         if (*length == 1) {
00364             if (*p == '&')
00365                 return GetEntity(p, _value, length, encoding);
00366             *_value = *p;
00367             return p + 1;
00368         } else if (*length) {
00369             //strncpy( _value, p, *length );    // lots of compilers don't like this function (unsafe),
00370             // and the null terminator isn't needed
00371             for (int i = 0; p[i] && i < *length; ++i) {
00372                 _value[i] = p[i];
00373             }
00374             return p + (*length);
00375         } else {
00376             // Not valid text.
00377             return 0;
00378         }
00379     }
00380 
00381     // Return true if the next characters in the stream are any of the endTag sequences.
00382     // Ignore case only works for english, and should only be relied on when comparing
00383     // to English words: StringEqual( p, "version", true ) is fine.
00384     static bool StringEqual(const char* p, const char* endTag, bool ignoreCase,
00385             TiXmlEncoding encoding);
00386 
00387     static const char* errorString[TIXML_ERROR_STRING_COUNT];
00388 
00389     TiXmlCursor location;
00390 
00392     void* userData;
00393 
00394     // None of these methods are reliable for any language except English.
00395     // Good for approximation, not great for accuracy.
00396     static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding);
00397     static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding);
00398     inline static int ToLower(int v, TiXmlEncoding encoding) {
00399         if (encoding == TIXML_ENCODING_UTF8) {
00400             if (v < 128)
00401                 return tolower(v);
00402             return v;
00403         } else {
00404             return tolower(v);
00405         }
00406     }
00407     static void ConvertUTF32ToUTF8(unsigned long input, char* output,
00408             int* length);
00409 
00410     private:
00411     TiXmlBase(const TiXmlBase&); // not implemented.
00412     void operator=(const TiXmlBase& base); // not allowed.
00413 
00414     struct Entity {
00415         const char* str;
00416         unsigned int strLength;
00417         char chr;
00418     };
00419     enum {
00420         NUM_ENTITY = 5, MAX_ENTITY_LENGTH = 6
00421 
00422     };
00423     static Entity entity[NUM_ENTITY];
00424     static bool condenseWhiteSpace;
00425 };
00426 
00433 class TiXmlNode: public TiXmlBase {
00434     friend class TiXmlDocument;
00435     friend class TiXmlElement;
00436 
00437     public:
00438 #ifdef TIXML_USE_STL
00439 
00443     friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
00444 
00461     friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
00462 
00464     friend std::string& operator<< (std::string& out, const TiXmlNode& base );
00465 
00466 #endif
00467 
00471     enum NodeType {
00472         DOCUMENT, ELEMENT, COMMENT, UNKNOWN, TEXT, DECLARATION, TYPECOUNT
00473     };
00474 
00475     virtual ~TiXmlNode();
00476 
00489     const char *Value() const {
00490         return value.c_str();
00491     }
00492 
00493 #ifdef TIXML_USE_STL
00494 
00498     const std::string& ValueStr() const {return value;}
00499 #endif
00500 
00501     const TIXML_STRING& ValueTStr() const {
00502         return value;
00503     }
00504 
00514     void SetValue(const char * _value) {
00515         value = _value;
00516     }
00517 
00518 #ifdef TIXML_USE_STL
00519 
00520     void SetValue( const std::string& _value ) {value = _value;}
00521 #endif
00522 
00524     void Clear();
00525 
00527     TiXmlNode* Parent() {
00528         return parent;
00529     }
00530     const TiXmlNode* Parent() const {
00531         return parent;
00532     }
00533 
00534     const TiXmlNode* FirstChild() const {
00535         return firstChild;
00536     } 
00537     TiXmlNode* FirstChild() {
00538         return firstChild;
00539     }
00540     const TiXmlNode* FirstChild(const char * value) const; 
00541 
00542     TiXmlNode* FirstChild(const char * _value) {
00543         // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
00544         // call the method, cast the return back to non-const.
00545         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->FirstChild(
00546                     _value));
00547     }
00548     const TiXmlNode* LastChild() const {
00549         return lastChild;
00550     } 
00551     TiXmlNode* LastChild() {
00552         return lastChild;
00553     }
00554 
00555     const TiXmlNode* LastChild(const char * value) const; 
00556     TiXmlNode* LastChild(const char * _value) {
00557         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->LastChild(
00558                     _value));
00559     }
00560 
00561 #ifdef TIXML_USE_STL
00562     const TiXmlNode* FirstChild( const std::string& _value ) const {return FirstChild (_value.c_str ());} 
00563     TiXmlNode* FirstChild( const std::string& _value ) {return FirstChild (_value.c_str ());} 
00564     const TiXmlNode* LastChild( const std::string& _value ) const {return LastChild (_value.c_str ());} 
00565     TiXmlNode* LastChild( const std::string& _value ) {return LastChild (_value.c_str ());} 
00566 #endif
00567 
00584     const TiXmlNode* IterateChildren(const TiXmlNode* previous) const;
00585     TiXmlNode* IterateChildren(const TiXmlNode* previous) {
00586         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->IterateChildren(
00587                     previous));
00588     }
00589 
00591     const TiXmlNode* IterateChildren(const char * value,
00592             const TiXmlNode* previous) const;
00593     TiXmlNode* IterateChildren(const char * _value, const TiXmlNode* previous) {
00594         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->IterateChildren(
00595                     _value, previous));
00596     }
00597 
00598 #ifdef TIXML_USE_STL
00599     const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const {return IterateChildren (_value.c_str (), previous);} 
00600     TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) {return IterateChildren (_value.c_str (), previous);} 
00601 #endif
00602 
00606     TiXmlNode* InsertEndChild(const TiXmlNode& addThis);
00607 
00617     TiXmlNode* LinkEndChild(TiXmlNode* addThis);
00618 
00622     TiXmlNode* InsertBeforeChild(TiXmlNode* beforeThis,
00623             const TiXmlNode& addThis);
00624 
00628     TiXmlNode* InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis);
00629 
00633     TiXmlNode* ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis);
00634 
00636     bool RemoveChild(TiXmlNode* removeThis);
00637 
00639     const TiXmlNode* PreviousSibling() const {
00640         return prev;
00641     }
00642     TiXmlNode* PreviousSibling() {
00643         return prev;
00644     }
00645 
00647     const TiXmlNode* PreviousSibling(const char *) const;
00648     TiXmlNode* PreviousSibling(const char *_prev) {
00649         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->PreviousSibling(
00650                     _prev));
00651     }
00652 
00653 #ifdef TIXML_USE_STL
00654     const TiXmlNode* PreviousSibling( const std::string& _value ) const {return PreviousSibling (_value.c_str ());} 
00655     TiXmlNode* PreviousSibling( const std::string& _value ) {return PreviousSibling (_value.c_str ());} 
00656     const TiXmlNode* NextSibling( const std::string& _value) const {return NextSibling (_value.c_str ());} 
00657     TiXmlNode* NextSibling( const std::string& _value) {return NextSibling (_value.c_str ());} 
00658 #endif
00659 
00661     const TiXmlNode* NextSibling() const {
00662         return next;
00663     }
00664     TiXmlNode* NextSibling() {
00665         return next;
00666     }
00667 
00669     const TiXmlNode* NextSibling(const char *) const;
00670     TiXmlNode* NextSibling(const char* _next) {
00671         return const_cast<TiXmlNode*> ((const_cast<const TiXmlNode*> (this))->NextSibling(
00672                     _next));
00673     }
00674 
00679     const TiXmlElement* NextSiblingElement() const;
00680     TiXmlElement* NextSiblingElement() {
00681         return const_cast<TiXmlElement*> ((const_cast<const TiXmlNode*> (this))->NextSiblingElement());
00682     }
00683 
00688     const TiXmlElement* NextSiblingElement(const char *) const;
00689     TiXmlElement* NextSiblingElement(const char *_next) {
00690         return const_cast<TiXmlElement*> ((const_cast<const TiXmlNode*> (this))->NextSiblingElement(
00691                     _next));
00692     }
00693 
00694 #ifdef TIXML_USE_STL
00695     const TiXmlElement* NextSiblingElement( const std::string& _value) const {return NextSiblingElement (_value.c_str ());} 
00696     TiXmlElement* NextSiblingElement( const std::string& _value) {return NextSiblingElement (_value.c_str ());} 
00697 #endif
00698 
00700     const TiXmlElement* FirstChildElement() const;
00701     TiXmlElement* FirstChildElement() {
00702         return const_cast<TiXmlElement*> ((const_cast<const TiXmlNode*> (this))->FirstChildElement());
00703     }
00704 
00706     const TiXmlElement* FirstChildElement(const char * _value) const;
00707     TiXmlElement* FirstChildElement(const char * _value) {
00708         return const_cast<TiXmlElement*> ((const_cast<const TiXmlNode*> (this))->FirstChildElement(
00709                     _value));
00710     }
00711 
00712 #ifdef TIXML_USE_STL
00713     const TiXmlElement* FirstChildElement( const std::string& _value ) const {return FirstChildElement (_value.c_str ());} 
00714     TiXmlElement* FirstChildElement( const std::string& _value ) {return FirstChildElement (_value.c_str ());} 
00715 #endif
00716 
00721     int Type() const {
00722         return type;
00723     }
00724 
00728     const TiXmlDocument* GetDocument() const;
00729     TiXmlDocument* GetDocument() {
00730         return const_cast<TiXmlDocument*> ((const_cast<const TiXmlNode*> (this))->GetDocument());
00731     }
00732 
00734     bool NoChildren() const {
00735         return !firstChild;
00736     }
00737 
00738     virtual const TiXmlDocument* ToDocument() const {
00739         return 0;
00740     } 
00741     virtual const TiXmlElement* ToElement() const {
00742         return 0;
00743     } 
00744     virtual const TiXmlComment* ToComment() const {
00745         return 0;
00746     } 
00747     virtual const TiXmlUnknown* ToUnknown() const {
00748         return 0;
00749     } 
00750     virtual const TiXmlText* ToText() const {
00751         return 0;
00752     } 
00753     virtual const TiXmlDeclaration* ToDeclaration() const {
00754         return 0;
00755     } 
00756 
00757     virtual TiXmlDocument* ToDocument() {
00758         return 0;
00759     } 
00760     virtual TiXmlElement* ToElement() {
00761         return 0;
00762     } 
00763     virtual TiXmlComment* ToComment() {
00764         return 0;
00765     } 
00766     virtual TiXmlUnknown* ToUnknown() {
00767         return 0;
00768     } 
00769     virtual TiXmlText* ToText() {
00770         return 0;
00771     } 
00772     virtual TiXmlDeclaration* ToDeclaration() {
00773         return 0;
00774     } 
00775 
00779     virtual TiXmlNode* Clone() const = 0;
00780 
00803     virtual bool Accept(TiXmlVisitor* visitor) const = 0;
00804 
00805     protected:
00806     TiXmlNode(NodeType _type);
00807 
00808     // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
00809     // and the assignment operator.
00810     void CopyTo(TiXmlNode* target) const;
00811 
00812 #ifdef TIXML_USE_STL
00813     // The real work of the input operator.
00814     virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
00815 #endif
00816 
00817     // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
00818     TiXmlNode* Identify(const char* start, TiXmlEncoding encoding);
00819 
00820     TiXmlNode* parent;
00821     NodeType type;
00822 
00823     TiXmlNode* firstChild;
00824     TiXmlNode* lastChild;
00825 
00826     TIXML_STRING value;
00827 
00828     TiXmlNode* prev;
00829     TiXmlNode* next;
00830 
00831     private:
00832     TiXmlNode(const TiXmlNode&); // not implemented.
00833     void operator=(const TiXmlNode& base); // not allowed.
00834 };
00835 
00843 class TiXmlAttribute: public TiXmlBase {
00844     friend class TiXmlAttributeSet;
00845 
00846     public:
00848     TiXmlAttribute() :
00849         TiXmlBase() {
00850             document = 0;
00851             prev = next = 0;
00852         }
00853 
00854 #ifdef TIXML_USE_STL
00855 
00856     TiXmlAttribute( const std::string& _name, const std::string& _value )
00857     {
00858         name = _name;
00859         value = _value;
00860         document = 0;
00861         prev = next = 0;
00862     }
00863 #endif
00864 
00866     TiXmlAttribute(const char * _name, const char * _value) {
00867         name = _name;
00868         value = _value;
00869         document = 0;
00870         prev = next = 0;
00871     }
00872 
00873     const char* Name() const {
00874         return name.c_str();
00875     } 
00876     const char* Value() const {
00877         return value.c_str();
00878     } 
00879 #ifdef TIXML_USE_STL
00880     const std::string& ValueStr() const {return value;} 
00881 #endif
00882     int IntValue() const; 
00883     double DoubleValue() const; 
00884 
00885     // Get the tinyxml string representation
00886     const TIXML_STRING& NameTStr() const {
00887         return name;
00888     }
00889 
00899     int QueryIntValue(int* _value) const;
00901     int QueryDoubleValue(double* _value) const;
00902 
00903     void SetName(const char* _name) {
00904         name = _name;
00905     } 
00906     void SetValue(const char* _value) {
00907         value = _value;
00908     } 
00909 
00910     void SetIntValue(int _value); 
00911     void SetDoubleValue(double _value); 
00912 
00913 #ifdef TIXML_USE_STL
00914 
00915     void SetName( const std::string& _name ) {name = _name;}
00917     void SetValue( const std::string& _value ) {value = _value;}
00918 #endif
00919 
00921     const TiXmlAttribute* Next() const;
00922     TiXmlAttribute* Next() {
00923         return const_cast<TiXmlAttribute*> ((const_cast<const TiXmlAttribute*> (this))->Next());
00924     }
00925 
00927     const TiXmlAttribute* Previous() const;
00928     TiXmlAttribute* Previous() {
00929         return const_cast<TiXmlAttribute*> ((const_cast<const TiXmlAttribute*> (this))->Previous());
00930     }
00931 
00932     bool operator==(const TiXmlAttribute& rhs) const {
00933         return rhs.name == name;
00934     }
00935     bool operator<(const TiXmlAttribute& rhs) const {
00936         return name < rhs.name;
00937     }
00938     bool operator>(const TiXmlAttribute& rhs) const {
00939         return name > rhs.name;
00940     }
00941 
00942     /*  Attribute parsing starts: first letter of the name
00943 returns: the next char after the value end quote
00944 */
00945     virtual const char* Parse(const char* p, TiXmlParsingData* data,
00946             TiXmlEncoding encoding);
00947 
00948     // Prints this Attribute to a FILE stream.
00949     virtual void Print(FILE* cfile, int depth) const {
00950         Print(cfile, depth, 0);
00951     }
00952     void Print(FILE* cfile, int depth, TIXML_STRING* str) const;
00953 
00954     // [internal use]
00955     // Set the document pointer so the attribute can report errors.
00956     void SetDocument(TiXmlDocument* doc) {
00957         document = doc;
00958     }
00959 
00960     private:
00961     TiXmlAttribute(const TiXmlAttribute&); // not implemented.
00962     void operator=(const TiXmlAttribute& base); // not allowed.
00963 
00964     TiXmlDocument* document; // A pointer back to a document, for error reporting.
00965     TIXML_STRING name;
00966     TIXML_STRING value;
00967     TiXmlAttribute* prev;
00968     TiXmlAttribute* next;
00969 };
00970 
00971 /*      A class used to manage a group of attributes.
00972     It is only used internally, both by the ELEMENT and the DECLARATION.
00973 
00974     The set can be changed transparent to the Element and Declaration
00975     classes that use it, but NOT transparent to the Attribute
00976     which has to implement a next() and previous() method. Which makes
00977     it a bit problematic and prevents the use of STL.
00978 
00979     This version is implemented with circular lists because:
00980     - I like circular lists
00981     - it demonstrates some independence from the (typical) doubly linked list.
00982     */
00983 class TiXmlAttributeSet {
00984     public:
00985         TiXmlAttributeSet();
00986         ~TiXmlAttributeSet();
00987 
00988         void Add(TiXmlAttribute* attribute);
00989         void Remove(TiXmlAttribute* attribute);
00990 
00991         const TiXmlAttribute* First() const {
00992             return (sentinel.next == &sentinel) ? 0 : sentinel.next;
00993         }
00994         TiXmlAttribute* First() {
00995             return (sentinel.next == &sentinel) ? 0 : sentinel.next;
00996         }
00997         const TiXmlAttribute* Last() const {
00998             return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
00999         }
01000         TiXmlAttribute* Last() {
01001             return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
01002         }
01003 
01004         const TiXmlAttribute* Find(const char* _name) const;
01005         TiXmlAttribute* Find(const char* _name) {
01006             return const_cast<TiXmlAttribute*> ((const_cast<const TiXmlAttributeSet*> (this))->Find(
01007                         _name));
01008         }
01009 #ifdef TIXML_USE_STL
01010         const TiXmlAttribute* Find( const std::string& _name ) const;
01011         TiXmlAttribute* Find( const std::string& _name ) {
01012             return const_cast< TiXmlAttribute*>( (const_cast< const TiXmlAttributeSet*>(this))->Find( _name ) );
01013         }
01014 
01015 #endif
01016 
01017     private:
01018         //*ME:  Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
01019         //*ME:  this class must be also use a hidden/disabled copy-constructor !!!
01020         TiXmlAttributeSet(const TiXmlAttributeSet&); // not allowed
01021         void operator=(const TiXmlAttributeSet&); // not allowed (as TiXmlAttribute)
01022 
01023         TiXmlAttribute sentinel;
01024 };
01025 
01030 class TiXmlElement: public TiXmlNode {
01031     public:
01033         TiXmlElement(const char * in_value);
01034 
01035 #ifdef TIXML_USE_STL
01036 
01037         TiXmlElement( const std::string& _value );
01038 #endif
01039 
01040         TiXmlElement(const TiXmlElement&);
01041 
01042         void operator=(const TiXmlElement& base);
01043 
01044         virtual ~TiXmlElement();
01045 
01049         const char* Attribute(const char* name) const;
01050 
01057         const char* Attribute(const char* name, int* i) const;
01058 
01065         const char* Attribute(const char* name, double* d) const;
01066 
01074         int QueryIntAttribute(const char* name, int* _value) const;
01076         int QueryDoubleAttribute(const char* name, double* _value) const;
01078         int QueryFloatAttribute(const char* name, float* _value) const {
01079             double d;
01080             int result = QueryDoubleAttribute(name, &d);
01081             if (result == TIXML_SUCCESS) {
01082                 *_value = (float) d;
01083             }
01084             return result;
01085         }
01086 
01087 #ifdef TIXML_USE_STL
01088 
01096         template< typename T> int QueryValueAttribute( const std::string& name, T* outValue ) const
01097         {
01098             const TiXmlAttribute* node = attributeSet.Find( name );
01099             if ( !node )
01100                 return TIXML_NO_ATTRIBUTE;
01101 
01102             std::stringstream sstream( node->ValueStr() );
01103             sstream >> *outValue;
01104             if ( !sstream.fail() )
01105                 return TIXML_SUCCESS;
01106             return TIXML_WRONG_TYPE;
01107         }
01108         /*
01109            This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
01110            but template specialization is hard to get working cross-compiler. Leaving the bug for now.
01111 
01112         // The above will fail for std::string because the space character is used as a seperator.
01113         // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
01114         template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
01115         {
01116         const TiXmlAttribute* node = attributeSet.Find( name );
01117         if ( !node )
01118         return TIXML_NO_ATTRIBUTE;
01119          *outValue = node->ValueStr();
01120          return TIXML_SUCCESS;
01121          }
01122          */
01123 #endif
01124 
01128         void SetAttribute(const char* name, const char * _value);
01129 
01130 #ifdef TIXML_USE_STL
01131         const std::string* Attribute( const std::string& name ) const;
01132         const std::string* Attribute( const std::string& name, int* i ) const;
01133         const std::string* Attribute( const std::string& name, double* d ) const;
01134         int QueryIntAttribute( const std::string& name, int* _value ) const;
01135         int QueryDoubleAttribute( const std::string& name, double* _value ) const;
01136 
01138         void SetAttribute( const std::string& name, const std::string& _value );
01140         void SetAttribute( const std::string& name, int _value );
01141 #endif
01142 
01146         void SetAttribute(const char * name, int value);
01147 
01151         void SetDoubleAttribute(const char * name, double value);
01152 
01155         void RemoveAttribute(const char * name);
01156 #ifdef TIXML_USE_STL
01157         void RemoveAttribute( const std::string& name ) {RemoveAttribute (name.c_str ());} 
01158 #endif
01159 
01160         const TiXmlAttribute* FirstAttribute() const {
01161             return attributeSet.First();
01162         } 
01163         TiXmlAttribute* FirstAttribute() {
01164             return attributeSet.First();
01165         }
01166         const TiXmlAttribute* LastAttribute() const {
01167             return attributeSet.Last();
01168         } 
01169         TiXmlAttribute* LastAttribute() {
01170             return attributeSet.Last();
01171         }
01172 
01205         const char* GetText() const;
01206 
01208         virtual TiXmlNode* Clone() const;
01209         // Print the Element to a FILE stream.
01210         virtual void Print(FILE* cfile, int depth) const;
01211 
01212         /*      Attribtue parsing starts: next char past '<'
01213 returns: next char past '>'
01214 */
01215         virtual const char* Parse(const char* p, TiXmlParsingData* data,
01216                 TiXmlEncoding encoding);
01217 
01218         virtual const TiXmlElement* ToElement() const {
01219             return this;
01220         } 
01221         virtual TiXmlElement* ToElement() {
01222             return this;
01223         } 
01224 
01227         virtual bool Accept(TiXmlVisitor* visitor) const;
01228 
01229     protected:
01230 
01231         void CopyTo(TiXmlElement* target) const;
01232         void ClearThis(); // like clear, but initializes 'this' object as well
01233 
01234         // Used to be public [internal use]
01235 #ifdef TIXML_USE_STL
01236         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01237 #endif
01238         /*      [internal use]
01239             Reads the "value" of the element -- another element, or text.
01240             This should terminate with the current end tag.
01241             */
01242         const char* ReadValue(const char* in, TiXmlParsingData* prevData,
01243                 TiXmlEncoding encoding);
01244 
01245     private:
01246 
01247         TiXmlAttributeSet attributeSet;
01248 };
01249 
01252 class TiXmlComment: public TiXmlNode {
01253     public:
01255         TiXmlComment() :
01256             TiXmlNode(TiXmlNode::COMMENT) {
01257             }
01259         TiXmlComment(const char* _value) :
01260             TiXmlNode(TiXmlNode::COMMENT) {
01261                 SetValue(_value);
01262             }
01263         TiXmlComment(const TiXmlComment&);
01264         void operator=(const TiXmlComment& base);
01265 
01266         virtual ~TiXmlComment() {
01267         }
01268 
01270         virtual TiXmlNode* Clone() const;
01271         // Write this Comment to a FILE stream.
01272         virtual void Print(FILE* cfile, int depth) const;
01273 
01274         /*      Attribtue parsing starts: at the ! of the !--
01275 returns: next char past '>'
01276 */
01277         virtual const char* Parse(const char* p, TiXmlParsingData* data,
01278                 TiXmlEncoding encoding);
01279 
01280         virtual const TiXmlComment* ToComment() const {
01281             return this;
01282         } 
01283         virtual TiXmlComment* ToComment() {
01284             return this;
01285         } 
01286 
01289         virtual bool Accept(TiXmlVisitor* visitor) const;
01290 
01291     protected:
01292         void CopyTo(TiXmlComment* target) const;
01293 
01294         // used to be public
01295 #ifdef TIXML_USE_STL
01296         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01297 #endif
01298         //      virtual void StreamOut( TIXML_OSTREAM * out ) const;
01299 
01300     private:
01301 
01302 };
01303 
01309 class TiXmlText: public TiXmlNode {
01310     friend class TiXmlElement;
01311     public:
01316     TiXmlText(const char * initValue) :
01317         TiXmlNode(TiXmlNode::TEXT) {
01318             SetValue(initValue);
01319             cdata = false;
01320         }
01321     virtual ~TiXmlText() {
01322     }
01323 
01324 #ifdef TIXML_USE_STL
01325 
01326     TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
01327     {
01328         SetValue( initValue );
01329         cdata = false;
01330     }
01331 #endif
01332 
01333     TiXmlText(const TiXmlText& copy) :
01334         TiXmlNode(TiXmlNode::TEXT) {
01335             copy.CopyTo(this);
01336         }
01337     void operator=(const TiXmlText& base) {
01338         base.CopyTo(this);
01339     }
01340 
01341     // Write this text object to a FILE stream.
01342     virtual void Print(FILE* cfile, int depth) const;
01343 
01345     bool CDATA() const {
01346         return cdata;
01347     }
01349     void SetCDATA(bool _cdata) {
01350         cdata = _cdata;
01351     }
01352 
01353     virtual const char* Parse(const char* p, TiXmlParsingData* data,
01354             TiXmlEncoding encoding);
01355 
01356     virtual const TiXmlText* ToText() const {
01357         return this;
01358     } 
01359     virtual TiXmlText* ToText() {
01360         return this;
01361     } 
01362 
01365     virtual bool Accept(TiXmlVisitor* content) const;
01366 
01367     protected:
01369     virtual TiXmlNode* Clone() const;
01370     void CopyTo(TiXmlText* target) const;
01371 
01372     bool Blank() const; // returns true if all white space and new lines
01373     // [internal use]
01374 #ifdef TIXML_USE_STL
01375     virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01376 #endif
01377 
01378     private:
01379     bool cdata; // true if this should be input and output as a CDATA style text element
01380 };
01381 
01395 class TiXmlDeclaration: public TiXmlNode {
01396     public:
01398         TiXmlDeclaration() :
01399             TiXmlNode(TiXmlNode::DECLARATION) {
01400             }
01401 
01402 #ifdef TIXML_USE_STL
01403 
01404         TiXmlDeclaration( const std::string& _version,
01405                 const std::string& _encoding,
01406                 const std::string& _standalone );
01407 #endif
01408 
01410         TiXmlDeclaration(const char* _version, const char* _encoding,
01411                 const char* _standalone);
01412 
01413         TiXmlDeclaration(const TiXmlDeclaration& copy);
01414         void operator=(const TiXmlDeclaration& copy);
01415 
01416         virtual ~TiXmlDeclaration() {
01417         }
01418 
01420         const char *Version() const {
01421             return version.c_str();
01422         }
01424         const char *Encoding() const {
01425             return encoding.c_str();
01426         }
01428         const char *Standalone() const {
01429             return standalone.c_str();
01430         }
01431 
01433         virtual TiXmlNode* Clone() const;
01434         // Print this declaration to a FILE stream.
01435         virtual void Print(FILE* cfile, int depth, TIXML_STRING* str) const;
01436         virtual void Print(FILE* cfile, int depth) const {
01437             Print(cfile, depth, 0);
01438         }
01439 
01440         virtual const char* Parse(const char* p, TiXmlParsingData* data,
01441                 TiXmlEncoding encoding);
01442 
01443         virtual const TiXmlDeclaration* ToDeclaration() const {
01444             return this;
01445         } 
01446         virtual TiXmlDeclaration* ToDeclaration() {
01447             return this;
01448         } 
01449 
01452         virtual bool Accept(TiXmlVisitor* visitor) const;
01453 
01454     protected:
01455         void CopyTo(TiXmlDeclaration* target) const;
01456         // used to be public
01457 #ifdef TIXML_USE_STL
01458         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01459 #endif
01460 
01461     private:
01462         TIXML_STRING version;
01463         TIXML_STRING encoding;
01464         TIXML_STRING standalone;
01465 };
01466 
01474 class TiXmlUnknown: public TiXmlNode {
01475     public:
01476         TiXmlUnknown() :
01477             TiXmlNode(TiXmlNode::UNKNOWN) {
01478             }
01479         virtual ~TiXmlUnknown() {
01480         }
01481 
01482         TiXmlUnknown(const TiXmlUnknown& copy) :
01483             TiXmlNode(TiXmlNode::UNKNOWN) {
01484                 copy.CopyTo(this);
01485             }
01486         void operator=(const TiXmlUnknown& copy) {
01487             copy.CopyTo(this);
01488         }
01489 
01491         virtual TiXmlNode* Clone() const;
01492         // Print this Unknown to a FILE stream.
01493         virtual void Print(FILE* cfile, int depth) const;
01494 
01495         virtual const char* Parse(const char* p, TiXmlParsingData* data,
01496                 TiXmlEncoding encoding);
01497 
01498         virtual const TiXmlUnknown* ToUnknown() const {
01499             return this;
01500         } 
01501         virtual TiXmlUnknown* ToUnknown() {
01502             return this;
01503         } 
01504 
01507         virtual bool Accept(TiXmlVisitor* content) const;
01508 
01509     protected:
01510         void CopyTo(TiXmlUnknown* target) const;
01511 
01512 #ifdef TIXML_USE_STL
01513         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01514 #endif
01515 
01516     private:
01517 
01518 };
01519 
01524 class TiXmlDocument: public TiXmlNode {
01525     public:
01527         TiXmlDocument();
01529         TiXmlDocument(const char * documentName);
01530 
01531 #ifdef TIXML_USE_STL
01532 
01533         TiXmlDocument( const std::string& documentName );
01534 #endif
01535 
01536         TiXmlDocument(const TiXmlDocument& copy);
01537         void operator=(const TiXmlDocument& copy);
01538 
01539         virtual ~TiXmlDocument() {
01540         }
01541 
01546         bool LoadFile(TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
01548         bool SaveFile() const;
01550         bool LoadFile(const char * filename, TiXmlEncoding encoding =
01551                 TIXML_DEFAULT_ENCODING);
01553         bool SaveFile(const char * filename) const;
01559         bool LoadFile(FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
01561         bool SaveFile(FILE*) const;
01562 
01563 #ifdef TIXML_USE_STL
01564         bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) 
01565         {
01566             //          StringToBuffer f( filename );
01567             //          return ( f.buffer && LoadFile( f.buffer, encoding ));
01568             return LoadFile( filename.c_str(), encoding );
01569         }
01570         bool SaveFile( const std::string& filename ) const 
01571         {
01572             //          StringToBuffer f( filename );
01573             //          return ( f.buffer && SaveFile( f.buffer ));
01574             return SaveFile( filename.c_str() );
01575         }
01576 #endif
01577 
01582         virtual const char* Parse(const char* p, TiXmlParsingData* data = 0,
01583                 TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
01584 
01589         const TiXmlElement* RootElement() const {
01590             return FirstChildElement();
01591         }
01592         TiXmlElement* RootElement() {
01593             return FirstChildElement();
01594         }
01595 
01601         bool Error() const {
01602             return error;
01603         }
01604 
01606         const char * ErrorDesc() const {
01607             return errorDesc.c_str();
01608         }
01609 
01613         int ErrorId() const {
01614             return errorId;
01615         }
01616 
01624         int ErrorRow() const {
01625             return errorLocation.row + 1;
01626         }
01627         int ErrorCol() const {
01628             return errorLocation.col + 1;
01629         } 
01630 
01655         void SetTabSize(int _tabsize) {
01656             tabsize = _tabsize;
01657         }
01658 
01659         int TabSize() const {
01660             return tabsize;
01661         }
01662 
01666         void ClearError() {
01667             error = false;
01668             errorId = 0;
01669             errorDesc = "";
01670             errorLocation.row = errorLocation.col = 0;
01671             //errorLocation.last = 0;
01672         }
01673 
01675         void Print() const {
01676             Print(stdout, 0);
01677         }
01678 
01679         /* Write the document to a string using formatted printing ("pretty print"). This
01680            will allocate a character array (new char[]) and return it as a pointer. The
01681            calling code pust call delete[] on the return char* to avoid a memory leak.
01682            */
01683         //char* PrintToMemory() const;
01684 
01686         virtual void Print(FILE* cfile, int depth = 0) const;
01687         // [internal use]
01688         void SetError(int err, const char* errorLocation,
01689                 TiXmlParsingData* prevData, TiXmlEncoding encoding);
01690 
01691         virtual const TiXmlDocument* ToDocument() const {
01692             return this;
01693         } 
01694         virtual TiXmlDocument* ToDocument() {
01695             return this;
01696         } 
01697 
01700         virtual bool Accept(TiXmlVisitor* content) const;
01701 
01702     protected:
01703         // [internal use]
01704         virtual TiXmlNode* Clone() const;
01705 #ifdef TIXML_USE_STL
01706         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01707 #endif
01708 
01709     private:
01710         void CopyTo(TiXmlDocument* target) const;
01711 
01712         bool error;
01713         int errorId;
01714         TIXML_STRING errorDesc;
01715         int tabsize;
01716         TiXmlCursor errorLocation;
01717         bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write.
01718 };
01719 
01800 class TiXmlHandle {
01801     public:
01803         TiXmlHandle(TiXmlNode* _node) {
01804             this->node = _node;
01805         }
01807         TiXmlHandle(const TiXmlHandle& ref) {
01808             this->node = ref.node;
01809         }
01810         TiXmlHandle operator=(const TiXmlHandle& ref) {
01811             this->node = ref.node;
01812             return *this;
01813         }
01814 
01816         TiXmlHandle FirstChild() const;
01818         TiXmlHandle FirstChild(const char * value) const;
01820         TiXmlHandle FirstChildElement() const;
01822         TiXmlHandle FirstChildElement(const char * value) const;
01823 
01827         TiXmlHandle Child(const char* value, int index) const;
01831         TiXmlHandle Child(int index) const;
01836         TiXmlHandle ChildElement(const char* value, int index) const;
01841         TiXmlHandle ChildElement(int index) const;
01842 
01843 #ifdef TIXML_USE_STL
01844         TiXmlHandle FirstChild( const std::string& _value ) const {return FirstChild( _value.c_str() );}
01845         TiXmlHandle FirstChildElement( const std::string& _value ) const {return FirstChildElement( _value.c_str() );}
01846 
01847         TiXmlHandle Child( const std::string& _value, int index ) const {return Child( _value.c_str(), index );}
01848         TiXmlHandle ChildElement( const std::string& _value, int index ) const {return ChildElement( _value.c_str(), index );}
01849 #endif
01850 
01853         TiXmlNode* ToNode() const {
01854             return node;
01855         }
01858         TiXmlElement* ToElement() const {
01859             return ((node && node->ToElement()) ? node->ToElement() : 0);
01860         }
01863         TiXmlText* ToText() const {
01864             return ((node && node->ToText()) ? node->ToText() : 0);
01865         }
01868         TiXmlUnknown* ToUnknown() const {
01869             return ((node && node->ToUnknown()) ? node->ToUnknown() : 0);
01870         }
01871 
01875         TiXmlNode* Node() const {
01876             return ToNode();
01877         }
01881         TiXmlElement* Element() const {
01882             return ToElement();
01883         }
01887         TiXmlText* Text() const {
01888             return ToText();
01889         }
01893         TiXmlUnknown* Unknown() const {
01894             return ToUnknown();
01895         }
01896 
01897     private:
01898         TiXmlNode* node;
01899 };
01900 
01920 class TiXmlPrinter: public TiXmlVisitor {
01921     public:
01922         TiXmlPrinter() :
01923             depth(0), simpleTextPrint(false), buffer(), indent("    "), lineBreak(
01924                     "\n") {
01925             }
01926 
01927         virtual bool VisitEnter(const TiXmlDocument& doc);
01928         virtual bool VisitExit(const TiXmlDocument& doc);
01929 
01930         virtual bool VisitEnter(const TiXmlElement& element,
01931                 const TiXmlAttribute* firstAttribute);
01932         virtual bool VisitExit(const TiXmlElement& element);
01933 
01934         virtual bool Visit(const TiXmlDeclaration& declaration);
01935         virtual bool Visit(const TiXmlText& text);
01936         virtual bool Visit(const TiXmlComment& comment);
01937         virtual bool Visit(const TiXmlUnknown& unknown);
01938 
01942         void SetIndent(const char* _indent) {
01943             indent = _indent ? _indent : "";
01944         }
01946         const char* Indent() {
01947             return indent.c_str();
01948         }
01953         void SetLineBreak(const char* _lineBreak) {
01954             lineBreak = _lineBreak ? _lineBreak : "";
01955         }
01957         const char* LineBreak() {
01958             return lineBreak.c_str();
01959         }
01960 
01964         void SetStreamPrinting() {
01965             indent = "";
01966             lineBreak = "";
01967         }
01969         const char* CStr() {
01970             return buffer.c_str();
01971         }
01973         size_t Size() {
01974             return buffer.size();
01975         }
01976 
01977 #ifdef TIXML_USE_STL
01978 
01979         const std::string& Str() {return buffer;}
01980 #endif
01981 
01982     private:
01983         void DoIndent() {
01984             for (int i = 0; i < depth; ++i)
01985                 buffer += indent;
01986         }
01987         void DoLineBreak() {
01988             buffer += lineBreak;
01989         }
01990 
01991         int depth;
01992         bool simpleTextPrint;
01993         TIXML_STRING buffer;
01994         TIXML_STRING indent;
01995         TIXML_STRING lineBreak;
01996 };
01997 
01998 #ifdef _MSC_VER
01999 #pragma warning( pop )
02000 #endif
02001 
02002 #endif
02003 


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29