QDBusData Class Reference

Class for accurately representing D-Bus data types. More...

#include <qdbusdata.h>

List of all members.

Public Types

enum  Type {
  Invalid = 0, Bool, Byte, Int16,
  UInt16, Int32, UInt32, Int64,
  UInt64, Double, String, ObjectPath,
  List, Struct, Variant, Map
}
 

Enum for the data types used in D-Bus messages.

More...

Public Member Functions

 QDBusData ()
 Creates an empty, Invalid data object.
 QDBusData (const QDBusData &other)
 Copies a given other data object.
 ~QDBusData ()
 Destroys the data object.
QDBusDataoperator= (const QDBusData &other)
 Copies a given other data object.
bool operator== (const QDBusData &other) const
 Checks if the given other data object is equal to this instance.
bool operator!= (const QDBusData &other) const
 Checks if the given other data object is different from this instance.
bool isValid () const
 Checks whether the data object contains a valid content.
Type type () const
 Returns the Type of the data object.
Type keyType () const
 Returns the Type of the key type for maps.
const char * typeName () const
 Returns the string representation of the object's Type.
bool toBool (bool *ok=0) const
 Tries to get the encapsulated boolean value.
Q_UINT8 toByte (bool *ok=0) const
 Tries to get the encapsulated byte (unsigned char) value.
Q_INT16 toInt16 (bool *ok=0) const
 Tries to get the encapsulated signed 16-bit integer value.
Q_UINT16 toUInt16 (bool *ok=0) const
 Tries to get the encapsulated unsigned 16-bit integer value.
Q_INT32 toInt32 (bool *ok=0) const
 Tries to get the encapsulated signed 32-bit integer value.
Q_UINT32 toUInt32 (bool *ok=0) const
 Tries to get the encapsulated unsigned 32-bit integer value.
Q_INT64 toInt64 (bool *ok=0) const
 Tries to get the encapsulated signed 64-bit integer value.
Q_UINT64 toUInt64 (bool *ok=0) const
 Tries to get the encapsulated unsigned 64-bit integer value.
double toDouble (bool *ok=0) const
 Tries to get the encapsulated double value.
QString toString (bool *ok=0) const
 Tries to get the encapsulated string value.
QDBusObjectPath toObjectPath (bool *ok=0) const
 Tries to get the encapsulated object path value.
QDBusDataList toList (bool *ok=0) const
 Tries to get the encapsulated list.
QValueList< QDBusDatatoQValueList (bool *ok=0) const
 Tries to get the encapsulated list.
QValueList< QDBusDatatoStruct (bool *ok=0) const
 Tries to get the encapsulated struct memberList.
QDBusVariant toVariant (bool *ok=0) const
 Tries to get the encapsulated variant value.
QDBusDataMap< Q_UINT8 > toByteKeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_INT16 > toInt16KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_UINT16 > toUInt16KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_INT32 > toInt32KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_UINT32 > toUInt32KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_INT64 > toInt64KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< Q_UINT64 > toUInt64KeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< QString > toStringKeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QDBusDataMap< QDBusObjectPathtoObjectPathKeyMap (bool *ok=0) const
 Tries to get the encapsulated map.
QCString buildDBusSignature () const
 Creates the data objects D-Bus signature.

Static Public Member Functions

static const char * typeName (Type type)
 Returns the string representation for the given type.
static QDBusData fromBool (bool value)
 Creates a data object for the given boolean value.
static QDBusData fromByte (Q_UINT8 value)
 Creates a data object for the given byte (unsigned char) value.
static QDBusData fromInt16 (Q_INT16 value)
 Creates a data object for the given signed 16-bit integer value.
static QDBusData fromUInt16 (Q_UINT16 value)
 Creates a data object for the given unsigned 16-bit integer value.
static QDBusData fromInt32 (Q_INT32 value)
 Creates a data object for the given signed 32-bit integer value.
static QDBusData fromUInt32 (Q_UINT32 value)
 Creates a data object for the given unsigned 32-bit integer value.
static QDBusData fromInt64 (Q_INT64 value)
 Creates a data object for the given signed 64-bit integer value.
static QDBusData fromUInt64 (Q_UINT64 value)
 Creates a data object for the given unsigned 64-bit integer value.
