23 #ifndef _TelepathyQt_callbacks_h_HEADER_GUARD_
24 #define _TelepathyQt_callbacks_h_HEADER_GUARD_
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
30 #include <TelepathyQt/Functors>
31 #include <TelepathyQt/Global>
38 typedef void *(*HookType)(
void*);
52 template <
class T,
class Functor>
73 bool isValid()
const {
return caller != 0; }
77 if (caller == other.
caller)
return *
this;
88 template <
class Functor,
class R >
99 Type *typed =
static_cast<Type*
>(call);
100 return (typed->functor)();
111 template <
class Functor>
119 return invokeMethod(
caller );
125 template <
class Functor,
class R ,
class Arg1>
136 Type *typed =
static_cast<Type*
>(call);
137 return (typed->functor)(a1);
141 template <
class R ,
class Arg1>
148 template <
class Functor>
156 return invokeMethod(
caller , a1);
162 template <
class Functor,
class R ,
class Arg1,
class Arg2>
173 Type *typed =
static_cast<Type*
>(call);
174 return (typed->functor)(a1, a2);
178 template <
class R ,
class Arg1,
class Arg2>
185 template <
class Functor>
193 return invokeMethod(
caller , a1, a2);
199 template <
class Functor,
class R ,
class Arg1,
class Arg2,
class Arg3>
210 Type *typed =
static_cast<Type*
>(call);
211 return (typed->functor)(a1, a2, a3);
215 template <
class R ,
class Arg1,
class Arg2,
class Arg3>
222 template <
class Functor>
230 return invokeMethod(
caller , a1, a2, a3);
236 template <
class Functor,
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4>
247 Type *typed =
static_cast<Type*
>(call);
248 return (typed->functor)(a1, a2, a3, a4);
252 template <
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4>
259 template <
class Functor>
267 return invokeMethod(
caller , a1, a2, a3, a4);
273 template <
class Functor,
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
284 Type *typed =
static_cast<Type*
>(call);
285 return (typed->functor)(a1, a2, a3, a4, a5);
289 template <
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
296 template <
class Functor>
304 return invokeMethod(
caller , a1, a2, a3, a4, a5);
310 template <
class Functor,
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6>
321 Type *typed =
static_cast<Type*
>(call);
322 return (typed->functor)(a1, a2, a3, a4, a5, a6);
326 template <
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6>
333 template <
class Functor>
341 return invokeMethod(
caller , a1, a2, a3, a4, a5, a6);
347 template <
class Functor,
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6,
class Arg7>
353 explicit FunctorCaller7(
const Functor &
functor) :
BaseFunctorCaller<
FunctorCaller7, Functor>(functor, reinterpret_cast<
AbstractFunctorCaller::
HookType>(&
FunctorCaller7<Functor, R , Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>::
invoke)) {}
358 Type *typed =
static_cast<Type*
>(call);
359 return (typed->functor)(a1, a2, a3, a4, a5, a6, a7);
363 template <
class R ,
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6,
class Arg7>
370 template <
class Functor>
378 return invokeMethod(
caller , a1, a2, a3, a4, a5, a6, a7);
Callback4(const Functor &functor)
Definition: callbacks.h:260
FunctorCaller7(const Functor &functor)
Definition: callbacks.h:353
R(* FunctionType)(Arg1)
Definition: callbacks.h:144
R(* FunctionType)(Arg1, Arg2, Arg3)
Definition: callbacks.h:218
bool isValid() const
Definition: callbacks.h:73
Functor functor
Definition: callbacks.h:62
Definition: callbacks.h:53
ResultType operator()(Arg1 a1, Arg2 a2) const
Definition: callbacks.h:188
Definition: callbacks.h:126
Callback1()
Definition: callbacks.h:147
FunctorCaller5(const Functor &functor)
Definition: callbacks.h:279
Callback3(const Functor &functor)
Definition: callbacks.h:223
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) const
Definition: callbacks.h:262
Callback1(const Functor &functor)
Definition: callbacks.h:149
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5)
Definition: callbacks.h:277
BaseCallback & operator=(const BaseCallback &other)
Definition: callbacks.h:75
void *(* HookType)(void *)
Definition: callbacks.h:38
Callback7(const Functor &functor)
Definition: callbacks.h:371
FunctorCaller0(const Functor &functor)
Definition: callbacks.h:94
Callback with 4 arguments.
Definition: callbacks.h:253
R ResultType
Definition: callbacks.h:145
Callback with 2 arguments.
Definition: callbacks.h:179
R ResultType
Definition: callbacks.h:330
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3)
Definition: callbacks.h:207
static ResultType invoke(AbstractFunctorCaller *call)
Definition: callbacks.h:96
FunctorCaller6(const Functor &functor)
Definition: callbacks.h:316
virtual AbstractFunctorCaller * clone() const
Definition: callbacks.h:60
R ResultType
Definition: callbacks.h:108
virtual ~BaseFunctorCaller()
Definition: callbacks.h:58
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6, Arg7 a7) const
Definition: callbacks.h:373
R ResultType
Definition: callbacks.h:202
BaseCallback(const BaseCallback &other)
Definition: callbacks.h:70
Definition: callbacks.h:89
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)
Definition: callbacks.h:366
virtual AbstractFunctorCaller * clone() const =0
FunctorCaller3(const Functor &functor)
Definition: callbacks.h:205
HookType invokeMethodHook
Definition: callbacks.h:45
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6, Arg7 a7)
Definition: callbacks.h:355
Definition: callbacks.h:200
Callback with 0 arguments.
Definition: callbacks.h:105
Callback with 7 arguments.
Definition: callbacks.h:364
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5)
Definition: callbacks.h:292
Callback3()
Definition: callbacks.h:221
R(* InvokeType)(AbstractFunctorCaller *, Arg1)
Definition: callbacks.h:129
Callback4()
Definition: callbacks.h:258
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)
Definition: callbacks.h:351
R(* InvokeType)(AbstractFunctorCaller *)
Definition: callbacks.h:92
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6) const
Definition: callbacks.h:336
Callback5()
Definition: callbacks.h:295
R(* FunctionType)(Arg1, Arg2)
Definition: callbacks.h:181
R ResultType
Definition: callbacks.h:165
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5)
Definition: callbacks.h:281
Callback0()
Definition: callbacks.h:110
R ResultType
Definition: callbacks.h:182
R ResultType
Definition: callbacks.h:91
Callback0(const Functor &functor)
Definition: callbacks.h:112
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)
Definition: callbacks.h:329
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2)
Definition: callbacks.h:166
Callback with 1 argument.
Definition: callbacks.h:142
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)
Definition: callbacks.h:314
Callback with 6 arguments.
Definition: callbacks.h:327
AbstractFunctorCaller(HookType invokeMethodHook)
Definition: callbacks.h:40
R(* FunctionType)()
Definition: callbacks.h:107
Callback5(const Functor &functor)
Definition: callbacks.h:297
R ResultType
Definition: callbacks.h:239
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2)
Definition: callbacks.h:170
R ResultType
Definition: callbacks.h:367
R ResultType
Definition: callbacks.h:256
BaseFunctorCaller(const Functor &functor, AbstractFunctorCaller::HookType invokeMethodHook)
Definition: callbacks.h:55
R ResultType
Definition: callbacks.h:276
R ResultType
Definition: callbacks.h:128
virtual ~BaseCallback()
Definition: callbacks.h:71
AbstractFunctorCaller * caller
Definition: callbacks.h:85
R ResultType
Definition: callbacks.h:293
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6)
Definition: callbacks.h:318
BaseCallback()
Definition: callbacks.h:67
Callback2()
Definition: callbacks.h:184
Definition: callbacks.h:163
Callback6()
Definition: callbacks.h:332
FunctorCaller4(const Functor &functor)
Definition: callbacks.h:242
Definition: callbacks.h:348
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) const
Definition: callbacks.h:299
ResultType operator()() const
Definition: callbacks.h:114
Definition: callbacks.h:274
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3) const
Definition: callbacks.h:225
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1)
Definition: callbacks.h:133
ResultType operator()(Arg1 a1) const
Definition: callbacks.h:151
Base class for all the callback classes.
Definition: callbacks.h:65
FunctorCaller2(const Functor &functor)
Definition: callbacks.h:168
R ResultType
Definition: callbacks.h:219
Callback2(const Functor &functor)
Definition: callbacks.h:186
Definition: callbacks.h:36
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3)
Definition: callbacks.h:203
Callback6(const Functor &functor)
Definition: callbacks.h:334
R ResultType
Definition: callbacks.h:350
Callback with 5 arguments.
Definition: callbacks.h:290
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4)
Definition: callbacks.h:244
Callback with 3 arguments.
Definition: callbacks.h:216
Callback7()
Definition: callbacks.h:369
FunctorCaller1(const Functor &functor)
Definition: callbacks.h:131
R ResultType
Definition: callbacks.h:313
Definition: callbacks.h:311
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4)
Definition: callbacks.h:255
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4)
Definition: callbacks.h:240
virtual ~AbstractFunctorCaller()
Definition: callbacks.h:41
BaseCallback(AbstractFunctorCaller *caller)
Definition: callbacks.h:69
Definition: callbacks.h:237