Browse Source

fix query return type

Lee Thomason 7 years ago
parent
commit
fc80df3b39
1 changed files with 34 additions and 34 deletions
  1. 34 34
      tinyxml2.h

+ 34 - 34
tinyxml2.h

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