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

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

Prototypeクラスをab_commonプロジェクトに移動した。

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