Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 ()
 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
 

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 22 of file qdbuspendingcall.h.

Constructor & Destructor Documentation

◆ QDBusPendingCall() [1/2]

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 233 of file qdbuspendingcall.cpp.

References QDBusPendingCall().

Referenced by QDBusPendingCall(), and QDBusPendingCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~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 256 of file qdbuspendingcall.cpp.

◆ QDBusPendingCall() [2/2]

QDBusPendingCall::QDBusPendingCall ( QDBusPendingCallPrivate * dd)
protected

Definition at line 241 of file qdbuspendingcall.cpp.

References QDBusPendingCall(), QBasicAtomicInteger< T >::deref(), Q_ASSERT, and QSharedData::ref.

+ Here is the call graph for this function:

Member Function Documentation

◆ error()

QDBusError QDBusPendingCall::error ( ) const

Definition at line 370 of file qdbuspendingcall.cpp.

References d, QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage(), QDBusPendingCallPrivate::mutex, and QDBusPendingCallPrivate::replyMessage.

Referenced by fromError(), and reply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 455 of file qdbuspendingcall.cpp.

References d, QDBusMessage::ErrorMessage, QDBusPendingCallPrivate, QSharedData::ref, QDBusMessage::ReplyMessage, QDBusPendingCallPrivate::replyMessage, QBasicAtomicInteger< T >::storeRelaxed(), and QDBusMessage::type().

Referenced by fromError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 438 of file qdbuspendingcall.cpp.

References QDBusMessage::createError(), error(), and fromCompletedCall().

Referenced by QDBusAbstractInterface::asyncCallWithArgumentList(), and QIBusProxy::GetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isError()

bool QDBusPendingCall::isError ( ) const

Definition at line 354 of file qdbuspendingcall.cpp.

References d, QDBusMessage::ErrorMessage, QDBusPendingCallPrivate::mutex, QDBusPendingCallPrivate::replyMessage, and QDBusMessage::type().

+ Here is the call graph for this function:

◆ isFinished()

bool QDBusPendingCall::isFinished ( ) const

Definition at line 314 of file qdbuspendingcall.cpp.

References d, QDBusMessage::InvalidMessage, QDBusPendingCallPrivate::mutex, QDBusPendingCallPrivate::replyMessage, and QDBusMessage::type().

+ Here is the call graph for this function:

◆ isValid()

bool QDBusPendingCall::isValid ( ) const

Definition at line 337 of file qdbuspendingcall.cpp.

References d, QDBusPendingCallPrivate::mutex, QDBusMessage::ReplyMessage, QDBusPendingCallPrivate::replyMessage, and QDBusMessage::type().

+ Here is the call graph for this function:

◆ 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.

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 272 of file qdbuspendingcall.cpp.

References d, and other().

+ Here is the call graph for this function:

◆ operator=() [2/2]

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

Definition at line 27 of file qdbuspendingcall.h.

References other(), and swap().

Referenced by QDBusPendingReplyBase::assign().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reply()

QDBusMessage QDBusPendingCall::reply ( ) const

Definition at line 394 of file qdbuspendingcall.cpp.

References QDBusMessage::createError(), d, error(), QDBusPendingCallPrivate::mutex, and QDBusPendingCallPrivate::replyMessage.

+ Here is the call graph for this function:

◆ swap()

void QDBusPendingCall::swap ( QDBusPendingCall & other)
inlinenoexcept
Since
5.0

Swaps this pending call instance with other. This function is very fast and never fails.

Definition at line 30 of file qdbuspendingcall.h.

References d, and other().

+ Here is the call graph for this function:

◆ waitForFinished()

void QDBusPendingCall::waitForFinished ( )

Definition at line 323 of file qdbuspendingcall.cpp.

References d, and QDBusPendingCallPrivate::waitForFinished().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QDBusConnection

friend class QDBusConnection
friend

Definition at line 50 of file qdbuspendingcall.h.

◆ QDBusPendingCallPrivate

friend class QDBusPendingCallPrivate
friend

Definition at line 48 of file qdbuspendingcall.h.

Referenced by QDBusPendingReplyBase::assign(), and fromCompletedCall().

◆ QDBusPendingCallWatcher

friend class QDBusPendingCallWatcher
friend

Definition at line 49 of file qdbuspendingcall.h.

Member Data Documentation

◆ d


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