Support for 'long long' number values.

This commit is contained in:
Uli Kusterer
2014-01-21 12:24:47 +01:00
parent 4cd1f269c2
commit 664d05662e
2 changed files with 69 additions and 0 deletions

View File

@@ -540,6 +540,7 @@ public:
// converts primitive types to strings
static void ToStr( int v, char* buffer, int bufferSize );
static void ToStr( long long v, char* buffer, int bufferSize );
static void ToStr( unsigned v, char* buffer, int bufferSize );
static void ToStr( bool v, char* buffer, int bufferSize );
static void ToStr( float v, char* buffer, int bufferSize );
@@ -547,6 +548,7 @@ public:
// converts strings to primitive types
static bool ToInt( const char* str, int* value );
static bool ToLongLong( const char* str, long long* value );
static bool ToUnsigned( const char* str, unsigned* value );
static bool ToBool( const char* str, bool* value );
static bool ToFloat( const char* str, float* value );
@@ -1093,6 +1095,8 @@ public:
/// Set the attribute to value.
void SetAttribute( int value );
/// Set the attribute to value.
void SetAttribute( long long value );
/// Set the attribute to value.
void SetAttribute( unsigned value );
/// Set the attribute to value.
void SetAttribute( bool value );
@@ -1308,6 +1312,11 @@ public:
a->SetAttribute( value );
}
/// Sets the named attribute to value.
void SetAttribute( const char* name, long long value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
}
/// Sets the named attribute to value.
void SetAttribute( const char* name, unsigned value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
@@ -1418,6 +1427,8 @@ public:
/// Sets the text to the given float.
void SetText( float inNum );
/// Sets the text to the given long long.
void SetText( long long inNum );
/// Convenience for QueryIntText when you don't care if the text won't convert.
int IntText()
@@ -1427,6 +1438,14 @@ public:
return i;
}
/// Convenience for QueryLongLongText when you don't care if the text won't convert.
long long LongLongText()
{
long long i = 0;
QueryLongLongText( &i );
return i;
}
/// Convenience for QueryUnsignedText when you don't care if the text won't convert.
unsigned UnsignedText()
{
@@ -1492,6 +1511,8 @@ public:
*/
XMLError QueryIntText( int* ival ) const;
/// See QueryIntText()
XMLError QueryLongLongText( long long* ival ) const;
/// See QueryIntText()
XMLError QueryUnsignedText( unsigned* uval ) const;
/// See QueryIntText()
XMLError QueryBoolText( bool* bval ) const;