From 4cd1f269c28ff2c84c454270acbb47a2c8eb0403 Mon Sep 17 00:00:00 2001 From: Uli Kusterer Date: Tue, 21 Jan 2014 02:54:36 +0100 Subject: [PATCH] Added IntText(), UnsignedText(), DoubleText() and FloatText() convenience wrappers. --- tinyxml2.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tinyxml2.h b/tinyxml2.h index 0eae819..3731562 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -1417,7 +1417,39 @@ public: /// Sets the text to the given float. void SetText( float inNum ); + + + /// Convenience for QueryIntText when you don't care if the text won't convert. + int IntText() + { + int i = 0; + QueryIntText( &i ); + return i; + } + /// Convenience for QueryUnsignedText when you don't care if the text won't convert. + unsigned UnsignedText() + { + unsigned i = 0; + QueryUnsignedText( &i ); + return i; + } + + /// Convenience for QueryDoubleText when you don't care if the text won't convert. + double DoubleText() + { + double i = 0; + QueryDoubleText( &i ); + return i; + } + + /// Convenience for QueryFloatText when you don't care if the text won't convert. + float FloatText() + { + float i = 0; + QueryFloatText( &i ); + return i; + } /// Adds a sub-element equivalent to the given boolean. void SetBoolFirstChild( bool inBool );