@@ -118,7 +118,7 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
118118
119119static const int TIXML2_MAJOR_VERSION = 1 ;
120120static const int TIXML2_MINOR_VERSION = 0 ;
121- static const int TIXML2_PATCH_VERSION = 11 ;
121+ static const int TIXML2_PATCH_VERSION = 12 ;
122122
123123namespace tinyxml2
124124{
@@ -251,6 +251,11 @@ class DynArray
251251 return _mem[i];
252252 }
253253
254+ const T& PeekTop () const {
255+ TIXMLASSERT ( _size > 0 );
256+ return _mem[ _size - 1 ];
257+ }
258+
254259 int Size () const {
255260 return _size;
256261 }
@@ -638,9 +643,7 @@ class TINYXML2_LIB XMLNode
638643 Text: the text string
639644 @endverbatim
640645 */
641- const char * Value () const {
642- return _value.GetStr ();
643- }
646+ const char * Value () const ;
644647
645648 /* * Set the Value of an XML node.
646649 @sa Value()
@@ -731,6 +734,10 @@ class TINYXML2_LIB XMLNode
731734
732735 /* *
733736 Add a child node as the last (right) child.
737+ If the child node is already part of the document,
738+ it is moved from its old location to the new location.
739+ Returns the addThis argument or 0 if the node does not
740+ belong to the same document.
734741 */
735742 XMLNode* InsertEndChild ( XMLNode* addThis );
736743
@@ -739,10 +746,19 @@ class TINYXML2_LIB XMLNode
739746 }
740747 /* *
741748 Add a child node as the first (left) child.
749+ If the child node is already part of the document,
750+ it is moved from its old location to the new location.
751+ Returns the addThis argument or 0 if the node does not
752+ belong to the same document.
742753 */
743754 XMLNode* InsertFirstChild ( XMLNode* addThis );
744755 /* *
745756 Add a node after the specified child node.
757+ If the child node is already part of the document,
758+ it is moved from its old location to the new location.
759+ Returns the addThis argument or 0 if the afterThis node
760+ is not a child of this node, or if the node does not
761+ belong to the same document.
746762 */
747763 XMLNode* InsertAfterChild ( XMLNode* afterThis, XMLNode* addThis );
748764
@@ -1009,13 +1025,11 @@ class TINYXML2_LIB XMLAttribute
10091025 friend class XMLElement ;
10101026public:
10111027 // / The name of the attribute.
1012- const char * Name () const {
1013- return _name.GetStr ();
1014- }
1028+ const char * Name () const ;
1029+
10151030 // / The value of the attribute.
1016- const char * Value () const {
1017- return _value.GetStr ();
1018- }
1031+ const char * Value () const ;
1032+
10191033 // / The next attribute in the list.
10201034 const XMLAttribute* Next () const {
10211035 return _next;
@@ -1884,7 +1898,7 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
18841898 with only required whitespace and newlines.
18851899 */
18861900 XMLPrinter ( FILE* file=0 , bool compact = false , int depth = 0 );
1887- ~XMLPrinter () {}
1901+ virtual ~XMLPrinter () {}
18881902
18891903 /* * If streaming, write the BOM and declaration. */
18901904 void PushHeader ( bool writeBOM, bool writeDeclaration );
@@ -1899,7 +1913,7 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
18991913 void PushAttribute ( const char * name, bool value );
19001914 void PushAttribute ( const char * name, double value );
19011915 // / If streaming, close the Element.
1902- void CloseElement ();
1916+ virtual void CloseElement ();
19031917
19041918 // / Add a text node.
19051919 void PushText ( const char * text, bool cdata=false );
@@ -1949,13 +1963,16 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
19491963 return _buffer.Size ();
19501964 }
19511965
1952- private :
1966+ protected :
19531967 void SealElement ();
1968+ bool _elementJustOpened;
1969+ DynArray< const char *, 10 > _stack;
1970+
1971+ private:
19541972 void PrintSpace ( int depth );
19551973 void PrintString ( const char *, bool restrictedEntitySet ); // prints out, after detecting entities.
19561974 void Print ( const char * format, ... );
19571975
1958- bool _elementJustOpened;
19591976 bool _firstElement;
19601977 FILE* _fp;
19611978 int _depth;
@@ -1970,7 +1987,6 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
19701987 bool _entityFlag[ENTITY_RANGE];
19711988 bool _restrictedEntityFlag[ENTITY_RANGE];
19721989
1973- DynArray< const char *, 10 > _stack;
19741990 DynArray< char , 20 > _buffer;
19751991#ifdef _MSC_VER
19761992 DynArray< char , 20 > _accumulator;
0 commit comments