mFrame
載入中...
搜尋中...
無符合項目
SupplierMethod.h
1
7#ifndef MFRAME_7CB5B2B6_EE12_4760_B144_0E8250AF90D9
8#define MFRAME_7CB5B2B6_EE12_4760_B144_0E8250AF90D9
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../func/Supplier.h"
18#include "./../lang/Object.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::func {
24 class SupplierMethod;
25} // namespace ufm::func
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
30
40 /* *************************************************************************************
41 * Variable
42 */
43 private:
44 Interface& vClass;
45 Interface& (Interface::*vMethod)(void);
46 /* *************************************************************************************
47 * Abstract Method
48 */
49
50 /* *************************************************************************************
51 * Construct Method
52 */
53 public:
67 template <typename R, typename C>
68 SupplierMethod(Interface& c, C& (Supplier<C>::*method)(void)) : vClass(c) {
69 this->vMethod = reinterpret_cast<Interface& (Interface::*)(void)>(method);
70 return;
71 }
72
84 template <typename R>
86 return;
87 }
88
95 virtual ~SupplierMethod(void) override;
96
97 /* *************************************************************************************
98 * Operator Method
99 */
100 public:
111 template <typename R>
112 inline operator const Supplier<R>&(void) const {
113 const Supplier<R>* src = this;
114 return *reinterpret_cast<const Supplier<R>*>(this);
115 }
116
127 template <typename R>
128 inline operator Supplier<R>&(void) {
129 Supplier<R>* src = this;
130 return *reinterpret_cast<Supplier<R>*>(this);
131 }
132
133 /* *************************************************************************************
134 * Override Method - ufm::func::Supplier<>
135 */
136 public:
146 virtual Interface& get(void) override;
147
148 /* *************************************************************************************
149 * Public Method
150 */
151
152 /* *************************************************************************************
153 * Protected Method
154 */
155
156 /* *************************************************************************************
157 * Private Method
158 */
159
160 /* *************************************************************************************
161 * Static Variable
162 */
163
164 /* *************************************************************************************
165 * Static Method
166 */
167};
168
169/* ***************************************************************************************
170 * End of file
171 */
172
173#endif /* MFRAME_7CB5B2B6_EE12_4760_B144_0E8250AF90D9 */
供應方法類別,將物件方法封裝為供應者
Definition SupplierMethod.h:39
SupplierMethod(Supplier< R > &supplier)
從現有供應者建構供應方法物件
Definition SupplierMethod.h:85
virtual Interface & get(void) override
實現 Supplier 介面的 get 方法
SupplierMethod(Interface &c, C &(Supplier< C >::*method)(void))
建構供應方法物件
Definition SupplierMethod.h:68
virtual ~SupplierMethod(void) override
解構供應方法物件
物件基底類別
Definition Object.h:63
Definition BiConsumer.h:22
[Interface] 供應者函數式介面模板
Definition Supplier.h:42
類別共用基礎介面
Definition Interface.h:152