Index: code/branches/buildsystem3/src/tinyxml/ticpp.h
===================================================================
--- code/branches/buildsystem3/src/tinyxml/ticpp.h	(revision 2663)
+++ code/branches/buildsystem3/src/tinyxml/ticpp.h	(revision 2664)
@@ -1,4 +1,2 @@
-#define TIXML_USE_TICPP
-
 /*
 http://code.google.com/p/ticpp/
@@ -30,5 +28,4 @@
 @date		04/11/2006
 
-@version  0.04b by nico@orxonox.net: gcc-4.3 compilation hotfixes
 @version	0.04a by edam@waxworlds.org: based Exception based on std::exception; added stream
 					<< and >> support; added Document::Parse(); bug fix; improved THROW() macro.
@@ -94,4 +91,5 @@
 		file = file.substr( file.find_last_of( "\\/" ) + 1 );				\
 		full_message << message << " <" << file << "@" << __LINE__ << ">";	\
+		full_message << BuildDetailedErrorString();							\
 		throw Exception( full_message.str() );								\
 	}
@@ -221,9 +219,50 @@
 
 		/**
+		Compare internal TiXml pointers to determine is both are wrappers around the same node
+		*/
+		bool operator == ( const Base& rhs ) const
+		{
+			return ( GetBasePointer() == rhs.GetBasePointer() );
+		}
+		
+		/**
+		Compare internal TiXml pointers to determine is both are wrappers around the same node
+		*/
+		bool operator != ( const Base& rhs ) const
+		{
+			return ( GetBasePointer() != rhs.GetBasePointer() );
+		}
+		
+		/**
+		Builds detailed error string using TiXmlDocument::Error() and others
+		*/
+		std::string BuildDetailedErrorString() const
+		{
+			std::ostringstream full_message;
+			#ifndef TICPP_NO_RTTI
+			TiXmlNode* node = dynamic_cast< TiXmlNode* >( GetBasePointer() );
+			if ( node != 0 )
+			{
+				TiXmlDocument* doc = node->GetDocument();
+				if ( doc != 0 )
+				{
+					if ( doc->Error() )
+					{
+						full_message 	<< "\nDescription: " << doc->ErrorDesc()
+										<< "\nFile: " << (strlen( doc->Value() ) > 0 ? doc->Value() : "<unnamed-file>") 
+										<< "\nLine: " << doc->ErrorRow() 
+										<< "\nColumn: " << doc->ErrorCol();
+					}
+				}
+			}
+			#endif
+			return full_message.str();
+		}
+
+		/**
 		Destructor
 		*/
 		virtual ~Base()
 		{
-			DeleteSpawnedWrappers();
 		}
 
@@ -231,6 +270,4 @@
 		mutable TiCppRCImp* m_impRC;	/**< Holds status of internal TiXmlPointer - use this to determine if object has been deleted already */
 
-		mutable std::vector< Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/
-
 		/**
 		@internal
@@ -250,19 +287,5 @@
 				TICPPTHROW( "Internal TiXml Pointer is NULL" );
 			}
-		}
-
-		/**
-		@internal
-		Delete all container objects we've spawned with 'new'.
-		*/
-		void DeleteSpawnedWrappers()
-		{
-			std::vector< Base* >::reverse_iterator wrapper;
-			for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper )
-			{
-				delete *wrapper;
-			}
-			m_spawnedWrappers.clear();
-		}
+		}		
 
 		/**
@@ -875,4 +898,5 @@
 		bool NoChildren() const;
 
+		#ifndef TICPP_NO_RTTI
 		/**
 		Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc.
@@ -895,4 +919,5 @@
 			return pointer;
 		}
+		#endif
 
 		/**
@@ -1085,6 +1110,6 @@
 
 		/// Constructor
-		Iterator( const Iterator& it, const std::string& value  = "" )
-			: m_p( it.m_p ), m_value( value )
+		Iterator( const Iterator& it )
+			: m_p( it.m_p ), m_value( it.m_value )
 		{
 		}
@@ -1103,4 +1128,5 @@
 		{
 			m_p = it.m_p;
+			m_value = it.m_value;
 			return *this;
 		}
@@ -1121,7 +1147,9 @@
 
 		/** Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings */
