mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-09 03:24:59 -06:00
Added GateMethodActionArg1, an obscure form of callback.
git-svn-id: svn://ultimatepp.org/upp/trunk@606 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d4c57a76fe
commit
6c395bd86d
1 changed files with 17 additions and 0 deletions
|
|
@ -100,6 +100,23 @@ Callback1<P1> callback1(const Object *object, void (M::*method)(P1, P) const, T
|
|||
(object, method, arg));
|
||||
}
|
||||
|
||||
template <class OBJECT_, class METHOD_, class P1, class T>
|
||||
struct GateMethodActionArg1 : public Gate1Action<P1> {
|
||||
OBJECT_ *object;
|
||||
METHOD_ method;
|
||||
T arg;
|
||||
bool Execute(P1 p1) { return (object->*method)(p1, arg); }
|
||||
|
||||
GateMethodActionArg1(OBJECT_ *object, METHOD_ method, T arg)
|
||||
: object(object), method(method), arg(arg) {}
|
||||
};
|
||||
|
||||
template <class Object, class M, class P1, class P, class T>
|
||||
Gate1<P1> callback1(Object *object, bool (M::*method)(P1, P), T arg) {
|
||||
return Gate1<P1>(new GateMethodActionArg1<Object, bool (M::*)(P1, P), P1, T>
|
||||
(object, method, arg));
|
||||
}
|
||||
|
||||
template <class F, class P1, class T, class HC = F>
|
||||
struct CallbackActionCallArg1 : Callback1Action<P1> {
|
||||
F fn;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue