23 #ifndef QTPDCOM_FUTUREWATCHERS_DETAILS_H 24 #define QTPDCOM_FUTUREWATCHERS_DETAILS_H 26 #include <QFutureWatcher> 28 #include <type_traits> 32 template <
class T>
using void_t = void;
36 template <
class Func>
static bool value(...)
38 throw "argument mismatch. Make sure that your callback takes " 39 "(optionally) a reference to Object as first argument " 40 "and the result of the Future (if it is non-void) as value or " 41 "const reference as the other argument";
47 decltype(std::declval<Func>()(std::declval<Arg>()...))>>
48 static constexpr
bool value(
char)
56 std::declval<Obj &>(),
57 std::declval<Arg>()...))>>
58 static constexpr
bool value(
int)
64 template <
class Func,
class Obj,
class... Args>
73 template <
class Result,
class Obj,
class Func>
static void 74 call(Func &&func, Obj &obj, QFutureWatcher<Result>
const *watcher)
76 func(obj, watcher->result());
82 template <
class Result,
class Obj,
class Func>
static void 83 call(Func &&func, Obj &, QFutureWatcher<Result>
const *watcher)
85 func(watcher->result());
90 template <
class Result,
class Obj,
class Func>
91 static void call(Func &&func, Obj &obj, QFutureWatcher<Result>
const *)
99 template <
class Result,
class Obj,
class Func>
100 static void call(Func &&func, Obj &, QFutureWatcher<Result>
const *)
106 template <
class Result,
class Obj>
struct invoke 108 template <
class Func>
static void 109 call(Func &&func, Obj &obj, QFutureWatcher<Result>
const *watcher)
112 call(std::forward<Func>(func), obj, watcher);
115 template <
class FnArg>
static void 116 call(
void (Obj::*member)(FnArg),
118 QFutureWatcher<Result>
const *watcher)
120 (obj.*member)(watcher->result());
124 template <
class Obj>
struct invoke<void, Obj>
126 template <
class Func>
static void 127 call(Func &&func, Obj &obj, QFutureWatcher<void>
const *watcher)
130 std::forward<Func>(func),
138 QFutureWatcher<void>
const * )
146 #endif // QTPDCOM_FUTUREWATCHERS_DETAILS_H Definition: FutureWatchersDetails.h:106
static void call(Func &&func, Obj &obj, QFutureWatcher< void > const *watcher)
Definition: FutureWatchersDetails.h:127
static void call(Func &&func, Obj &obj, QFutureWatcher< Result > const *watcher)
Definition: FutureWatchersDetails.h:109
Definition: FutureWatchersDetails.h:71
Definition: BroadcastModel.h:32
static void call(Func &&func, Obj &, QFutureWatcher< Result > const *)
Definition: FutureWatchersDetails.h:100
void void_t
Definition: FutureWatchersDetails.h:32
static void call(Func &&func, Obj &obj, QFutureWatcher< Result > const *watcher)
Definition: FutureWatchersDetails.h:74
static bool value(...)
Definition: FutureWatchersDetails.h:36
static void call(Func &&func, Obj &, QFutureWatcher< Result > const *watcher)
Definition: FutureWatchersDetails.h:83
static void call(Func &&func, Obj &obj, QFutureWatcher< Result > const *)
Definition: FutureWatchersDetails.h:91
static constexpr bool value(char)
Definition: FutureWatchersDetails.h:48
static constexpr bool value(int)
Definition: FutureWatchersDetails.h:58
Definition: FutureWatchersDetails.h:34
static void call(void(Obj::*member)(), Obj &obj, QFutureWatcher< void > const *)
Definition: FutureWatchersDetails.h:136
constexpr bool takes_obj_as_first_parameter()
Definition: FutureWatchersDetails.h:65
static void call(void(Obj::*member)(FnArg), Obj &obj, QFutureWatcher< Result > const *watcher)
Definition: FutureWatchersDetails.h:116