QDBusReply Class

The QDBusReply class stores the reply for a method call to a remote object. More...

Header: #include <QDBusReply>
qmake: QT += dbus
Since: Qt 4.2

Public Functions

QDBusReply(const QDBusMessage &reply)
QDBusReply(const QDBusReply &) = default
QDBusReply(const QDBusPendingCall &pcall)
QDBusReply(const QDBusPendingReply<T> &reply)
QDBusReply(const QDBusError &dbusError = QDBusError())
const QDBusError &error()
const QDBusError &error() const
bool isValid() const
Type value() const
operator Type() const
QDBusReply &operator=(const QDBusMessage &reply)
QDBusReply &operator=(const QDBusPendingCall &pcall)
QDBusReply &operator=(const QDBusError &dbusError)
QDBusReply &operator=(const QDBusReply &other)

Detailed Description

The QDBusReply class stores the reply for a method call to a remote object.

A QDBusReply object is a subset of the QDBusMessage object that represents a method call's reply. It contains only the first output argument or the error code and is used by QDBusInterface-derived classes to allow returning the error code as the function's return argument.

It can be used in the following manner:

 QDBusReply<QString> reply = interface->call("RemoteMethod");
 if (reply.isValid())
     // use the returned value
     useValue(reply.value());
 else
     // call failed. Show an error condition.
     showError(reply.error());

If the remote method call cannot fail, you can skip the error checking:

 QString reply = interface->call("RemoteMethod");

However, if it does fail under those conditions, the value returned by QDBusReply<T>::value() is a default-constructed value. It may be indistinguishable from a valid return value.

QDBusReply objects are used for remote calls that have no output arguments or return values (i.e., they have a "void" return type). Use the isValid() function to test if the reply succeeded.

See also QDBusMessage and QDBusInterface.

Member Function Documentation

QDBusReply::QDBusReply(const QDBusMessage &reply)

Default constructs an instance of QDBusReply.

[default] QDBusReply::QDBusReply(const QDBusReply &)

Copy constructor.

QDBusReply::QDBusReply(const QDBusPendingCall &pcall)

Default constructs an instance of QDBusReply.

QDBusReply::QDBusReply(const QDBusPendingReply<T> &reply)

Default constructs an instance of QDBusReply.

QDBusReply::QDBusReply(const QDBusError &dbusError = QDBusError())

Default constructs an instance of QDBusReply.

const QDBusError &QDBusReply::error()

const QDBusError &QDBusReply::error() const

bool QDBusReply::isValid() const

Type QDBusReply::value() const

QDBusReply::operator Type() const

QDBusReply &QDBusReply::operator=(const QDBusMessage &reply)

QDBusReply &QDBusReply::operator=(const QDBusPendingCall &pcall)

QDBusReply &QDBusReply::operator=(const QDBusError &dbusError)

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

Copy-assignment operator.