diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h index 2c8492133cd..c360dc07288 100644 --- a/src/libs/utils/runextensions.h +++ b/src/libs/utils/runextensions.h @@ -97,7 +97,7 @@ template class StoredInterfaceFunctionCall1 : public QRunnable { public: - StoredInterfaceFunctionCall1(void (fn)(QFutureInterface &, Arg1), Arg1 arg1) + StoredInterfaceFunctionCall1(void (fn)(QFutureInterface &, Arg1), const Arg1 &arg1) : fn(fn), arg1(arg1) { } QFuture start() @@ -122,7 +122,7 @@ template class StoredInterfaceMemberFunctionCall1 : public QRunnable { public: - StoredInterfaceMemberFunctionCall1(void (Class::*fn)(QFutureInterface &, Arg1), Class *object, Arg1 arg1) + StoredInterfaceMemberFunctionCall1(void (Class::*fn)(QFutureInterface &, Arg1), Class *object, const Arg1 &arg1) : fn(fn), object(object), arg1(arg1) { } QFuture start() @@ -149,7 +149,7 @@ template class StoredInterfaceFunctionCall2 : public QRunnable { public: - StoredInterfaceFunctionCall2(void (fn)(QFutureInterface &, Arg1, Arg2), Arg1 arg1, Arg2 arg2) + StoredInterfaceFunctionCall2(void (fn)(QFutureInterface &, Arg1, Arg2), const Arg1 &arg1, const Arg2 &arg2) : fn(fn), arg1(arg1), arg2(arg2) { } QFuture start() @@ -174,7 +174,7 @@ template &, Arg1, Arg2), Class *object, Arg1 arg1, Arg2 arg2) + StoredInterfaceMemberFunctionCall2(void (Class::*fn)(QFutureInterface &, Arg1, Arg2), Class *object, const Arg1 &arg1, const Arg2 &arg2) : fn(fn), object(object), arg1(arg1), arg2(arg2) { } QFuture start() @@ -201,7 +201,7 @@ template &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) + StoredInterfaceFunctionCall3(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3) { } QFuture start() @@ -226,7 +226,7 @@ template &, Arg1, Arg2, Arg3), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3) + StoredInterfaceMemberFunctionCall3(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3) { } QFuture start() @@ -253,7 +253,7 @@ template &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) + StoredInterfaceFunctionCall4(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { } QFuture start() @@ -278,7 +278,7 @@ template &, Arg1, Arg2, Arg3, Arg4), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) + StoredInterfaceMemberFunctionCall4(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { } QFuture start() @@ -305,7 +305,7 @@ template &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) + StoredInterfaceFunctionCall5(void (fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) : fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { } QFuture start() @@ -330,7 +330,7 @@ template &, Arg1, Arg2, Arg3, Arg4, Arg5), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) + StoredInterfaceMemberFunctionCall5(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) : fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { } QFuture start() @@ -359,27 +359,27 @@ QFuture run(void (*functionPointer)(QFutureInterface &)) return (new StoredInterfaceFunctionCall0 &)>(functionPointer))->start(); } template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1), Arg1 arg1) +QFuture run(void (*functionPointer)(QFutureInterface &, Arg1), const Arg1 &arg1) { return (new StoredInterfaceFunctionCall1 &, Arg1), Arg1>(functionPointer, arg1))->start(); } template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2), Arg1 arg1, Arg2 arg2) +QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2), const Arg1 &arg1, const Arg2 &arg2) { return (new StoredInterfaceFunctionCall2 &, Arg1, Arg2), Arg1, Arg2>(functionPointer, arg1, arg2))->start(); } template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3) +QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) { return (new StoredInterfaceFunctionCall3 &, Arg1, Arg2, Arg3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start(); } template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) +QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) { return (new StoredInterfaceFunctionCall4 &, Arg1, Arg2, Arg3, Arg4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start(); } template -QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) +QFuture run(void (*functionPointer)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) { return (new StoredInterfaceFunctionCall5 &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); } @@ -390,6 +390,35 @@ QFuture run(void (Class::*fn)(QFutureInterface &), Class *object) return (new StoredInterfaceMemberFunctionCall0 &), Class>(fn, object))->start(); } +template +QFuture run(void (Class::*fn)(QFutureInterface &, Arg1), Class *object, Arg1 arg1) +{ + return (new StoredInterfaceMemberFunctionCall1 &, Arg1), Class, Arg1>(fn, object, arg1))->start(); +} + +template +QFuture run(void (Class::*fn)(QFutureInterface &, Arg1, Arg2), Class *object, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new StoredInterfaceMemberFunctionCall2 &, Arg1, Arg2), Class, Arg1, Arg2>(fn, object, arg1, arg2))->start(); +} + +template +QFuture run(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new StoredInterfaceMemberFunctionCall3 &, Arg1, Arg2, Arg3), Class, Arg1, Arg2, Arg3>(fn, object, arg1, arg2, arg3))->start(); +} + +template +QFuture run(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new StoredInterfaceMemberFunctionCall4 &, Arg1, Arg2, Arg3, Arg4), Class, Arg1, Arg2, Arg3, Arg4>(fn, object, arg1, arg2, arg3, arg4))->start(); +} + +template +QFuture run(void (Class::*fn)(QFutureInterface &, Arg1, Arg2, Arg3, Arg4, Arg5), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new StoredInterfaceMemberFunctionCall5 &, Arg1, Arg2, Arg3, Arg4, Arg5), Class, Arg1, Arg2, Arg3, Arg4, Arg5>(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} } // namespace QtConcurrent QT_END_NAMESPACE