Qt 4.8
Public Types | Public Functions | Protected Functions | Protected Variables | Friends | Related Functions | List of all members
QDBusArgument Class Reference

The QDBusArgument class is used to marshall and demarshall D-Bus arguments. More...

#include <qdbusargument.h>

Public Types

enum  ElementType {
  BasicType, VariantType, ArrayType, StructureType,
  MapType, MapEntryType, UnknownType = -1
}
 This enum describes the type of element held by the argument. More...
 

Public Functions

void appendVariant (const QVariant &v)
 Appends the variant v. More...
 
QVariant asVariant () const
 Returns the current argument in the form of a QVariant. More...
 
bool atEnd () const
 Returns true if there are no more elements to be extracted from this QDBusArgument. More...
 
void beginArray (int elementMetaTypeId)
 Opens a new D-Bus array suitable for appending elements of meta-type id. More...
 
void beginArray () const
 Recurses into the D-Bus array to allow extraction of the array elements. More...
 
void beginMap (int keyMetaTypeId, int valueMetaTypeId)
 Opens a new D-Bus map suitable for appending elements. More...
 
void beginMap () const
 Recurses into the D-Bus map to allow extraction of the map's elements. More...
 
void beginMapEntry ()
 Opens a D-Bus map entry suitable for appending the key and value entries. More...
 
void beginMapEntry () const
 Recurses into the D-Bus map entry to allow extraction of the key and value pair. More...
 
void beginStructure ()
 Opens a new D-Bus structure suitable for appending new arguments. More...
 
void beginStructure () const
 Opens a D-Bus structure suitable for extracting elements. More...
 
QString currentSignature () const
 Returns the type signature of the D-Bus type this QDBusArgument object is currently pointing to. More...
 
ElementType currentType () const
 Returns the classification of the current element type. More...
 
void endArray ()
 Closes a D-Bus array opened with beginArray(). More...
 
void endArray () const
 Closes the D-Bus array and allow extracting of the next element after the array. More...
 
void endMap ()
 Closes a D-Bus map opened with beginMap(). More...
 
void endMap () const
 Closes the D-Bus map and allow extracting of the next element after the map. More...
 
void endMapEntry ()
 Closes a D-Bus map entry opened with beginMapEntry(). More...
 
void endMapEntry () const
 Closes the D-Bus map entry and allow extracting of the next element on the map. More...
 
void endStructure ()
 Closes a D-Bus structure opened with beginStructure(). More...
 
void endStructure () const
 Closes the D-Bus structure and allow extracting of the next element after the structure. More...
 
QDBusArgumentoperator<< (uchar arg)
 Appends the primitive value arg of type BYTE to the D-Bus stream. More...
 
QDBusArgumentoperator<< (bool arg)
 Appends the primitive value arg of type BOOLEAN to the D-Bus stream. More...
 
QDBusArgumentoperator<< (short arg)
 Appends the primitive value arg of type INT16 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (ushort arg)
 Appends the primitive value arg of type UINT16 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (int arg)
 Appends the primitive value arg of type INT32 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (uint arg)
 Appends the primitive value arg of type UINT32 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (qlonglong arg)
 Appends the primitive value arg of type INT64 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (qulonglong arg)
 Appends the primitive value arg of type UINT64 to the D-Bus stream. More...
 
QDBusArgumentoperator<< (double arg)
 Appends the primitive value arg of type DOUBLE (double-precision floating-point) to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QString &arg)
 Appends the primitive value arg of type STRING (Unicode character string) to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QDBusVariant &arg)
 Appends the primitive value arg of type VARIANT to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QDBusObjectPath &arg)
 Appends the primitive value arg of type OBJECT_PATH (path to a D-Bus object) to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QDBusSignature &arg)
 Appends the primitive value arg of type SIGNATURE (D-Bus type signature) to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QDBusUnixFileDescriptor &arg)
 Appends the primitive value arg of type UNIX_FILE_DESCRIPTOR (Unix File Descriptor) to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QStringList &arg)
 Appends the QStringList given by arg as ARRAY of STRING to the D-Bus stream. More...
 
QDBusArgumentoperator<< (const QByteArray &arg)
 Appends the QByteArray given by arg as ARRAY of BYTE to the D-Bus stream. More...
 
QDBusArgumentoperator= (const QDBusArgument &other)
 Copies the other QDBusArgument object into this one. More...
 
const QDBusArgumentoperator>> (uchar &arg) const
 Extracts one D-BUS primitive argument of type BYTE from the D-BUS stream and puts it into arg. More...
 
