Changeset 2509 for code/branches/buildsystem2/src/tinyxml/ticpp.cc
- Timestamp:
- Dec 17, 2008, 8:59:48 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2
- Property svn:ignore deleted
- Property svn:mergeinfo changed
/code/branches/buildsystem (added) merged: 1875,1882-1886,1975-1982,1991,1999,2054,2061,2135,2137-2139,2197-2199,2204,2214-2220,2223-2224,2229,2233-2244,2248-2249,2252-2253,2260,2275
-
code/branches/buildsystem2/src/tinyxml/ticpp.cc
r1625 r2509 1 #define TIXML_USE_TICPP2 3 1 /* 4 2 http://code.google.com/p/ticpp/ … … 23 21 */ 24 22 25 /*26 Modifications by the orxonox team:27 In function: void Document::Parse( const std::string& xml, bool throwIfParseError, TiXmlEncoding encoding )28 change: Added row and column number to the error description.29 author: Reto Grieder30 */31 32 23 #ifdef TIXML_USE_TICPP 33 24 … … 164 155 165 156 Attribute* temp = new Attribute( attribute ); 166 m_spawnedWrappers.push_back( temp );157 attribute->m_spawnedWrappers.push_back( temp ); 167 158 168 159 return temp; … … 186 177 187 178 Attribute* temp = new Attribute( attribute ); 188 m_spawnedWrappers.push_back( temp );179 attribute->m_spawnedWrappers.push_back( temp ); 189 180 190 181 return temp; … … 262 253 if ( rememberSpawnedWrapper ) 263 254 { 264 m_spawnedWrappers.push_back( temp );255 tiXmlNode->m_spawnedWrappers.push_back( temp ); 265 256 } 266 257 return temp; … … 386 377 } 387 378 379 TiXmlNode* pointer = GetTiXmlPointer()->InsertEndChild( *addThis.GetTiXmlPointer() ); 380 if ( 0 == pointer ) 381 { 382 TICPPTHROW( "Node can't be inserted" ); 383 } 384 385 return NodeFactory( pointer ); 386 } 387 388 Node* Node::LinkEndChild( Node* childNode ) 389 { 390 if ( childNode->Type() == TiXmlNode::DOCUMENT ) 391 { 392 TICPPTHROW( "Node is a Document and can't be linked" ); 393 } 394 395 // Increment reference count when adding to the tree 396 childNode->m_impRC->IncRef(); 397 398 if ( 0 == GetTiXmlPointer()->LinkEndChild( childNode->GetTiXmlPointer() ) ) 399 { 400 TICPPTHROW( "Node can't be linked" ); 401 } 402 403 return childNode; 404 } 405 406 Node* Node::InsertBeforeChild( Node* beforeThis, Node& addThis ) 407 { 408 if ( addThis.Type() == TiXmlNode::DOCUMENT ) 409 { 410 TICPPTHROW( "Node is a Document and can't be inserted" ); 411 } 412 388 413 // Increment reference count when adding to the tree 389 414 addThis.m_impRC->IncRef(); 390 415 391 TiXmlNode* pointer = GetTiXmlPointer()->Insert EndChild(*addThis.GetTiXmlPointer() );416 TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild( beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() ); 392 417 if ( 0 == pointer ) 393 418 { … … 398 423 } 399 424 400 Node* Node::LinkEndChild( Node* childNode ) 401 { 402 if ( childNode->Type() == TiXmlNode::DOCUMENT ) 403 { 404 TICPPTHROW( "Node is a Document and can't be linked" ); 405 } 406 407 // Increment reference count when adding to the tree 408 childNode->m_impRC->IncRef(); 409 410 if ( 0 == GetTiXmlPointer()->LinkEndChild( childNode->GetTiXmlPointer() ) ) 411 { 412 TICPPTHROW( "Node can't be linked" ); 413 } 414 415 return childNode; 416 } 417 418 Node* Node::InsertBeforeChild( Node* beforeThis, Node& addThis ) 425 Node* Node::InsertAfterChild( Node* afterThis, Node& addThis ) 419 426 { 420 427 if ( addThis.Type() == TiXmlNode::DOCUMENT ) … … 426 433 addThis.m_impRC->IncRef(); 427 434 428 TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild( beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() );429 if ( 0 == pointer )430 {431 TICPPTHROW( "Node can't be inserted" );432 }433 434 return NodeFactory( pointer );435 }436 437 Node* Node::InsertAfterChild( Node* afterThis, Node& addThis )438 {439 if ( addThis.Type() == TiXmlNode::DOCUMENT )440 {441 TICPPTHROW( "Node is a Document and can't be inserted" );442 }443 444 // Increment reference count when adding to the tree445 addThis.m_impRC->IncRef();446 447 435 TiXmlNode* pointer = GetTiXmlPointer()->InsertAfterChild( afterThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() ); 448 436 if ( 0 == pointer ) … … 576 564 577 565 Element* temp = new Element( sibling ); 578 m_spawnedWrappers.push_back( temp );566 sibling->m_spawnedWrappers.push_back( temp ); 579 567 580 568 return temp; … … 616 604 617 605 Element* temp = new Element( element ); 618 m_spawnedWrappers.push_back( temp );606 element->m_spawnedWrappers.push_back( temp ); 619 607 620 608 return temp; … … 641 629 } 642 630 Document* temp = new Document( doc ); 643 m_spawnedWrappers.push_back( temp );631 doc->m_spawnedWrappers.push_back( temp ); 644 632 645 633 return temp; … … 659 647 } 660 648 Document* temp = new Document( doc ); 661 m_spawnedWrappers.push_back( temp );649 doc->m_spawnedWrappers.push_back( temp ); 662 650 663 651 return temp; … … 672 660 } 673 661 Element* temp = new Element( doc ); 674 m_spawnedWrappers.push_back( temp );662 doc->m_spawnedWrappers.push_back( temp ); 675 663 676 664 return temp; … … 685 673 } 686 674 Comment* temp = new Comment( doc ); 687 m_spawnedWrappers.push_back( temp );675 doc->m_spawnedWrappers.push_back( temp ); 688 676 689 677 return temp; … … 698 686 } 699 687 Text* temp = new Text( doc ); 700 m_spawnedWrappers.push_back( temp );688 doc->m_spawnedWrappers.push_back( temp ); 701 689 702 690 return temp; … … 711 699 } 712 700 Declaration* temp = new Declaration( doc ); 713 m_spawnedWrappers.push_back( temp );701 doc->m_spawnedWrappers.push_back( temp ); 714 702 715 703 return temp; … … 724 712 } 725 713 StylesheetReference* temp = new StylesheetReference( doc ); 726 m_spawnedWrappers.push_back( temp );714 doc->m_spawnedWrappers.push_back( temp ); 727 715 728 716 return temp; … … 860 848 if( throwIfParseError && m_tiXmlPointer->Error() ) 861 849 { 862 TICPPTHROW( "Error parsing xml: " << m_tiXmlPointer->ErrorDesc() 863 << " In row " << m_tiXmlPointer->ErrorRow() << ", column " << m_tiXmlPointer->ErrorCol() << "."); 850 TICPPTHROW( "Error parsing xml." ); 864 851 } 865 852 } … … 912 899 913 900 Attribute* temp = new Attribute( attribute ); 914 m_spawnedWrappers.push_back( temp );901 attribute->m_spawnedWrappers.push_back( temp ); 915 902 916 903 return temp; … … 939 926 940 927 Attribute* temp = new Attribute( attribute ); 941 m_spawnedWrappers.push_back( temp );928 attribute->m_spawnedWrappers.push_back( temp ); 942 929 943 930 return temp; … … 957 944 { 958 945 return GetAttributeOrDefault( name, std::string() ); 946 } 947 948 bool Element::HasAttribute( const std::string& name ) const 949 { 950 ValidatePointer(); 951 return ( 0 != m_tiXmlPointer->Attribute( name.c_str() ) ); 952 } 953 954 void Element::RemoveAttribute( const std::string& name ) 955 { 956 ValidatePointer(); 957 m_tiXmlPointer->RemoveAttribute( name.c_str() ); 959 958 } 960 959 … … 1086 1085 } 1087 1086 1087 void TiCppRC::DeleteSpawnedWrappers() 1088 { 1089 std::vector< Base* >::reverse_iterator wrapper; 1090 for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper ) 1091 { 1092 delete *wrapper; 1093 } 1094 m_spawnedWrappers.clear(); 1095 } 1096 1088 1097 TiCppRC::~TiCppRC() 1089 { 1098 { 1099 DeleteSpawnedWrappers(); 1100 1090 1101 // Set pointer held by reference counter to NULL 1091 1102 this->m_tiRC->Nullify();
Note: See TracChangeset
for help on using the changeset viewer.