forked from qt-creator/qt-creator
Add extensions for qt concurrent
Now it is possible to use a object and a function signature. Change-Id: I508492f131fa101e1715a65a7f8e3ecdcaa45c38 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -97,7 +97,7 @@ template <typename T, typename FunctionPointer, typename Arg1>
|
|||||||
class StoredInterfaceFunctionCall1 : public QRunnable
|
class StoredInterfaceFunctionCall1 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceFunctionCall1(void (fn)(QFutureInterface<T> &, Arg1), Arg1 arg1)
|
StoredInterfaceFunctionCall1(void (fn)(QFutureInterface<T> &, Arg1), const Arg1 &arg1)
|
||||||
: fn(fn), arg1(arg1) { }
|
: fn(fn), arg1(arg1) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -122,7 +122,7 @@ template <typename T, typename FunctionPointer, typename Class, typename Arg1>
|
|||||||
class StoredInterfaceMemberFunctionCall1 : public QRunnable
|
class StoredInterfaceMemberFunctionCall1 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceMemberFunctionCall1(void (Class::*fn)(QFutureInterface<T> &, Arg1), Class *object, Arg1 arg1)
|
StoredInterfaceMemberFunctionCall1(void (Class::*fn)(QFutureInterface<T> &, Arg1), Class *object, const Arg1 &arg1)
|
||||||
: fn(fn), object(object), arg1(arg1) { }
|
: fn(fn), object(object), arg1(arg1) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -149,7 +149,7 @@ template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
|
|||||||
class StoredInterfaceFunctionCall2 : public QRunnable
|
class StoredInterfaceFunctionCall2 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceFunctionCall2(void (fn)(QFutureInterface<T> &, Arg1, Arg2), Arg1 arg1, Arg2 arg2)
|
StoredInterfaceFunctionCall2(void (fn)(QFutureInterface<T> &, Arg1, Arg2), const Arg1 &arg1, const Arg2 &arg2)
|
||||||
: fn(fn), arg1(arg1), arg2(arg2) { }
|
: fn(fn), arg1(arg1), arg2(arg2) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -174,7 +174,7 @@ template <typename T, typename FunctionPointer, typename Class, typename Arg1,
|
|||||||
class StoredInterfaceMemberFunctionCall2 : public QRunnable
|
class StoredInterfaceMemberFunctionCall2 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceMemberFunctionCall2(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2), Class *object, Arg1 arg1, Arg2 arg2)
|
StoredInterfaceMemberFunctionCall2(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2), Class *object, const Arg1 &arg1, const Arg2 &arg2)
|
||||||
: fn(fn), object(object), arg1(arg1), arg2(arg2) { }
|
: fn(fn), object(object), arg1(arg1), arg2(arg2) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -201,7 +201,7 @@ template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, t
|
|||||||
class StoredInterfaceFunctionCall3 : public QRunnable
|
class StoredInterfaceFunctionCall3 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceFunctionCall3(void (fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3)
|
StoredInterfaceFunctionCall3(void (fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||||
: fn(fn), arg1(arg1), arg2(arg2), arg3(arg3) { }
|
: fn(fn), arg1(arg1), arg2(arg2), arg3(arg3) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -226,7 +226,7 @@ template <typename T, typename FunctionPointer, typename Class, typename Arg1,
|
|||||||
class StoredInterfaceMemberFunctionCall3 : public QRunnable
|
class StoredInterfaceMemberFunctionCall3 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceMemberFunctionCall3(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3)
|
StoredInterfaceMemberFunctionCall3(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||||
: fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3) { }
|
: fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -253,7 +253,7 @@ template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, t
|
|||||||
class StoredInterfaceFunctionCall4 : public QRunnable
|
class StoredInterfaceFunctionCall4 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceFunctionCall4(void (fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
|
StoredInterfaceFunctionCall4(void (fn)(QFutureInterface<T> &, 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) { }
|
: fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -278,7 +278,7 @@ template <typename T, typename FunctionPointer, typename Class, typename Arg1,
|
|||||||
class StoredInterfaceMemberFunctionCall4 : public QRunnable
|
class StoredInterfaceMemberFunctionCall4 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceMemberFunctionCall4(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
|
StoredInterfaceMemberFunctionCall4(void (Class::*fn)(QFutureInterface<T> &, 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) { }
|
: fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -305,7 +305,7 @@ template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, t
|
|||||||
class StoredInterfaceFunctionCall5 : public QRunnable
|
class StoredInterfaceFunctionCall5 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceFunctionCall5(void (fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
|
StoredInterfaceFunctionCall5(void (fn)(QFutureInterface<T> &, 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) { }
|
: fn(fn), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -330,7 +330,7 @@ template <typename T, typename FunctionPointer, typename Class, typename Arg1,
|
|||||||
class StoredInterfaceMemberFunctionCall5 : public QRunnable
|
class StoredInterfaceMemberFunctionCall5 : public QRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StoredInterfaceMemberFunctionCall5(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Class *object, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
|
StoredInterfaceMemberFunctionCall5(void (Class::*fn)(QFutureInterface<T> &, 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) { }
|
: fn(fn), object(object), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { }
|
||||||
|
|
||||||
QFuture<T> start()
|
QFuture<T> start()
|
||||||
@@ -359,27 +359,27 @@ QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &))
|
|||||||
return (new StoredInterfaceFunctionCall0<T, void (*)(QFutureInterface<T> &)>(functionPointer))->start();
|
return (new StoredInterfaceFunctionCall0<T, void (*)(QFutureInterface<T> &)>(functionPointer))->start();
|
||||||
}
|
}
|
||||||
template <typename T, typename Arg1>
|
template <typename T, typename Arg1>
|
||||||
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1), Arg1 arg1)
|
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1), const Arg1 &arg1)
|
||||||
{
|
{
|
||||||
return (new StoredInterfaceFunctionCall1<T, void (*)(QFutureInterface<T> &, Arg1), Arg1>(functionPointer, arg1))->start();
|
return (new StoredInterfaceFunctionCall1<T, void (*)(QFutureInterface<T> &, Arg1), Arg1>(functionPointer, arg1))->start();
|
||||||
}
|
}
|
||||||
template <typename T, typename Arg1, typename Arg2>
|
template <typename T, typename Arg1, typename Arg2>
|
||||||
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2), Arg1 arg1, Arg2 arg2)
|
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2), const Arg1 &arg1, const Arg2 &arg2)
|
||||||
{
|
{
|
||||||
return (new StoredInterfaceFunctionCall2<T, void (*)(QFutureInterface<T> &, Arg1, Arg2), Arg1, Arg2>(functionPointer, arg1, arg2))->start();
|
return (new StoredInterfaceFunctionCall2<T, void (*)(QFutureInterface<T> &, Arg1, Arg2), Arg1, Arg2>(functionPointer, arg1, arg2))->start();
|
||||||
}
|
}
|
||||||
template <typename T, typename Arg1, typename Arg2, typename Arg3>
|
template <typename T, typename Arg1, typename Arg2, typename Arg3>
|
||||||
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Arg1 arg1, Arg2 arg2, Arg3 arg3)
|
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||||
{
|
{
|
||||||
return (new StoredInterfaceFunctionCall3<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start();
|
return (new StoredInterfaceFunctionCall3<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start();
|
||||||
}
|
}
|
||||||
template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
||||||
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
|
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
|
||||||
{
|
{
|
||||||
return (new StoredInterfaceFunctionCall4<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start();
|
return (new StoredInterfaceFunctionCall4<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start();
|
||||||
}
|
}
|
||||||
template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
||||||
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
|
QFuture<T> run(void (*functionPointer)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
|
||||||
{
|
{
|
||||||
return (new StoredInterfaceFunctionCall5<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
|
return (new StoredInterfaceFunctionCall5<T, void (*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
|
||||||
}
|
}
|
||||||
@@ -390,6 +390,35 @@ QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &), Class *object)
|
|||||||
return (new StoredInterfaceMemberFunctionCall0<T, void (Class::*)(QFutureInterface<T> &), Class>(fn, object))->start();
|
return (new StoredInterfaceMemberFunctionCall0<T, void (Class::*)(QFutureInterface<T> &), Class>(fn, object))->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Class, typename T, typename Arg1>
|
||||||
|
QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &, Arg1), Class *object, Arg1 arg1)
|
||||||
|
{
|
||||||
|
return (new StoredInterfaceMemberFunctionCall1<T, void (Class::*)(QFutureInterface<T> &, Arg1), Class, Arg1>(fn, object, arg1))->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Class, typename T, typename Arg1, typename Arg2>
|
||||||
|
QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2), Class *object, const Arg1 &arg1, const Arg2 &arg2)
|
||||||
|
{
|
||||||
|
return (new StoredInterfaceMemberFunctionCall2<T, void (Class::*)(QFutureInterface<T> &, Arg1, Arg2), Class, Arg1, Arg2>(fn, object, arg1, arg2))->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Class, typename T, typename Arg1, typename Arg2, typename Arg3>
|
||||||
|
QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||||
|
{
|
||||||
|
return (new StoredInterfaceMemberFunctionCall3<T, void (Class::*)(QFutureInterface<T> &, Arg1, Arg2, Arg3), Class, Arg1, Arg2, Arg3>(fn, object, arg1, arg2, arg3))->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Class, typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
||||||
|
QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Class *object, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
|
||||||
|
{
|
||||||
|
return (new StoredInterfaceMemberFunctionCall4<T, void (Class::*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4), Class, Arg1, Arg2, Arg3, Arg4>(fn, object, arg1, arg2, arg3, arg4))->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Class, typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
||||||
|
QFuture<T> run(void (Class::*fn)(QFutureInterface<T> &, 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<T, void (Class::*)(QFutureInterface<T> &, Arg1, Arg2, Arg3, Arg4, Arg5), Class, Arg1, Arg2, Arg3, Arg4, Arg5>(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
|
||||||
|
}
|
||||||
} // namespace QtConcurrent
|
} // namespace QtConcurrent
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
Reference in New Issue
Block a user