add variants of SetText() to support types
This commit is contained in:
41
tinyxml2.cpp
41
tinyxml2.cpp
@@ -1270,6 +1270,47 @@ void XMLElement::SetText( const char* inText )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XMLElement::SetText( int v )
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
XMLUtil::ToStr( v, buf, BUF_SIZE );
|
||||
SetText( buf );
|
||||
}
|
||||
|
||||
|
||||
void XMLElement::SetText( unsigned v )
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
XMLUtil::ToStr( v, buf, BUF_SIZE );
|
||||
SetText( buf );
|
||||
}
|
||||
|
||||
|
||||
void XMLElement::SetText( bool v )
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
XMLUtil::ToStr( v, buf, BUF_SIZE );
|
||||
SetText( buf );
|
||||
}
|
||||
|
||||
|
||||
void XMLElement::SetText( float v )
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
XMLUtil::ToStr( v, buf, BUF_SIZE );
|
||||
SetText( buf );
|
||||
}
|
||||
|
||||
|
||||
void XMLElement::SetText( double v )
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
XMLUtil::ToStr( v, buf, BUF_SIZE );
|
||||
SetText( buf );
|
||||
}
|
||||
|
||||
|
||||
XMLError XMLElement::QueryIntText( int* ival ) const
|
||||
{
|
||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||
|
||||
Reference in New Issue
Block a user