-		Iterator& operator++(int)
-		{
-			return this->operator ++();
+		Iterator operator++(int)
+		{
+			Iterator tmp(*this);
+			++(*this);
+			return tmp;
 		}
 
@@ -1134,13 +1162,23 @@
 
 		/** Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings */
-		Iterator& operator--(int)
-		{
-			return this->operator --();
+		Iterator operator--(int)
+		{			
+			Iterator tmp(*this);
+			--(*this);
+			return tmp;
 		}
 
 		/** Compares internal pointer */
-		bool operator!=( T* p ) const
-		{
-			return m_p != p;
+		bool operator!=( const T* p ) const
+		{
+			if ( m_p == p )
+			{
+				return false;
+			}
+			if ( 0 == m_p || 0 == p )
+			{
+				return true;
+			}
+			return *m_p != *p;
 		}
 
@@ -1148,5 +1186,5 @@
 		bool operator!=( const Iterator& it ) const
 		{
-			return m_p != it.m_p;
+			return operator!=( it.m_p );
 		}
 
@@ -1154,5 +1192,13 @@
 		bool operator==( T* p ) const
 		{
-			return m_p == p;
+			if ( m_p == p )
+			{
+				return true;
+			}
+			if ( 0 == m_p || 0 == p )
+			{
+				return false;
+			}
+			return *m_p == *p;
 		}
 
@@ -1160,5 +1206,5 @@
 		bool operator==( const Iterator& it ) const
 		{
-			return m_p == it.m_p;
+			return operator==( it.m_p );
 		}
 
@@ -1220,5 +1266,9 @@
 			if ( 0 == tiXmlPointer )
 			{
-				TICPPTHROW( "Can not create a " << typeid( T ).name() );
+				#ifdef TICPP_NO_RTTI
+					TICPPTHROW( "Can not create TinyXML objext" );
+				#else
+					TICPPTHROW( "Can not create a " << typeid( T ).name() );
+				#endif
 			}
 			SetTiXmlPointer( tiXmlPointer );
@@ -1233,6 +1283,4 @@
 		virtual void operator=( const NodeImp<T>& copy )
 		{
-			DeleteSpawnedWrappers();
-
 			// Dropping the reference to the old object
 			this->m_impRC->DecRef();
@@ -1267,6 +1315,4 @@
 		virtual ~NodeImp()
 		{
-			// The spawnedWrappers need to be deleted before m_tiXmlPointer
-			DeleteSpawnedWrappers();
 			m_impRC->DecRef();
 		}
@@ -1685,4 +1731,35 @@
 
 		/**
+		Returns an attribute of @a name from an element.
+		Uses FromString to convert the string to the type of choice.
+
+		@param name				The name of the attribute you are querying.
+		@param throwIfNotFound	[DEF]	If true, will throw an exception if the attribute doesn't exist
+		@throws Exception When the attribute doesn't exist and throwIfNotFound is true
+		@see GetAttributeOrDefault
+		*/
+		template < class T >
+			T GetAttribute( const std::string& name, bool throwIfNotFound = true ) const
+		{
+			// Get the attribute's value as a std::string
+			std::string temp;
+			T value;
+			if ( !GetAttributeImp( name, &temp ) )
+			{
+				if ( throwIfNotFound )
+				{
+					TICPPTHROW( "Attribute does not exist" );
+				}
+			}
+			else
+			{
+				// Stream the value from the string to T
+				FromString( temp, &value );
+			}
+
+			return value;
+		}
+
+		/**
 		Gets an attribute of @a name from an element.
 		Uses FromString to convert the string to the type of choice.
@@ -1727,4 +1804,19 @@
 		std::string GetAttribute( const std::string& name ) const;
 
+		/**
+		Returns true, if attribute exists
+
+		@param name The name of the attribute you are checking.
+		@return Existence of attribute
+		*/
+		bool HasAttribute( const std::string& name ) const;
+
+		/**
+		Removes attribute from element.
+
+		@param name The name of the attribute to remove.
+		*/
+		void RemoveAttribute( const std::string& name );
+
 	private:
 