const QDBusArgumentoperator>> (bool &arg) const
 Extracts one D-Bus primitive argument of type BOOLEAN from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (short &arg) const
 Extracts one D-Bus primitive argument of type INT16 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (ushort &arg) const
 Extracts one D-Bus primitive argument of type UINT16 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (int &arg) const
 Extracts one D-Bus primitive argument of type INT32 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (uint &arg) const
 Extracts one D-Bus primitive argument of type UINT32 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (qlonglong &arg) const
 Extracts one D-Bus primitive argument of type INT64 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (qulonglong &arg) const
 Extracts one D-Bus primitive argument of type UINT64 from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (double &arg) const
 Extracts one D-Bus primitive argument of type DOUBLE (double-precision floating pount) from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QString &arg) const
 Extracts one D-Bus primitive argument of type STRING (Unicode character string) from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QDBusVariant &arg) const
 Extracts one D-Bus primitive argument of type VARIANT from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QDBusObjectPath &arg) const
 Extracts one D-Bus primitive argument of type OBJECT_PATH (D-Bus path to an object) from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QDBusSignature &arg) const
 Extracts one D-Bus primitive argument of type SIGNATURE (D-Bus type signature) from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QDBusUnixFileDescriptor &arg) const
 Extracts one D-Bus primitive argument of type UNIX_FILE_DESCRIPTOR (Unix file descriptor) from the D-Bus stream. More...
 
const QDBusArgumentoperator>> (QStringList &arg) const
 Extracts an array of strings from the D-Bus stream and return it as a QStringList. More...
 
const QDBusArgumentoperator>> (QByteArray &arg) const
 Extracts an array of bytes from the D-Bus stream and return it as a QByteArray. More...
 
 QDBusArgument ()
 Constructs an empty QDBusArgument argument. More...
 
 QDBusArgument (const QDBusArgument &other)
 Constructs a copy of the other QDBusArgument object. More...
 
 ~QDBusArgument ()
 Disposes of the resources associated with this QDBusArgument object. More...
 

Protected Functions

 QDBusArgument (QDBusArgumentPrivate *d)
 

Protected Variables

QDBusArgumentPrivated
 

Friends

class QDBusArgumentPrivate
 

Related Functions

(Note that these are not member functions.)

 qdbus_cast (const QDBusArgument &argument)
 Attempts to demarshall the contents of argument into the type T. More...
 
int qDBusRegisterMetaType ()
 Registers T with the qdbustypesystem . More...
 

Detailed Description

The QDBusArgument class is used to marshall and demarshall D-Bus arguments.

Attention
Module: QtDBus
Since
4.2

The class is used to send arguments over D-Bus to remote applications and to receive them back. D-Bus offers an extensible type system, based on a few primitive types and associations of them. See the QtDBus type system page for more information on the type system.

QDBusArgument is the central class in the QtDBus type system, providing functions to marshall and demarshall the primitive types. The compound types are then created by association of one or more of the primitive types in arrays, dictionaries or structures.

The following example illustrates how a structure containing an integer and a string can be constructed using the QtDBus type system:

struct MyStructure
{
    int count;
    QString name;
};
Q_DECLARE_METATYPE(MyStructure)

// Marshall the MyStructure data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const MyStructure &mystruct)
{
    argument.beginStructure();
    argument << mystruct.count << mystruct.name;
    argument.endStructure();
    return argument;
}

// Retrieve the MyStructure data from the D-Bus argument
const QDBusArgument &operator>>(const QDBusArgument &argument, MyStructure &mystruct)
{
    argument.beginStructure();
    argument >> mystruct.count >> mystruct.name;
    argument.endStructure();
    return argument;
}

The type has to be registered with qDBusRegisterMetaType() before it can be used with QDBusArgument. Therefore, somewhere in your program, you should add the following code:

qDBusRegisterMetaType();

Once registered, a type can be used in outgoing method calls (placed with QDBusAbstractInterface::call()), signal emissions from registered objects or in incoming calls from remote applications.

It is important to note that the operator<< and operator>> streaming functions must always produce the same number of entries in case of structures, both in reading and in writing (marshalling and demarshalling), otherwise calls and signals may start to silently fail.

The following example illustrates this wrong usage in context of a class that may contain invalid data:

Wrongly marshall the MyTime data into a D-Bus argument QDBusArgument &operator<<(QDBusArgument &argument, const MyTime &mytime) { argument.beginStructure(); if (mytime.isValid) argument << true << mytime.hour << mytime.minute << mytime.second; else argument << false; argument.endStructure(); return argument; }

In this example, both the operator<< and the operator>> functions may produce a different number of reads/writes. This can confuse the QtDBus type system and should be avoided.

See also
QDBusAbstractInterface, {qdbustypesystem.html}{The QtDBus type system}, {usingadaptors.html}{Using Adaptors}, qdbus_cast()

Definition at line 69 of file qdbusargument.h.

Enumerations

◆ ElementType

This enum describes the type of element held by the argument.

Since
4.5
  • ArrayType An array element, usually represented by QList<T> or QVector<T>. Note: QByteArray and associative maps are not considered arrays, even if the D-Bus protocol transports them as such.
  • StructureType A custom type represented by a structure, like QDateTime, QPoint, etc.
  • MapEntryType One entry in an associative container: both the key and the value form one map-entry type.
  • UnknownType The type is unknown or we have reached the end of the list.