static QDBusData fromDouble (double value)
 Creates a data object for the given double value.
static QDBusData fromString (const QString &value)
 Creates a data object for the given string value.
static QDBusData fromObjectPath (const QDBusObjectPath &value)
 Creates a data object for the given object path value.
static QDBusData fromList (const QDBusDataList &list)
 Creates a data object for the given list.
static QDBusData fromQValueList (const QValueList< QDBusData > &list)
 Creates a data object for the given list.
static QDBusData fromStruct (const QValueList< QDBusData > &memberList)
 Creates a data object for the given struct's memberList.
static QDBusData fromVariant (const QDBusVariant &value)
 Creates a data object for the given variant value.
static QDBusData fromByteKeyMap (const QDBusDataMap< Q_UINT8 > &map)
 Creates a data object for the given map.
static QDBusData fromInt16KeyMap (const QDBusDataMap< Q_INT16 > &map)
 Creates a data object for the given map.
static QDBusData fromUInt16KeyMap (const QDBusDataMap< Q_UINT16 > &map)
 Creates a data object for the given map.
static QDBusData fromInt32KeyMap (const QDBusDataMap< Q_INT32 > &map)
 Creates a data object for the given map.
static QDBusData fromUInt32KeyMap (const QDBusDataMap< Q_UINT32 > &map)
 Creates a data object for the given map.
static QDBusData fromInt64KeyMap (const QDBusDataMap< Q_INT64 > &map)
 Creates a data object for the given map.
static QDBusData fromUInt64KeyMap (const QDBusDataMap< Q_UINT64 > &map)
 Creates a data object for the given map.
static QDBusData fromStringKeyMap (const QDBusDataMap< QString > &map)
 Creates a data object for the given map.
static QDBusData fromObjectPathKeyMap (const QDBusDataMap< QDBusObjectPath > &map)
 Creates a data object for the given map.

Detailed Description

Class for accurately representing D-Bus data types.

The QDBusData class can be compared to Qt's QVariant class, but specialized to contain data types used in D-Bus messages.

Like QVariant objects of QDBusData use implicit sharing, i.e. copying a QDBusData object is a cheap operation and does not require that the content itself is copied.

Depending on the Type of the object, the content can be a recursive construct of QDBusData objects, e.g. a List can contain elements that are containers themselves, e.g. Map, Struct, Variant or even List again.

See also:
QDBusDataList
QDBusDataMap
QDBusDataConverter

Member Enumeration Documentation

Enum for the data types used in D-Bus messages.

In order to provide correct mapping of C++ and Qt types and the data types used in D-Bus messages, QDBusData uses explicit naming of types where the name is usually the one used in D-Bus, with the exception of List and Map since this is closer to the Qt container they are implemented with (QValueList and QMap respectively)

See also:
type(), keyType()
typeName()
Enumerator:
Invalid 

Base type for QDBusData objects created by the default constructor.

Also used as the type of returned objects when getter type methods fail due to type incompatabilties, i.e. toInt32() called on a List object.

See also:
isValid()
Bool 

Type when encapsulating a boolean value.

See also:
fromBool(), toBool()
Byte 

Type when encapsulating a byte (unsigned char) value.

See also:
fromByte(), toByte()
Int16 

Type when encapsulating a signed 16-bit integer value.

See also:
fromInt16(), toInt16()
UInt16 

Type when encapsulating an unsigned 16-bit integer value.

See also:
fromUInt16(), toUInt16()
Int32 

Type when encapsulating a signed 32-bit integer value.

See also:
fromInt32(), toInt32()
UInt32 

Type when encapsulating an unsigned 32-bit integer value.

See also:
fromUInt32(), toUInt32()
Int64 

Type when encapsulating a signed 64-bit integer value.

See also:
fromInt64(), toInt64()
UInt64 

Type when encapsulating an unsigned 64-bit integer value.

See also:
fromUInt64(), toUInt64()
Double 

Type when encapsulating a double value.

See also:
fromDouble(), toDouble()
String 

Type when encapsulating a string value.

All strings are converted to UTF-8 during transmission

See also:
fromString(), toString()
ObjectPath 

Type when encapsulating a D-Bus object path.

D-Bus defines a special string variation for transporting the paths used to address objects within D-Bus services, see Object paths for formatting details.

