UnsignedInt64 support
This commit is contained in:
19
tinyxml2.cpp
19
tinyxml2.cpp
@@ -653,6 +653,16 @@ bool XMLUtil::ToInt64(const char* str, int64_t* value)
|
||||
}
|
||||
|
||||
|
||||
bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) {
|
||||
unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu
|
||||
if(TIXML_SSCANF(str, "%llu", &v) == 1) {
|
||||
*value = (uint64_t)v;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
char* XMLDocument::Identify( char* p, XMLNode** node )
|
||||
{
|
||||
TIXMLASSERT( node );
|
||||
@@ -1414,6 +1424,15 @@ XMLError XMLAttribute::QueryInt64Value(int64_t* value) const
|
||||
}
|
||||
|
||||
|
||||
XMLError XMLAttribute::QueryUnsigned64Value(uint64_t* value) const
|
||||
{
|
||||
if(XMLUtil::ToUnsigned64(Value(), value)) {
|
||||
return XML_SUCCESS;
|
||||
}
|
||||
return XML_WRONG_ATTRIBUTE_TYPE;
|
||||
}
|
||||
|
||||
|
||||
XMLError XMLAttribute::QueryBoolValue( bool* value ) const
|
||||
{
|
||||
if ( XMLUtil::ToBool( Value(), value )) {
|
||||
|
||||
Reference in New Issue
Block a user