1 | #pragma once
|
---|
2 |
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include "Type.h"
|
---|
7 | #include "Class.h"
|
---|
8 | #include "Source.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 |
|
---|
20 | string initializeExpression;
|
---|
21 | string constructParameter;
|
---|
22 |
|
---|
23 | // XMLシリアライズ用
|
---|
24 | private:
|
---|
25 | friend class boost::serialization::access;
|
---|
26 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
27 | {
|
---|
28 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( MemberPrototype );
|
---|
29 | ar & BOOST_SERIALIZATION_NVP( name );
|
---|
30 | ar & BOOST_SERIALIZATION_NVP( type );
|
---|
31 | ar & BOOST_SERIALIZATION_NVP( isConst );
|
---|
32 | ar & BOOST_SERIALIZATION_NVP( initializeExpression );
|
---|
33 | ar & BOOST_SERIALIZATION_NVP( constructParameter );
|
---|
34 | }
|
---|
35 |
|
---|
36 | public:
|
---|
37 | int SubScripts[MAX_ARRAYDIM];
|
---|
38 |
|
---|
39 | int source_code_address;
|
---|
40 |
|
---|
41 | const string &GetName() const
|
---|
42 | {
|
---|
43 | return name;
|
---|
44 | }
|
---|
45 | void SetName( const string &name )
|
---|
46 | {
|
---|
47 | this->name = name;
|
---|
48 | }
|
---|
49 |
|
---|
50 | Type GetType() const
|
---|
51 | {
|
---|
52 | return type;
|
---|
53 | }
|
---|
54 |
|
---|
55 | bool IsConst()
|
---|
56 | {
|
---|
57 | return isConst;
|
---|
58 | }
|
---|
59 |
|
---|
60 | const string &GetInitializeExpression() const
|
---|
61 | {
|
---|
62 | return initializeExpression;
|
---|
63 | }
|
---|
64 | const string &GetConstructParameter() const
|
---|
65 | {
|
---|
66 | return constructParameter;
|
---|
67 | }
|
---|
68 |
|
---|
69 | CMember( Prototype::Accessibility accessibility, const string &name, const Type &newType, bool isConst, const string &initializeExpression, const string &constructParameter )
|
---|
70 | : MemberPrototype( accessibility )
|
---|
71 | , name( name )
|
---|
72 | , type( newType )
|
---|
73 | , isConst( isConst )
|
---|
74 | , initializeExpression( initializeExpression )
|
---|
75 | , constructParameter( constructParameter )
|
---|
76 | {
|
---|
77 | }
|
---|
78 | CMember::CMember(CMember &member)
|
---|
79 | : MemberPrototype( member.GetAccessibility() )
|
---|
80 | , name( member.GetName() )
|
---|
81 | , type( member.GetType() )
|
---|
82 | , isConst( member.IsConst() )
|
---|
83 | {
|
---|
84 | //SubScripts
|
---|
85 | memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int));
|
---|
86 |
|
---|
87 | //ソースコードの位置
|
---|
88 | source_code_address=member.source_code_address;
|
---|
89 | }
|
---|
90 | ~CMember()
|
---|
91 | {
|
---|
92 | }
|
---|
93 | };
|
---|
94 | typedef std::vector<CMember *> Members;
|
---|