From 6c395bd86dfe99efe8d71277360e321017c5b51b Mon Sep 17 00:00:00 2001 From: rylek Date: Wed, 5 Nov 2008 13:25:14 +0000 Subject: [PATCH] Added GateMethodActionArg1, an obscure form of callback. git-svn-id: svn://ultimatepp.org/upp/trunk@606 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Callback.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/uppsrc/Core/Callback.h b/uppsrc/Core/Callback.h index 785245b90..a7c1c1ce9 100644 --- a/uppsrc/Core/Callback.h +++ b/uppsrc/Core/Callback.h @@ -100,6 +100,23 @@ Callback1 callback1(const Object *object, void (M::*method)(P1, P) const, T (object, method, arg)); } +template +struct GateMethodActionArg1 : public Gate1Action { + 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 +Gate1 callback1(Object *object, bool (M::*method)(P1, P), T arg) { + return Gate1(new GateMethodActionArg1 + (object, method, arg)); +} + template struct CallbackActionCallArg1 : Callback1Action { F fn;