source: dev/trunk/abdev/BasicCompiler_Common/include/Member.h@ 273

Last change on this file since 273 was 266, checked in by dai_9181, 17 years ago

BasicSourceのシリアライズがうまくいっていない

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