mFrame
載入中...
搜尋中...
無符合項目
FunctionMethod.h
1
7#ifndef MFRAME_F6D62182_CA3A_4CCA_82D2_44B456A08840
8#define MFRAME_F6D62182_CA3A_4CCA_82D2_44B456A08840
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../func/Function.h"
18#include "./../lang/Object.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace mframe::func {
24 class FunctionMethod;
25} // namespace mframe::func
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
31 public mframe::func::Function<> {
32 /* *************************************************************************************
33 * Variable
34 */
35 private:
36 Interface& vClass;
37 Interface& (*Interface::*vMethod)(Interface&);
38
39 /* *************************************************************************************
40 * Abstract Method
41 */
42
43 /* *************************************************************************************
44 * Construct Method
45 */
46 public:
56 template <typename T = Interface, typename R = Interface, typename C = Interface>
57 FunctionMethod(Interface& c, Interface& (C::*method)(Interface&)) : vClass(c) {
58 this->vMethod = reinterpret_cast<Interface& (*Interface::*)(Interface&)>(method);
59 return;
60 }
61
69 template <typename T = Interface, typename R = Interface>
70 FunctionMethod(Function<T, R>& function) : FunctionMethod(function, Function<T, R>::apply) {
71 return;
72 }
73
78 virtual ~FunctionMethod(void) override;
79
80 /* *************************************************************************************
81 * Operator Method
82 */
83 public:
91 template <typename T, typename R>
92 inline operator const Function<T, R>&(void) const {
93 const Function<>* src = this;
94 return *reinterpret_cast<const Function<T, R>*>(src);
95 }
96
103 template <typename T, typename R>
104 inline operator Function<T, R>&(void) {
105 Function<>* src = this;
106 return *reinterpret_cast<Function<T, R>*>(src);
107 }
108
109 /* *************************************************************************************
110 * Public Method <Override> - mframe::func::Function<Interface, Interface>
111 */
112 public:
113 virtual Interface& apply(Interface& t) override;
114
115 /* *************************************************************************************
116 * Public Method
117 */
118
119 /* *************************************************************************************
120 * Protected Method
121 */
122
123 /* *************************************************************************************
124 * Private Method
125 */
126
127 /* *************************************************************************************
128 * Static Variable
129 */
130
131 /* *************************************************************************************
132 * Static Method
133 */
134};
135
136/* ***************************************************************************************
137 * End of file
138 */
139
140#endif /* MFRAME_F6D62182_CA3A_4CCA_82D2_44B456A08840 */
Definition FunctionMethod.h:31
FunctionMethod(Interface &c, Interface &(C::*method)(Interface &))
Construct a new Function Method object.
Definition FunctionMethod.h:57
virtual ~FunctionMethod(void) override
Destroy the object.
FunctionMethod(Function< T, R > &function)
Construct a new Function Method object.
Definition FunctionMethod.h:70
Definition Object.h:34
Definition BiConsumer.h:22
Definition Function.h:31
Definition Interface.h:134