source: dev/trunk/abdev/BasicCompiler_Common/include/Member.h@ 393

Last change on this file since 393 was 382, checked in by dai_9181, 17 years ago

ジェネリクスインターフェイス実装時のオーバーロード解決ロジックを改良。(型パラメータを戻り値に持つメソッドのオーバーロードをミスしてしまうバグを修正)

File size: 2.3 KB
Line 
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <option.h>
7#include <Program.h>
8#include <Prototype.h>
9
10using namespace std;
11
12class CClass;
13
14class CMember : public MemberPrototype
15{
16 string name;
17 Type type;
18 bool isConst;
19 Subscripts subscripts;
20
21 string initializeExpression;
22 string constructParameter;
23
24 // XMLシリアライズ用
25 // TODO: xml
26private:
27 friend class boost::serialization::access;
28 template<class Archive> void serialize(Archive& ar, const unsigned int version)
29 {
30 trace_for_serialize( "serializing - CMember" );
31
32 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( MemberPrototype );
33 ar & BOOST_SERIALIZATION_NVP( name );
34 ar & BOOST_SERIALIZATION_NVP( type );
35 ar & BOOST_SERIALIZATION_NVP( isConst );
36 ar & BOOST_SERIALIZATION_NVP( subscripts );
37 ar & BOOST_SERIALIZATION_NVP( initializeExpression );
38 ar & BOOST_SERIALIZATION_NVP( constructParameter );
39 }
40
41public:
42
43 int source_code_address;
44
45 const string &GetName() const
46 {
47 return name;
48 }
49 void SetName( const string &name )
50 {
51 this->name = name;
52 }
53
54 const Type &GetType() const
55 {
56 return type;
57 }
58 void ResetType( const Type &type )
59 {
60 this->type = type;
61 }
62
63 bool IsConst()
64 {
65 return isConst;
66 }
67
68 const Subscripts &GetSubscripts() const
69 {
70 return subscripts;
71 }
72
73 const string &GetInitializeExpression() const
74 {
75 return initializeExpression;
76 }
77 const string &GetConstructParameter() const
78 {
79 return constructParameter;
80 }
81
82 CMember( Prototype::Accessibility accessibility, const string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const string &initializeExpression, const string &constructParameter )
83 : MemberPrototype( accessibility )
84 , name( name )
85 , type( newType )
86 , isConst( isConst )
87 , subscripts( subscripts )
88 , initializeExpression( initializeExpression )
89 , constructParameter( constructParameter )
90 {
91 }
92 CMember::CMember(CMember &member)
93 : MemberPrototype( member.GetAccessibility() )
94 , name( member.GetName() )
95 , type( member.GetType() )
96 , isConst( member.IsConst() )
97 , subscripts( member.GetSubscripts() )
98 {
99 //ソースコードの位置
100 source_code_address=member.source_code_address;
101 }
102 CMember()
103 {
104 }
105 ~CMember()
106 {
107 }
108};
109typedef std::vector<CMember *> Members;
Note: See TracBrowser for help on using the repository browser.