source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Member.h@ 561

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

AddMemberAddDynamicMethod
・CMember→Member
・CreateMemberメソッドをCClassクラスからLexicalAnalyzerクラスへ移動した。

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