Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QDBusPendingCall Class Reference

\inmodule QtDBus More...

#include <qdbuspendingcall.h>

Inheritance diagram for QDBusPendingCall:
Collaboration diagram for QDBusPendingCall:

Public Member Functions

 QDBusPendingCall (const QDBusPendingCall &other)
 Creates a copy of the other pending asynchronous call.
 QDBusPendingCall (QDBusPendingCall &&other) noexcept=default
 ~QDBusPendingCall ()
 Destroys this copy of the QDBusPendingCall object.
QDBusPendingCalloperator= (QDBusPendingCall &&other) noexcept
QDBusPendingCalloperator= (const QDBusPendingCall &other)
 Creates a copy of the other pending asynchronous call and drops the reference to the previously-referenced call.
void swap (QDBusPendingCall &other) noexcept
bool isFinished () const
void waitForFinished ()
bool isError () const
bool isValid () const
QDBusError error () const
QDBusMessage reply () const

Static Public Member Functions

static QDBusPendingCall fromError (const QDBusError &error)
static QDBusPendingCall fromCompletedCall (const QDBusMessage &message)

Protected Member Functions

 QDBusPendingCall (QDBusPendingCallPrivate *dd)

Protected Attributes

QExplicitlySharedDataPointer< QDBusPendingCallPrivated

Friends

class QDBusPendingCallPrivate
class QDBusPendingCallWatcher
class QDBusConnection
class ::tst_QDBusPendingReply

Detailed Description

\inmodule QtDBus

Since
4.5

The QDBusPendingCall class refers to one pending asynchronous call.

A QDBusPendingCall object is a reference to a method call that was sent over D-Bus without waiting for a reply. QDBusPendingCall is an opaque type, meant to be used as a handle for a pending reply.

In most programs, the QDBusPendingCall class will not be used directly. It can be safely replaced with the template-based QDBusPendingReply, in order to access the contents of the reply or wait for it to be complete.

The QDBusPendingCallWatcher class allows one to connect to a signal that will indicate when the reply has arrived or if the call has timed out. It also provides the QDBusPendingCallWatcher::waitForFinished() method which will suspend the execution of the program until the reply has arrived.

Note
If you create a copy of a QDBusPendingCall object, all information will be shared among the many copies. Therefore, QDBusPendingCall is an explicitly-shared object and does not provide a method of detaching the copies (since they refer to the same pending call)
See also
QDBusPendingReply, QDBusPendingCallWatcher

Definition at line 28 of file qdbuspendingcall.h.

Constructor & Destructor Documentation

◆ QDBusPendingCall() [1/3]

QDBusPendingCall::QDBusPendingCall ( const QDBusPendingCall & other)

Creates a copy of the other pending asynchronous call.

Note that both objects will refer to the same pending call.

Definition at line 243 of file qdbuspendingcall.cpp.

◆ QDBusPendingCall() [2/3]

QDBusPendingCall::QDBusPendingCall ( QDBusPendingCall && other)
defaultnoexcept
Since
6.10

Moves other into this object.

partially-formed

◆ ~QDBusPendingCall()

QDBusPendingCall::~QDBusPendingCall ( )

Destroys this copy of the QDBusPendingCall object.

If this copy is also the last copy of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.

Definition at line 266 of file qdbuspendingcall.cpp.

◆ QDBusPendingCall() [3/3]

QDBusPendingCall::QDBusPendingCall ( QDBusPendingCallPrivate * dd)
protected

Definition at line 251 of file qdbuspendingcall.cpp.

Member Function Documentation

◆ error()

QDBusError QDBusPendingCall::error ( ) const

Definition at line 391 of file qdbuspendingcall.cpp.

◆ fromCompletedCall()

QDBusPendingCall QDBusPendingCall::fromCompletedCall ( const QDBusMessage & msg)
static
Since
4.6 Creates a QDBusPendingCall object based on the message msg. The message must be of type QDBusMessage::ErrorMessage or QDBusMessage::ReplyMessage (that is, a message that is typical of a completed call).

This function is useful for code that requires simulating a pending call, but that has already finished.

See also
fromError()

Definition at line 476 of file qdbuspendingcall.cpp.

◆ fromError()

QDBusPendingCall QDBusPendingCall::fromError ( const QDBusError & error)
static
Since
4.6 Creates a QDBusPendingCall object based on the error condition error. The resulting pending call object will be in the "finished" state and QDBusPendingReply<Types...>::isError() will return true.
See also
fromCompletedCall()

Definition at line 459 of file qdbuspendingcall.cpp.

◆ isError()

bool QDBusPendingCall::isError ( ) const

Definition at line 375 of file qdbuspendingcall.cpp.

◆ isFinished()

bool QDBusPendingCall::isFinished ( ) const

Definition at line 335 of file qdbuspendingcall.cpp.

◆ isValid()

bool QDBusPendingCall::isValid ( ) const

Definition at line 358 of file qdbuspendingcall.cpp.

◆ operator=() [1/2]

QDBusPendingCall & QDBusPendingCall::operator= ( const QDBusPendingCall & other)

Creates a copy of the other pending asynchronous call and drops the reference to the previously-referenced call.

\fn QDBusPendingCall &QDBusPendingCall::operator=(QDBusPendingCall &&other)

Move-assigns \a other into this QDBusPendingCall.

! [partially-formed]

Note
The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value. ! [partially-formed]

Note that both objects will refer to the same pending call after this function.

If this object contained the last reference of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.

Definition at line 295 of file qdbuspendingcall.cpp.

◆ operator=() [2/2]

QDBusPendingCall & QDBusPendingCall::operator= ( QDBusPendingCall && other)
inlinenoexcept

Definition at line 34 of file qdbuspendingcall.h.

◆ reply()

QDBusMessage QDBusPendingCall::reply ( ) const

Definition at line 415 of file qdbuspendingcall.cpp.

◆ swap()

void QDBusPendingCall::swap ( QDBusPendingCall & other)
inlinenoexcept
Since
5.0 \memberswap{pending call instance}

Definition at line 37 of file qdbuspendingcall.h.

◆ waitForFinished()

void QDBusPendingCall::waitForFinished ( )

Definition at line 344 of file qdbuspendingcall.cpp.

◆ ::tst_QDBusPendingReply

friend class ::tst_QDBusPendingReply
friend

Definition at line 64 of file qdbuspendingcall.h.

◆ QDBusConnection

friend class QDBusConnection
friend

Definition at line 57 of file qdbuspendingcall.h.

◆ QDBusPendingCallPrivate

friend class QDBusPendingCallPrivate
friend

Definition at line 55 of file qdbuspendingcall.h.

◆ QDBusPendingCallWatcher

friend class QDBusPendingCallWatcher
friend

Definition at line 56 of file qdbuspendingcall.h.

Member Data Documentation

◆ d

QExplicitlySharedDataPointer<QDBusPendingCallPrivate> QDBusPendingCall::d
protected

Definition at line 54 of file qdbuspendingcall.h.


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