1 | #pragma once
|
---|
2 |
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include "../Class.h"
|
---|
7 | #include <windows.h>
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | class UserProc;
|
---|
12 | class CClass;
|
---|
13 | void SetError();
|
---|
14 |
|
---|
15 | class CMethod : public MemberPrototype
|
---|
16 | {
|
---|
17 | public:
|
---|
18 | UserProc *pUserProc;
|
---|
19 |
|
---|
20 | CMethod( UserProc *pUserProc, Prototype::Accessibility accessibility )
|
---|
21 | : MemberPrototype( accessibility )
|
---|
22 | , pUserProc( pUserProc )
|
---|
23 | {
|
---|
24 | }
|
---|
25 |
|
---|
26 | virtual bool IsAbstract() const = 0;
|
---|
27 | virtual void Override() = 0;
|
---|
28 | virtual bool IsVirtual() const = 0;
|
---|
29 | virtual bool IsConst() const = 0;
|
---|
30 | virtual bool IsStatic() const = 0;
|
---|
31 | virtual const CClass *GetInheritsClassPtr() const = 0;
|
---|
32 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass ) = 0;
|
---|
33 | };
|
---|
34 |
|
---|
35 | class DynamicMethod : public CMethod
|
---|
36 | {
|
---|
37 | bool isAbstract;
|
---|
38 | bool isVirtual;
|
---|
39 | bool isConst;
|
---|
40 | const CClass *pInheritsClass;
|
---|
41 |
|
---|
42 | public:
|
---|
43 | DynamicMethod( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL )
|
---|
44 | : CMethod( pUserProc, accessibility )
|
---|
45 | , isAbstract( isAbstract )
|
---|
46 | , isVirtual( isVirtual )
|
---|
47 | , isConst( isConst )
|
---|
48 | , pInheritsClass( pInheritsClass )
|
---|
49 | {
|
---|
50 | }
|
---|
51 | DynamicMethod( const CMethod &method )
|
---|
52 | : CMethod( method.pUserProc, method.GetAccessibility() )
|
---|
53 | , isAbstract( method.IsAbstract() )
|
---|
54 | , isVirtual( method.IsVirtual() )
|
---|
55 | , isConst( method.IsConst() )
|
---|
56 | , pInheritsClass( method.GetInheritsClassPtr() )
|
---|
57 | {
|
---|
58 | }
|
---|
59 |
|
---|
60 | virtual bool IsAbstract() const
|
---|
61 | {
|
---|
62 | return isAbstract;
|
---|
63 | }
|
---|
64 | virtual void Override()
|
---|
65 | {
|
---|
66 | isAbstract = false;
|
---|
67 | }
|
---|
68 | virtual bool IsVirtual() const
|
---|
69 | {
|
---|
70 | return isVirtual;
|
---|
71 | }
|
---|
72 | virtual bool IsConst() const
|
---|
73 | {
|
---|
74 | return isConst;
|
---|
75 | }
|
---|
76 | virtual bool IsStatic() const
|
---|
77 | {
|
---|
78 | return false;
|
---|
79 | }
|
---|
80 | virtual const CClass *GetInheritsClassPtr() const
|
---|
81 | {
|
---|
82 | return pInheritsClass;
|
---|
83 | }
|
---|
84 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass )
|
---|
85 | {
|
---|
86 | this->pInheritsClass = pInheritsClass;
|
---|
87 | }
|
---|
88 | };
|
---|
89 | class StaticMethod : public CMethod
|
---|
90 | {
|
---|
91 | public:
|
---|
92 | StaticMethod( UserProc *pUserProc, Prototype::Accessibility accessibility )
|
---|
93 | : CMethod( pUserProc, accessibility )
|
---|
94 | {
|
---|
95 | }
|
---|
96 |
|
---|
97 | virtual bool IsAbstract() const{SetError();return false;}
|
---|
98 | virtual void Override(){SetError();}
|
---|
99 | virtual bool IsVirtual() const{
|
---|
100 | return false;
|
---|
101 | }
|
---|
102 | virtual bool IsConst() const{SetError();return false;}
|
---|
103 | virtual bool IsStatic() const
|
---|
104 | {
|
---|
105 | return true;
|
---|
106 | }
|
---|
107 | virtual const CClass *GetInheritsClassPtr() const{SetError();return NULL;}
|
---|
108 | virtual void SetInheritsClassPtr( const CClass *pInheritsClass ){SetError();}
|
---|
109 | };
|
---|
110 |
|
---|
111 | class Methods : public vector<CMethod *>
|
---|
112 | {
|
---|
113 | public:
|
---|
114 | Methods();
|
---|
115 | ~Methods();
|
---|
116 |
|
---|
117 | //メンバ、メソッドの追加
|
---|
118 | void Add( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual );
|
---|
119 | void AddStatic(UserProc *pUserProc,Prototype::Accessibility accessibility);
|
---|
120 |
|
---|
121 | const CMethod *GetMethodPtr( UserProc *pUserProc ) const;
|
---|
122 | bool IsExist( const char *name ) const;
|
---|
123 | virtual void Enum( const char *methodName, vector<UserProc *> &subs ) const;
|
---|
124 | virtual void Enum( const BYTE idOperatorCalc, vector<UserProc *> &subs ) const;
|
---|
125 | };
|
---|