fix query return type
This commit is contained in:
68
tinyxml2.h
68
tinyxml2.h
@@ -106,10 +106,10 @@ static const int TIXML2_PATCH_VERSION = 0;
|
||||
#define TINYXML2_MINOR_VERSION 2
|
||||
#define TINYXML2_PATCH_VERSION 0
|
||||
|
||||
// A fixed element depth limit is problematic. There needs to be a
|
||||
// limit to avoid a stack overflow. However, that limit varies per
|
||||
// system, and the capacity of the stack. On the other hand, it's a trivial
|
||||
// attack that can result from ill, malicious, or even correctly formed XML,
|
||||
// A fixed element depth limit is problematic. There needs to be a
|
||||
// limit to avoid a stack overflow. However, that limit varies per
|
||||
// system, and the capacity of the stack. On the other hand, it's a trivial
|
||||
// attack that can result from ill, malicious, or even correctly formed XML,
|
||||
// so there needs to be a limit in place.
|
||||
static const int TINYXML2_MAX_ELEMENT_DEPTH = 100;
|
||||
|
||||
@@ -349,7 +349,7 @@ public:
|
||||
~MemPoolT() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void Clear() {
|
||||
// Delete the blocks.
|
||||
while( !_blockPtrs.Empty()) {
|
||||
@@ -395,7 +395,7 @@ public:
|
||||
++_nUntracked;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
virtual void Free( void* mem ) {
|
||||
if ( !mem ) {
|
||||
return;
|
||||
@@ -572,7 +572,7 @@ public:
|
||||
static bool IsWhiteSpace( char p ) {
|
||||
return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
|
||||
}
|
||||
|
||||
|
||||
inline static bool IsNameStartChar( unsigned char ch ) {
|
||||
if ( ch >= 128 ) {
|
||||
// This is a heuristic guess in attempt to not implement Unicode-aware isalpha()
|
||||
@@ -583,7 +583,7 @@ public:
|
||||
}
|
||||
return ch == ':' || ch == '_';
|
||||
}
|
||||
|
||||
|
||||
inline static bool IsNameChar( unsigned char ch ) {
|
||||
return IsNameStartChar( ch )
|
||||
|| isdigit( ch )
|
||||
@@ -600,7 +600,7 @@ public:
|
||||
TIXMLASSERT( nChar >= 0 );
|
||||
return strncmp( p, q, nChar ) == 0;
|
||||
}
|
||||
|
||||
|
||||
inline static bool IsUTF8Continuation( char p ) {
|
||||
return ( p & 0x80 ) != 0;
|
||||
}
|
||||
@@ -882,11 +882,11 @@ public:
|
||||
Make a copy of this node and all its children.
|
||||
|
||||
If the 'target' is null, then the nodes will
|
||||
be allocated in the current document. If 'target'
|
||||
is specified, the memory will be allocated is the
|
||||
be allocated in the current document. If 'target'
|
||||
is specified, the memory will be allocated is the
|
||||
specified XMLDocument.
|
||||
|
||||
NOTE: This is probably not the correct tool to
|
||||
NOTE: This is probably not the correct tool to
|
||||
copy a document, since XMLDocuments can have multiple
|
||||
top level XMLNodes. You probably want to use
|
||||
XMLDocument::DeepCopy()
|
||||
@@ -925,8 +925,8 @@ public:
|
||||
*/
|
||||
virtual bool Accept( XMLVisitor* visitor ) const = 0;
|
||||
|
||||
/**
|
||||
Set user data into the XMLNode. TinyXML-2 in
|
||||
/**
|
||||
Set user data into the XMLNode. TinyXML-2 in
|
||||
no way processes or interprets user data.
|
||||
It is initially 0.
|
||||
*/
|
||||
@@ -1384,14 +1384,14 @@ public:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** Given an attribute name, QueryAttribute() returns
|
||||
XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||
can't be performed, or XML_NO_ATTRIBUTE if the attribute
|
||||
doesn't exist. It is overloaded for the primitive types,
|
||||
and is a generally more convenient replacement of
|
||||
QueryIntAttribute() and related functions.
|
||||
|
||||
|
||||
If successful, the result of the conversion
|
||||
will be written to 'value'. If not successful, nothing will
|
||||
be written to 'value'. This allows you to provide default
|
||||
@@ -1402,27 +1402,27 @@ public:
|
||||
QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
|
||||
@endverbatim
|
||||
*/
|
||||
int QueryAttribute( const char* name, int* value ) const {
|
||||
XMLError QueryAttribute( const char* name, int* value ) const {
|
||||
return QueryIntAttribute( name, value );
|
||||
}
|
||||
|
||||
int QueryAttribute( const char* name, unsigned int* value ) const {
|
||||
XMLError QueryAttribute( const char* name, unsigned int* value ) const {
|
||||
return QueryUnsignedAttribute( name, value );
|
||||
}
|
||||
|
||||
int QueryAttribute(const char* name, int64_t* value) const {
|
||||
XMLError QueryAttribute(const char* name, int64_t* value) const {
|
||||
return QueryInt64Attribute(name, value);
|
||||
}
|
||||
|
||||
int QueryAttribute( const char* name, bool* value ) const {
|
||||
XMLError QueryAttribute( const char* name, bool* value ) const {
|
||||
return QueryBoolAttribute( name, value );
|
||||
}
|
||||
|
||||
int QueryAttribute( const char* name, double* value ) const {
|
||||
XMLError QueryAttribute( const char* name, double* value ) const {
|
||||
return QueryDoubleAttribute( name, value );
|
||||
}
|
||||
|
||||
int QueryAttribute( const char* name, float* value ) const {
|
||||
XMLError QueryAttribute( const char* name, float* value ) const {
|
||||
return QueryFloatAttribute( name, value );
|
||||
}
|
||||
|
||||
@@ -1530,7 +1530,7 @@ public:
|
||||
@verbatim
|
||||
<foo>Hullaballoo!<b>This is text</b></foo>
|
||||
@endverbatim
|
||||
|
||||
|
||||
For this XML:
|
||||
@verbatim
|
||||
<foo />
|
||||
@@ -1544,15 +1544,15 @@ public:
|
||||
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||
void SetText( int value );
|
||||
/// 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.
|
||||
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.
|
||||
void SetText( double value );
|
||||
void SetText( double value );
|
||||
/// Convenience method for setting text inside an element. See SetText() for important limitations.
|
||||
void SetText( float value );
|
||||
void SetText( float value );
|
||||
|
||||
/**
|
||||
Convenience method to query the value of a child text node. This is probably best
|
||||
@@ -1660,7 +1660,7 @@ class TINYXML2_LIB XMLDocument : public XMLNode
|
||||
friend class XMLElement;
|
||||
// Gives access to SetError and Push/PopDepth, but over-access for everything else.
|
||||
// Wishing C++ had "internal" scope.
|
||||
friend class XMLNode;
|
||||
friend class XMLNode;
|
||||
friend class XMLText;
|
||||
friend class XMLComment;
|
||||
friend class XMLDeclaration;
|
||||
@@ -1700,8 +1700,8 @@ public:
|
||||
|
||||
/**
|
||||
Load an XML file from disk. You are responsible
|
||||
for providing and closing the FILE*.
|
||||
|
||||
for providing and closing the FILE*.
|
||||
|
||||
NOTE: The file should be opened as binary ("rb")
|
||||
not text in order for TinyXML-2 to correctly
|
||||
do newline normalization.
|
||||
@@ -1831,7 +1831,7 @@ public:
|
||||
const char* ErrorName() const;
|
||||
static const char* ErrorIDToName(XMLError errorID);
|
||||
|
||||
/** Returns a "long form" error description. A hopefully helpful
|
||||
/** Returns a "long form" error description. A hopefully helpful
|
||||
diagnostic with location, line number, and/or additional info.
|
||||
*/
|
||||
const char* ErrorStr() const;
|
||||
@@ -1844,7 +1844,7 @@ public:
|
||||
{
|
||||
return _errorLineNum;
|
||||
}
|
||||
|
||||
|
||||
/// Clear the document, resetting it to the initial state.
|
||||
void Clear();
|
||||
|
||||
@@ -1907,8 +1907,8 @@ private:
|
||||
// the stack. Track stack depth, and error out if needed.
|
||||
class DepthTracker {
|
||||
public:
|
||||
DepthTracker(XMLDocument * document) {
|
||||
this->_document = document;
|
||||
DepthTracker(XMLDocument * document) {
|
||||
this->_document = document;
|
||||
document->PushDepth();
|
||||
}
|
||||
~DepthTracker() {
|
||||
|
||||
Reference in New Issue
Block a user