Forgot Text and XMLElement versions;
This commit is contained in:
25
tinyxml2.cpp
25
tinyxml2.cpp
@@ -582,12 +582,17 @@ void XMLUtil::ToStr( double v, char* buffer, int bufferSize )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XMLUtil::ToStr(int64_t v, char* buffer, int bufferSize)
|
void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize )
|
||||||
{
|
{
|
||||||
// horrible syntax trick to make the compiler happy about %lld
|
// horrible syntax trick to make the compiler happy about %lld
|
||||||
TIXML_SNPRINTF(buffer, bufferSize, "%lld", (long long)v);
|
TIXML_SNPRINTF(buffer, bufferSize, "%lld", (long long)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize )
|
||||||
|
{
|
||||||
|
// horrible syntax trick to make the compiler happy about %llu
|
||||||
|
TIXML_SNPRINTF(buffer, bufferSize, "%llu", (long long)v);
|
||||||
|
}
|
||||||
|
|
||||||
bool XMLUtil::ToInt( const char* str, int* value )
|
bool XMLUtil::ToInt( const char* str, int* value )
|
||||||
{
|
{
|
||||||
@@ -1639,6 +1644,12 @@ void XMLElement::SetText(int64_t v)
|
|||||||
SetText(buf);
|
SetText(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XMLElement::SetText(uint64_t v) {
|
||||||
|
char buf[BUF_SIZE];
|
||||||
|
XMLUtil::ToStr(v, buf, BUF_SIZE);
|
||||||
|
SetText(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void XMLElement::SetText( bool v )
|
void XMLElement::SetText( bool v )
|
||||||
{
|
{
|
||||||
@@ -1703,6 +1714,18 @@ XMLError XMLElement::QueryInt64Text(int64_t* ival) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XMLError XMLElement::QueryUnsigned64Text(uint64_t* ival) const {
|
||||||
|
if(FirstChild() && FirstChild()->ToText()) {
|
||||||
|
const char* t = FirstChild()->Value();
|
||||||
|
if(XMLUtil::ToUnsigned64(t, ival)) {
|
||||||
|
return XML_SUCCESS;
|
||||||
|
}
|
||||||
|
return XML_CAN_NOT_CONVERT_TEXT;
|
||||||
|
}
|
||||||
|
return XML_NO_TEXT_NODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
XMLError XMLElement::QueryBoolText( bool* bval ) const
|
XMLError XMLElement::QueryBoolText( bool* bval ) const
|
||||||
{
|
{
|
||||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||||
|
|||||||
@@ -617,6 +617,7 @@ public:
|
|||||||
static void ToStr( float v, char* buffer, int bufferSize );
|
static void ToStr( float v, char* buffer, int bufferSize );
|
||||||
static void ToStr( double v, char* buffer, int bufferSize );
|
static void ToStr( double v, char* buffer, int bufferSize );
|
||||||
static void ToStr(int64_t v, char* buffer, int bufferSize);
|
static void ToStr(int64_t v, char* buffer, int bufferSize);
|
||||||
|
static void ToStr(uint64_t v, char* buffer, int bufferSize);
|
||||||
|
|
||||||
// converts strings to primitive types
|
// converts strings to primitive types
|
||||||
static bool ToInt( const char* str, int* value );
|
static bool ToInt( const char* str, int* value );
|
||||||
@@ -1565,6 +1566,8 @@ public:
|
|||||||
void SetText( unsigned value );
|
void SetText( unsigned value );
|
||||||
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||||
void SetText(int64_t value);
|
void SetText(int64_t value);
|
||||||
|
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||||
|
void SetText(uint64_t value);
|
||||||
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||||
void SetText( bool value );
|
void SetText( bool value );
|
||||||
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||||
@@ -1604,6 +1607,8 @@ public:
|
|||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
XMLError QueryInt64Text(int64_t* uval) const;
|
XMLError QueryInt64Text(int64_t* uval) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
|
XMLError QueryUnsigned64Text(uint64_t* uval) const;
|
||||||
|
/// See QueryIntText()
|
||||||
XMLError QueryBoolText( bool* bval ) const;
|
XMLError QueryBoolText( bool* bval ) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
XMLError QueryDoubleText( double* dval ) const;
|
XMLError QueryDoubleText( double* dval ) const;
|
||||||
@@ -1616,6 +1621,8 @@ public:
|
|||||||
unsigned UnsignedText(unsigned defaultValue = 0) const;
|
unsigned UnsignedText(unsigned defaultValue = 0) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
int64_t Int64Text(int64_t defaultValue = 0) const;
|
int64_t Int64Text(int64_t defaultValue = 0) const;
|
||||||
|
/// See QueryIntText()
|
||||||
|
uint64_t Unsigned64Text(uint64_t defaultValue = 0) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
bool BoolText(bool defaultValue = false) const;
|
bool BoolText(bool defaultValue = false) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
|
|||||||
Reference in New Issue
Block a user