1 | #pragma once
|
---|
2 |
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include <option.h>
|
---|
7 | #include <Program.h>
|
---|
8 | #include <Class.h>
|
---|
9 | #include <Procedure.h>
|
---|
10 |
|
---|
11 | #include <windows.h>
|
---|
12 |
|
---|
13 | using namespace std;
|
---|
14 |
|
---|
15 | class UserProc;
|
---|
16 | class CClass;
|
---|
17 | void SetError();
|
---|
18 |
|
---|
19 | class CMethod : public MemberPrototype
|
---|
20 | {
|
---|
21 | const UserProc *pUserProc;
|
---|
22 |
|
---|
23 | // XMLシリアライズ用
|
---|
24 | private:
|
---|
25 | friend class boost::serialization::access;
|
---|
26 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
27 | {
|
---|
28 | trace_for_serialize( "serializing - CMethod" );
|
---|
29 |
|
---|
30 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( MemberPrototype );
|
---|
31 | ar & boost::serialization::make_nvp("pUserProc", const_cast<UserProc *&>(pUserProc));
|
---|
32 | }
|
---|
33 |
|
---|
34 | public:
|
---|
35 | CMethod( const UserProc *pUserProc, Prototype::Accessibility accessibility )
|
---|
36 | : MemberPrototype( accessibility )
|
---|
37 | , pUserProc( pUserProc )
|
---|
38 | {
|
---|
39 | }
|
---|
40 | CMethod()
|
---|
41 | {
|
---|
42 | }
|
---|
43 |
|
---|
44 | const UserProc &GetUserProc() const
|
---|
45 | {
|
---|
46 | return *pUserProc;
|
---|
47 | }
|
---|
48 | void SetUserProcPtr( const UserProc *pUserProc )
|
---|
49 | {
|
---|
50 | this->pUserProc = pUserProc;
|
---|
51 | }
|
---|
52 |
|
---|
53 | virtual bool IsAbstract() const = 0;
|
---|
54 | virtual void Override() = 0;
|
---|
55 | virtual bool IsVirtual() const = 0;
|
---|
56 | virtual bool IsConst() const = 0;
|
---|
57 | virtual bool IsStatic() const = 0;
|
---|
58 | virtual const CClass *GetInheritsClassPtr() const = 0;
|
---|
59 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass ) = 0;
|
---|
60 | };
|
---|
61 |
|
---|
62 | class DynamicMethod : public CMethod
|
---|
63 | {
|
---|
64 | bool isAbstract;
|
---|
65 | bool isVirtual;
|
---|
66 | bool isConst;
|
---|
67 | const CClass *pInheritsClass;
|
---|
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 | trace_for_serialize( "serializing - DynamicMethod" );
|
---|
75 |
|
---|
76 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( CMethod );
|
---|
77 | ar & BOOST_SERIALIZATION_NVP( isAbstract );
|
---|
78 | ar & BOOST_SERIALIZATION_NVP( isVirtual );
|
---|
79 | ar & BOOST_SERIALIZATION_NVP( isConst );
|
---|
80 | ar & boost::serialization::make_nvp("pInheritsClass", const_cast<CClass *&>(pInheritsClass));
|
---|
81 | }
|
---|
82 |
|
---|
83 | public:
|
---|
84 | DynamicMethod( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL )
|
---|
85 | : CMethod( pUserProc, accessibility )
|
---|
86 | , isAbstract( isAbstract )
|
---|
87 | , isVirtual( isVirtual )
|
---|
88 | , isConst( isConst )
|
---|
89 | , pInheritsClass( pInheritsClass )
|
---|
90 | {
|
---|
91 | }
|
---|
92 | DynamicMethod( const CMethod &method )
|
---|
93 | : CMethod( &method.GetUserProc(), method.GetAccessibility() )
|
---|
94 | , isAbstract( method.IsAbstract() )
|
---|
95 | , isVirtual( method.IsVirtual() )
|
---|
96 | , isConst( method.IsConst() )
|
---|
97 | , pInheritsClass( method.GetInheritsClassPtr() )
|
---|
98 | {
|
---|
99 | }
|
---|
100 | DynamicMethod()
|
---|
101 | {
|
---|
102 | }
|
---|
103 |
|
---|
104 | virtual bool IsAbstract() const
|
---|
105 | {
|
---|
106 | return isAbstract;
|
---|
107 | }
|
---|
108 | virtual void Override()
|
---|
109 | {
|
---|
110 | isAbstract = false;
|
---|
111 | }
|
---|
112 | virtual bool IsVirtual() const
|
---|
113 | {
|
---|
114 | return isVirtual;
|
---|
115 | }
|
---|
116 | virtual bool IsConst() const
|
---|
117 | {
|
---|
118 | return isConst;
|
---|
119 | }
|
---|
120 | virtual bool IsStatic() const
|
---|
121 | {
|
---|
122 | return false;
|
---|
123 | }
|
---|
124 | virtual const CClass *GetInheritsClassPtr() const
|
---|
125 | {
|
---|
126 | return pInheritsClass;
|
---|
127 | }
|
---|
128 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass )
|
---|
129 | {
|
---|
130 | this->pInheritsClass = pInheritsClass;
|
---|
131 | }
|
---|
132 | };
|
---|
133 | BOOST_CLASS_EXPORT( DynamicMethod );
|
---|
134 | class StaticMethod : public CMethod
|
---|
135 | {
|
---|
136 | // XMLシリアライズ用
|
---|
137 | private:
|
---|
138 | friend class boost::serialization::access;
|
---|
139 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
140 | {
|
---|
141 | trace_for_serialize( "serializing - StaticMethod" );
|
---|
142 |
|
---|
143 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( CMethod );
|
---|
144 | }
|
---|
145 |
|
---|
146 | public:
|
---|
147 | StaticMethod( UserProc *pUserProc, Prototype::Accessibility accessibility )
|
---|
148 | : CMethod( pUserProc, accessibility )
|
---|
149 | {
|
---|
150 | }
|
---|
151 | StaticMethod()
|
---|
152 | {
|
---|
153 | }
|
---|
154 |
|
---|
155 | virtual bool IsAbstract() const{SetError();return false;}
|
---|
156 | virtual void Override(){SetError();}
|
---|
157 | virtual bool IsVirtual() const{
|
---|
158 | return false;
|
---|
159 | }
|
---|
160 | virtual bool IsConst() const{SetError();return false;}
|
---|
161 | virtual bool IsStatic() const
|
---|
162 | {
|
---|
163 | return true;
|
---|
164 | }
|
---|
165 | virtual const CClass *GetInheritsClassPtr() const{SetError();return NULL;}
|
---|
166 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass ){SetError();}
|
---|
167 | };
|
---|
168 | BOOST_CLASS_EXPORT( StaticMethod );
|
---|
169 |
|
---|
170 | class Methods : public vector<CMethod *>
|
---|
171 | {
|
---|
172 | // XMLシリアライズ用
|
---|
173 | private:
|
---|
174 | friend class boost::serialization::access;
|
---|
175 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
176 | {
|
---|
177 | trace_for_serialize( "serializing - Methods" );
|
---|
178 |
|
---|
179 | ar & boost::serialization::make_nvp("vector_CMethod", boost::serialization::base_object<vector<CMethod *>>(*this));
|
---|
180 | }
|
---|
181 |
|
---|
182 | public:
|
---|
183 | Methods();
|
---|
184 | ~Methods();
|
---|
185 |
|
---|
186 | //メンバ、メソッドの追加
|
---|
187 | void Add( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual );
|
---|
188 | void AddStatic(UserProc *pUserProc,Prototype::Accessibility accessibility);
|
---|
189 |
|
---|
190 | const CMethod *GetMethodPtr( const UserProc *pUserProc ) const;
|
---|
191 | bool IsExist( const char *name ) const;
|
---|
192 | virtual void Enum( const char *methodName, vector<const UserProc *> &subs ) const;
|
---|
193 | virtual void Enum( BYTE idOperatorCalc, vector<const UserProc *> &subs ) const;
|
---|
194 | };
|
---|