CopperSpice DBUS  1.7.4
QDBusPendingReply< Ts > Class Template Reference

Contains the reply from sending an asynchronous message to a remote object. More...

Inherits QDBusPendingReplyAbstract.

Public Methods

 QDBusPendingReply ()
 
 QDBusPendingReply (const QDBusMessage &message)
 
 QDBusPendingReply (const QDBusPendingCall &call)
 
 QDBusPendingReply (const QDBusPendingReply &other)
 
template<int Index>
const Select< Index >::Type argumentAt () const
 
QVariant argumentAt (int index) const
 
int count () const
 
QDBusPendingReply & operator= (const QDBusMessage &message)
 
QDBusPendingReply & operator= (const QDBusPendingCall &call)
 
QDBusPendingReply & operator= (const QDBusPendingReply &other)
 
Select< 0 >::Type value () const
 

Detailed Description

template<typename... Ts>
class QDBusPendingReply< Ts >

The QDBusPendingReply class contains the reply from sending an asynchronous message to a remote object. The QDBusPendingReply is a templated class and the template parameters must correspond to the data types the remote object will return in the reply message. It is the programmers responsibility to ensure the template types match the expected reply message.

This class is similar to QDBusReply with two important differences as listed below.

  • QDBusReply accepts exactly one return type however QDBusPendingReply can have multiple return types
  • QDBusReply only works on already completed replies, however QDBusPendingReply allows the code to wait for replies from pending calls
See also
QDBusPendingCallWatcher, QDBusReply, QDBusAbstractInterface::asyncCall()

Constructor & Destructor Documentation

template<typename... Ts>
QDBusPendingReply< Ts >::QDBusPendingReply ( )
inline

(broom)

Creates an empty QDBusPendingReply object. Without assigning a QDBusPendingCall object to this reply, QDBusPendingReply can not do anything. All methods in this call will return their failure values.

template<typename... Ts>
QDBusPendingReply< Ts >::QDBusPendingReply ( const QDBusPendingReply< Ts > &  other)
inline

(broom)

Copy constructs a new QDBusPendingReply from other. The new QDBusPendingReply object will share the same pending call reference. All copies share the same return values.

template<typename... Ts>
QDBusPendingReply< Ts >::QDBusPendingReply ( const QDBusPendingCall call)
inline

(broom)

Creates a QDBusPendingReply object that will take its contents from the call pending asynchronous call. This QDBusPendingReply object will share the same pending call reference as call.

template<typename... Ts>
QDBusPendingReply< Ts >::QDBusPendingReply ( const QDBusMessage message)
inline

(broom)

Creates a new QDBusPendingReply object which will

take its contents from the given message.

In this case, this object will be already in its finished state and the reply's contents will be accessible.

See also
isFinished()

Method Documentation

template<typename... Ts>
template<int Index>
const Select< Index >::Type QDBusPendingReply< Ts >::argumentAt ( ) const
inline

Returns the argument at position Index.

If the reply has not been received this method causes the calling thread to block until the reply is processed. If the reply does not contain an argument at position Index or if the reply was an error, this method returns a default constructed value. To reliably determine if the message contains an error call isError().

template<typename... Ts>
QVariant QDBusPendingReply< Ts >::argumentAt ( int  index) const
inline

Returns the argument at position index.

If the reply does not have enough elements, the return value is undefined. You should verify that isFinished() and isValid() are both true before calling this method.

If the reply does not contain an argument at position index or if the reply was an error, this method returns an invalid QVariant. Since D-Bus messages can never contain invalid QVariants, this return can be used to detect an error condition.

template<typename... Ts>
int QDBusPendingReply< Ts >::count ( ) const
inline

Returns the number of arguments the reply should contain.

This number matches the number of template parameters in this class. If the reply arrives with a different number of arguments (or with different types), it will be transformed into an error reply indicating a bad signature.

template<typename... Ts>
QDBusPendingReply & QDBusPendingReply< Ts >::operator= ( const QDBusMessage message)
inline

Assigns the data members from the given message to the current QDBusPendingReply object. The current QDBusPendingReply object and the specified QDBusMessage object refer to the same data.

After the assignment the QDBusPendingReply object will be in its "finished" state and the message contents will be accessible.

  • If the current pending call in QDBusPendingReply has not completed it may be cancelled
  • All information about the current pending call in QDBusPendingReply is dropped so if the call completes there will be no way to retrieve the reply
See also
isFinished()
template<typename... Ts>
QDBusPendingReply & QDBusPendingReply< Ts >::operator= ( const QDBusPendingCall call)
inline

Assigns the data members from the given call to the current QDBusPendingReply object. The current QDBusPendingReply object and the specified QDBusPendingCall object refer to the same data.

  • If the current pending call in QDBusPendingReply has not completed it may be cancelled
  • All information about the current pending call in QDBusPendingReply is dropped so if the call completes there will be no way to retrieve the reply
template<typename... Ts>
QDBusPendingReply & QDBusPendingReply< Ts >::operator= ( const QDBusPendingReply< Ts > &  other)
inline

Copy assigns from other and returns a reference to this object.

  • If the current pending call in QDBusPendingReply has not completed it may be cancelled
  • All information about the current pending call in QDBusPendingReply is dropped so if the call completes there will be no way to retrieve the reply
template<typename... Ts>
Select< 0 >::Type QDBusPendingReply< Ts >::value ( ) const
inline

Returns the first argument in this reply. This method is equivalent to calling argumentAt<0>().

If the reply has not arrived this method causes the calling thread to block until the reply is processed. If the reply is an error, a default constructed value is returned. To reliably determine if the message contains an error call isError().