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

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

ヘッダファイルを整理中

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