source: dev/trunk/ab5.0/abdev/ab_common/src/Lexical/Interface.cpp@ 639

Last change on this file since 639 was 639, checked in by dai_9181, 16 years ago

静的リンクリンカの依存関係解決モジュールを製作中

File size: 2.0 KB
Line 
1#include "stdafx.h"
2
3Interface::Interface( const CClass *pInterfaceClass, const Types &actualTypeParameters )
4 : DynamicMethodsPrototype()
5 , pInterfaceClass( pInterfaceClass )
6 , vtblOffset( -1 )
7 , actualTypeParameters( actualTypeParameters )
8{
9 //メソッドをコピー
10 BOOST_FOREACH( const CMethod *pBaseMethod, pInterfaceClass->GetDynamicMethods() )
11 {
12 CMethod *pMethod = new DynamicMethod( *pBaseMethod );
13
14 // アクセシビリティ
15 if(pBaseMethod->GetAccessibility() == Prototype::Private){
16 pMethod->SetAccessibility( Prototype::None );
17 }
18 else{
19 pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
20 }
21
22 //pobj_Inherits
23 // ※継承元のClassIndexをセット(入れ子継承を考慮する)
24 if(pBaseMethod->GetInheritsClassPtr()==0){
25 pMethod->SetInheritsClassPtr( pInterfaceClass );
26 }
27 else{
28 pMethod->SetInheritsClassPtr( pBaseMethod->GetInheritsClassPtr() );
29 }
30
31 AddDynamicMethods( pMethod );
32 }
33}
34
35std::string Interface::GetFullNameWithActualGenericTypeParameters() const
36{
37 std::string interfaceName = this->GetClass().GetFullName();
38 if( actualTypeParameters.size() )
39 {
40 std::string actualGenericTypesName;
41 BOOST_FOREACH( const Type &typeParameter, actualTypeParameters )
42 {
43 if( actualGenericTypesName.size() )
44 {
45 actualGenericTypesName += ",";
46 }
47 actualGenericTypesName += typeParameter.ToString();
48 }
49
50 interfaceName += "<" + actualGenericTypesName + ">";
51 }
52 return interfaceName;
53}
54
55bool Interface::Resolve( const ObjectModule &resolver )
56{
57 // 動的メソッド
58 BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )
59 {
60 pMethod->Resolve( resolver );
61 }
62
63 // クラス
64 if( this->pInterfaceClass )
65 {
66 if( this->pInterfaceClass->IsNeedResolve() )
67 {
68 this->pInterfaceClass = resolver.meta.GetClasses().FindLike( pInterfaceClass );
69 }
70 }
71
72 BOOST_FOREACH( Type &actualTypeParameter, actualTypeParameters )
73 {
74 actualTypeParameter.Resolve( resolver );
75 }
76
77 return true;
78}
Note: See TracBrowser for help on using the repository browser.