QXmppPromise Class
template <typename T> class QXmppPromiseCreate and update QXmppTask objects to communicate results of asynchronous operations. More...
| Header: | #include <QXmppTask.h> |
| Since: | QXmpp 1.5 |
- List of all members, including inherited members
- Deprecated members
- QXmppPromise is part of Core classes.
Public Functions
| QXmppPromise(QXmppPromise<T> &&p) | |
(since QXmpp 1.15) bool | cancelled() const |
| void | finish() |
| void | finish(U &&value) |
| QXmppTask<T> | task() |
| QXmppPromise<T> & | operator=(QXmppPromise<T> &&p) |
Detailed Description
Unlike QFuture, this is not thread-safe. This avoids the need to do mutex locking at every access though.
Member Function Documentation
QXmppPromise::QXmppPromise(QXmppPromise<T> &&p)
Move constructor.
[since QXmpp 1.15] bool QXmppPromise::cancelled() const
Returns whether the task has been cancelled.
If a task is cancelled, no call to finish() is needed and no continuation is resumed.
This function was introduced in QXmpp 1.15.
void QXmppPromise::finish() requires (std::is_void_v<T>)
Finishes task.
Must be called only once.
template <typename U> void QXmppPromise::finish(U &&value) requires (!std::is_void_v<T>)
Finishes task with result.
Must be called only once.
QXmppTask<T> QXmppPromise::task()
Obtain a handle to this promise that allows to obtain the value that will be produced asynchronously.
QXmppPromise<T> &QXmppPromise::operator=(QXmppPromise<T> &&p)
Move assignment operator, moving from p.