Note:
from the point of view of this bindings an object path is pretty much a normal string with externally checked restrictions. However, method calls or return values can require a signature to include an object path and any remote peer might then reject the normal string signature.
See also:
fromObjectPath(), toObjectPath()
List 

Type when encapsulating a list of values.

The D-Bus type this maps to is called array but since the Qt container class used to implement this type is QValueList (or rather QDBusDataList), the QDBusData type is called List instead.

A list can contain any of the supported types as elements, even container types. However it can only contain elements with the same type per list object.

See also:
fromList(), toList()
Struct 

Type when encapsulating a struct of values.

A struct is basically a list of struct member variables, each member can be any of the supported types, even containers types.

The C++/Qt value type used in the converter methods is a QValueList with type QDBusData. For example a QRect could be mapped like this:

 QRect rect(0, 0, 640, 480);
 QValueList<QDBusData> memberList;

 memberList << QDBusData::fromInt32(rect.x());
 memberList << QDBusData::fromInt32(rect.y());
 memberList << QDBusData::fromInt32(rect.width());
 memberList << QDBusData::fromInt32(rect.height());

 QDBusData data = QDBusData:fromStruct(memberList);

And reconstructed like this:

 memberList = data.toStruct();

 int x = memberList[0].toInt32();
 int y = memberList[1].toInt32();
 int w = memberList[2].toInt32();
 int h = memberList[3].toInt32();

 rect = QRect(x, y, w, h);
Note:
Empty structs, i.e. an empty member list, are not allowed
See also:
fromStruct(), toStruct()
QDBusDataConverter
Variant 

Type when encapsulating a special variable container value.

See QDBusVariant for details on variant usage.

See also:
fromVariant(), toVariant()
Map 

Type when encapsulating a map of keys to values.

The D-Bus type this maps to is called dict but since the Qt container class used to implement this type is QMap (or rather QDBusDataMap), the QDBusData type is called Map instead.

A map can contain any of the supported types as values, even container types, but only the following basic types as keys:

All values need to be of the same type.

See also:
fromByteKeyMap(), toByteKeyMap()
fromInt16KeyMap(), toInt16KeyMap()
fromUInt16KeyMap(), toUInt16KeyMap()
fromInt32KeyMap(), toInt32KeyMap()
fromUInt32KeyMap(), toUInt32KeyMap()
fromInt64KeyMap(), toInt64KeyMap()
fromUInt64KeyMap(), toUInt64KeyMap()
fromStringKeyMap(), toStringKeyMap()
fromObjectPathKeyMap(), toObjectPathKeyMap()

Constructor & Destructor Documentation

QDBusData::QDBusData (  ) 

Creates an empty, Invalid data object.

Referenced by QDBusDataMap< T >::operator=().

QDBusData::QDBusData ( const QDBusData other  ) 

Copies a given other data object.

Since QDBusData is implicitly shared, both objects will have the same content and the last object to reference it will delete it.

Parameters:
other the object to copy
QDBusData::~QDBusData (  ) 

Destroys the data object.

If this is the last instance to a shared content, it will delete it as well.


Member Function Documentation

QCString QDBusData::buildDBusSignature (  )  const

Creates the data objects D-Bus signature.

Recursivly builds the D-Bus signature of the data object if it holds a container type, i.e. if the object is of type List, Map or Struct

This can be used to create a signature for QDBusVariant when creating one for sending over D-Bus.

Returns:
a string containing the content's signature, or a null string if the data object is Invalid

Referenced by QDBusDataMap< T >::insert(), and QDBusDataMap< T >::operator==().

static QDBusData QDBusData::fromBool ( bool  value  )  [static]

Creates a data object for the given boolean value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Bool containing the value
See also:
toBool()
static QDBusData QDBusData::fromByte ( Q_UINT8  value  )  [static]

Creates a data object for the given byte (unsigned char) value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Byte containing the value
See also:
toByte()
static QDBusData QDBusData::fromByteKeyMap ( const QDBusDataMap< Q_UINT8 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to Byte.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toByteKeyMap()
static QDBusData QDBusData::fromDouble ( double  value  )  [static]

Creates a data object for the given double value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Double containing the value
See also:
toDouble()
static QDBusData QDBusData::fromInt16 ( Q_INT16  value  )  [static]

Creates a data object for the given signed 16-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Int16 containing the value
See also:
toInt16()
static QDBusData QDBusData::fromInt16KeyMap ( const QDBusDataMap< Q_INT16 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to Int16.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toInt16KeyMap()
static QDBusData QDBusData::fromInt32 ( Q_INT32  value  )  [static]

Creates a data object for the given signed 32-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Int32 containing the value
See also:
toInt32()
static QDBusData QDBusData::fromInt32KeyMap ( const QDBusDataMap< Q_INT32 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to Int32.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toInt32KeyMap()
static QDBusData QDBusData::fromInt64 ( Q_INT64  value  )  [static]

Creates a data object for the given signed 64-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Int64 containing the value
See also:
toInt64()
static QDBusData QDBusData::fromInt64KeyMap ( const QDBusDataMap< Q_INT64 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to Int64.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toInt64KeyMap()
static QDBusData QDBusData::fromList ( const QDBusDataList list  )  [static]

Creates a data object for the given list.

Note:
The list is allowed to be empty but is required to have a valid type

Unless the list the is empty, the convenience method fromQValueList() will usually be easier to use since it does not require to create a QDBusDataList first. For empty lists this method has to be used to make sure there is sufficient type information on the list's elements available for the binding's marshalling code.

Parameters:
list the list to encapsulate
Returns:
a data object of type List containing the list or an Invalid object if the list's type is Invalid
See also:
toList()
Examples:
example-service.cpp.
static QDBusData QDBusData::fromObjectPath ( const QDBusObjectPath value  )  [static]

Creates a data object for the given object path value.

Parameters:
value the value to encapsulate
Returns:
a data object of type ObjectPath containing the value
See also:
toObjectPath()
static QDBusData QDBusData::fromObjectPathKeyMap ( const QDBusDataMap< QDBusObjectPath > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to ObjectPath.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toObjectPathKeyMap()
static QDBusData QDBusData::fromQValueList ( const QValueList< QDBusData > &  list  )  [static]

Creates a data object for the given list.

Warning:
All elements of the list have to be of the same Type

Convenience overload for fromList(), usually more straight forward to use because it doesn't require to create a QDBusDataList object first, however it can only handle lists which contain elements, for empty lists fromList() is the only option.

Parameters:
list the list to encapsulate
Returns:
a data object of type List containing the list or an Invalid object if the list is empty or if elements have different types.
See also:
toQValueList()
static QDBusData QDBusData::fromString ( const QString &  value  )  [static]

Creates a data object for the given string value.

Parameters:
value the value to encapsulate
Returns:
a data object of type String containing the value
See also:
toString()
Examples:
example-client.cpp.
static QDBusData QDBusData::fromStringKeyMap ( const QDBusDataMap< QString > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to String.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toStringKeyMap()
static QDBusData QDBusData::fromStruct ( const QValueList< QDBusData > &  memberList  )  [static]

Creates a data object for the given struct's memberList.

See the documentation of Struct for an example.

Parameters:
memberList the list of already encapsulated struct members
Returns:
a data object of type Struct containing the memberList
See also:
toStruct()
static QDBusData QDBusData::fromUInt16 ( Q_UINT16  value  )  [static]

Creates a data object for the given unsigned 16-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type UInt16 containing the value
See also:
toUInt16()
static QDBusData QDBusData::fromUInt16KeyMap ( const QDBusDataMap< Q_UINT16 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to UInt16.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toUInt16KeyMap()
static QDBusData QDBusData::fromUInt32 ( Q_UINT32  value  )  [static]

Creates a data object for the given unsigned 32-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type UInt32 containing the value
See also:
toUInt32()
static QDBusData QDBusData::fromUInt32KeyMap ( const QDBusDataMap< Q_UINT32 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to UInt32.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toUInt32KeyMap()
static QDBusData QDBusData::fromUInt64 ( Q_UINT64  value  )  [static]

Creates a data object for the given unsigned 64-bit integer value.

Parameters:
value the value to encapsulate
Returns:
a data object of type UInt64 containing the value
See also:
toUInt64()
static QDBusData QDBusData::fromUInt64KeyMap ( const QDBusDataMap< Q_UINT64 > &  map  )  [static]

Creates a data object for the given map.

Note:
The map is allowed to be empty but is required to have a valid value type

The resulting data object will have the keyType() set to UInt64.

Parameters:
map the map to encapsulate
Returns:
a data object of type Map containing the map or an Invalid object if the map's value type is Invalid
See also:
toUInt64KeyMap()
static QDBusData QDBusData::fromVariant ( const QDBusVariant value  )  [static]

Creates a data object for the given variant value.

Parameters:
value the value to encapsulate
Returns:
a data object of type Variant containing the value
See also:
toVariant()
bool QDBusData::isValid (  )  const [inline]

Checks whether the data object contains a valid content.

This is equal to checking type() for not being Invalid

Returns:
true if the data object is valid, otherwise false

References Invalid.

Type QDBusData::keyType (  )  const

Returns the Type of the key type for maps.

If the type of the data object is Map, this method returns the type of the map's key, String for a QDBusDataMap<QString>

If the type of the data object is not Map, it will return Invalid

Returns:
one of the values of the Type enum, Invalid if the object is not holding a Map
See also:
type()
typeName()
bool QDBusData::operator!= ( const QDBusData other  )  const

Checks if the given other data object is different from this instance.

Parameters:
other the object to compare with
Returns:
false if the two data objects are not equal, otherwise false
See also:
operator==()
QDBusData& QDBusData::operator= ( const QDBusData other  ) 

Copies a given other data object.

Since QDBusData is implicitly shared, both objects will have the same content and the last object to reference it will delete it.

Parameters:
other the object to copy
Returns:
a reference to this instance

Referenced by QDBusDataMap< T >::operator=().

bool QDBusData::operator== ( const QDBusData other  )  const

Checks if the given other data object is equal to this instance.

Two QDBusData object are considered equal if they reference the same shared content or have the same type and the content's equality operator says the contents are equal.

Parameters:
other the object to compare with
Returns:
true if the two data objects are equal, otherwise false
bool QDBusData::toBool ( bool *  ok = 0  )  const

Tries to get the encapsulated boolean value.

If the data object is not of type Bool this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Bool)
Returns:
the encapsulated boolean value or false if it fails
See also:
fromBool()
Q_UINT8 QDBusData::toByte ( bool *  ok = 0  )  const

Tries to get the encapsulated byte (unsigned char) value.

If the data object is not of type Byte this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Byte)
Returns:
the encapsulated byte (unsigned char) value or 0 if it fails
See also:
fromByte()
QDBusDataMap<Q_UINT8> QDBusData::toByteKeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not Byte this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not Byte)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromByteKeyMap()
double QDBusData::toDouble ( bool *  ok = 0  )  const

Tries to get the encapsulated double value.

If the data object is not of type Double this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Double)
Returns:
the encapsulated double value or 0.0 if it fails
See also:
fromDouble()
Q_INT16 QDBusData::toInt16 ( bool *  ok = 0  )  const

Tries to get the encapsulated signed 16-bit integer value.

If the data object is not of type Int16 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Int16)
Returns:
the encapsulated signed 16-bit integer value or 0 if it fails
See also:
fromInt16()
QDBusDataMap<Q_INT16> QDBusData::toInt16KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not Int16 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not Int16)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromInt16KeyMap()
Q_INT32 QDBusData::toInt32 ( bool *  ok = 0  )  const

Tries to get the encapsulated signed 32-bit integer value.

If the data object is not of type Int32 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Int32)
Returns:
the encapsulated signed 32-bit integer value or 0 if it fails
See also:
fromInt32()
QDBusDataMap<Q_INT32> QDBusData::toInt32KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not Int32 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not Int32)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromInt32KeyMap()
Q_INT64 QDBusData::toInt64 ( bool *  ok = 0  )  const

