QXmpp Version: 1.15.0
Loading...
Searching...
No Matches
QXmppPromise< T > Class Template Reference

Create and update QXmppTask objects to communicate results of asynchronous operations. More...

#include <QXmppTask.h>

Public Member Functions

 QXmppPromise (const QXmppPromise< T > &p)
 QXmppPromise (QXmppPromise< T > &&p)
 Move constructor.
QXmppPromise< T > & operator= (const QXmppPromise< T > &p)
QXmppPromise< T > & operator= (QXmppPromise< T > &&p)
 Move assignment operator.
QXmppTask< T > task ()
void finish ()
template<typename U>
requires (!std::is_void_v<T>)
void finish (U &&value)
bool cancelled () const

Friends

class QXmppTask< T >

Detailed Description

template<typename T>
class QXmppPromise< T >

Create and update QXmppTask objects to communicate results of asynchronous operations.

Unlike QFuture, this is not thread-safe. This avoids the need to do mutex locking at every access though.

Since
QXmpp 1.5

Constructor & Destructor Documentation

◆ QXmppPromise()

template<typename T>
QXmppPromise< T >::QXmppPromise ( const QXmppPromise< T > & p)
inline
Deprecated
Copying a promise creates shared ownership via heap allocation. Move the promise instead.

Member Function Documentation

◆ cancelled()

template<typename T>
bool QXmppPromise< T >::cancelled ( ) const
inline

Returns whether the task has been cancelled.

If a task is cancelled, no call to finish() is needed and no continuation is resumed.

Since
QXmpp 1.11

◆ finish() [1/2]

template<typename T>
void QXmppPromise< T >::finish ( )
inline

Finishes task.

Must be called only once.

◆ finish() [2/2]

template<typename T>
template<typename U>
requires (!std::is_void_v<T>)
void QXmppPromise< T >::finish ( U && value)
inline

Finishes task with result.

Must be called only once.

◆ operator=()

template<typename T>
QXmppPromise< T > & QXmppPromise< T >::operator= ( const QXmppPromise< T > & p)
inline
Deprecated
Copying a promise creates shared ownership via heap allocation. Move the promise instead.

◆ task()

template<typename T>
QXmppTask< T > QXmppPromise< T >::task ( )
inline

Obtain a handle to this promise that allows to obtain the value that will be produced asynchronously.


The documentation for this class was generated from the following file: