1 | #pragma once
|
---|
2 |
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include <jenga/include/smoothie/Source.h>
|
---|
7 |
|
---|
8 | #include <option.h>
|
---|
9 | #include <Program.h>
|
---|
10 | #include <Prototype.h>
|
---|
11 | #include <Type.h>
|
---|
12 |
|
---|
13 | using namespace std;
|
---|
14 |
|
---|
15 | class CClass;
|
---|
16 |
|
---|
17 | class CMember : public MemberPrototype
|
---|
18 | {
|
---|
19 | string name;
|
---|
20 | Type type;
|
---|
21 | bool isConst;
|
---|
22 | Subscripts subscripts;
|
---|
23 |
|
---|
24 | string initializeExpression;
|
---|
25 | string constructParameter;
|
---|
26 |
|
---|
27 | // XMLシリアライズ用
|
---|
28 | // TODO: xml
|
---|
29 | private:
|
---|
30 | friend class boost::serialization::access;
|
---|
31 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
32 | {
|
---|
33 | trace_for_serialize( "serializing - CMember" );
|
---|
34 |
|
---|
35 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( MemberPrototype );
|
---|
36 | ar & BOOST_SERIALIZATION_NVP( name );
|
---|
37 | ar & BOOST_SERIALIZATION_NVP( type );
|
---|
38 | ar & BOOST_SERIALIZATION_NVP( isConst );
|
---|
39 | ar & BOOST_SERIALIZATION_NVP( subscripts );
|
---|
40 | ar & BOOST_SERIALIZATION_NVP( initializeExpression );
|
---|
41 | ar & BOOST_SERIALIZATION_NVP( constructParameter );
|
---|
42 | }
|
---|
43 |
|
---|
44 | public:
|
---|
45 |
|
---|
46 | int source_code_address;
|
---|
47 |
|
---|
48 | const string &GetName() const
|
---|
49 | {
|
---|
50 | return name;
|
---|
51 | }
|
---|
52 | void SetName( const string &name )
|
---|
53 | {
|
---|
54 | this->name = name;
|
---|
55 | }
|
---|
56 |
|
---|
57 | Type GetType() const
|
---|
58 | {
|
---|
59 | return type;
|
---|
60 | }
|
---|
61 |
|
---|
62 | bool IsConst()
|
---|
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 | };
|
---|
108 | typedef std::vector<CMember *> Members;
|
---|