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