diff --git a/src/libs/extensionsystem/invoker.h b/src/libs/extensionsystem/invoker.h index ada8aa7cf51..c9a0e7bad53 100644 --- a/src/libs/extensionsystem/invoker.h +++ b/src/libs/extensionsystem/invoker.h @@ -55,36 +55,11 @@ template class Invoker : public InvokerBase { public: - Invoker(QObject *target, const char *slot) - { - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0) + template + Invoker(QObject *target, const char *slot, const Args &...args) { setReturnValue(result); - addArgument(t0); - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0, const T1 &t1) - { - setReturnValue(result); - addArgument(t0); - addArgument(t1); - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0, - const T1 &t1, const T2 &t2) - { - setReturnValue(result); - addArgument(t0); - addArgument(t1); - addArgument(t2); + (addArgument(args), ...); InvokerBase::invoke(target, slot); } @@ -97,33 +72,10 @@ private: template<> class Invoker : public InvokerBase { public: - Invoker(QObject *target, const char *slot) + template + Invoker(QObject *target, const char *slot, const Args &...args) { - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0) - { - addArgument(t0); - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0, const T1 &t1) - { - addArgument(t0); - addArgument(t1); - InvokerBase::invoke(target, slot); - } - - template - Invoker(QObject *target, const char *slot, const T0 &t0, - const T1 &t1, const T2 &t2) - { - addArgument(t0); - addArgument(t1); - addArgument(t2); + (addArgument(args), ...); InvokerBase::invoke(target, slot); } }; @@ -145,38 +97,11 @@ inline void invokeHelper(InvokerBase &in, QObject *target, const char *slo } #endif -template -Result invoke(QObject *target, const char *slot) +template +Result invoke(QObject *target, const char *slot, const Args &...args) { InvokerBase in; - return invokeHelper(in, target, slot); -} - -template -Result invoke(QObject *target, const char *slot, const T0 &t0) -{ - InvokerBase in; - in.addArgument(t0); - return invokeHelper(in, target, slot); -} - -template -Result invoke(QObject *target, const char *slot, const T0 &t0, const T1 &t1) -{ - InvokerBase in; - in.addArgument(t0); - in.addArgument(t1); - return invokeHelper(in, target, slot); -} - -template -Result invoke(QObject *target, const char *slot, - const T0 &t0, const T1 &t1, const T2 &t2) -{ - InvokerBase in; - in.addArgument(t0); - in.addArgument(t1); - in.addArgument(t2); + (in.addArgument(args), ...); return invokeHelper(in, target, slot); }