Changeset 735 in dev for trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
- Timestamp:
- Aug 25, 2008, 5:26:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r728 r735 1 1 #include "stdafx.h" 2 2 #include <algorithm> 3 #include <boost/checked_delete.hpp> 3 4 4 5 CClass::CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces ) … … 74 75 CClass::~CClass() 75 76 { 77 using std::for_each; 78 using boost::checked_deleter; 76 79 // 動的メンバ 77 BOOST_FOREACH( Member *member, dynamicMembers ) 78 { 79 delete member; 80 } 81 80 for_each( dynamicMembers.begin(), dynamicMembers.end(), checked_deleter<Member>() ); 82 81 // 静的メンバ 83 BOOST_FOREACH( Member *member, staticMembers ) 84 { 85 delete member; 86 } 87 82 for_each( staticMembers.begin(), staticMembers.end(), checked_deleter<Member>() ); 88 83 // インターフェイス 89 BOOST_FOREACH( ::Interface *pInterface, interfaces ) 90 { 91 delete pInterface; 92 } 93 84 for_each( interfaces.begin(), interfaces.end(), checked_deleter<::Interface>() ); 94 85 // テンプレート展開済みのクラス 95 BOOST_FOREACH( ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses ) 96 { 97 delete pExpandedTemplateClass; 98 } 86 for_each( expandedTemplateClasses.begin(), expandedTemplateClasses.end(), checked_deleter<ExpandedTemplateClass>() ); 99 87 } 100 88 … … 233 221 { 234 222 //メソッドをコピー 235 BOOST_FOREACH( const CMethod *pBaseMethod, inheritsClass.GetDynamicMethods() ){ 223 const Methods& inheritsClassMethods = inheritsClass.GetDynamicMethods(); 224 GetDynamicMethods().reserve( inheritsClassMethods.size() ); 225 BOOST_FOREACH( const CMethod *pBaseMethod, inheritsClassMethods ){ 236 226 CMethod *pMethod = new DynamicMethod( *pBaseMethod ); 237 227 … … 264 254 265 255 // インターフェイスを引き継ぐ 266 BOOST_FOREACH( ::Interface *pInterface, inheritsClass.GetInterfaces() ) 256 const Interfaces& inheritsClassInterfaces = inheritsClass.GetInterfaces(); 257 interfaces.reserve( inheritsClassInterfaces.size() ); 258 BOOST_FOREACH( const ::Interface *pInterface, inheritsClassInterfaces ) 267 259 { 268 260 interfaces.push_back( new ::Interface( *pInterface ) ); … … 307 299 //メソッド 308 300 BOOST_FOREACH( const CMethod *pMethod, GetDynamicMethods() ){ 309 if( lstrcmp( name, pMethod->GetUserProc().GetName().c_str() ) == 0){301 if( name == pMethod->GetUserProc().GetName() ){ 310 302 return 1; 311 303 } … … 328 320 329 321 // 動的メンバ 330 BOOST_FOREACH( Member *pMember, dynamicMembers )322 BOOST_FOREACH( const Member *pMember, dynamicMembers ) 331 323 { 332 324 if( GetName() == pMember->GetName() ) … … 438 430 if( this->HasSuperClass() ) 439 431 { 432 const CClass& super = this->GetSuperClass(); 440 433 // 基底クラスのサイズを追加 441 resultSize += this->GetSuperClass().GetSize();434 resultSize += super.GetSize(); 442 435 443 436 // 基底クラスのアラインメントを取得 444 alignment = this->GetSuperClass().GetAlignment();437 alignment = super.GetAlignment(); 445 438 } 446 439 else … … 455 448 BOOST_FOREACH( Member *pMember, dynamicMembers ) 456 449 { 450 const Type& memberType = pMember->GetType(); 457 451 // メンバサイズ 458 int tempMemberSize = pMember->GetType().GetSize();452 int tempMemberSize = memberType.GetSize(); 459 453 460 454 // 一時アラインメントを算出 461 455 int tempAlignment = tempMemberSize; 462 if( pMember->GetType().IsStruct() )456 if( memberType.IsStruct() ) 463 457 { 464 458 // メンバが構造体の場合は、メンバのアラインメントを取得 465 tempAlignment = pMember->GetType().GetClass().GetAlignment();459 tempAlignment = memberType.GetClass().GetAlignment(); 466 460 } 467 461 … … 484 478 if( tempMemberSize == 0 ) 485 479 { 486 if( ! pMember->GetType().IsStruct() )480 if( !memberType.IsStruct() ) 487 481 { 488 482 throw; … … 847 841 if( result.size() ) 848 842 { 849 result += ",";850 } 851 852 result += "\"" + pMember->GetName() + "\"";843 result += ','; 844 } 845 846 result += '\"' + pMember->GetName() + '\"'; 853 847 } 854 848 … … 863 857 if( result.size() ) 864 858 { 865 result += ",";859 result += ','; 866 860 } 867 861 … … 869 863 870 864 char temporary[255]; 871 itoa( offset, temporary, 16 );865 _itoa( offset, temporary, 16 ); 872 866 873 867 result += (std::string)"&H" + temporary;
Note:
See TracChangeset
for help on using the changeset viewer.