MTK++ Latest version: 0.2.0

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 
00026 #ifndef TINYXML_INCLUDED
00027 #define TINYXML_INCLUDED
00028 
00029 #ifdef _MSC_VER
00030 #pragma warning( push )
00031 #pragma warning( disable : 4530 )
00032 #pragma warning( disable : 4786 )
00033 #endif
00034 
00035 #ifdef __INTEL_COMPILER
00036 
00037 // remark #981: operands are evaluated in unspecified order
00038 #pragma warning(disable:981)
00039 
00040 // remark #1418: external function definition with no prior declaration
00041 #pragma warning(disable:1418)
00042 
00043 #endif
00044 
00045 #include <ctype.h>
00046 #include <stdio.h>
00047 #include <stdlib.h>
00048 #include <string.h>
00049 #include <assert.h>
00050 
00051 // Help out windows:
00052 #if defined( _DEBUG ) && !defined( DEBUG )
00053 #define DEBUG
00054 #endif
00055 
00056 #ifdef TIXML_USE_STL
00057         #include <string>
00058         #include <iostream>
00059         #include <sstream>
00060         #define TIXML_STRING            std::string
00061 #else
00062         #include "tinystr.h"
00063         #define TIXML_STRING            TiXmlString
00064 #endif
00065 
00066 // Deprecated library function hell. Compilers want to use the
00067 // new safe versions. This probably doesn't fully address the problem,
00068 // but it gets closer. There are too many compilers for me to fully
00069 // test. If you get compilation troubles, undefine TIXML_SAFE
00070 #define TIXML_SAFE
00071 
00072 #ifdef TIXML_SAFE
00073         #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
00074                 // Microsoft visual studio, version 2005 and higher.
00075                 #define TIXML_SNPRINTF _snprintf_s
00076                 #define TIXML_SNSCANF  _snscanf_s
00077                 #define TIXML_SSCANF   sscanf_s
00078         #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
00079                 // Microsoft visual studio, version 6 and higher.
00080                 //#pragma message( "Using _sn* functions." )
00081                 #define TIXML_SNPRINTF _snprintf
00082                 #define TIXML_SNSCANF  _snscanf
00083                 #define TIXML_SSCANF   sscanf
00084         #elif defined(__GNUC__) && (__GNUC__ >= 3 )
00085                 // GCC version 3 and higher.s
00086                 //#warning( "Using sn* functions." )
00087                 #define TIXML_SNPRINTF snprintf
00088                 #define TIXML_SNSCANF  snscanf
00089                 #define TIXML_SSCANF   sscanf
00090         #else
00091                 #define TIXML_SSCANF   sscanf
00092         #endif
00093 #endif  
00094 
00095 class TiXmlDocument;
00096 class TiXmlElement;
00097 class TiXmlComment;
00098 class TiXmlUnknown;
00099 class TiXmlAttribute;
00100 class TiXmlText;
00101 class TiXmlDeclaration;
00102 class TiXmlParsingData;
00103 
00104 const int TIXML_MAJOR_VERSION = 2;
00105 const int TIXML_MINOR_VERSION = 5;
00106 const int TIXML_PATCH_VERSION = 3;
00107 
00108 /*      Internal structure for tracking location of items 
00109         in the XML file.
00110 */
00111 struct TiXmlCursor
00112 {
00113         TiXmlCursor()           { Clear(); }
00114         void Clear()            { row = col = -1; }
00115 
00116         int row;        // 0 based.
00117         int col;        // 0 based.
00118 };
00119 
00120 
00139 class TiXmlVisitor
00140 {
00141 public:
00142         virtual ~TiXmlVisitor() {}
00143 
00145         virtual bool VisitEnter( const TiXmlDocument& /*doc*/ )                 { return true; }
00147         virtual bool VisitExit( const TiXmlDocument& /*doc*/ )                  { return true; }
00148 
00150         virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ )    { return true; }
00152         virtual bool VisitExit( const TiXmlElement& /*element*/ )               { return true; }
00153 
00155         virtual bool Visit( const TiXmlDeclaration& /*declaration*/ )   { return true; }
00157         virtual bool Visit( const TiXmlText& /*text*/ )                                 { return true; }
00159         virtual bool Visit( const TiXmlComment& /*comment*/ )                   { return true; }
00161         virtual bool Visit( const TiXmlUnknown& /*unknown*/ )                   { return true; }
00162 };
00163 
00164 // Only used by Attribute::Query functions
00165 enum 
00166 { 
00167         TIXML_SUCCESS,
00168         TIXML_NO_ATTRIBUTE,
00169         TIXML_WRONG_TYPE
00170 };
00171 
00172 
00173 // Used by the parsing routines.
00174 enum TiXmlEncoding
00175 {
00176         TIXML_ENCODING_UNKNOWN,
00177         TIXML_ENCODING_UTF8,
00178         TIXML_ENCODING_LEGACY
00179 };
00180 
00181 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00182 
00205 class TiXmlBase
00206 {
00207         friend class TiXmlNode;
00208         friend class TiXmlElement;
00209         friend class TiXmlDocument;
00210 
00211 public:
00212         TiXmlBase()     :       userData(0)             {}
00213         virtual ~TiXmlBase()                    {}
00214 
00224         virtual void Print( FILE* cfile, int depth ) const = 0;
00225 
00232         static void SetCondenseWhiteSpace( bool condense )              { condenseWhiteSpace = condense; }
00233 
00235         static bool IsWhiteSpaceCondensed()                                             { return condenseWhiteSpace; }
00236 
00255         int Row() const                 { return location.row + 1; }
00256         int Column() const              { return location.col + 1; }    
00257 
00258         void  SetUserData( void* user )                 { userData = user; }    
00259         void* GetUserData()                                             { return userData; }    
00260         const void* GetUserData() const                 { return userData; }    
00261 
00262         // Table that returs, for a given lead byte, the total number of bytes
00263         // in the UTF-8 sequence.
00264         static const int utf8ByteTable[256];
00265 
00266         virtual const char* Parse(      const char* p, 
00267                                                                 TiXmlParsingData* data, 
00268                                                                 TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
00269 
00273         static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
00274 
00275         enum
00276         {
00277                 TIXML_NO_ERROR = 0,
00278                 TIXML_ERROR,
00279                 TIXML_ERROR_OPENING_FILE,
00280                 TIXML_ERROR_OUT_OF_MEMORY,
00281                 TIXML_ERROR_PARSING_ELEMENT,
00282                 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00283                 TIXML_ERROR_READING_ELEMENT_VALUE,
00284                 TIXML_ERROR_READING_ATTRIBUTES,
00285                 TIXML_ERROR_PARSING_EMPTY,
00286                 TIXML_ERROR_READING_END_TAG,
00287                 TIXML_ERROR_PARSING_UNKNOWN,
00288                 TIXML_ERROR_PARSING_COMMENT,
00289                 TIXML_ERROR_PARSING_DECLARATION,
00290                 TIXML_ERROR_DOCUMENT_EMPTY,
00291                 TIXML_ERROR_EMBEDDED_NULL,
00292                 TIXML_ERROR_PARSING_CDATA,
00293                 TIXML_ERROR_DOCUMENT_TOP_ONLY,
00294 
00295                 TIXML_ERROR_STRING_COUNT
00296         };
00297 
00298 protected:
00299 
00300         static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
00301         inline static bool IsWhiteSpace( char c )               
00302         { 
00303                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
00304         }
00305         inline static bool IsWhiteSpace( int c )
00306         {
00307                 if ( c < 256 )
00308                         return IsWhiteSpace( (char) c );
00309                 return false;   // Again, only truly correct for English/Latin...but usually works.
00310         }
00311 
00312         #ifdef TIXML_USE_STL
00313         static bool     StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
00314         static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
00315         #endif
00316 
00317         /*      Reads an XML name into the string provided. Returns
00318                 a pointer just past the last character of the name,
00319                 or 0 if the function has an error.
00320         */
00321         static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
00322 
00323         /*      Reads text. Returns a pointer past the given end tag.
00324                 Wickedly complex options, but it keeps the (sensitive) code in one place.
00325         */
00326         static const char* ReadText(    const char* in,                         // where to start
00327                                                                         TIXML_STRING* text,                     // the string read
00328                                                                         bool ignoreWhiteSpace,          // whether to keep the white space
00329                                                                         const char* endTag,                     // what ends this text
00330                                                                         bool ignoreCase,                        // whether to ignore case in the end tag
00331                                                                         TiXmlEncoding encoding );       // the current encoding
00332 
00333         // If an entity has been found, transform it into a character.
00334         static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
00335 
00336         // Get a character, while interpreting entities.
00337         // The length can be from 0 to 4 bytes.
00338         inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
00339         {
00340                 assert( p );
00341                 if ( encoding == TIXML_ENCODING_UTF8 )
00342                 {
00343                         *length = utf8ByteTable[ *((const unsigned char*)p) ];
00344                         assert( *length >= 0 && *length < 5 );
00345                 }
00346                 else
00347                 {
00348                         *length = 1;
00349                 }
00350 
00351                 if ( *length == 1 )
00352                 {
00353                         if ( *p == '&' )
00354                                 return GetEntity( p, _value, length, encoding );
00355                         *_value = *p;
00356                         return p+1;
00357                 }
00358                 else if ( *length )
00359                 {
00360                         //strncpy( _value, p, *length );        // lots of compilers don't like this function (unsafe),
00361                                                                                                 // and the null terminator isn't needed
00362                         for( int i=0; p[i] && i<*length; ++i ) {
00363                                 _value[i] = p[i];
00364                         }
00365                         return p + (*length);
00366                 }
00367                 else
00368                 {
00369                         // Not valid text.
00370                         return 0;
00371                 }
00372         }
00373 
00374         // Return true if the next characters in the stream are any of the endTag sequences.
00375         // Ignore case only works for english, and should only be relied on when comparing
00376         // to English words: StringEqual( p, "version", true ) is fine.
00377         static bool StringEqual(        const char* p,
00378                                                                 const char* endTag,
00379                                                                 bool ignoreCase,
00380                                                                 TiXmlEncoding encoding );
00381 
00382         static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
00383 
00384         TiXmlCursor location;
00385 
00387         void*                   userData;
00388         
00389         // None of these methods are reliable for any language except English.
00390         // Good for approximation, not great for accuracy.
00391         static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
00392         static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
00393         inline static int ToLower( int v, TiXmlEncoding encoding )
00394         {
00395                 if ( encoding == TIXML_ENCODING_UTF8 )
00396                 {
00397                         if ( v < 128 ) return tolower( v );
00398                         return v;
00399                 }
00400                 else
00401                 {
00402                         return tolower( v );
00403                 }
00404         }
00405         static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
00406 
00407 private:
00408         TiXmlBase( const TiXmlBase& );                          // not implemented.
00409         void operator=( const TiXmlBase& base );        // not allowed.
00410 
00411         struct Entity
00412         {
00413                 const char*     str;
00414                 unsigned int    strLength;
00415                 char                chr;
00416         };
00417         enum
00418         {
00419                 NUM_ENTITY = 5,
00420                 MAX_ENTITY_LENGTH = 6
00421 
00422         };
00423         static Entity entity[ NUM_ENTITY ];
00424         static bool condenseWhiteSpace;
00425 };
00426 
00427 
00434 class TiXmlNode : public TiXmlBase
00435 {
00436         friend class TiXmlDocument;
00437         friend class TiXmlElement;
00438 
00439 public:
00440         #ifdef TIXML_USE_STL    
00441 
00445             friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
00446 
00463             friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
00464 
00466                 friend std::string& operator<< (std::string& out, const TiXmlNode& base );
00467 
00468         #endif
00469 
00473         enum NodeType
00474         {
00475                 DOCUMENT,
00476                 ELEMENT,
00477                 COMMENT,
00478                 UNKNOWN,
00479                 TEXT,
00480                 DECLARATION,
00481                 TYPECOUNT
00482         };
00483 
00484         virtual ~TiXmlNode();
00485 
00498         const char *Value() const { return value.c_str (); }
00499 
00500     #ifdef TIXML_USE_STL
00501 
00505         const std::string& ValueStr() const { return value; }
00506         #endif
00507 
00508         const TIXML_STRING& ValueTStr() const { return value; }
00509 
00519         void SetValue(const char * _value) { value = _value;}
00520 
00521     #ifdef TIXML_USE_STL
00522 
00523         void SetValue( const std::string& _value )      { value = _value; }
00524         #endif
00525 
00527         void Clear();
00528 
00530         TiXmlNode* Parent()                                                     { return parent; }
00531         const TiXmlNode* Parent() const                         { return parent; }
00532 
00533         const TiXmlNode* FirstChild()   const           { return firstChild; }  
00534         TiXmlNode* FirstChild()                                         { return firstChild; }
00535         const TiXmlNode* FirstChild( const char * value ) const;                        
00536 
00537         TiXmlNode* FirstChild( const char * _value ) {
00538                 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
00539                 // call the method, cast the return back to non-const.
00540                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
00541         }
00542         const TiXmlNode* LastChild() const      { return lastChild; }           
00543         TiXmlNode* LastChild()  { return lastChild; }
00544         
00545         const TiXmlNode* LastChild( const char * value ) const;                 
00546         TiXmlNode* LastChild( const char * _value ) {
00547                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
00548         }
00549 
00550     #ifdef TIXML_USE_STL
00551         const TiXmlNode* FirstChild( const std::string& _value ) const  {       return FirstChild (_value.c_str ());    }       
00552         TiXmlNode* FirstChild( const std::string& _value )                              {       return FirstChild (_value.c_str ());    }       
00553         const TiXmlNode* LastChild( const std::string& _value ) const   {       return LastChild (_value.c_str ());     }       
00554         TiXmlNode* LastChild( const std::string& _value )                               {       return LastChild (_value.c_str ());     }       
00555         #endif
00556 
00573         const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
00574         TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
00575                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
00576         }
00577 
00579         const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
00580         TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
00581                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
00582         }
00583 
00584     #ifdef TIXML_USE_STL
00585         const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const  {       return IterateChildren (_value.c_str (), previous);     }       
00586         TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) {    return IterateChildren (_value.c_str (), previous);     }       
00587         #endif
00588 
00592         TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
00593 
00594 
00604         TiXmlNode* LinkEndChild( TiXmlNode* addThis );
00605 
00609         TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
00610 
00614         TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
00615 
00619         TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
00620 
00622         bool RemoveChild( TiXmlNode* removeThis );
00623 
00625         const TiXmlNode* PreviousSibling() const                        { return prev; }
00626         TiXmlNode* PreviousSibling()                                            { return prev; }
00627 
00629         const TiXmlNode* PreviousSibling( const char * ) const;
00630         TiXmlNode* PreviousSibling( const char *_prev ) {
00631                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
00632         }
00633 
00634     #ifdef TIXML_USE_STL
00635         const TiXmlNode* PreviousSibling( const std::string& _value ) const     {       return PreviousSibling (_value.c_str ());       }       
00636         TiXmlNode* PreviousSibling( const std::string& _value )                         {       return PreviousSibling (_value.c_str ());       }       
00637         const TiXmlNode* NextSibling( const std::string& _value) const          {       return NextSibling (_value.c_str ());   }       
00638         TiXmlNode* NextSibling( const std::string& _value)                                      {       return NextSibling (_value.c_str ());   }       
00639         #endif
00640 
00642         const TiXmlNode* NextSibling() const                            { return next; }
00643         TiXmlNode* NextSibling()                                                        { return next; }
00644 
00646         const TiXmlNode* NextSibling( const char * ) const;
00647         TiXmlNode* NextSibling( const char* _next ) {
00648                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
00649         }
00650 
00655         const TiXmlElement* NextSiblingElement() const;
00656         TiXmlElement* NextSiblingElement() {
00657                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
00658         }
00659 
00664         const TiXmlElement* NextSiblingElement( const char * ) const;
00665         TiXmlElement* NextSiblingElement( const char *_next ) {
00666                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
00667         }
00668 
00669     #ifdef TIXML_USE_STL
00670         const TiXmlElement* NextSiblingElement( const std::string& _value) const        {       return NextSiblingElement (_value.c_str ());    }       
00671         TiXmlElement* NextSiblingElement( const std::string& _value)                            {       return NextSiblingElement (_value.c_str ());    }       
00672         #endif
00673 
00675         const TiXmlElement* FirstChildElement() const;
00676         TiXmlElement* FirstChildElement() {
00677                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
00678         }
00679 
00681         const TiXmlElement* FirstChildElement( const char * _value ) const;
00682         TiXmlElement* FirstChildElement( const char * _value ) {
00683                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
00684         }
00685 
00686     #ifdef TIXML_USE_STL
00687         const TiXmlElement* FirstChildElement( const std::string& _value ) const        {       return FirstChildElement (_value.c_str ());     }       
00688         TiXmlElement* FirstChildElement( const std::string& _value )                            {       return FirstChildElement (_value.c_str ());     }       
00689         #endif
00690 
00695         int Type() const        { return type; }
00696 
00700         const TiXmlDocument* GetDocument() const;
00701         TiXmlDocument* GetDocument() {
00702                 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
00703         }
00704 
00706         bool NoChildren() const                                         { return !firstChild; }
00707 
00708         virtual const TiXmlDocument*    ToDocument()    const { return 0; } 
00709         virtual const TiXmlElement*     ToElement()     const { return 0; } 
00710         virtual const TiXmlComment*     ToComment()     const { return 0; } 
00711         virtual const TiXmlUnknown*     ToUnknown()     const { return 0; } 
00712         virtual const TiXmlText*        ToText()        const { return 0; } 
00713         virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } 
00714 
00715         virtual TiXmlDocument*          ToDocument()    { return 0; } 
00716         virtual TiXmlElement*           ToElement()         { return 0; } 
00717         virtual TiXmlComment*           ToComment()     { return 0; } 
00718         virtual TiXmlUnknown*           ToUnknown()         { return 0; } 
00719         virtual TiXmlText*                  ToText()        { return 0; } 
00720         virtual TiXmlDeclaration*       ToDeclaration() { return 0; } 
00721 
00725         virtual TiXmlNode* Clone() const = 0;
00726 
00749         virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
00750 
00751 protected:
00752         TiXmlNode( NodeType _type );
00753 
00754         // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
00755         // and the assignment operator.
00756         void CopyTo( TiXmlNode* target ) const;
00757 
00758         #ifdef TIXML_USE_STL
00759             // The real work of the input operator.
00760         virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
00761         #endif
00762 
00763         // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
00764         TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
00765 
00766         TiXmlNode*              parent;
00767         NodeType                type;
00768 
00769         TiXmlNode*              firstChild;
00770         TiXmlNode*              lastChild;
00771 
00772         TIXML_STRING    value;
00773 
00774         TiXmlNode*              prev;
00775         TiXmlNode*              next;
00776 
00777 private:
00778         TiXmlNode( const TiXmlNode& );                          // not implemented.
00779         void operator=( const TiXmlNode& base );        // not allowed.
00780 };
00781 
00782 
00790 class TiXmlAttribute : public TiXmlBase
00791 {
00792         friend class TiXmlAttributeSet;
00793 
00794 public:
00796         TiXmlAttribute() : TiXmlBase()
00797         {
00798                 document = 0;
00799                 prev = next = 0;
00800         }
00801 
00802         #ifdef TIXML_USE_STL
00803 
00804         TiXmlAttribute( const std::string& _name, const std::string& _value )
00805         {
00806                 name = _name;
00807                 value = _value;
00808                 document = 0;
00809                 prev = next = 0;
00810         }
00811         #endif
00812 
00814         TiXmlAttribute( const char * _name, const char * _value )
00815         {
00816                 name = _name;
00817                 value = _value;
00818                 document = 0;
00819                 prev = next = 0;
00820         }
00821 
00822         const char*             Name()  const           { return name.c_str(); }                
00823         const char*             Value() const           { return value.c_str(); }               
00824         #ifdef TIXML_USE_STL
00825         const std::string& ValueStr() const     { return value; }                               
00826         #endif
00827         int                             IntValue() const;                                                                       
00828         double                  DoubleValue() const;                                                            
00829 
00830         // Get the tinyxml string representation
00831         const TIXML_STRING& NameTStr() const { return name; }
00832 
00842         int QueryIntValue( int* _value ) const;
00844         int QueryDoubleValue( double* _value ) const;
00845 
00846         void SetName( const char* _name )       { name = _name; }                               
00847         void SetValue( const char* _value )     { value = _value; }                             
00848 
00849         void SetIntValue( int _value );                                                                         
00850         void SetDoubleValue( double _value );                                                           
00851 
00852     #ifdef TIXML_USE_STL
00853 
00854         void SetName( const std::string& _name )        { name = _name; }       
00856         void SetValue( const std::string& _value )      { value = _value; }
00857         #endif
00858 
00860         const TiXmlAttribute* Next() const;
00861         TiXmlAttribute* Next() {
00862                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); 
00863         }
00864 
00866         const TiXmlAttribute* Previous() const;
00867         TiXmlAttribute* Previous() {
00868                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); 
00869         }
00870 
00871         bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
00872         bool operator<( const TiXmlAttribute& rhs )      const { return name < rhs.name; }
00873         bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
00874 
00875         /*      Attribute parsing starts: first letter of the name
00876                                                  returns: the next char after the value end quote
00877         */
00878         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
00879 
00880         // Prints this Attribute to a FILE stream.
00881         virtual void Print( FILE* cfile, int depth ) const {
00882                 Print( cfile, depth, 0 );
00883         }
00884         void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
00885 
00886         // [internal use]
00887         // Set the document pointer so the attribute can report errors.
00888         void SetDocument( TiXmlDocument* doc )  { document = doc; }
00889 
00890 private:
00891         TiXmlAttribute( const TiXmlAttribute& );                                // not implemented.
00892         void operator=( const TiXmlAttribute& base );   // not allowed.
00893 
00894         TiXmlDocument*  document;       // A pointer back to a document, for error reporting.
00895         TIXML_STRING name;
00896         TIXML_STRING value;
00897         TiXmlAttribute* prev;
00898         TiXmlAttribute* next;
00899 };
00900 
00901 
00902 /*      A class used to manage a group of attributes.
00903         It is only used internally, both by the ELEMENT and the DECLARATION.
00904         
00905         The set can be changed transparent to the Element and Declaration
00906         classes that use it, but NOT transparent to the Attribute
00907         which has to implement a next() and previous() method. Which makes
00908         it a bit problematic and prevents the use of STL.
00909 
00910         This version is implemented with circular lists because:
00911                 - I like circular lists
00912                 - it demonstrates some independence from the (typical) doubly linked list.
00913 */
00914 class TiXmlAttributeSet
00915 {
00916 public:
00917         TiXmlAttributeSet();
00918         ~TiXmlAttributeSet();
00919 
00920         void Add( TiXmlAttribute* attribute );
00921         void Remove( TiXmlAttribute* attribute );
00922 
00923         const TiXmlAttribute* First()   const   { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00924         TiXmlAttribute* First()                                 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00925         const TiXmlAttribute* Last() const              { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00926         TiXmlAttribute* Last()                                  { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00927 
00928         const TiXmlAttribute*   Find( const char* _name ) const;
00929         TiXmlAttribute* Find( const char* _name ) {
00930                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00931         }
00932         #ifdef TIXML_USE_STL
00933         const TiXmlAttribute*   Find( const std::string& _name ) const;
00934         TiXmlAttribute* Find( const std::string& _name ) {
00935                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00936         }
00937 
00938         #endif
00939 
00940 private:
00941         //*ME:  Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
00942         //*ME:  this class must be also use a hidden/disabled copy-constructor !!!
00943         TiXmlAttributeSet( const TiXmlAttributeSet& );  // not allowed
00944         void operator=( const TiXmlAttributeSet& );     // not allowed (as TiXmlAttribute)
00945 
00946         TiXmlAttribute sentinel;
00947 };
00948 
00949 
00954 class TiXmlElement : public TiXmlNode
00955 {
00956 public:
00958         TiXmlElement (const char * in_value);
00959 
00960         #ifdef TIXML_USE_STL
00961 
00962         TiXmlElement( const std::string& _value );
00963         #endif
00964 
00965         TiXmlElement( const TiXmlElement& );
00966 
00967         void operator=( const TiXmlElement& base );
00968 
00969         virtual ~TiXmlElement();
00970 
00974         const char* Attribute( const char* name ) const;
00975 
00982         const char* Attribute( const char* name, int* i ) const;
00983 
00990         const char* Attribute( const char* name, double* d ) const;
00991 
00999         int QueryIntAttribute( const char* name, int* _value ) const;
01001         int QueryDoubleAttribute( const char* name, double* _value ) const;
01003         int QueryFloatAttribute( const char* name, float* _value ) const {
01004                 double d;
01005                 int result = QueryDoubleAttribute( name, &d );
01006                 if ( result == TIXML_SUCCESS ) {
01007                         *_value = (float)d;
01008                 }
01009                 return result;
01010         }
01011 
01012     #ifdef TIXML_USE_STL
01013 
01021         template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
01022         {
01023                 const TiXmlAttribute* node = attributeSet.Find( name );
01024                 if ( !node )
01025                         return TIXML_NO_ATTRIBUTE;
01026 
01027                 std::stringstream sstream( node->ValueStr() );
01028                 sstream >> *outValue;
01029                 if ( !sstream.fail() )
01030                         return TIXML_SUCCESS;
01031                 return TIXML_WRONG_TYPE;
01032         }
01033         /*
01034          This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
01035          but template specialization is hard to get working cross-compiler. Leaving the bug for now.
01036          
01037         // The above will fail for std::string because the space character is used as a seperator.
01038         // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
01039         template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
01040         {
01041                 const TiXmlAttribute* node = attributeSet.Find( name );
01042                 if ( !node )
01043                         return TIXML_NO_ATTRIBUTE;
01044                 *outValue = node->ValueStr();
01045                 return TIXML_SUCCESS;
01046         }
01047         */
01048         #endif
01049 
01053         void SetAttribute( const char* name, const char * _value );
01054 
01055     #ifdef TIXML_USE_STL
01056         const std::string* Attribute( const std::string& name ) const;
01057         const std::string* Attribute( const std::string& name, int* i ) const;
01058         const std::string* Attribute( const std::string& name, double* d ) const;
01059         int QueryIntAttribute( const std::string& name, int* _value ) const;
01060         int QueryDoubleAttribute( const std::string& name, double* _value ) const;
01061 
01063         void SetAttribute( const std::string& name, const std::string& _value );
01065         void SetAttribute( const std::string& name, int _value );
01066         #endif
01067 
01071         void SetAttribute( const char * name, int value );
01072 
01076         void SetDoubleAttribute( const char * name, double value );
01077 
01080         void RemoveAttribute( const char * name );
01081     #ifdef TIXML_USE_STL
01082         void RemoveAttribute( const std::string& name ) {       RemoveAttribute (name.c_str ());        }       
01083         #endif
01084 
01085         const TiXmlAttribute* FirstAttribute() const    { return attributeSet.First(); }                
01086         TiXmlAttribute* FirstAttribute()                                { return attributeSet.First(); }
01087         const TiXmlAttribute* LastAttribute()   const   { return attributeSet.Last(); }         
01088         TiXmlAttribute* LastAttribute()                                 { return attributeSet.Last(); }
01089 
01122         const char* GetText() const;
01123 
01125         virtual TiXmlNode* Clone() const;
01126         // Print the Element to a FILE stream.
01127         virtual void Print( FILE* cfile, int depth ) const;
01128 
01129         /*      Attribtue parsing starts: next char past '<'
01130                                                  returns: next char past '>'
01131         */
01132         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01133 
01134         virtual const TiXmlElement*     ToElement()     const { return this; } 
01135         virtual TiXmlElement*           ToElement()               { return this; } 
01136 
01139         virtual bool Accept( TiXmlVisitor* visitor ) const;
01140 
01141 protected:
01142 
01143         void CopyTo( TiXmlElement* target ) const;
01144         void ClearThis();       // like clear, but initializes 'this' object as well
01145 
01146         // Used to be public [internal use]
01147         #ifdef TIXML_USE_STL
01148         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01149         #endif
01150         /*      [internal use]
01151                 Reads the "value" of the element -- another element, or text.
01152                 This should terminate with the current end tag.
01153         */
01154         const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01155 
01156 private:
01157 
01158         TiXmlAttributeSet attributeSet;
01159 };
01160 
01161 
01164 class TiXmlComment : public TiXmlNode
01165 {
01166 public:
01168         TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
01170         TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
01171                 SetValue( _value );
01172         }
01173         TiXmlComment( const TiXmlComment& );
01174         void operator=( const TiXmlComment& base );
01175 
01176         virtual ~TiXmlComment() {}
01177 
01179         virtual TiXmlNode* Clone() const;
01180         // Write this Comment to a FILE stream.
01181         virtual void Print( FILE* cfile, int depth ) const;
01182 
01183         /*      Attribtue parsing starts: at the ! of the !--
01184                                                  returns: next char past '>'
01185         */
01186         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01187 
01188         virtual const TiXmlComment*  ToComment() const { return this; } 
01189         virtual TiXmlComment*  ToComment() { return this; } 
01190 
01193         virtual bool Accept( TiXmlVisitor* visitor ) const;
01194 
01195 protected:
01196         void CopyTo( TiXmlComment* target ) const;
01197 
01198         // used to be public
01199         #ifdef TIXML_USE_STL
01200         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01201         #endif
01202 //      virtual void StreamOut( TIXML_OSTREAM * out ) const;
01203 
01204 private:
01205 
01206 };
01207 
01208 
01214 class TiXmlText : public TiXmlNode
01215 {
01216         friend class TiXmlElement;
01217 public:
01222         TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
01223         {
01224                 SetValue( initValue );
01225                 cdata = false;
01226         }
01227         virtual ~TiXmlText() {}
01228 
01229         #ifdef TIXML_USE_STL
01230 
01231         TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
01232         {
01233                 SetValue( initValue );
01234                 cdata = false;
01235         }
01236         #endif
01237 
01238         TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT )       { copy.CopyTo( this ); }
01239         void operator=( const TiXmlText& base )                                                         { base.CopyTo( this ); }
01240 
01241         // Write this text object to a FILE stream.
01242         virtual void Print( FILE* cfile, int depth ) const;
01243 
01245         bool CDATA() const                              { return cdata; }
01247         void SetCDATA( bool _cdata )    { cdata = _cdata; }
01248 
01249         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01250 
01251         virtual const TiXmlText* ToText() const { return this; } 
01252         virtual TiXmlText*       ToText()       { return this; } 
01253 
01256         virtual bool Accept( TiXmlVisitor* content ) const;
01257 
01258 protected :
01260         virtual TiXmlNode* Clone() const;
01261         void CopyTo( TiXmlText* target ) const;
01262 
01263         bool Blank() const;     // returns true if all white space and new lines
01264         // [internal use]
01265         #ifdef TIXML_USE_STL
01266         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01267         #endif
01268 
01269 private:
01270         bool cdata;                     // true if this should be input and output as a CDATA style text element
01271 };
01272 
01273 
01287 class TiXmlDeclaration : public TiXmlNode
01288 {
01289 public:
01291         TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
01292 
01293 #ifdef TIXML_USE_STL
01294 
01295         TiXmlDeclaration(       const std::string& _version,
01296                                                 const std::string& _encoding,
01297                                                 const std::string& _standalone );
01298 #endif
01299 
01301         TiXmlDeclaration(       const char* _version,
01302                                                 const char* _encoding,
01303                                                 const char* _standalone );
01304 
01305         TiXmlDeclaration( const TiXmlDeclaration& copy );
01306         void operator=( const TiXmlDeclaration& copy );
01307 
01308         virtual ~TiXmlDeclaration()     {}
01309 
01311         const char *Version() const                     { return version.c_str (); }
01313         const char *Encoding() const            { return encoding.c_str (); }
01315         const char *Standalone() const          { return standalone.c_str (); }
01316 
01318         virtual TiXmlNode* Clone() const;
01319         // Print this declaration to a FILE stream.
01320         virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
01321         virtual void Print( FILE* cfile, int depth ) const {
01322                 Print( cfile, depth, 0 );
01323         }
01324 
01325         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01326 
01327         virtual const TiXmlDeclaration* ToDeclaration() const { return this; } 
01328         virtual TiXmlDeclaration*       ToDeclaration()       { return this; } 
01329 
01332         virtual bool Accept( TiXmlVisitor* visitor ) const;
01333 
01334 protected:
01335         void CopyTo( TiXmlDeclaration* target ) const;
01336         // used to be public
01337         #ifdef TIXML_USE_STL
01338         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01339         #endif
01340 
01341 private:
01342 
01343         TIXML_STRING version;
01344         TIXML_STRING encoding;
01345         TIXML_STRING standalone;
01346 };
01347 
01348 
01356 class TiXmlUnknown : public TiXmlNode
01357 {
01358 public:
01359         TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN )        {}
01360         virtual ~TiXmlUnknown() {}
01361 
01362         TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN )              { copy.CopyTo( this ); }
01363         void operator=( const TiXmlUnknown& copy )                                                                              { copy.CopyTo( this ); }
01364 
01366         virtual TiXmlNode* Clone() const;
01367         // Print this Unknown to a FILE stream.
01368         virtual void Print( FILE* cfile, int depth ) const;
01369 
01370         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01371 
01372         virtual const TiXmlUnknown*     ToUnknown()     const { return this; } 
01373         virtual TiXmlUnknown*           ToUnknown()         { return this; } 
01374 
01377         virtual bool Accept( TiXmlVisitor* content ) const;
01378 
01379 protected:
01380         void CopyTo( TiXmlUnknown* target ) const;
01381 
01382         #ifdef TIXML_USE_STL
01383         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01384         #endif
01385 
01386 private:
01387 
01388 };
01389 
01390 
01395 class TiXmlDocument : public TiXmlNode
01396 {
01397 public:
01399         TiXmlDocument();
01401         TiXmlDocument( const char * documentName );
01402 
01403         #ifdef TIXML_USE_STL
01404 
01405         TiXmlDocument( const std::string& documentName );
01406         #endif
01407 
01408         TiXmlDocument( const TiXmlDocument& copy );
01409         void operator=( const TiXmlDocument& copy );
01410 
01411         virtual ~TiXmlDocument() {}
01412 
01417         bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01419         bool SaveFile() const;
01421         bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01423         bool SaveFile( const char * filename ) const;
01429         bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01431         bool SaveFile( FILE* ) const;
01432 
01433         #ifdef TIXML_USE_STL
01434         bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )                   
01435         {
01436 //              StringToBuffer f( filename );
01437 //              return ( f.buffer && LoadFile( f.buffer, encoding ));
01438                 return LoadFile( filename.c_str(), encoding );
01439         }
01440         bool SaveFile( const std::string& filename ) const              
01441         {
01442 //              StringToBuffer f( filename );
01443 //              return ( f.buffer && SaveFile( f.buffer ));
01444                 return SaveFile( filename.c_str() );
01445         }
01446         #endif
01447 
01452         virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01453 
01458         const TiXmlElement* RootElement() const         { return FirstChildElement(); }
01459         TiXmlElement* RootElement()                                     { return FirstChildElement(); }
01460 
01466         bool Error() const                                              { return error; }
01467 
01469         const char * ErrorDesc() const  { return errorDesc.c_str (); }
01470 
01474         int ErrorId()   const                           { return errorId; }
01475 
01483         int ErrorRow() const    { return errorLocation.row+1; }
01484         int ErrorCol() const    { return errorLocation.col+1; } 
01485 
01510         void SetTabSize( int _tabsize )         { tabsize = _tabsize; }
01511 
01512         int TabSize() const     { return tabsize; }
01513 
01517         void ClearError()                                               {       error = false; 
01518                                                                                                 errorId = 0; 
01519                                                                                                 errorDesc = ""; 
01520                                                                                                 errorLocation.row = errorLocation.col = 0; 
01521                                                                                                 //errorLocation.last = 0; 
01522                                                                                         }
01523 
01525         void Print() const                                              { Print( stdout, 0 ); }
01526 
01527         /* Write the document to a string using formatted printing ("pretty print"). This
01528                 will allocate a character array (new char[]) and return it as a pointer. The
01529                 calling code pust call delete[] on the return char* to avoid a memory leak.
01530         */
01531         //char* PrintToMemory() const; 
01532 
01534         virtual void Print( FILE* cfile, int depth = 0 ) const;
01535         // [internal use]
01536         void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01537 
01538         virtual const TiXmlDocument*    ToDocument()    const { return this; } 
01539         virtual TiXmlDocument*          ToDocument()          { return this; } 
01540 
01543         virtual bool Accept( TiXmlVisitor* content ) const;
01544 
01545 protected :
01546         // [internal use]
01547         virtual TiXmlNode* Clone() const;
01548         #ifdef TIXML_USE_STL
01549         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01550         #endif
01551 
01552 private:
01553         void CopyTo( TiXmlDocument* target ) const;
01554 
01555         bool error;
01556         int  errorId;
01557         TIXML_STRING errorDesc;
01558         int tabsize;
01559         TiXmlCursor errorLocation;
01560         bool useMicrosoftBOM;           // the UTF-8 BOM were found when read. Note this, and try to write.
01561 };
01562 
01563 
01644 class TiXmlHandle
01645 {
01646 public:
01648         TiXmlHandle( TiXmlNode* _node )                                 { this->node = _node; }
01650         TiXmlHandle( const TiXmlHandle& ref )                   { this->node = ref.node; }
01651         TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
01652 
01654         TiXmlHandle FirstChild() const;
01656         TiXmlHandle FirstChild( const char * value ) const;
01658         TiXmlHandle FirstChildElement() const;
01660         TiXmlHandle FirstChildElement( const char * value ) const;
01661 
01665         TiXmlHandle Child( const char* value, int index ) const;
01669         TiXmlHandle Child( int index ) const;
01674         TiXmlHandle ChildElement( const char* value, int index ) const;
01679         TiXmlHandle ChildElement( int index ) const;
01680 
01681         #ifdef TIXML_USE_STL
01682         TiXmlHandle FirstChild( const std::string& _value ) const                               { return FirstChild( _value.c_str() ); }
01683         TiXmlHandle FirstChildElement( const std::string& _value ) const                { return FirstChildElement( _value.c_str() ); }
01684 
01685         TiXmlHandle Child( const std::string& _value, int index ) const                 { return Child( _value.c_str(), index ); }
01686         TiXmlHandle ChildElement( const std::string& _value, int index ) const  { return ChildElement( _value.c_str(), index ); }
01687         #endif
01688 
01691         TiXmlNode* ToNode() const                       { return node; } 
01694         TiXmlElement* ToElement() const         { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
01697         TiXmlText* ToText() const                       { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
01700         TiXmlUnknown* ToUnknown() const         { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
01701 
01705         TiXmlNode* Node() const                 { return ToNode(); } 
01709         TiXmlElement* Element() const   { return ToElement(); }
01713         TiXmlText* Text() const                 { return ToText(); }
01717         TiXmlUnknown* Unknown() const   { return ToUnknown(); }
01718 
01719 private:
01720         TiXmlNode* node;
01721 };
01722 
01723 
01743 class TiXmlPrinter : public TiXmlVisitor
01744 {
01745 public:
01746         TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
01747                                          buffer(), indent( "    " ), lineBreak( "\n" ) {}
01748 
01749         virtual bool VisitEnter( const TiXmlDocument& doc );
01750         virtual bool VisitExit( const TiXmlDocument& doc );
01751 
01752         virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
01753         virtual bool VisitExit( const TiXmlElement& element );
01754 
01755         virtual bool Visit( const TiXmlDeclaration& declaration );
01756         virtual bool Visit( const TiXmlText& text );
01757         virtual bool Visit( const TiXmlComment& comment );
01758         virtual bool Visit( const TiXmlUnknown& unknown );
01759 
01763         void SetIndent( const char* _indent )                   { indent = _indent ? _indent : "" ; }
01765         const char* Indent()                                                    { return indent.c_str(); }
01770         void SetLineBreak( const char* _lineBreak )             { lineBreak = _lineBreak ? _lineBreak : ""; }
01772         const char* LineBreak()                                                 { return lineBreak.c_str(); }
01773 
01777         void SetStreamPrinting()                                                { indent = "";
01778                                                                                                           lineBreak = "";
01779                                                                                                         }       
01781         const char* CStr()                                                              { return buffer.c_str(); }
01783         size_t Size()                                                                   { return buffer.size(); }
01784 
01785         #ifdef TIXML_USE_STL
01786 
01787         const std::string& Str()                                                { return buffer; }
01788         #endif
01789 
01790 private:
01791         void DoIndent() {
01792                 for( int i=0; i<depth; ++i )
01793                         buffer += indent;
01794         }
01795         void DoLineBreak() {
01796                 buffer += lineBreak;
01797         }
01798 
01799         int depth;
01800         bool simpleTextPrint;
01801         TIXML_STRING buffer;
01802         TIXML_STRING indent;
01803         TIXML_STRING lineBreak;
01804 };
01805 
01806 
01807 #ifdef _MSC_VER
01808 #pragma warning( pop )
01809 #endif
01810 
01811 #endif
01812 

Generated on Fri Dec 23 2011 09:28:52 for MTK++ by Doxygen 1.7.5.1