source: dev/trunk/jenga/include/smoothie/Member.h@ 203

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

jengaライブラリに一通りserializeメソッドを仕込んだ

File size: 2.0 KB
Line 
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include "Type.h"
7#include "Class.h"
8#include "Source.h"
9
10using namespace std;
11
12class CClass;
13
14class CMember : public MemberPrototype
15{
16 string name;
17 Type type;
18 bool isConst;
19
20 string initializeExpression;
21 string constructParameter;
22
23 // XMLシリアライズ用
24private:
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
36public:
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};
94typedef std::vector<CMember *> Members;
Note: See TracBrowser for help on using the repository browser.