From bdd7ff7bf44ee6d0a5d8567c2aec97418c72a899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Sun, 8 Feb 2015 13:18:38 +0100 Subject: Async: move public API implementation --- async/src/async.h | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'async') diff --git a/async/src/async.h b/async/src/async.h index 95b28d7..9a2f721 100644 --- a/async/src/async.h +++ b/async/src/async.h @@ -183,12 +183,7 @@ Job start(ThenTask func); * */ template -Job null() -{ - return Async::start([](Async::Future &future) { - future.setFinished(); - }); -} +Job null(); /** * An error job. @@ -197,10 +192,7 @@ Job null() * */ template -Job error(int errorCode = 1, const QString &errorMessage = QString()) -{ - return Async::start([errorCode, errorMessage](Async::Future &future) {future.setError(errorCode, errorMessage);}); -} +Job error(int errorCode = 1, const QString &errorMessage = QString()); class JobBase { @@ -370,6 +362,25 @@ Job start(SyncThenTask func) return Job(Private::ExecutorBasePtr(new Private::SyncThenExecutor(func, ErrorHandler(), Private::ExecutorBasePtr()))); } +template +Job null() +{ + return Async::start( + [](Async::Future &future) { + future.setFinished(); + }); +} + +template +Job error(int errorCode, const QString &errorMessage) +{ + return Async::start( + [errorCode, errorMessage](Async::Future &future) { + future.setError(errorCode, errorMessage); + }); +} + + namespace Private { template -- cgit v1.2.3