From 85fff5e50a6b6c1b9cb668fb795ee99ce7590193 Mon Sep 17 00:00:00 2001 From: Uli Kusterer Date: Tue, 21 Jan 2014 01:35:30 +0100 Subject: [PATCH] Add comment for SetText(). --- tinyxml2.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tinyxml2.h b/tinyxml2.h index 3ae1c32..2330ab9 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -1369,6 +1369,40 @@ public: */ const char* GetText() const; + /** Convenience function for easy access to the text inside an element. Although easy + and concise, SetText() is limited compared to creating an XMLText child + and mutating it directly. + + If the first child of 'this' is a XMLText, SetText() sets its value to + the given string, otherwise it will create a first child that is an XMLText. + + This is a convenient method for setting the text of simple contained text: + @verbatim + This is text + fooElement->SetText( "Hullaballoo!" ); + Hullaballoo! + @endverbatim + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then it will not change "This is text", but rather prefix it with a text element: + @verbatim + Hullaballoo!This is text + @endverbatim + + For this XML: + @verbatim + + @endverbatim + SetText() will generate + @verbatim + Hullaballoo! + @endverbatim + */ void SetText( const char* inText ); /**