mFrame
載入中...
搜尋中...
無符合項目
BiConsumerMethod.h
1
7#ifndef MFRAME_18F94E68_41A6_40F6_A880_DC5C066EEDFC
8#define MFRAME_18F94E68_41A6_40F6_A880_DC5C066EEDFC
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../func/BiConsumer.h"
18#include "./../lang/Object.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::func {
24 class BiConsumerMethod;
25} // namespace ufm::func
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
30
39 /* *************************************************************************************
40 * Variable
41 */
42 private:
46 Interface& vClass;
47
53 void (Interface::*vMethod)(Interface&, Interface&);
54
55 /* *************************************************************************************
56 * Abstract Method
57 */
58
59 /* *************************************************************************************
60 * Construct Method
61 */
62 public:
76 template <typename T, typename U, typename C>
77 BiConsumerMethod(Interface& c, void (C::*method)(T, U)) : vClass(c) {
78 this->vMethod = reinterpret_cast<void (Interface::*)(Interface&, Interface&)>(method);
79 return;
80 }
81
93 template <typename T, typename U>
95 : BiConsumerMethod(biConsumer, BiConsumer<T, U>::accept) {
96 return;
97 }
98
103 virtual ~BiConsumerMethod(void) override;
104
105 /* *************************************************************************************
106 * Operator Method
107 */
108 public:
120 template <typename T, typename U>
121 inline operator const BiConsumer<T, U>&(void) const {
122 const BiConsumer<>* src = this;
123 return *reinterpret_cast<const BiConsumer<T, U>*>(src);
124 }
125
137 template <typename T, typename U>
138 inline operator BiConsumer<T, U>&(void) {
139 BiConsumer<>* src = this;
140 return *reinterpret_cast<BiConsumer<T, U>*>(src);
141 }
142
143 /* *************************************************************************************
144 * Override Method - ufm::func::BiConsumer<void*, void*>
145 */
146 public:
157 virtual void accept(Interface& t, Interface& u) override;
158
159 /* *************************************************************************************
160 * Public Method
161 */
162
163 /* *************************************************************************************
164 * Protected Method
165 */
166
167 /* *************************************************************************************
168 * Private Method
169 */
170
171 /* *************************************************************************************
172 * Static Variable
173 */
174
175 /* *************************************************************************************
176 * Static Method
177 */
178};
179
180/* ***************************************************************************************
181 * End of file
182 */
183
184#endif /* MFRAME_18F94E68_41A6_40F6_A880_DC5C066EEDFC */
雙參數消費者方法類別
Definition BiConsumerMethod.h:38
BiConsumerMethod(ufm::func::BiConsumer< T, U > biConsumer)
從另一個 BiConsumer 構造雙參數消費者方法物件
Definition BiConsumerMethod.h:94
BiConsumerMethod(Interface &c, void(C::*method)(T, U))
構造一個新的雙參數消費者方法物件
Definition BiConsumerMethod.h:77
virtual void accept(Interface &t, Interface &u) override
實現 BiConsumer 介面的 accept 方法
virtual ~BiConsumerMethod(void) override
析構函數
物件基底類別
Definition Object.h:63
Definition BiConsumer.h:22
[Interface] 雙參數消費者函數式介面模板
Definition BiConsumer.h:44
類別共用基礎介面
Definition Interface.h:152