diff options
Diffstat (limited to 'async/src/future.h')
-rw-r--r-- | async/src/future.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/async/src/future.h b/async/src/future.h index 54580ad..098f6e8 100644 --- a/async/src/future.h +++ b/async/src/future.h | |||
@@ -36,6 +36,7 @@ public: | |||
36 | 36 | ||
37 | virtual void setFinished() = 0; | 37 | virtual void setFinished() = 0; |
38 | virtual bool isFinished() const = 0; | 38 | virtual bool isFinished() const = 0; |
39 | virtual void setError(int code = 1, const QString &message = QString()) = 0; | ||
39 | 40 | ||
40 | protected: | 41 | protected: |
41 | FutureBase(); | 42 | FutureBase(); |
@@ -69,6 +70,23 @@ public: | |||
69 | return d->finished; | 70 | return d->finished; |
70 | } | 71 | } |
71 | 72 | ||
73 | void setError(int errorCode, const QString &message) | ||
74 | { | ||
75 | d->errorCode = errorCode; | ||
76 | d->errorMessage = message; | ||
77 | setFinished(); | ||
78 | } | ||
79 | |||
80 | int errorCode() const | ||
81 | { | ||
82 | return d->errorCode; | ||
83 | } | ||
84 | |||
85 | QString errorMessage() const | ||
86 | { | ||
87 | return d->errorMessage; | ||
88 | } | ||
89 | |||
72 | void waitForFinished() | 90 | void waitForFinished() |
73 | { | 91 | { |
74 | if (isFinished()) { | 92 | if (isFinished()) { |