source: dev/trunk/ab5.0/abdev/ab_common/include/Lexical/Interface.h@ 824

Last change on this file since 824 was 728, checked in by dai, 16 years ago

#200への対応。ジェネリックインターフェイスを実装したジェネリッククラスのテンプレート展開に対応。

File size: 2.4 KB
Line 
1#pragma once
2
3class CClass;
4
5class DynamicMethodsPrototype
6{
7 // 動的メソッド
8 Methods dynamicMethods;
9
10 // XMLシリアライズ用
11private:
12 friend class boost::serialization::access;
13 template<class Archive> void serialize(Archive& ar, const unsigned int version)
14 {
15 ar & BOOST_SERIALIZATION_NVP( dynamicMethods );
16 }
17
18public:
19 DynamicMethodsPrototype(){}
20 DynamicMethodsPrototype( const DynamicMethodsPrototype &dynamicMethodsPrototype )
21 : dynamicMethods( dynamicMethodsPrototype.dynamicMethods )
22 {
23 }
24 ~DynamicMethodsPrototype(){}
25
26 const Methods &GetDynamicMethods() const
27 {
28 return dynamicMethods;
29 }
30 Methods &GetDynamicMethods()
31 {
32 return dynamicMethods;
33 }
34
35 void AddDynamicMethods( CMethod *pMethod )
36 {
37 dynamicMethods.push_back( pMethod );
38 }
39};
40
41class Interface : public DynamicMethodsPrototype
42{
43 const CClass *pInterfaceClass;
44 mutable int vtblOffset;
45
46 // 型パラメータ(実パラメータ)
47 Types actualTypeParameters;
48
49 // XMLシリアライズ用
50private:
51 friend class boost::serialization::access;
52 template<class Archive> void serialize(Archive& ar, const unsigned int version)
53 {
54 trace_for_serialize( "serializing - Interface" );
55
56 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( DynamicMethodsPrototype );
57 ar & boost::serialization::make_nvp("pInterfaceClass", const_cast<CClass *&>(pInterfaceClass) );
58 ar & BOOST_SERIALIZATION_NVP( vtblOffset );
59 ar & BOOST_SERIALIZATION_NVP( actualTypeParameters );
60 }
61
62public:
63 Interface( const CClass *pInterfaceClass, const Types &actualTypeParameters );
64 Interface( const Interface &objInterface )
65 : DynamicMethodsPrototype( objInterface )
66 , pInterfaceClass( objInterface.pInterfaceClass )
67 , vtblOffset( objInterface.vtblOffset )
68 {
69 }
70 Interface()
71 : pInterfaceClass( NULL )
72 , vtblOffset( NULL )
73 {
74 }
75
76 const CClass &GetClass() const
77 {
78 return *pInterfaceClass;
79 }
80 int GetVtblOffset() const
81 {
82 return vtblOffset;
83 }
84 void SetVtblOffset( int vtblOffset ) const
85 {
86 this->vtblOffset = vtblOffset;
87 }
88
89 const Types &GetActualTypeParameters() const
90 {
91 return actualTypeParameters;
92 }
93
94 bool Equals( const Interface *pInterface ) const;
95
96 std::string GetFullNameWithActualGenericTypeParameters() const;
97
98 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
99};
100typedef std::vector<Interface *> Interfaces;
Note: See TracBrowser for help on using the repository browser.