Changeset 2664 for code/branches/buildsystem3/src/tinyxml
- Timestamp:
- Feb 14, 2009, 10:53:45 PM (16 years ago)
- Location:
- code/branches/buildsystem3
- Files:
-
- 5 deleted
- 5 edited
- 9 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem3
- Property svn:ignore deleted
- Property svn:mergeinfo changed
-
code/branches/buildsystem3/src/tinyxml/CMakeLists.txt
r1810 r2664 1 SET( TINYXML_SRC_FILES 2 ticpp.cc 3 tinystr.cc 4 tinyxml.cc 5 tinyxmlerror.cc 6 tinyxmlparser.cc 1 # 2 # ORXONOX - the hottest 3D action shooter ever to exist 3 # > www.orxonox.net < 4 # 5 # This program is free software; you can redistribute it and/or 6 # modify it under the terms of the GNU General Public License 7 # as published by the Free Software Foundation; either version 2 8 # of the License, or (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License along 16 # with this program; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 # 19 20 SET(TINYXML++_FILES 21 ticpp.h 22 ticpprc.h 23 tinystr.h 24 tinyxml.h 25 26 ticpp.cpp 27 tinystr.cpp 28 tinyxml.cpp 29 tinyxmlerror.cpp 30 tinyxmlparser.cpp 7 31 ) 32 GENERATE_SOURCE_GROUPS(${TINYXML++_FILES}) 8 33 9 ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES}) 34 IF(MSVC) 35 ADD_LIBRARY(tinyxml++_orxonox STATIC ${TINYXML++_FILES}) 36 ELSE() 37 ADD_LIBRARY(tinyxml++_orxonox SHARED ${TINYXML++_FILES}) 38 ORXONOX_INSTALL(tinyxml++_orxonox) 39 ENDIF() -
code/branches/buildsystem3/src/tinyxml/ticpp.h
r2087 r2664 1 #define TIXML_USE_TICPP2 3 1 /* 4 2 http://code.google.com/p/ticpp/ … … 30 28 @date 04/11/2006 31 29 32 @version 0.04b by nico@orxonox.net: gcc-4.3 compilation hotfixes33 30 @version 0.04a by edam@waxworlds.org: based Exception based on std::exception; added stream 34 31 << and >> support; added Document::Parse(); bug fix; improved THROW() macro. … … 94 91 file = file.substr( file.find_last_of( "\\/" ) + 1 ); \ 95 92 full_message << message << " <" << file << "@" << __LINE__ << ">"; \ 93 full_message << BuildDetailedErrorString(); \ 96 94 throw Exception( full_message.str() ); \ 97 95 } … … 221 219 222 220 /** 221 Compare internal TiXml pointers to determine is both are wrappers around the same node 222 */ 223 bool operator == ( const Base& rhs ) const 224 { 225 return ( GetBasePointer() == rhs.GetBasePointer() ); 226 } 227 228 /** 229 Compare internal TiXml pointers to determine is both are wrappers around the same node 230 */ 231 bool operator != ( const Base& rhs ) const 232 { 233 return ( GetBasePointer() != rhs.GetBasePointer() ); 234 } 235 236 /** 237 Builds detailed error string using TiXmlDocument::Error() and others 238 */ 239 std::string BuildDetailedErrorString() const 240 { 241 std::ostringstream full_message; 242 #ifndef TICPP_NO_RTTI 243 TiXmlNode* node = dynamic_cast< TiXmlNode* >( GetBasePointer() ); 244 if ( node != 0 ) 245 { 246 TiXmlDocument* doc = node->GetDocument(); 247 if ( doc != 0 ) 248 { 249 if ( doc->Error() ) 250 { 251 full_message << "\nDescription: " << doc->ErrorDesc() 252 << "\nFile: " << (strlen( doc->Value() ) > 0 ? doc->Value() : "<unnamed-file>") 253 << "\nLine: " << doc->ErrorRow() 254 << "\nColumn: " << doc->ErrorCol(); 255 } 256 } 257 } 258 #endif 259 return full_message.str(); 260 } 261 262 /** 223 263 Destructor 224 264 */ 225 265 virtual ~Base() 226 266 { 227 DeleteSpawnedWrappers();228 267 } 229 268 … … 231 270 mutable TiCppRCImp* m_impRC; /**< Holds status of internal TiXmlPointer - use this to determine if object has been deleted already */ 232 271 233 mutable std::vector< Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/234 235 272 /** 236 273 @internal … … 250 287 TICPPTHROW( "Internal TiXml Pointer is NULL" ); 251 288 } 252 } 253 254 /** 255 @internal 256 Delete all container objects we've spawned with 'new'. 257 */ 258 void DeleteSpawnedWrappers() 259 { 260 std::vector< Base* >::reverse_iterator wrapper; 261 for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper ) 262 { 263 delete *wrapper; 264 } 265 m_spawnedWrappers.clear(); 266 } 289 } 267 290 268 291 /** … … 875 898 bool NoChildren() const; 876 899 900 #ifndef TICPP_NO_RTTI 877 901 /** 878 902 Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc. … … 895 919 return pointer; 896 920 } 921 #endif 897 922 898 923 /** … … 1085 1110 1086 1111 /// Constructor 1087 Iterator( const Iterator& it , const std::string& value = "")1088 : m_p( it.m_p ), m_value( value )1112 Iterator( const Iterator& it ) 1113 : m_p( it.m_p ), m_value( it.m_value ) 1089 1114 { 1090 1115 } … … 1103 1128 { 1104 1129 m_p = it.m_p; 1130 m_value = it.m_value; 1105 1131 return *this; 1106 1132 } … … 1121 1147 1122 1148 /** Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings */ 1123 Iterator& operator++(int) 1124 { 1125 return this->operator ++(); 1149 Iterator operator++(int) 1150 { 1151 Iterator tmp(*this); 1152 ++(*this); 1153 return tmp; 1126 1154 } 1127 1155 … … 1134 1162 1135 1163 /** Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings */ 1136 Iterator& operator--(int) 1137 { 1138 return this->operator --(); 1164 Iterator operator--(int) 1165 { 1166 Iterator tmp(*this); 1167 --(*this); 1168 return tmp; 1139 1169 } 1140 1170 1141 1171 /** Compares internal pointer */ 1142 bool operator!=( T* p ) const 1143 { 1144 return m_p != p; 1172 bool operator!=( const T* p ) const 1173 { 1174 if ( m_p == p ) 1175 { 1176 return false; 1177 } 1178 if ( 0 == m_p || 0 == p ) 1179 { 1180 return true; 1181 } 1182 return *m_p != *p; 1145 1183 } 1146 1184 … … 1148 1186 bool operator!=( const Iterator& it ) const 1149 1187 { 1150 return m_p != it.m_p;1188 return operator!=( it.m_p ); 1151 1189 } 1152 1190 … … 1154 1192 bool operator==( T* p ) const 1155 1193 { 1156 return m_p == p; 1194 if ( m_p == p ) 1195 { 1196 return true; 1197 } 1198 if ( 0 == m_p || 0 == p ) 1199 { 1200 return false; 1201 } 1202 return *m_p == *p; 1157 1203 } 1158 1204 … … 1160 1206 bool operator==( const Iterator& it ) const 1161 1207 { 1162 return m_p == it.m_p;1208 return operator==( it.m_p ); 1163 1209 } 1164 1210 … … 1220 1266 if ( 0 == tiXmlPointer ) 1221 1267 { 1222 TICPPTHROW( "Can not create a " << typeid( T ).name() ); 1268 #ifdef TICPP_NO_RTTI 1269 TICPPTHROW( "Can not create TinyXML objext" ); 1270 #else 1271 TICPPTHROW( "Can not create a " << typeid( T ).name() ); 1272 #endif 1223 1273 } 1224 1274 SetTiXmlPointer( tiXmlPointer ); … … 1233 1283 virtual void operator=( const NodeImp<T>& copy ) 1234 1284 { 1235 DeleteSpawnedWrappers();1236 1237 1285 // Dropping the reference to the old object 1238 1286 this->m_impRC->DecRef(); … … 1267 1315 virtual ~NodeImp() 1268 1316 { 1269 // The spawnedWrappers need to be deleted before m_tiXmlPointer1270 DeleteSpawnedWrappers();1271 1317 m_impRC->DecRef(); 1272 1318 } … … 1685 1731 1686 1732 /** 1733 Returns an attribute of @a name from an element. 1734 Uses FromString to convert the string to the type of choice. 1735 1736 @param name The name of the attribute you are querying. 1737 @param throwIfNotFound [DEF] If true, will throw an exception if the attribute doesn't exist 1738 @throws Exception When the attribute doesn't exist and throwIfNotFound is true 1739 @see GetAttributeOrDefault 1740 */ 1741 template < class T > 1742 T GetAttribute( const std::string& name, bool throwIfNotFound = true ) const 1743 { 1744 // Get the attribute's value as a std::string 1745 std::string temp; 1746 T value; 1747 if ( !GetAttributeImp( name, &temp ) ) 1748 { 1749 if ( throwIfNotFound ) 1750 { 1751 TICPPTHROW( "Attribute does not exist" ); 1752 } 1753 } 1754 else 1755 { 1756 // Stream the value from the string to T 1757 FromString( temp, &value ); 1758 } 1759 1760 return value; 1761 } 1762 1763 /** 1687 1764 Gets an attribute of @a name from an element. 1688 1765 Uses FromString to convert the string to the type of choice. … … 1727 1804 std::string GetAttribute( const std::string& name ) const; 1728 1805 1806 /** 1807 Returns true, if attribute exists 1808 1809 @param name The name of the attribute you are checking. 1810 @return Existence of attribute 1811 */ 1812 bool HasAttribute( const std::string& name ) const; 1813 1814 /** 1815 Removes attribute from element. 1816 1817 @param name The name of the attribute to remove. 1818 */ 1819 void RemoveAttribute( const std::string& name ); 1820 1729 1821 private: 1730 1822 -
code/branches/buildsystem3/src/tinyxml/ticpprc.h
r1505 r2664 1 #define TIXML_USE_TICPP2 3 1 /* 4 2 http://code.google.com/p/ticpp/ … … 28 26 #define TICPPRC_INCLUDED 29 27 28 #include <vector> 30 29 31 30 // Forward declare ticpp::Node, so it can be made a friend of TiCppRC … … 64 63 */ 65 64 virtual ~TiCppRC(); 65 66 std::vector< ticpp::Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/ 67 68 /** 69 Delete all container objects we've spawned with 'new'. 70 */ 71 void DeleteSpawnedWrappers(); 66 72 }; 67 73 -
code/branches/buildsystem3/src/tinyxml/tinyxml.h
r1505 r2664 1 #define TIXML_USE_TICPP2 3 1 /* 4 2 www.sourceforge.net/projects/tinyxml
Note: See TracChangeset
for help on using the changeset viewer.