| 1 | #pragma once
|
|---|
| 2 |
|
|---|
| 3 | namespace ActiveBasic{ namespace Common{ namespace Lexical{
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | class Prototype : public Symbol
|
|---|
| 7 | {
|
|---|
| 8 | public:
|
|---|
| 9 | enum Accessibility{
|
|---|
| 10 | None,
|
|---|
| 11 | Private,
|
|---|
| 12 | Protected,
|
|---|
| 13 | Public,
|
|---|
| 14 | };
|
|---|
| 15 |
|
|---|
| 16 | private:
|
|---|
| 17 | mutable bool isUsing;
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | // XMLシリアライズ用
|
|---|
| 21 | private:
|
|---|
| 22 | friend class boost::serialization::access;
|
|---|
| 23 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
|---|
| 24 | {
|
|---|
| 25 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
|
|---|
| 26 | ar & BOOST_SERIALIZATION_NVP( isUsing );
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | public:
|
|---|
| 31 |
|
|---|
| 32 | Prototype( const NamespaceScopes &namespaceScopes, const std::string &name )
|
|---|
| 33 | : Symbol( namespaceScopes, name )
|
|---|
| 34 | , isUsing( false )
|
|---|
| 35 | {
|
|---|
| 36 | }
|
|---|
| 37 | Prototype()
|
|---|
| 38 | : Symbol()
|
|---|
| 39 | {
|
|---|
| 40 | }
|
|---|
| 41 | ~Prototype()
|
|---|
| 42 | {
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | //自身と等しいかどうかを確認
|
|---|
| 46 | bool IsEquals( const Prototype *prototype ) const
|
|---|
| 47 | {
|
|---|
| 48 | if( this == prototype ){
|
|---|
| 49 | return true;
|
|---|
| 50 | }
|
|---|
| 51 | return false;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | // 利用状況
|
|---|
| 55 | bool IsUsing() const
|
|---|
| 56 | {
|
|---|
| 57 | return isUsing;
|
|---|
| 58 | }
|
|---|
| 59 | void Using() const
|
|---|
| 60 | {
|
|---|
| 61 | isUsing = true;
|
|---|
| 62 | }
|
|---|
| 63 | };
|
|---|
| 64 |
|
|---|
| 65 | class MemberPrototype
|
|---|
| 66 | {
|
|---|
| 67 | Prototype::Accessibility accessibility;
|
|---|
| 68 |
|
|---|
| 69 | // XMLシリアライズ用
|
|---|
| 70 | private:
|
|---|
| 71 | friend class boost::serialization::access;
|
|---|
| 72 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
|---|
| 73 | {
|
|---|
| 74 | ar & BOOST_SERIALIZATION_NVP( accessibility );
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | public:
|
|---|
| 78 | MemberPrototype( Prototype::Accessibility accessibility )
|
|---|
| 79 | : accessibility( accessibility )
|
|---|
| 80 | {
|
|---|
| 81 | }
|
|---|
| 82 | MemberPrototype()
|
|---|
| 83 | : accessibility( Prototype::None )
|
|---|
| 84 | {
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | Prototype::Accessibility GetAccessibility() const
|
|---|
| 88 | {
|
|---|
| 89 | return accessibility;
|
|---|
| 90 | }
|
|---|
| 91 | void SetAccessibility( Prototype::Accessibility accessibility ){
|
|---|
| 92 | this->accessibility = accessibility;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | bool IsNoneAccess() const
|
|---|
| 96 | {
|
|---|
| 97 | return ( accessibility == Prototype::None );
|
|---|
| 98 | }
|
|---|
| 99 | bool IsPrivate() const
|
|---|
| 100 | {
|
|---|
| 101 | return ( accessibility == Prototype::Private );
|
|---|
| 102 | }
|
|---|
| 103 | bool IsProtected() const
|
|---|
| 104 | {
|
|---|
| 105 | return ( accessibility == Prototype::Protected );
|
|---|
| 106 | }
|
|---|
| 107 | bool IsPublic() const
|
|---|
| 108 | {
|
|---|
| 109 | return ( accessibility == Prototype::Public );
|
|---|
| 110 | }
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 | }}}
|
|---|