1 | #pragma once
|
---|
2 |
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include <option.h>
|
---|
7 | #include <Program.h>
|
---|
8 | #include <Prototype.h>
|
---|
9 |
|
---|
10 | using namespace std;
|
---|
11 |
|
---|
12 | class CClass;
|
---|
13 |
|
---|
14 | class 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
|
---|
26 | private:
|
---|
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 |
|
---|
41 | public:
|
---|
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() const
|
---|
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 | };
|
---|
109 | typedef std::vector<CMember *> Members;
|
---|