source: dev/trunk/jenga/include/smoothie/Method.h@ 183

Last change on this file since 183 was 170, checked in by dai_9181, 17 years ago

ベースを作成中...

File size: 3.1 KB
RevLine 
[170]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
11using namespace std;
12
13class UserProc;
14class CClass;
15void SetError();
16
17class CMethod : public MemberPrototype
18{
19public:
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
37class DynamicMethod : public CMethod
38{
39 bool isAbstract;
40 bool isVirtual;
41 bool isConst;
42 const CClass *pInheritsClass;
43
44public:
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};
91class StaticMethod : public CMethod
92{
93public:
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
113class Methods : public vector<CMethod *>
114{
115public:
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};
Note: See TracBrowser for help on using the repository browser.