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);
BaseCallback & operator=(const BaseCallback &other)
Definition: callbacks.h:75
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4)
Definition: callbacks.h:240
FunctorCaller0(const Functor &functor)
Definition: callbacks.h:94
Callback with 3 arguments.
Definition: callbacks.h:216
Definition: callbacks.h:163
Callback5(const Functor &functor)
Definition: callbacks.h:297
R ResultType
Definition: callbacks.h:108
virtual AbstractFunctorCaller * clone() const
Definition: callbacks.h:60
Callback1()
Definition: callbacks.h:147
Callback4()
Definition: callbacks.h:258
virtual ~AbstractFunctorCaller()
Definition: callbacks.h:41
R ResultType
Definition: callbacks.h:276
R ResultType
Definition: callbacks.h:256
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4)
Definition: callbacks.h:255
R(* FunctionType)(Arg1)
Definition: callbacks.h:144
FunctorCaller5(const Functor &functor)
Definition: callbacks.h:279
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2)
Definition: callbacks.h:170
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)
Definition: callbacks.h:351
R ResultType
Definition: callbacks.h:91
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3)
Definition: callbacks.h:203
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) const
Definition: callbacks.h:262
HookType invokeMethodHook
Definition: callbacks.h:45
R ResultType
Definition: callbacks.h:202
R ResultType
Definition: callbacks.h:182
FunctorCaller1(const Functor &functor)
Definition: callbacks.h:131
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5)
Definition: callbacks.h:292
Callback6()
Definition: callbacks.h:332
Callback with 5 arguments.
Definition: callbacks.h:290
BaseCallback(AbstractFunctorCaller *caller)
Definition: callbacks.h:69
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)
Definition: callbacks.h:366
Definition: callbacks.h:237
Callback3(const Functor &functor)
Definition: callbacks.h:223
AbstractFunctorCaller * caller
Definition: callbacks.h:85
R ResultType
Definition: callbacks.h:313
FunctorCaller6(const Functor &functor)
Definition: callbacks.h:316
Callback0(const Functor &functor)
Definition: callbacks.h:112
Callback2(const Functor &functor)
Definition: callbacks.h:186
R ResultType
Definition: callbacks.h:367
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6) const
Definition: callbacks.h:336
Callback with 6 arguments.
Definition: callbacks.h:327
Callback6(const Functor &functor)
Definition: callbacks.h:334
R ResultType
Definition: callbacks.h:145
FunctorCaller2(const Functor &functor)
Definition: callbacks.h:168
R(* FunctionType)()
Definition: callbacks.h:107
Functor functor
Definition: callbacks.h:62
Callback3()
Definition: callbacks.h:221
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3)
Definition: callbacks.h:207
FunctorCaller3(const Functor &functor)
Definition: callbacks.h:205
R ResultType
Definition: callbacks.h:350
Callback2()
Definition: callbacks.h:184
virtual AbstractFunctorCaller * clone() const =0
bool isValid() const
Definition: callbacks.h:73
R(* FunctionType)(Arg1, Arg2)
Definition: callbacks.h:181
R ResultType
Definition: callbacks.h:293
Callback with 0 arguments.
Definition: callbacks.h:105
Definition: callbacks.h:274
R(* FunctionType)(Arg1, Arg2, Arg3)
Definition: callbacks.h:218
Definition: callbacks.h:53
Callback1(const Functor &functor)
Definition: callbacks.h:149
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5)
Definition: callbacks.h:281
static ResultType invoke(AbstractFunctorCaller *call)
Definition: callbacks.h:96
void *(* HookType)(void *)
Definition: callbacks.h:38
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:219
Definition: callbacks.h:200
FunctorCaller7(const Functor &functor)
Definition: callbacks.h:353
R(* FunctionType)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)
Definition: callbacks.h:329
Callback with 7 arguments.
Definition: callbacks.h:364
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3) const
Definition: callbacks.h:225
Callback with 1 argument.
Definition: callbacks.h:142
Definition: callbacks.h:311
R ResultType
Definition: callbacks.h:165
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1)
Definition: callbacks.h:133
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6, Arg7 a7)
Definition: callbacks.h:355
Callback with 4 arguments.
Definition: callbacks.h:253
R ResultType
Definition: callbacks.h:239
R(* InvokeType)(AbstractFunctorCaller *)
Definition: callbacks.h:92
virtual ~BaseFunctorCaller()
Definition: callbacks.h:58
ResultType operator()() const
Definition: callbacks.h:114
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4)
Definition: callbacks.h:244
static ResultType invoke(AbstractFunctorCaller *call, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5, Arg6 a6)
Definition: callbacks.h:318
Callback5()
Definition: callbacks.h:295
BaseCallback(const BaseCallback &other)
Definition: callbacks.h:70
virtual ~BaseCallback()
Definition: callbacks.h:71
Callback7()
Definition: callbacks.h:369
Definition: callbacks.h:348
R ResultType
Definition: callbacks.h:330
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5)
Definition: callbacks.h:277
ResultType operator()(Arg1 a1) const
Definition: callbacks.h:151
R ResultType
Definition: callbacks.h:128
BaseFunctorCaller(const Functor &functor, AbstractFunctorCaller::HookType invokeMethodHook)
Definition: callbacks.h:55
ResultType operator()(Arg1 a1, Arg2 a2) const
Definition: callbacks.h:188
R(* InvokeType)(AbstractFunctorCaller *, Arg1)
Definition: callbacks.h:129
Definition: callbacks.h:89
Definition: callbacks.h:36
FunctorCaller4(const Functor &functor)
Definition: callbacks.h:242
Callback0()
Definition: callbacks.h:110
Callback7(const Functor &functor)
Definition: callbacks.h:371
AbstractFunctorCaller(HookType invokeMethodHook)
Definition: callbacks.h:40
Definition: abstract-adaptor.cpp:31
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2)
Definition: callbacks.h:166
BaseCallback()
Definition: callbacks.h:67
R(* InvokeType)(AbstractFunctorCaller *, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)
Definition: callbacks.h:314
Callback with 2 arguments.
Definition: callbacks.h:179
Definition: callbacks.h:126
ResultType operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) const
Definition: callbacks.h:299
Base class for all the callback classes.
Definition: callbacks.h:65
Callback4(const Functor &functor)
Definition: callbacks.h:260