Tries to get the encapsulated signed 64-bit integer value.

If the data object is not of type Int64 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Int64)
Returns:
the encapsulated signed 64-bit integer value or 0 if it fails
See also:
fromInt64()
QDBusDataMap<Q_INT64> QDBusData::toInt64KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not Int64 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not Int64)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromInt64KeyMap()
QDBusDataList QDBusData::toList ( bool *  ok = 0  )  const

Tries to get the encapsulated list.

If the data object is not of type List this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type List)
Returns:
the encapsulated list or an empty and Invalid list if it fails
See also:
fromList()
QDBusObjectPath QDBusData::toObjectPath ( bool *  ok = 0  )  const

Tries to get the encapsulated object path value.

If the data object is not of type ObjectPath this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type ObjectPath)
Returns:
the encapsulated object path value or an empty and invalid object if it fails
See also:
fromObjectPath()
QDBusDataMap<QDBusObjectPath> QDBusData::toObjectPathKeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not ObjectPath this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not ObjectPath)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromObjectPathKeyMap()
QValueList<QDBusData> QDBusData::toQValueList ( bool *  ok = 0  )  const

Tries to get the encapsulated list.

Convenience overload for toList().

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type List)
Returns:
the encapsulated list or an empty and Invalid list if it fails
See also:
fromQValueList()
QString QDBusData::toString ( bool *  ok = 0  )  const

