|
@@ -30,6 +30,7 @@ distribution.
|
|
|
# include <stdio.h>
|
|
# include <stdio.h>
|
|
|
# include <stdlib.h>
|
|
# include <stdlib.h>
|
|
|
# include <string.h>
|
|
# include <string.h>
|
|
|
|
|
+# include <stdint.h>
|
|
|
# if defined(__PS3__)
|
|
# if defined(__PS3__)
|
|
|
# include <stddef.h>
|
|
# include <stddef.h>
|
|
|
# endif
|
|
# endif
|
|
@@ -39,6 +40,7 @@ distribution.
|
|
|
# include <cstdio>
|
|
# include <cstdio>
|
|
|
# include <cstdlib>
|
|
# include <cstdlib>
|
|
|
# include <cstring>
|
|
# include <cstring>
|
|
|
|
|
+# include <cstdint>
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -577,6 +579,7 @@ public:
|
|
|
static void ToStr( bool v, char* buffer, int bufferSize );
|
|
static void ToStr( bool v, char* buffer, int bufferSize );
|
|
|
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);
|
|
|
|
|
|
|
|
// 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 );
|
|
@@ -584,6 +587,7 @@ public:
|
|
|
static bool ToBool( const char* str, bool* value );
|
|
static bool ToBool( const char* str, bool* value );
|
|
|
static bool ToFloat( const char* str, float* value );
|
|
static bool ToFloat( const char* str, float* value );
|
|
|
static bool ToDouble( const char* str, double* value );
|
|
static bool ToDouble( const char* str, double* value );
|
|
|
|
|
+ static bool ToInt64(const char* str, int64_t* value);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1061,11 +1065,18 @@ public:
|
|
|
If the value isn't an integer, 0 will be returned. There is no error checking;
|
|
If the value isn't an integer, 0 will be returned. There is no error checking;
|
|
|
use QueryIntValue() if you need error checking.
|
|
use QueryIntValue() if you need error checking.
|
|
|
*/
|
|
*/
|
|
|
- int IntValue() const {
|
|
|
|
|
- int i=0;
|
|
|
|
|
- QueryIntValue( &i );
|
|
|
|
|
- return i;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ int IntValue() const {
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+ QueryIntValue(&i);
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int64_t Int64Value() const {
|
|
|
|
|
+ int64_t i = 0;
|
|
|
|
|
+ QueryInt64Value(&i);
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// Query as an unsigned integer. See IntValue()
|
|
/// Query as an unsigned integer. See IntValue()
|
|
|
unsigned UnsignedValue() const {
|
|
unsigned UnsignedValue() const {
|
|
|
unsigned i=0;
|
|
unsigned i=0;
|
|
@@ -1098,7 +1109,9 @@ public:
|
|
|
XMLError QueryIntValue( int* value ) const;
|
|
XMLError QueryIntValue( int* value ) const;
|
|
|
/// See QueryIntValue
|
|
/// See QueryIntValue
|
|
|
XMLError QueryUnsignedValue( unsigned int* value ) const;
|
|
XMLError QueryUnsignedValue( unsigned int* value ) const;
|
|
|
- /// See QueryIntValue
|
|
|
|
|
|
|
+ /// See QueryIntValue
|
|
|
|
|
+ XMLError QueryInt64Value(int64_t* value) const;
|
|
|
|
|
+ /// See QueryIntValue
|
|
|
XMLError QueryBoolValue( bool* value ) const;
|
|
XMLError QueryBoolValue( bool* value ) const;
|
|
|
/// See QueryIntValue
|
|
/// See QueryIntValue
|
|
|
XMLError QueryDoubleValue( double* value ) const;
|
|
XMLError QueryDoubleValue( double* value ) const;
|
|
@@ -1111,7 +1124,9 @@ public:
|
|
|
void SetAttribute( int value );
|
|
void SetAttribute( int value );
|
|
|
/// Set the attribute to value.
|
|
/// Set the attribute to value.
|
|
|
void SetAttribute( unsigned value );
|
|
void SetAttribute( unsigned value );
|
|
|
- /// Set the attribute to value.
|
|
|
|
|
|
|
+ /// Set the attribute to value.
|
|
|
|
|
+ void SetAttribute(int64_t value);
|
|
|
|
|
+ /// Set the attribute to value.
|
|
|
void SetAttribute( bool value );
|
|
void SetAttribute( bool value );
|
|
|
/// Set the attribute to value.
|
|
/// Set the attribute to value.
|
|
|
void SetAttribute( double value );
|
|
void SetAttribute( double value );
|
|
@@ -1197,26 +1212,35 @@ public:
|
|
|
QueryIntAttribute( name, &i );
|
|
QueryIntAttribute( name, &i );
|
|
|
return i;
|
|
return i;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/// See IntAttribute()
|
|
/// See IntAttribute()
|
|
|
unsigned UnsignedAttribute( const char* name ) const {
|
|
unsigned UnsignedAttribute( const char* name ) const {
|
|
|
unsigned i=0;
|
|
unsigned i=0;
|
|
|
QueryUnsignedAttribute( name, &i );
|
|
QueryUnsignedAttribute( name, &i );
|
|
|
return i;
|
|
return i;
|
|
|
}
|
|
}
|
|
|
- /// See IntAttribute()
|
|
|
|
|
- bool BoolAttribute( const char* name ) const {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /// See IntAttribute()
|
|
|
|
|
+ int64_t Int64Attribute(const char* name) const {
|
|
|
|
|
+ int64_t i = 0;
|
|
|
|
|
+ QueryInt64Attribute(name, &i);
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// See IntAttribute()
|
|
|
|
|
+ bool BoolAttribute( const char* name ) const {
|
|
|
bool b=false;
|
|
bool b=false;
|
|
|
QueryBoolAttribute( name, &b );
|
|
QueryBoolAttribute( name, &b );
|
|
|
return b;
|
|
return b;
|
|
|
}
|
|
}
|
|
|
/// See IntAttribute()
|
|
/// See IntAttribute()
|
|
|
- double DoubleAttribute( const char* name ) const {
|
|
|
|
|
|
|
+ double DoubleAttribute( const char* name ) const {
|
|
|
double d=0;
|
|
double d=0;
|
|
|
QueryDoubleAttribute( name, &d );
|
|
QueryDoubleAttribute( name, &d );
|
|
|
return d;
|
|
return d;
|
|
|
}
|
|
}
|
|
|
/// See IntAttribute()
|
|
/// See IntAttribute()
|
|
|
- float FloatAttribute( const char* name ) const {
|
|
|
|
|
|
|
+ float FloatAttribute( const char* name ) const {
|
|
|
float f=0;
|
|
float f=0;
|
|
|
QueryFloatAttribute( name, &f );
|
|
QueryFloatAttribute( name, &f );
|
|
|
return f;
|
|
return f;
|
|
@@ -1242,7 +1266,8 @@ public:
|
|
|
}
|
|
}
|
|
|
return a->QueryIntValue( value );
|
|
return a->QueryIntValue( value );
|
|
|
}
|
|
}
|
|
|
- /// See QueryIntAttribute()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /// See QueryIntAttribute()
|
|
|
XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
|
|
XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
|
|
|
const XMLAttribute* a = FindAttribute( name );
|
|
const XMLAttribute* a = FindAttribute( name );
|
|
|
if ( !a ) {
|
|
if ( !a ) {
|
|
@@ -1250,7 +1275,17 @@ public:
|
|
|
}
|
|
}
|
|
|
return a->QueryUnsignedValue( value );
|
|
return a->QueryUnsignedValue( value );
|
|
|
}
|
|
}
|
|
|
- /// See QueryIntAttribute()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /// See QueryIntAttribute()
|
|
|
|
|
+ XMLError QueryInt64Attribute(const char* name, int64_t* value) const {
|
|
|
|
|
+ const XMLAttribute* a = FindAttribute(name);
|
|
|
|
|
+ if (!a) {
|
|
|
|
|
+ return XML_NO_ATTRIBUTE;
|
|
|
|
|
+ }
|
|
|
|
|
+ return a->QueryInt64Value(value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// See QueryIntAttribute()
|
|
|
XMLError QueryBoolAttribute( const char* name, bool* value ) const {
|
|
XMLError QueryBoolAttribute( const char* name, bool* value ) const {
|
|
|
const XMLAttribute* a = FindAttribute( name );
|
|
const XMLAttribute* a = FindAttribute( name );
|
|
|
if ( !a ) {
|
|
if ( !a ) {
|
|
@@ -1301,6 +1336,10 @@ public:
|
|
|
return QueryUnsignedAttribute( name, value );
|
|
return QueryUnsignedAttribute( name, value );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int QueryAttribute(const char* name, int64_t* value) const {
|
|
|
|
|
+ return QueryInt64Attribute(name, value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
int QueryAttribute( const char* name, bool* value ) const {
|
|
int QueryAttribute( const char* name, bool* value ) const {
|
|
|
return QueryBoolAttribute( name, value );
|
|
return QueryBoolAttribute( name, value );
|
|
|
}
|
|
}
|
|
@@ -1328,7 +1367,14 @@ public:
|
|
|
XMLAttribute* a = FindOrCreateAttribute( name );
|
|
XMLAttribute* a = FindOrCreateAttribute( name );
|
|
|
a->SetAttribute( value );
|
|
a->SetAttribute( value );
|
|
|
}
|
|
}
|
|
|
- /// Sets the named attribute to value.
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /// Sets the named attribute to value.
|
|
|
|
|
+ void SetAttribute(const char* name, int64_t value) {
|
|
|
|
|
+ XMLAttribute* a = FindOrCreateAttribute(name);
|
|
|
|
|
+ a->SetAttribute(value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// Sets the named attribute to value.
|
|
|
void SetAttribute( const char* name, bool value ) {
|
|
void SetAttribute( const char* name, bool value ) {
|
|
|
XMLAttribute* a = FindOrCreateAttribute( name );
|
|
XMLAttribute* a = FindOrCreateAttribute( name );
|
|
|
a->SetAttribute( value );
|
|
a->SetAttribute( value );
|
|
@@ -1425,7 +1471,9 @@ public:
|
|
|
void SetText( int value );
|
|
void SetText( int 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( 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);
|
|
|
|
|
+ /// 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.
|
|
|
void SetText( double value );
|
|
void SetText( double value );
|
|
@@ -1461,7 +1509,9 @@ public:
|
|
|
XMLError QueryIntText( int* ival ) const;
|
|
XMLError QueryIntText( int* ival ) const;
|
|
|
/// See QueryIntText()
|
|
/// See QueryIntText()
|
|
|
XMLError QueryUnsignedText( unsigned* uval ) const;
|
|
XMLError QueryUnsignedText( unsigned* uval ) const;
|
|
|
- /// See QueryIntText()
|
|
|
|
|
|
|
+ /// See QueryIntText()
|
|
|
|
|
+ XMLError QueryInt64Text(int64_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;
|
|
@@ -1998,7 +2048,8 @@ public:
|
|
|
void PushAttribute( const char* name, const char* value );
|
|
void PushAttribute( const char* name, const char* value );
|
|
|
void PushAttribute( const char* name, int value );
|
|
void PushAttribute( const char* name, int value );
|
|
|
void PushAttribute( const char* name, unsigned value );
|
|
void PushAttribute( const char* name, unsigned value );
|
|
|
- void PushAttribute( const char* name, bool value );
|
|
|
|
|
|
|
+ void PushAttribute(const char* name, int64_t value);
|
|
|
|
|
+ void PushAttribute( const char* name, bool value );
|
|
|
void PushAttribute( const char* name, double value );
|
|
void PushAttribute( const char* name, double value );
|
|
|
/// If streaming, close the Element.
|
|
/// If streaming, close the Element.
|
|
|
virtual void CloseElement( bool compactMode=false );
|
|
virtual void CloseElement( bool compactMode=false );
|
|
@@ -2009,7 +2060,9 @@ public:
|
|
|
void PushText( int value );
|
|
void PushText( int value );
|
|
|
/// Add a text node from an unsigned.
|
|
/// Add a text node from an unsigned.
|
|
|
void PushText( unsigned value );
|
|
void PushText( unsigned value );
|
|
|
- /// Add a text node from a bool.
|
|
|
|
|
|
|
+ /// Add a text node from an unsigned.
|
|
|
|
|
+ void PushText(int64_t value);
|
|
|
|
|
+ /// Add a text node from a bool.
|
|
|
void PushText( bool value );
|
|
void PushText( bool value );
|
|
|
/// Add a text node from a float.
|
|
/// Add a text node from a float.
|
|
|
void PushText( float value );
|
|
void PushText( float value );
|