[206] | 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 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
| 13 | class CClass;
|
---|
| 14 |
|
---|
| 15 | class 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
|
---|
| 27 | private:
|
---|
| 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 |
|
---|
| 42 | public:
|
---|
| 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 |
|
---|
[299] | 55 | const Type &GetType() const
|
---|
[206] | 56 | {
|
---|
| 57 | return type;
|
---|
| 58 | }
|
---|
[299] | 59 | void ResetType( const Type &type )
|
---|
| 60 | {
|
---|
| 61 | this->type = type;
|
---|
| 62 | }
|
---|
[206] | 63 |
|
---|
| 64 | bool IsConst()
|
---|
| 65 | {
|
---|
| 66 | return isConst;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | const Subscripts &GetSubscripts() const
|
---|
| 70 | {
|
---|
| 71 | return subscripts;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | const string &GetInitializeExpression() const
|
---|
| 75 | {
|
---|
| 76 | return initializeExpression;
|
---|
| 77 | }
|
---|
| 78 | const string &GetConstructParameter() const
|
---|
| 79 | {
|
---|
| 80 | return constructParameter;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | CMember( Prototype::Accessibility accessibility, const string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const string &initializeExpression, const string &constructParameter )
|
---|
| 84 | : MemberPrototype( accessibility )
|
---|
| 85 | , name( name )
|
---|
| 86 | , type( newType )
|
---|
| 87 | , isConst( isConst )
|
---|
| 88 | , subscripts( subscripts )
|
---|
| 89 | , initializeExpression( initializeExpression )
|
---|
| 90 | , constructParameter( constructParameter )
|
---|
| 91 | {
|
---|
| 92 | }
|
---|
| 93 | CMember::CMember(CMember &member)
|
---|
| 94 | : MemberPrototype( member.GetAccessibility() )
|
---|
| 95 | , name( member.GetName() )
|
---|
| 96 | , type( member.GetType() )
|
---|
| 97 | , isConst( member.IsConst() )
|
---|
| 98 | , subscripts( member.GetSubscripts() )
|
---|
| 99 | {
|
---|
| 100 | //ソースコードの位置
|
---|
| 101 | source_code_address=member.source_code_address;
|
---|
| 102 | }
|
---|
| 103 | CMember()
|
---|
| 104 | {
|
---|
| 105 | }
|
---|
| 106 | ~CMember()
|
---|
| 107 | {
|
---|
| 108 | }
|
---|
| 109 | };
|
---|
| 110 | typedef std::vector<CMember *> Members;
|
---|