Tries to get the encapsulated string value.

If the data object is not of type String this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type String)
Returns:
the encapsulated string value or QString::null if it fails
See also:
fromString()
QDBusDataMap<QString> QDBusData::toStringKeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not String this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not String)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromStringKeyMap()
QValueList<QDBusData> QDBusData::toStruct ( bool *  ok = 0  )  const

Tries to get the encapsulated struct memberList.

If the data object is not of type Struct this will fail, i.e. the parameter ok will be set to false if present.

See the documentation of Struct for an example.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Struct)
Returns:
the encapsulated memberList or an empty list if it fails
See also:
fromStruct()
Q_UINT16 QDBusData::toUInt16 ( bool *  ok = 0  )  const

Tries to get the encapsulated unsigned 16-bit integer value.

If the data object is not of type UInt16 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type UInt16)
Returns:
the encapsulated unsigned 16-bit integer value or 0 if it fails
See also:
fromUInt16()
QDBusDataMap<Q_UINT16> QDBusData::toUInt16KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not UInt16 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not UInt16)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromUInt16KeyMap()
Q_UINT32 QDBusData::toUInt32 ( bool *  ok = 0  )  const

Tries to get the encapsulated unsigned 32-bit integer value.

If the data object is not of type UInt32 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type UInt32)
Returns:
the encapsulated unsigned 32-bit integer value or 0 if it fails
See also:
fromUInt32()
QDBusDataMap<Q_UINT32> QDBusData::toUInt32KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not UInt32 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not UInt32)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromUInt32KeyMap()
Q_UINT64 QDBusData::toUInt64 ( bool *  ok = 0  )  const

Tries to get the encapsulated unsigned 64-bit integer value.

If the data object is not of type UInt64 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type UInt64)
Returns:
the encapsulated unsigned 64-bit integer value or 0 if it fails
See also:
fromUInt64()
QDBusDataMap<Q_UINT64> QDBusData::toUInt64KeyMap ( bool *  ok = 0  )  const

Tries to get the encapsulated map.

If the data object is not of type Map or if its value type is not UInt64 this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Map or value type not UInt64)
Returns:
the encapsulated map or an empty and Invalid map if it fails
See also:
fromUInt64KeyMap()
QDBusVariant QDBusData::toVariant ( bool *  ok = 0  )  const

Tries to get the encapsulated variant value.

If the data object is not of type Variant this will fail, i.e. the parameter ok will be set to false if present.

Parameters:
ok optional pointer to a bool variable to store the success information in, i.e. will be set to true on success and to false if the conversion failed (not of type Variant)
Returns:
the encapsulated variant value or an empty variant if it fails
See also:
fromVariant()
Type QDBusData::type (  )  const

Returns the Type of the data object.

Returns:
one of the values of the Type enum
See also:
keyType()
typeName()

Referenced by QDBusDataMap< T >::insert().

static const char* QDBusData::typeName ( Type  type  )  [static]

Returns the string representation for the given type.

Parameters:
type the Type to get the string representation for
Returns:
an ASCII C-string for the given type
See also:
type()
typeName()
const char* QDBusData::typeName (  )  const [inline]

Returns the string representation of the object's Type.

Returns:
an ASCII C-string for the object's type
See also:
type()
typeName(Type)
Examples:
example-client.cpp.

References typeName().

Referenced by QDBusDataMap< T >::insert(), and typeName().


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

Generated by  doxygen 1.6.2