See also
currentType()
Enumerator
BasicType 
VariantType 
ArrayType 
StructureType 
MapType 
MapEntryType 
UnknownType 

Definition at line 72 of file qdbusargument.h.

Constructors and Destructors

◆ QDBusArgument() [1/3]

QDBusArgument::QDBusArgument ( )

Constructs an empty QDBusArgument argument.

An empty QDBusArgument object does not allow either reading or writing to be performed.

Definition at line 299 of file qdbusargument.cpp.

300 {
301  if (!qdbus_loadLibDBus()) {
302  d = 0;
303  return;
304  }
305 
306  QDBusMarshaller *dd = new QDBusMarshaller(0);
307  d = dd;
308 
309  // create a new message with any type, we won't sent it anyways
310  dd->message = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
311  q_dbus_message_iter_init_append(dd->message, &dd->iterator);
312 }
DBusMessage * message
DBusMessageIter iterator
QDBusArgumentPrivate * d
bool qdbus_loadLibDBus()

◆ QDBusArgument() [2/3]

QDBusArgument::QDBusArgument ( const QDBusArgument other)

Constructs a copy of the other QDBusArgument object.

Both objects will therefore contain the same state from this point forward. QDBusArguments are explicitly shared and, therefore, any modification to either copy will affect the other one too.

Definition at line 321 of file qdbusargument.cpp.

322  : d(other.d)
323 {
324  if (d)
325  d->ref.ref();
326 }
bool ref()
Atomically increments the value of this QAtomicInt.
QDBusArgumentPrivate * d

◆ ~QDBusArgument()

QDBusArgument::~QDBusArgument ( )

Disposes of the resources associated with this QDBusArgument object.

Definition at line 353 of file qdbusargument.cpp.

354 {
355  if (d && !d->ref.deref())
356  delete d;
357 }
bool deref()
Atomically decrements the value of this QAtomicInt.
QDBusArgumentPrivate * d

◆ QDBusArgument() [3/3]

QDBusArgument::QDBusArgument ( QDBusArgumentPrivate dd)
protected
Warning
This function is not part of the public interface.

Definition at line 331 of file qdbusargument.cpp.

332  : d(dd)
333 {
334 }
QDBusArgumentPrivate * d

Functions

◆ appendVariant()

void QDBusArgument::appendVariant ( const QVariant v)

Appends the variant v.

Warning
This function is not part of the public interface.
Since
4.5
See also
asVariant()

Definition at line 616 of file qdbusargument.cpp.

617 {
620 }
bool appendVariantInternal(const QVariant &arg)
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ asVariant()

QVariant QDBusArgument::asVariant ( ) const

Returns the current argument in the form of a QVariant.

Since
4.5

Basic types will be decoded and returned in the QVariant, but for complex types, this function will return a QDBusArgument object in the QVariant. It is the caller's responsibility to decode the argument (for example, by calling asVariant() in it).

For example, if the current argument is an INT32, this function will return a QVariant with an argument of type QVariant::Int. For an array of INT32, it will return a QVariant containing a QDBusArgument.

If an error occurs or if there are no more arguments to decode (i.e., we are at the end of the argument list), this function will return an invalid QVariant.

See also
atEnd()

Definition at line 1211 of file qdbusargument.cpp.

Referenced by argToString().

1212 {
1214  return d->demarshaller()->toVariantInternal();
1215 
1216  return QVariant();
1217 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QDBusDemarshaller * demarshaller()
static bool checkRead(QDBusArgumentPrivate *d)
QDBusArgumentPrivate * d

◆ atEnd()

bool QDBusArgument::atEnd ( ) const

Returns true if there are no more elements to be extracted from this QDBusArgument.

This function is usually used in QDBusArgument objects returned from beginMap() and beginArray().

Definition at line 1180 of file qdbusargument.cpp.

Referenced by argToString(), and operator>>().

1181 {
1183  return d->demarshaller()->atEnd();
1184 
1185  return true; // at least, stop reading
1186 }
QDBusDemarshaller * demarshaller()
static bool checkRead(QDBusArgumentPrivate *d)
QDBusArgumentPrivate * d

◆ beginArray() [1/2]

void QDBusArgument::beginArray ( int  id)

Opens a new D-Bus array suitable for appending elements of meta-type id.

This function is used usually in operator<< streaming operators, as in the following example:

// append an array of MyElement types
QDBusArgument &operator<<(QDBusArgument &argument, const MyArray &myarray)
{
argument.beginArray( qMetaTypeId<MyElement>() );
for ( int i = 0; i < myarray.length; ++i )
argument << myarray.elements[i];
argument.endArray();
return argument;
}

If the type you want to marshall is a QList, QVector or any of the Qt's Container Classes that take one template parameter, you need not declare an operator<< function for it, since QtDBus provides generic templates to do the job of marshalling the data. The same applies for STL's sequence containers, such as {std::list}, {std::vector}, etc.

See also
endArray(), beginStructure(), beginMap()

Definition at line 971 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

972 {
974  d = d->marshaller()->beginArray(id);
975 }
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
QDBusMarshaller * beginArray(int id)
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ beginArray() [2/2]

void QDBusArgument::beginArray ( ) const

Recurses into the D-Bus array to allow extraction of the array elements.

This function is used usually in operator>> streaming operators, as in the following example:

// extract a MyArray array of MyElement elements
const QDBusArgument &operator>>(const QDBusArgument &argument, MyArray &myarray)
{
argument.beginArray();
myarray.clear();
while ( !argument.atEnd() ) {
MyElement element;
argument >> element;
myarray.append( element );
}
argument.endArray();
return argument;
}

If the type you want to demarshall is a QList, QVector or any of the Qt's Container Classes that take one template parameter, you need not declare an operator>> function for it, since QtDBus provides generic templates to do the job of demarshalling the data. The same applies for STL's sequence containers, such as {std::list}, {std::vector}, etc.

See also
atEnd(), beginStructure(), beginMap()

Definition at line 1098 of file qdbusargument.cpp.

1099 {
1101  d = d->demarshaller()->beginArray();
1102 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d
QDBusDemarshaller * beginArray()

◆ beginMap() [1/2]

void QDBusArgument::beginMap ( int  kid,
int  vid 
)

Opens a new D-Bus map suitable for appending elements.

Maps are containers that associate one entry (the key) to another (the value), such as Qt's QMap or QHash. The ids of the map's key and value meta types must be passed in kid and vid respectively.

This function is used usually in operator<< streaming operators, as in the following example:

// append a dictionary that associates ints to MyValue types
QDBusArgument &operator<<(QDBusArgument &argument, const MyDictionary &mydict)
{
argument.beginMap( QVariant::Int, qMetaTypeId<MyValue>() );
for ( int i = 0; i < mydict.length; ++i ) {
argument.beginMapEntry();
argument << mydict.data[i].key << mydict.data[i].value;
argument.endMapEntry();
}
argument.endMap();
return argument;
}

If the type you want to marshall is a QMap or QHash, you need not declare an operator<< function for it, since QtDBus provides generic templates to do the job of marshalling the data.

See also
endMap(), beginStructure(), beginArray(), beginMapEntry()

Definition at line 1007 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

1008 {
1010  d = d->marshaller()->beginMap(kid, vid);
1011 }
QDBusMarshaller * marshaller()
QDBusMarshaller * beginMap(int kid, int vid)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ beginMap() [2/2]

void QDBusArgument::beginMap ( ) const

Recurses into the D-Bus map to allow extraction of the map's elements.

This function is used usually in operator>> streaming operators, as in the following example:

// extract a MyDictionary map that associates ints to MyValue elements
const QDBusArgument &operator>>(const QDBusArgument &argument, MyDictionary &mydict)
{
argument.beginMap();
mydict.clear();
while ( !argMap.atEnd() ) {
int key;
MyValue value;
argument.beginMapEntry();
argument >> key >> value;
argument.endMapEntry();
mydict.append( key, value );
}
argument.endMap();
return argument;
}

If the type you want to demarshall is a QMap or QHash, you need not declare an operator>> function for it, since QtDBus provides generic templates to do the job of demarshalling the data.

See also
endMap(), beginStructure(), beginArray(), beginMapEntry()

Definition at line 1131 of file qdbusargument.cpp.

1132 {
1134  d = d->demarshaller()->beginMap();
1135 }
QDBusDemarshaller * beginMap()
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ beginMapEntry() [1/2]

void QDBusArgument::beginMapEntry ( )

Opens a D-Bus map entry suitable for appending the key and value entries.

This function is only valid when a map has been opened with beginMap().

See beginMap() for an example of usage of this function.

See also
endMapEntry(), beginMap()

Definition at line 1034 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

1035 {
1037  d = d->marshaller()->beginMapEntry();
1038 }
QDBusMarshaller * beginMapEntry()
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ beginMapEntry() [2/2]

void QDBusArgument::beginMapEntry ( ) const

Recurses into the D-Bus map entry to allow extraction of the key and value pair.

See beginMap() for an example of how this function is usually used.

See also
endMapEntry(), beginMap()

Definition at line 1157 of file qdbusargument.cpp.

1158 {
1160  d = d->demarshaller()->beginMapEntry();
1161 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d
QDBusDemarshaller * beginMapEntry()

◆ beginStructure() [1/2]

void QDBusArgument::beginStructure ( )

Opens a new D-Bus structure suitable for appending new arguments.

This function is used usually in operator<< streaming operators, as in the following example:

QDBusArgument &operator<<(QDBusArgument &argument, const MyStructure &mystruct)
{
argument.beginStructure();
argument << mystruct.member1 << mystruct.member2 << ... ;
argument.endStructure();
return argument;
}

Structures can contain other structures, so the following code is also valid:

QDBusArgument &operator<<(QDBusArgument &argument, const MyStructure &mystruct)
{
argument.beginStructure();
argument << mystruct.member1 << mystruct.member2;
argument.beginStructure();
argument << mystruct.member3.subMember1 << mystruct.member3.subMember2;
argument.endStructure();
argument << mystruct.member4;
argument.endStructure();
return argument;
}
See also
endStructure(), beginArray(), beginMap()

Definition at line 936 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

937 {
939  d = d->marshaller()->beginStructure();
940 }
QDBusMarshaller * marshaller()
QDBusMarshaller * beginStructure()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ beginStructure() [2/2]

void QDBusArgument::beginStructure ( ) const

Opens a D-Bus structure suitable for extracting elements.

This function is used usually in operator>> streaming operators, as in the following example:

const QDBusArgument &operator>>(const QDBusArgument &argument, MyStructure &mystruct)
{
argument.beginStructure()
argument >> mystruct.member1 >> mystruct.member2 >> mystruct.member3 >> ...;
argument.endStructure();
return argument;
}
See also
endStructure(), beginArray(), beginMap()

Definition at line 1062 of file qdbusargument.cpp.

1063 {
1065  d = d->demarshaller()->beginStructure();
1066 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusDemarshaller * beginStructure()
QDBusArgumentPrivate * d

◆ currentSignature()

QString QDBusArgument::currentSignature ( ) const

Returns the type signature of the D-Bus type this QDBusArgument object is currently pointing to.

Warning
This function is not part of the public interface.

Definition at line 630 of file qdbusargument.cpp.

Referenced by argToString(), copyArgument(), QDBusAbstractInterfacePrivate::property(), and qDBusReplyFill().

631 {
632  if (!d)
633  return QString();
635  return d->demarshaller()->currentSignature();
636  else
637  return d->marshaller()->currentSignature();
638 }
QDBusDemarshaller * demarshaller()
The QString class provides a Unicode character string.
Definition: qstring.h:83
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
enum QDBusArgumentPrivate::Direction direction
QString currentSignature()

◆ currentType()

QDBusArgument::ElementType QDBusArgument::currentType ( ) const

Returns the classification of the current element type.

Since
4.5 If an error decoding the type occurs or if we're at the end of the argument, this function returns QDBusArgument::UnknownType.

This function only makes sense when demarshalling arguments. If it is used while marshalling, it will always return UnknownType.

Definition at line 652 of file qdbusargument.cpp.

Referenced by argToString().

653 {
654  if (!d)
655  return UnknownType;
657  return d->demarshaller()->currentType();
658  return UnknownType;
659 }
QDBusArgument::ElementType currentType()
QDBusDemarshaller * demarshaller()
QDBusArgumentPrivate * d
enum QDBusArgumentPrivate::Direction direction

◆ endArray() [1/2]

void QDBusArgument::endArray ( )

Closes a D-Bus array opened with beginArray().

This function must be called same number of times that beginArray() is called.

See also
beginArray(), endStructure(), endMap()

Definition at line 983 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

984 {
986  d = d->marshaller()->endArray();
987 }
QDBusMarshaller * endArray()
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ endArray() [2/2]

void QDBusArgument::endArray ( ) const

Closes the D-Bus array and allow extracting of the next element after the array.

See also
beginArray()

Definition at line 1110 of file qdbusargument.cpp.

1111 {
1113  d = d->demarshaller()->endArray();
1114 }
QDBusDemarshaller * demarshaller()
QDBusDemarshaller * endArray()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ endMap() [1/2]

void QDBusArgument::endMap ( )

Closes a D-Bus map opened with beginMap().

This function must be called same number of times that beginMap() is called.

See also
beginMap(), endStructure(), endArray()

Definition at line 1019 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

1020 {
1022  d = d->marshaller()->endMap();
1023 }
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)
QDBusMarshaller * endMap()

◆ endMap() [2/2]

void QDBusArgument::endMap ( ) const

Closes the D-Bus map and allow extracting of the next element after the map.

See also
beginMap()

Definition at line 1143 of file qdbusargument.cpp.

1144 {
1146  d = d->demarshaller()->endMap();
1147 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d
QDBusDemarshaller * endMap()

◆ endMapEntry() [1/2]

void QDBusArgument::endMapEntry ( )

Closes a D-Bus map entry opened with beginMapEntry().

This function must be called same number of times that beginMapEntry() is called.

See also
beginMapEntry()

Definition at line 1046 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

1047 {
1049  d = d->marshaller()->endMapEntry();
1050 }
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)
QDBusMarshaller * endMapEntry()

◆ endMapEntry() [2/2]

void QDBusArgument::endMapEntry ( ) const

Closes the D-Bus map entry and allow extracting of the next element on the map.

See also
beginMapEntry()

Definition at line 1169 of file qdbusargument.cpp.

1170 {
1172  d = d->demarshaller()->endMapEntry();
1173 }
QDBusDemarshaller * endMapEntry()
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ endStructure() [1/2]

void QDBusArgument::endStructure ( )

Closes a D-Bus structure opened with beginStructure().

This function must be called same number of times that beginStructure() is called.

See also
beginStructure(), endArray(), endMap()

Definition at line 948 of file qdbusargument.cpp.

Referenced by argToString(), operator<<(), and operator>>().

949 {
951  d = d->marshaller()->endStructure();
952 }
QDBusMarshaller * endStructure()
QDBusMarshaller * marshaller()
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ endStructure() [2/2]

void QDBusArgument::endStructure ( ) const

Closes the D-Bus structure and allow extracting of the next element after the structure.

See also
beginStructure()

Definition at line 1074 of file qdbusargument.cpp.

1075 {
1077  d = d->demarshaller()->endStructure();
1078 }
QDBusDemarshaller * endStructure()
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator<<() [1/16]

QDBusArgument & QDBusArgument::operator<< ( uchar  arg)

Appends the primitive value arg of type BYTE to the D-Bus stream.

Definition at line 362 of file qdbusargument.cpp.

363 {
365  d->marshaller()->append(arg);
366  return *this;
367 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [2/16]

QDBusArgument & QDBusArgument::operator<< ( bool  arg)

Appends the primitive value arg of type BOOLEAN to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 376 of file qdbusargument.cpp.

377 {
379  d->marshaller()->append(arg);
380  return *this;
381 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [3/16]

QDBusArgument & QDBusArgument::operator<< ( short  arg)

Appends the primitive value arg of type INT16 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 390 of file qdbusargument.cpp.

391 {
393  d->marshaller()->append(arg);
394  return *this;
395 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [4/16]

QDBusArgument & QDBusArgument::operator<< ( ushort  arg)

Appends the primitive value arg of type UINT16 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 404 of file qdbusargument.cpp.

405 {
407  d->marshaller()->append(arg);
408  return *this;
409 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [5/16]

QDBusArgument & QDBusArgument::operator<< ( int  arg)

Appends the primitive value arg of type INT32 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 418 of file qdbusargument.cpp.

419 {
421  d->marshaller()->append(arg);
422  return *this;
423 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [6/16]

QDBusArgument & QDBusArgument::operator<< ( uint  arg)

Appends the primitive value arg of type UINT32 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 432 of file qdbusargument.cpp.

433 {
435  d->marshaller()->append(arg);
436  return *this;
437 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [7/16]

QDBusArgument & QDBusArgument::operator<< ( qlonglong  arg)

Appends the primitive value arg of type INT64 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 446 of file qdbusargument.cpp.

447 {
449  d->marshaller()->append(arg);
450  return *this;
451 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [8/16]

QDBusArgument & QDBusArgument::operator<< ( qulonglong  arg)

Appends the primitive value arg of type UINT64 to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 460 of file qdbusargument.cpp.

461 {
463  d->marshaller()->append(arg);
464  return *this;
465 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [9/16]

QDBusArgument & QDBusArgument::operator<< ( double  arg)

Appends the primitive value arg of type DOUBLE (double-precision floating-point) to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 475 of file qdbusargument.cpp.

476 {
478  d->marshaller()->append(arg);
479  return *this;
480 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [10/16]

QDBusArgument & QDBusArgument::operator<< ( const QString arg)

Appends the primitive value arg of type STRING (Unicode character string) to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 490 of file qdbusargument.cpp.

491 {
493  d->marshaller()->append(arg);
494  return *this;
495 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [11/16]

QDBusArgument & QDBusArgument::operator<< ( const QDBusVariant arg)

Appends the primitive value arg of type VARIANT to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

A D-Bus variant type can contain any type, including other variants. It is similar to the Qt QVariant type.

Definition at line 556 of file qdbusargument.cpp.

557 {
559  d->marshaller()->append(arg);
560  return *this;
561 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [12/16]

QDBusArgument & QDBusArgument::operator<< ( const QDBusObjectPath arg)

Appends the primitive value arg of type OBJECT_PATH (path to a D-Bus object) to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Warning
This function is not part of the public interface.

Definition at line 506 of file qdbusargument.cpp.

507 {
509  d->marshaller()->append(arg);
510  return *this;
511 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [13/16]

QDBusArgument & QDBusArgument::operator<< ( const QDBusSignature arg)

Appends the primitive value arg of type SIGNATURE (D-Bus type signature) to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Warning
This function is not part of the public interface.

Definition at line 522 of file qdbusargument.cpp.

523 {
525  d->marshaller()->append(arg);
526  return *this;
527 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [14/16]

QDBusArgument & QDBusArgument::operator<< ( const QDBusUnixFileDescriptor arg)

Appends the primitive value arg of type UNIX_FILE_DESCRIPTOR (Unix File Descriptor) to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
4.8
Warning
This function is not part of the public interface.

Definition at line 539 of file qdbusargument.cpp.

540 {
542  d->marshaller()->append(arg);
543  return *this;
544 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [15/16]

QDBusArgument & QDBusArgument::operator<< ( const QStringList arg)

Appends the QStringList given by arg as ARRAY of STRING to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QStringList and QByteArray are the only two non-primitive types that are supported directly by QDBusArgument because of their widespread usage in Qt applications.

Other arrays are supported through compound types in QtDBus.

Definition at line 577 of file qdbusargument.cpp.

578 {
580  d->marshaller()->append(arg);
581  return *this;
582 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator<<() [16/16]

QDBusArgument & QDBusArgument::operator<< ( const QByteArray arg)

Appends the QByteArray given by arg as ARRAY of BYTE to the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QStringList and QByteArray are the only two non-primitive types that are supported directly by QDBusArgument because of their widespread usage in Qt applications.

Other arrays are supported through compound types in QtDBus.

Definition at line 598 of file qdbusargument.cpp.

599 {
601  d->marshaller()->append(arg);
602  return *this;
603 }
QDBusMarshaller * marshaller()
void append(uchar arg)
QDBusArgumentPrivate * d
static bool checkWrite(QDBusArgumentPrivate *&d)

◆ operator=()

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

Copies the other QDBusArgument object into this one.

Both objects will therefore contain the same state from this point forward. QDBusArguments are explicitly shared and, therefore, any modification to either copy will affect the other one too.

Definition at line 343 of file qdbusargument.cpp.

344 {
345  qAtomicAssign(d, other.d);
346  return *this;
347 }
QDBusArgumentPrivate * d
void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
Definition: qatomic.h:195

◆ operator>>() [1/16]

const QDBusArgument & QDBusArgument::operator>> ( uchar arg) const

Extracts one D-BUS primitive argument of type BYTE from the D-BUS stream and puts it into arg.

Definition at line 665 of file qdbusargument.cpp.

666 {
668  arg = d->demarshaller()->toByte();
669  return *this;
670 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [2/16]

const QDBusArgument & QDBusArgument::operator>> ( bool &  arg) const

Extracts one D-Bus primitive argument of type BOOLEAN from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 680 of file qdbusargument.cpp.

681 {
683  arg = d->demarshaller()->toBool();
684  return *this;
685 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [3/16]

const QDBusArgument & QDBusArgument::operator>> ( short &  arg) const

Extracts one D-Bus primitive argument of type INT16 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 710 of file qdbusargument.cpp.

711 {
713  arg = d->demarshaller()->toShort();
714  return *this;
715 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [4/16]

const QDBusArgument & QDBusArgument::operator>> ( ushort arg) const

Extracts one D-Bus primitive argument of type UINT16 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 695 of file qdbusargument.cpp.

696 {
698  arg = d->demarshaller()->toUShort();
699  return *this;
700 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [5/16]

const QDBusArgument & QDBusArgument::operator>> ( int &  arg) const

Extracts one D-Bus primitive argument of type INT32 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 725 of file qdbusargument.cpp.

726 {
728  arg = d->demarshaller()->toInt();
729  return *this;
730 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [6/16]

const QDBusArgument & QDBusArgument::operator>> ( uint arg) const

Extracts one D-Bus primitive argument of type UINT32 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 740 of file qdbusargument.cpp.

741 {
743  arg = d->demarshaller()->toUInt();
744  return *this;
745 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [7/16]

const QDBusArgument & QDBusArgument::operator>> ( qlonglong arg) const

Extracts one D-Bus primitive argument of type INT64 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 755 of file qdbusargument.cpp.

756 {
758  arg = d->demarshaller()->toLongLong();
759  return *this;
760 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [8/16]

const QDBusArgument & QDBusArgument::operator>> ( qulonglong arg) const

Extracts one D-Bus primitive argument of type UINT64 from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 770 of file qdbusargument.cpp.

771 {
773  arg = d->demarshaller()->toULongLong();
774  return *this;
775 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [9/16]

const QDBusArgument & QDBusArgument::operator>> ( double &  arg) const

Extracts one D-Bus primitive argument of type DOUBLE (double-precision floating pount) from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 785 of file qdbusargument.cpp.

786 {
788  arg = d->demarshaller()->toDouble();
789  return *this;
790 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [10/16]

const QDBusArgument & QDBusArgument::operator>> ( QString arg) const

Extracts one D-Bus primitive argument of type STRING (Unicode character string) from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 800 of file qdbusargument.cpp.

801 {
803  arg = d->demarshaller()->toString();
804  return *this;
805 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

◆ operator>>() [11/16]

const QDBusArgument & QDBusArgument::operator>> ( QDBusVariant arg) const

Extracts one D-Bus primitive argument of type VARIANT from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

A D-Bus variant type can contain any type, including other variants. It is similar to the Qt QVariant type.

In case the variant contains a type not directly supported by QDBusArgument, the value of the returned QDBusVariant will contain another QDBusArgument. It is your responsibility to further demarshall it into another type.

Definition at line 872 of file qdbusargument.cpp.

873 {
875  arg = d->demarshaller()->toVariant();
876  return *this;
877 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusVariant toVariant()
QDBusArgumentPrivate * d

◆ operator>>() [12/16]

const QDBusArgument & QDBusArgument::operator>> ( QDBusObjectPath arg) const

Extracts one D-Bus primitive argument of type OBJECT_PATH (D-Bus path to an object) from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Warning
This function is not part of the public interface.

Definition at line 816 of file qdbusargument.cpp.

817 {
819  arg = d->demarshaller()->toObjectPath();
820  return *this;
821 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d
QDBusObjectPath toObjectPath()

◆ operator>>() [13/16]

const QDBusArgument & QDBusArgument::operator>> ( QDBusSignature arg) const

Extracts one D-Bus primitive argument of type SIGNATURE (D-Bus type signature) from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Warning
This function is not part of the public interface.

Definition at line 832 of file qdbusargument.cpp.

833 {
835  arg = d->demarshaller()->toSignature();
836  return *this;
837 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusSignature toSignature()
QDBusArgumentPrivate * d

◆ operator>>() [14/16]

const QDBusArgument & QDBusArgument::operator>> ( QDBusUnixFileDescriptor arg) const

Extracts one D-Bus primitive argument of type UNIX_FILE_DESCRIPTOR (Unix file descriptor) from the D-Bus stream.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
4.8
Warning
This function is not part of the public interface.

Definition at line 849 of file qdbusargument.cpp.

850 {
852  arg = d->demarshaller()->toUnixFileDescriptor();
853  return *this;
854 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d
QDBusUnixFileDescriptor toUnixFileDescriptor()

◆ operator>>() [15/16]

const QDBusArgument & QDBusArgument::operator>> ( QStringList arg) const

Extracts an array of strings from the D-Bus stream and return it as a QStringList.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QStringList and QByteArray are the only two non-primitive types that are supported directly by QDBusArgument because of their widespread usage in Qt applications.

Other arrays are supported through compound types in QtDBus.

Definition at line 893 of file qdbusargument.cpp.

894 {
896  arg = d->demarshaller()->toStringList();
897  return *this;
898 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QStringList toStringList()
QDBusArgumentPrivate * d

◆ operator>>() [16/16]

const QDBusArgument & QDBusArgument::operator>> ( QByteArray arg) const

Extracts an array of bytes from the D-Bus stream and return it as a QByteArray.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QStringList and QByteArray are the only two non-primitive types that are supported directly by QDBusArgument because of their widespread usage in Qt applications.

Other arrays are supported through compound types in QtDBus.

Definition at line 914 of file qdbusargument.cpp.

915 {
917  arg = d->demarshaller()->toByteArray();
918  return *this;
919 }
QDBusDemarshaller * demarshaller()
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusArgumentPrivate * d

Friends and Related Functions

◆ qdbus_cast()

qdbus_cast ( const QDBusArgument argument)
related

Attempts to demarshall the contents of argument into the type T.

Since
4.2

For example:

MyType item = qdbus_cast<Type>(argument);

Note that it is equivalent to the following:

MyType item;
argument >> item;

Definition at line 155 of file qdbusargument.h.

160 {
161  T item;
162  arg >> item;
163  return item;
164 }

◆ QDBusArgumentPrivate

friend class QDBusArgumentPrivate
friend

Definition at line 151 of file qdbusargument.h.

◆ qDBusRegisterMetaType()

int qDBusRegisterMetaType ( )
related

Registers T with the QtDBus type system and the Qt QMetaType system, if it's not already registered.

Note
This class or function is threadsafe.
Since
4.2

To register a type, it must be declared as a meta-type with the Q_DECLARE_METATYPE() macro, and then registered as in the following example:

#include 
qDBusRegisterMetaType();

If T isn't a type derived from one of Qt's container classes, the operator<< and operator>> streaming operators between T and QDBusArgument must be already declared. See the QtDBus type system page for more information on how to declare such types.

This function returns the Qt meta type id for the type (the same value that is returned from qRegisterMetaType()).

\sa QtDBus type system, qRegisterMetaType(), QMetaType

Definition at line 79 of file qdbusmetatype.h.

84 {
85  void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper<T>;
86  void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper<T>;
87 
88  int id = qRegisterMetaType<T>(); // make sure it's registered
90  reinterpret_cast<QDBusMetaType::MarshallFunction>(mf),
91  reinterpret_cast<QDBusMetaType::DemarshallFunction>(df));
92  return id;
93 }
The QDBusArgument class is used to marshall and demarshall D-Bus arguments.
Definition: qdbusargument.h:69
static void registerMarshallOperators(int typeId, MarshallFunction, DemarshallFunction)
Registers the marshalling and demarshalling functions for meta type id.

Properties

◆ d

QDBusArgumentPrivate* QDBusArgument::d
mutableprotected

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