Add SetText() as analog to GetText().

This commit is contained in:
Uli Kusterer 2014-01-21 01:12:47 +01:00
parent 44ce7930b7
commit 8fe342a872
2 changed files with 15 additions and 3 deletions

View File

@ -1260,6 +1260,16 @@ const char* XMLElement::GetText() const
} }
void XMLElement::SetText( const char* inText )
{
if ( FirstChild() )
FirstChild()->SetValue( inText );
else {
XMLText* theText = GetDocument()->NewText( inText );
InsertFirstChild( theText );
}
}
XMLError XMLElement::QueryIntText( int* ival ) const XMLError XMLElement::QueryIntText( int* ival ) const
{ {
if ( FirstChild() && FirstChild()->ToText() ) { if ( FirstChild() && FirstChild()->ToText() ) {

View File

@ -116,9 +116,9 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
#define TIXML_SSCANF sscanf #define TIXML_SSCANF sscanf
#endif #endif
static const int TIXML2_MAJOR_VERSION = 1; static const int TIXML2_MAJOR_VERSION = 1;
static const int TIXML2_MINOR_VERSION = 0; static const int TIXML2_MINOR_VERSION = 0;
static const int TIXML2_PATCH_VERSION = 13; static const int TIXML2_PATCH_VERSION = 13;
namespace tinyxml2 namespace tinyxml2
{ {
@ -1369,6 +1369,8 @@ public:
*/ */
const char* GetText() const; const char* GetText() const;
void SetText( const char* inText );
/** /**
Convenience method to query the value of a child text node. This is probably best Convenience method to query the value of a child text node. This is probably best
shown by example. Given you have a document is this form: shown by example. Given you have a document is this form: