DBus-1-TQt 1.0
Loading...
Searching...
No Matches
TQT_DBusData Class Reference

#include <tqdbusdata.h>

+ Collaboration diagram for TQT_DBusData:

Classes

class  Private
 

Public Types

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

Public Member Functions

 TQT_DBusData ()
 
 TQT_DBusData (const TQT_DBusData &other)
 
 ~TQT_DBusData ()
 
TQT_DBusDataoperator= (const TQT_DBusData &other)
 
bool operator== (const TQT_DBusData &other) const
 
bool operator!= (const TQT_DBusData &other) const
 
bool isValid () const
 
Type type () const
 
Type keyType () const
 
const char * typeName () const
 
bool toBool (bool *ok=0) const
 
TQ_UINT8 toByte (bool *ok=0) const
 
TQ_INT16 toInt16 (bool *ok=0) const
 
TQ_UINT16 toUInt16 (bool *ok=0) const
 
TQ_INT32 toInt32 (bool *ok=0) const
 
TQ_UINT32 toUInt32 (bool *ok=0) const
 
TQ_INT64 toInt64 (bool *ok=0) const
 
TQ_UINT64 toUInt64 (bool *ok=0) const
 
double toDouble (bool *ok=0) const
 
TQString toString (bool *ok=0) const
 
TQT_DBusObjectPath toObjectPath (bool *ok=0) const
 
TQT_DBusUnixFd toUnixFd (bool *ok=0) const
 
TQT_DBusDataList toList (bool *ok=0) const
 
TQValueList< TQT_DBusDatatoTQValueList (bool *ok=0) const
 
TQValueList< TQT_DBusDatatoStruct (bool *ok=0) const
 
TQT_DBusVariant toVariant (bool *ok=0) const
 
TQT_DBusData getAsVariantData ()
 
TQT_DBusDataMap< TQ_UINT8 > toByteKeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_INT16 > toInt16KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_UINT16 > toUInt16KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_INT32 > toInt32KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_UINT32 > toUInt32KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_INT64 > toInt64KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQ_UINT64 > toUInt64KeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQString > toStringKeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQT_DBusObjectPathtoObjectPathKeyMap (bool *ok=0) const
 
TQT_DBusDataMap< TQT_DBusUnixFdtoUnixFdKeyMap (bool *ok=0) const
 
TQCString buildDBusSignature () const
 

Static Public Member Functions

static const char * typeName (Type type)
 
static TQT_DBusData fromBool (bool value)
 
static TQT_DBusData fromByte (TQ_UINT8 value)
 
static TQT_DBusData fromInt16 (TQ_INT16 value)
 
static TQT_DBusData fromUInt16 (TQ_UINT16 value)
 
static TQT_DBusData fromInt32 (TQ_INT32 value)
 
static TQT_DBusData fromUInt32 (TQ_UINT32 value)
 
static TQT_DBusData fromInt64 (TQ_INT64 value)
 
static TQT_DBusData fromUInt64 (TQ_UINT64 value)
 
static TQT_DBusData fromDouble (double value)
 
static TQT_DBusData fromString (const TQString &value)
 
static TQT_DBusData fromObjectPath (const TQT_DBusObjectPath &value)
 
static TQT_DBusData fromUnixFd (const TQT_DBusUnixFd &value)
 
static TQT_DBusData fromList (const TQT_DBusDataList &list)
 
static TQT_DBusData fromTQValueList (const TQValueList< TQT_DBusData > &list)
 
static TQT_DBusData fromStruct (const TQValueList< TQT_DBusData > &memberList)
 
static TQT_DBusData fromVariant (const TQT_DBusVariant &value)
 
static TQT_DBusData fromByteKeyMap (const TQT_DBusDataMap< TQ_UINT8 > &map)
 
static TQT_DBusData fromInt16KeyMap (const TQT_DBusDataMap< TQ_INT16 > &map)
 
static TQT_DBusData fromUInt16KeyMap (const TQT_DBusDataMap< TQ_UINT16 > &map)
 
static TQT_DBusData fromInt32KeyMap (const TQT_DBusDataMap< TQ_INT32 > &map)
 
static TQT_DBusData fromUInt32KeyMap (const TQT_DBusDataMap< TQ_UINT32 > &map)
 
static TQT_DBusData fromInt64KeyMap (const TQT_DBusDataMap< TQ_INT64 > &map)
 
static TQT_DBusData fromUInt64KeyMap (const TQT_DBusDataMap< TQ_UINT64 > &map)
 
static TQT_DBusData fromStringKeyMap (const TQT_DBusDataMap< TQString > &map)
 
static TQT_DBusData fromObjectPathKeyMap (const TQT_DBusDataMap< TQT_DBusObjectPath > &map)
 
static TQT_DBusData fromUnixFdKeyMap (const TQT_DBusDataMap< TQT_DBusUnixFd > &map)
 

Private Attributes

Privated
 

Detailed Description

Class for accurately representing D-Bus data types.

The TQT_DBusData class can be compared to TQt's TQVariant class, but specialized to contain data types used in D-Bus messages.

Like TQVariant objects of TQT_DBusData use implicit sharing, i.e. copying a TQT_DBusData 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 TQT_DBusData objects, e.g. a List can contain elements that are containers themselves, e.g. Map, Struct, Variant or even List again.

See also
TQT_DBusDataList
TQT_DBusDataMap
TQT_DBusDataConverter

Definition at line 58 of file tqdbusdata.h.

Member Enumeration Documentation

◆ Type

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

In order to provide correct mapping of C++ and TQt types and the data types used in D-Bus messages, TQT_DBusData 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 TQt container they are implemented with (TQValueList and TQMap respectively)

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

Base type for TQT_DBusData 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()
UnixFd 

Type when encapsulating a D-Bus unix file handle.

See also
fromUnixFd(), toUnixFd()
List 

Type when encapsulating a list of values.

The D-Bus type this maps to is called array but since the TQt container class used to implement this type is TQValueList (or rather TQT_DBusDataList), the TQT_DBusData 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++/TQt value type used in the converter methods is a TQValueList with type TQT_DBusData. For example a TQRect could be mapped like this:

TQRect rect(0, 0, 640, 480);
memberList << TQT_DBusData::fromInt32(rect.x());
memberList << TQT_DBusData::fromInt32(rect.y());
memberList << TQT_DBusData::fromInt32(rect.width());
memberList << TQT_DBusData::fromInt32(rect.height());
Class for accurately representing D-Bus data types.
Definition tqdbusdata.h:59
static TQT_DBusData fromStruct(const TQValueList< TQT_DBusData > &memberList)
Creates a data object for the given struct's memberList.
static TQT_DBusData fromInt32(TQ_INT32 value)
Creates a data object for the given signed 32-bit integer value.
TQT_DBusData()
Creates an empty, Invalid data object.

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 = TQRect(x, y, w, h);
TQValueList< TQT_DBusData > toStruct(bool *ok=0) const
Tries to get the encapsulated struct memberList.
Note
Empty structs, i.e. an empty member list, are not allowed
See also
fromStruct(), toStruct()
TQT_DBusDataConverter
Variant 

Type when encapsulating a special variable container value.

See TQT_DBusVariant 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 TQt container class used to implement this type is TQMap (or rather TQT_DBusDataMap), the TQT_DBusData 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()
fromUnixFdKeyMap(), toUnixFdKeyMap()

Definition at line 73 of file tqdbusdata.h.

74 {
84 Invalid = 0,
85
91 Bool,
92
98 Byte,
99
105 Int16,
106
112 UInt16,
113
119 Int32,
120
126 UInt32,
127
133 Int64,
134
140 UInt64,
141
147 Double,
148
156 String,
157
174
180 UnixFd,
181
196 List,
197
236 Struct,
237
245 Variant,
246
280 Map
281 };

Constructor & Destructor Documentation

◆ TQT_DBusData() [1/2]

TQT_DBusData::TQT_DBusData ( )

Creates an empty, Invalid data object.

Definition at line 176 of file tqdbusdata.cpp.

176 : d(new Private())
177{
178}
Private * d

◆ TQT_DBusData() [2/2]

TQT_DBusData::TQT_DBusData ( const TQT_DBusData other)

Copies a given other data object.

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

Parameters
otherthe object to copy

Definition at line 180 of file tqdbusdata.cpp.

180 : d(0)
181{
182 d = other.d;
183
184 d->ref();
185}

References d.

◆ ~TQT_DBusData()

TQT_DBusData::~TQT_DBusData ( )

Destroys the data object.

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

Definition at line 187 of file tqdbusdata.cpp.

188{
189 if (d->deref()) delete d;
190}

References d.

Member Function Documentation

◆ buildDBusSignature()

TQCString TQT_DBusData::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 TQT_DBusVariant 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

Definition at line 1034 of file tqdbusdata.cpp.

1035{
1036 TQCString signature;
1037
1038 switch (d->type)
1039 {
1040 case TQT_DBusData::List:
1041 {
1043 signature = DBUS_TYPE_ARRAY_AS_STRING;
1044 if (list->hasContainerItemType())
1045 signature += list->containerItemType().buildDBusSignature();
1046 else
1047 signature += qDBusTypeForTQT_DBusType(list->type());
1048 break;
1049 }
1050
1052 {
1053 signature += DBUS_STRUCT_BEGIN_CHAR;
1054
1055 TQValueList<TQT_DBusData>* memberList =
1057
1058 TQValueList<TQT_DBusData>::const_iterator it = (*memberList).begin();
1059 TQValueList<TQT_DBusData>::const_iterator endIt = (*memberList).end();
1060 for (; it != endIt; ++it)
1061 {
1062 signature += (*it).buildDBusSignature();
1063 }
1064 signature += DBUS_STRUCT_END_CHAR;
1065 break;
1066 }
1067
1068 case TQT_DBusData::Map:
1069 signature += DBUS_TYPE_ARRAY_AS_STRING;
1070 signature += DBUS_DICT_ENTRY_BEGIN_CHAR;
1071
1072 signature += qDBusTypeForTQT_DBusType(keyType());
1073
1074 switch (keyType())
1075 {
1076 case TQT_DBusData::Byte:
1077 signature += qDBusSignatureForMapValue<TQ_UINT8>(
1079 break;
1081 signature += qDBusSignatureForMapValue<TQ_INT16>(
1083 break;
1085 signature += qDBusSignatureForMapValue<TQ_UINT16>(
1087 break;
1089 signature += qDBusSignatureForMapValue<TQ_INT32>(
1091 break;
1093 signature += qDBusSignatureForMapValue<TQ_UINT32>(
1095 break;
1097 signature += qDBusSignatureForMapValue<TQ_INT64>(
1099 break;
1101 signature += qDBusSignatureForMapValue<TQ_UINT64>(
1103 break;
1105 signature += qDBusSignatureForMapValue<TQString>(
1107 break;
1109 signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>(
1111 break;
1113 signature += qDBusSignatureForMapValue<TQT_DBusUnixFd>(
1115 break;
1116 default:
1117 break;
1118 }
1119
1120 signature += DBUS_DICT_ENTRY_END_CHAR;
1121 break;
1122
1123 default:
1124 signature = qDBusTypeForTQT_DBusType(d->type);
1125 break;
1126 }
1127
1128 return signature;
1129}
union TQT_DBusData::Private::@0 value
Type keyType() const
Returns the Type of the key type for maps.
Class to transport lists of D-Bus data types.
Class to transport maps of D-Bus data types.
static const char * qDBusTypeForTQT_DBusType(TQT_DBusData::Type type)

References buildDBusSignature(), Byte, TQT_DBusDataList::containerItemType(), d, TQT_DBusDataList::hasContainerItemType(), Int16, Int32, Int64, keyType(), List, Map, ObjectPath, TQT_DBusData::Private::pointer, qDBusTypeForTQT_DBusType(), String, Struct, TQT_DBusData::Private::type, TQT_DBusDataList::type(), UInt16, UInt32, UInt64, UnixFd, and TQT_DBusData::Private::value.

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

◆ fromBool()

TQT_DBusData TQT_DBusData::fromBool ( bool  value)
static

Creates a data object for the given boolean value.

Parameters
valuethe value to encapsulate
Returns
a data object of type Bool containing the value
See also
toBool()

Definition at line 355 of file tqdbusdata.cpp.

356{
357 TQT_DBusData data;
358
359 data.d->type = TQT_DBusData::Bool;
360 data.d->value.boolValue = value;
361
362 return data;
363}

References Bool, TQT_DBusData::Private::boolValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromByte()

TQT_DBusData TQT_DBusData::fromByte ( TQ_UINT8  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type Byte containing the value
See also
toByte()

Definition at line 378 of file tqdbusdata.cpp.

379{
380 TQT_DBusData data;
381
382 data.d->type = TQT_DBusData::Byte;
383 data.d->value.byteValue = value;
384
385 return data;
386}

References Byte, TQT_DBusData::Private::byteValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromByteKeyMap()

TQT_DBusData TQT_DBusData::fromByteKeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 742 of file tqdbusdata.cpp.

743{
744 TQT_DBusData data;
745
746 data.d->type = TQT_DBusData::Map;
747 data.d->keyType = map.keyType();
748 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT8>(map);
749
750 return data;
751}
TQT_DBusData::Type keyType() const
Returns the key type of the map object.

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromDouble()

TQT_DBusData TQT_DBusData::fromDouble ( double  value)
static

Creates a data object for the given double value.

Parameters
valuethe value to encapsulate
Returns
a data object of type Double containing the value
See also
toDouble()

Definition at line 539 of file tqdbusdata.cpp.

540{
541 TQT_DBusData data;
542
544 data.d->value.doubleValue = value;
545
546 return data;
547}

References d, Double, TQT_DBusData::Private::doubleValue, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromInt16()

TQT_DBusData TQT_DBusData::fromInt16 ( TQ_INT16  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type Int16 containing the value
See also
toInt16()

Definition at line 401 of file tqdbusdata.cpp.

402{
403 TQT_DBusData data;
404
405 data.d->type = TQT_DBusData::Int16;
406 data.d->value.int16Value = value;
407
408 return data;
409}

References d, Int16, TQT_DBusData::Private::int16Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromInt16KeyMap()

TQT_DBusData TQT_DBusData::fromInt16KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 766 of file tqdbusdata.cpp.

767{
768 TQT_DBusData data;
769
770 data.d->type = TQT_DBusData::Map;
771 data.d->keyType = map.keyType();
772 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT16>(map);
773
774 return data;
775}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromInt32()

TQT_DBusData TQT_DBusData::fromInt32 ( TQ_INT32  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type Int32 containing the value
See also
toInt32()

Definition at line 447 of file tqdbusdata.cpp.

448{
449 TQT_DBusData data;
450
451 data.d->type = TQT_DBusData::Int32;
452 data.d->value.int32Value = value;
453
454 return data;
455}

References d, Int32, TQT_DBusData::Private::int32Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromInt32KeyMap()

TQT_DBusData TQT_DBusData::fromInt32KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 815 of file tqdbusdata.cpp.

816{
817 TQT_DBusData data;
818
819 data.d->type = TQT_DBusData::Map;
820 data.d->keyType = map.keyType();
821 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT32>(map);
822
823 return data;
824}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromInt64()

TQT_DBusData TQT_DBusData::fromInt64 ( TQ_INT64  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type Int64 containing the value
See also
toInt64()

Definition at line 493 of file tqdbusdata.cpp.

494{
495 TQT_DBusData data;
496
497 data.d->type = TQT_DBusData::Int64;
498 data.d->value.int64Value = value;
499
500 return data;
501}

References d, Int64, TQT_DBusData::Private::int64Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromInt64KeyMap()

TQT_DBusData TQT_DBusData::fromInt64KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 864 of file tqdbusdata.cpp.

865{
866 TQT_DBusData data;
867
868 data.d->type = TQT_DBusData::Map;
869 data.d->keyType = map.keyType();
870 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT64>(map);
871
872 return data;
873}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromList()

TQT_DBusData TQT_DBusData::fromList ( const TQT_DBusDataList 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 fromTQValueList() will usually be easier to use since it does not require to create a TQT_DBusDataList 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
listthe 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()

Definition at line 637 of file tqdbusdata.cpp.

638{
639 TQT_DBusData data;
640
641 if (list.type() == TQT_DBusData::Invalid) return data;
642
643 data.d->type = TQT_DBusData::List;
644 data.d->value.pointer = new TQT_DBusDataList(list);
645
646 return data;
647}
TQT_DBusData::Type type() const
Returns the element type of the list object.

References d, Invalid, List, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusDataList::type(), and TQT_DBusData::Private::value.

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

◆ fromObjectPath()

TQT_DBusData TQT_DBusData::fromObjectPath ( const TQT_DBusObjectPath value)
static

Creates a data object for the given object path value.

Parameters
valuethe value to encapsulate
Returns
a data object of type ObjectPath containing the value
See also
toObjectPath()

Definition at line 585 of file tqdbusdata.cpp.

586{
587 TQT_DBusData data;
588
589 if (value.isValid())
590 {
592 data.d->value.pointer = new TQT_DBusObjectPath(value);
593 }
594
595 return data;
596}
Class for representing D-Bus object paths.
bool isValid() const
Returns whether the current content is considered a valid object path.

References d, TQT_DBusObjectPath::isValid(), ObjectPath, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromObjectPathKeyMap()

TQT_DBusData TQT_DBusData::fromObjectPathKeyMap ( const TQT_DBusDataMap< TQT_DBusObjectPath > &  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
mapthe 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()

Definition at line 937 of file tqdbusdata.cpp.

938{
939 TQT_DBusData data;
940
941 data.d->type = TQT_DBusData::Map;
942 data.d->keyType = map.keyType();
944
945 return data;
946}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromString()

TQT_DBusData TQT_DBusData::fromString ( const TQString &  value)
static

Creates a data object for the given string value.

Parameters
valuethe value to encapsulate
Returns
a data object of type String containing the value
See also
toString()

Definition at line 562 of file tqdbusdata.cpp.

563{
564 TQT_DBusData data;
565
567 data.d->value.pointer = new TQString(value);
568
569 return data;
570}

References d, TQT_DBusData::Private::pointer, String, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromStringKeyMap()

TQT_DBusData TQT_DBusData::fromStringKeyMap ( const TQT_DBusDataMap< TQString > &  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
mapthe 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()

Definition at line 913 of file tqdbusdata.cpp.

914{
915 TQT_DBusData data;
916
917 data.d->type = TQT_DBusData::Map;
918 data.d->keyType = map.keyType();
919 data.d->value.pointer = new TQT_DBusDataMap<TQString>(map);
920
921 return data;
922}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromStruct()

TQT_DBusData TQT_DBusData::fromStruct ( const TQValueList< TQT_DBusData > &  memberList)
static

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

See the documentation of Struct for an example.

Parameters
memberListthe list of already encapsulated struct members
Returns
a data object of type Struct containing the memberList
See also
toStruct()

Definition at line 681 of file tqdbusdata.cpp.

682{
683 TQT_DBusData data;
684
685 TQValueList<TQT_DBusData>::const_iterator it = memberList.begin();
686 TQValueList<TQT_DBusData>::const_iterator endIt = memberList.end();
687 for (; it != endIt; ++it)
688 {
689 if ((*it).d->type == Invalid) return data;
690 }
691
693 data.d->value.pointer = new TQValueList<TQT_DBusData>(memberList);
694
695 return data;
696}

References d, Invalid, TQT_DBusData::Private::pointer, Struct, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromTQValueList()

TQT_DBusData TQT_DBusData::fromTQValueList ( const TQValueList< TQT_DBusData > &  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 TQT_DBusDataList object first, however it can only handle lists which contain elements, for empty lists fromList() is the only option.

Parameters
listthe 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
toTQValueList()

Definition at line 662 of file tqdbusdata.cpp.

663{
664 return fromList(TQT_DBusDataList(list));
665}
static TQT_DBusData fromList(const TQT_DBusDataList &list)
Creates a data object for the given list.

References fromList().

+ Here is the call graph for this function:

◆ fromUInt16()

TQT_DBusData TQT_DBusData::fromUInt16 ( TQ_UINT16  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type UInt16 containing the value
See also
toUInt16()

Definition at line 424 of file tqdbusdata.cpp.

425{
426 TQT_DBusData data;
427
429 data.d->value.uint16Value = value;
430
431 return data;
432}

References d, TQT_DBusData::Private::type, UInt16, TQT_DBusData::Private::uint16Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromUInt16KeyMap()

TQT_DBusData TQT_DBusData::fromUInt16KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 790 of file tqdbusdata.cpp.

791{
792 TQT_DBusData data;
793
794 data.d->type = TQT_DBusData::Map;
795 data.d->keyType = map.keyType();
796 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT16>(map);
797
798 return data;
799}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromUInt32()

TQT_DBusData TQT_DBusData::fromUInt32 ( TQ_UINT32  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type UInt32 containing the value
See also
toUInt32()

Definition at line 470 of file tqdbusdata.cpp.

471{
472 TQT_DBusData data;
473
475 data.d->value.uint32Value = value;
476
477 return data;
478}

References d, TQT_DBusData::Private::type, UInt32, TQT_DBusData::Private::uint32Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromUInt32KeyMap()

TQT_DBusData TQT_DBusData::fromUInt32KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 839 of file tqdbusdata.cpp.

840{
841 TQT_DBusData data;
842
843 data.d->type = TQT_DBusData::Map;
844 data.d->keyType = map.keyType();
845 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT32>(map);
846
847 return data;
848}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromUInt64()

TQT_DBusData TQT_DBusData::fromUInt64 ( TQ_UINT64  value)
static

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

Parameters
valuethe value to encapsulate
Returns
a data object of type UInt64 containing the value
See also
toUInt64()

Definition at line 516 of file tqdbusdata.cpp.

517{
518 TQT_DBusData data;
519
521 data.d->value.uint64Value = value;
522
523 return data;
524}

References d, TQT_DBusData::Private::type, UInt64, TQT_DBusData::Private::uint64Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ fromUInt64KeyMap()

TQT_DBusData TQT_DBusData::fromUInt64KeyMap ( const TQT_DBusDataMap< TQ_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
mapthe 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()

Definition at line 888 of file tqdbusdata.cpp.

889{
890 TQT_DBusData data;
891
892 data.d->type = TQT_DBusData::Map;
893 data.d->keyType = map.keyType();
894 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT64>(map);
895
896 return data;
897}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromUnixFd()

TQT_DBusData TQT_DBusData::fromUnixFd ( const TQT_DBusUnixFd value)
static

Creates a data object for the given unix file handle value.

Parameters
valuethe value to encapsulate
Returns
a data object of type UnixFd containing the value
See also
toUnixFd()

Definition at line 611 of file tqdbusdata.cpp.

612{
613 TQT_DBusData data;
614
615 if (value.isValid())
616 {
618 data.d->value.pointer = new TQT_DBusUnixFd(value);
619 }
620
621 return data;
622}
Class for representing D-Bus unix file handles.
bool isValid() const
Returns whether the current content is considered a valid unix file handle.

References d, TQT_DBusUnixFd::isValid(), TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, UnixFd, and TQT_DBusData::Private::value.

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

◆ fromUnixFdKeyMap()

TQT_DBusData TQT_DBusData::fromUnixFdKeyMap ( const TQT_DBusDataMap< TQT_DBusUnixFd > &  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 UnixFd.

Parameters
mapthe 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
toUnixFdhKeyMap()

Definition at line 962 of file tqdbusdata.cpp.

963{
964 TQT_DBusData data;
965
966 data.d->type = TQT_DBusData::Map;
967 data.d->keyType = map.keyType();
969
970 return data;
971}

References d, TQT_DBusData::Private::keyType, TQT_DBusDataMap< T >::keyType(), Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

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

◆ fromVariant()

TQT_DBusData TQT_DBusData::fromVariant ( const TQT_DBusVariant value)
static

Creates a data object for the given variant value.

Parameters
valuethe value to encapsulate
Returns
a data object of type Variant containing the value
See also
toVariant()

Definition at line 711 of file tqdbusdata.cpp.

712{
713 TQT_DBusData data;
714
716 data.d->value.pointer = new TQT_DBusVariant(value);
717
718 return data;
719}
Data type for representing a D-Bus variant.

References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusData::Private::value, and Variant.

+ Here is the caller graph for this function:

◆ getAsVariantData()

TQT_DBusData TQT_DBusData::getAsVariantData ( )

Creates a variant from this object and returns it as a TQT_DBusData object.

Returns
a data object of type Variant containing this object

Definition at line 734 of file tqdbusdata.cpp.

735{
736 TQT_DBusVariant variant;
737 variant.value = *this;
738 variant.signature = variant.value.buildDBusSignature();
739 return TQT_DBusData::fromVariant(variant);
740}
TQCString buildDBusSignature() const
Creates the data objects D-Bus signature.
static TQT_DBusData fromVariant(const TQT_DBusVariant &value)
Creates a data object for the given variant value.
TQT_DBusData value
The D-Bus data type to transport as a variant.
TQString signature
The D-Bus data signature of the data contained in value.

References buildDBusSignature(), fromVariant(), TQT_DBusVariant::signature, and TQT_DBusVariant::value.

+ Here is the call graph for this function:

◆ isValid()

bool TQT_DBusData::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

Definition at line 349 of file tqdbusdata.h.

349{ return type() != TQT_DBusData::Invalid; }
Type type() const
Returns the Type of the data object.

References Invalid.

+ Here is the caller graph for this function:

◆ keyType()

TQT_DBusData::Type TQT_DBusData::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 TQT_DBusDataMap<TQString>

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()

Definition at line 322 of file tqdbusdata.cpp.

323{
325
326 return d->keyType;
327}

References d, Invalid, TQT_DBusData::Private::keyType, Map, and TQT_DBusData::Private::type.

+ Here is the caller graph for this function:

◆ operator!=()

bool TQT_DBusData::operator!= ( const TQT_DBusData other) const

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

Parameters
otherthe object to compare with
Returns
false if the two data objects are not equal, otherwise false
See also
operator==()

Definition at line 312 of file tqdbusdata.cpp.

313{
314 return !operator==(other);
315}
bool operator==(const TQT_DBusData &other) const
Checks if the given other data object is equal to this instance.

References operator==().

+ Here is the call graph for this function:

◆ operator=()

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

Copies a given other data object.

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

Parameters
otherthe object to copy
Returns
a reference to this instance

Definition at line 192 of file tqdbusdata.cpp.

193{
194 if (&other == this) return *this;
195
196 if (d->deref()) delete d;
197
198 d = other.d;
199
200 d->ref();
201
202 return *this;
203}

References d.

◆ operator==()

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

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

Two TQT_DBusData 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
otherthe object to compare with
Returns
true if the two data objects are equal, otherwise false

Definition at line 205 of file tqdbusdata.cpp.

206{
207 if (&other == this) return true;
208
209 if (d == other.d) return true;
210
211 if (d->type == other.d->type)
212 {
213 switch (d->type)
214 {
216 return true;
217
219 return d->value.boolValue == other.d->value.boolValue;
220
222 return d->value.byteValue == other.d->value.byteValue;
223
225 return d->value.int16Value == other.d->value.int16Value;
226
228 return d->value.uint16Value == other.d->value.uint16Value;
229
231 return d->value.int32Value == other.d->value.int32Value;
232
234 return d->value.uint32Value == other.d->value.uint64Value;
235
237 return d->value.int64Value == other.d->value.int64Value;
238
240 return d->value.uint64Value == other.d->value.uint64Value;
241
243 // FIXME: should not compare doubles for equality like this
244 return d->value.doubleValue == other.d->value.doubleValue;
245
247 return toString() == other.toString();
248
250 return toObjectPath() == other.toObjectPath();
251
253 return toUnixFd() == other.toUnixFd();
254
256 return toList() == other.toList();
257
259 return toStruct() == other.toStruct();
260
262 return toVariant() == other.toVariant();
263
265 if (d->keyType != other.d->keyType) return false;
266
267 switch (d->keyType)
268 {
270 return toByteKeyMap() == other.toByteKeyMap();
271
273 return toInt16KeyMap() == other.toInt16KeyMap();
274
276 return toUInt16KeyMap() == other.toUInt16KeyMap();
277
279 return toInt32KeyMap() == other.toInt32KeyMap();
280
282 return toUInt32KeyMap() == other.toUInt32KeyMap();
283
285 return toInt64KeyMap() == other.toInt64KeyMap();
286
288 return toUInt64KeyMap() == other.toUInt64KeyMap();
289
291 return toStringKeyMap() == other.toStringKeyMap();
292
294 return toObjectPathKeyMap() == other.toObjectPathKeyMap();
295
297 return toUnixFdKeyMap() == other.toUnixFdKeyMap();
298
299 default:
300 tqFatal("TQT_DBusData operator== unhandled map key type %d(%s)",
302 break;
303 }
304
305 break;
306 }
307 }
308
309 return false;
310}
TQT_DBusDataMap< TQT_DBusUnixFd > toUnixFdKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusVariant toVariant(bool *ok=0) const
Tries to get the encapsulated variant value.
TQT_DBusUnixFd toUnixFd(bool *ok=0) const
Tries to get the encapsulated unix file handle value.
TQT_DBusDataMap< TQ_UINT64 > toUInt64KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQString toString(bool *ok=0) const
Tries to get the encapsulated string value.
TQT_DBusDataMap< TQ_INT16 > toInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataMap< TQ_UINT16 > toUInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataMap< TQ_UINT32 > toUInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataMap< TQString > toStringKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataMap< TQ_INT64 > toInt64KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusObjectPath toObjectPath(bool *ok=0) const
Tries to get the encapsulated object path value.
const char * typeName() const
Returns the string representation of the object's Type.
Definition tqdbusdata.h:385
TQT_DBusDataMap< TQ_UINT8 > toByteKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataMap< TQ_INT32 > toInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
TQT_DBusDataList toList(bool *ok=0) const
Tries to get the encapsulated list.
TQT_DBusDataMap< TQT_DBusObjectPath > toObjectPathKeyMap(bool *ok=0) const
Tries to get the encapsulated map.

References Bool, TQT_DBusData::Private::boolValue, Byte, TQT_DBusData::Private::byteValue, d, Double, TQT_DBusData::Private::doubleValue, Int16, TQT_DBusData::Private::int16Value, Int32, TQT_DBusData::Private::int32Value, Int64, TQT_DBusData::Private::int64Value, Invalid, TQT_DBusData::Private::keyType, List, Map, ObjectPath, String, Struct, toByteKeyMap(), toInt16KeyMap(), toInt32KeyMap(), toInt64KeyMap(), toList(), toObjectPath(), toObjectPathKeyMap(), toString(), toStringKeyMap(), toStruct(), toUInt16KeyMap(), toUInt32KeyMap(), toUInt64KeyMap(), toUnixFd(), toUnixFdKeyMap(), toVariant(), TQT_DBusData::Private::type, typeName(), UInt16, TQT_DBusData::Private::uint16Value, UInt32, TQT_DBusData::Private::uint32Value, UInt64, TQT_DBusData::Private::uint64Value, UnixFd, TQT_DBusData::Private::value, and Variant.

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

◆ toBool()

bool TQT_DBusData::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
okoptional 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()

Definition at line 365 of file tqdbusdata.cpp.

366{
367 if (d->type != TQT_DBusData::Bool)
368 {
369 if (ok != 0) *ok = false;
370 return false;
371 }
372
373 if (ok != 0) *ok = true;
374
375 return d->value.boolValue;
376}

References Bool, TQT_DBusData::Private::boolValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toByte()

TQ_UINT8 TQT_DBusData::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
okoptional 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()

Definition at line 388 of file tqdbusdata.cpp.

389{
390 if (d->type != TQT_DBusData::Byte)
391 {
392 if (ok != 0) *ok = false;
393 return 0;
394 }
395
396 if (ok != 0) *ok = true;
397
398 return d->value.byteValue;
399}

References Byte, TQT_DBusData::Private::byteValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toByteKeyMap()

TQT_DBusDataMap< TQ_UINT8 > TQT_DBusData::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
okoptional 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()

Definition at line 753 of file tqdbusdata.cpp.

754{
756 {
757 if (ok != 0) *ok = false;
759 }
760
761 if (ok != 0) *ok = true;
762
764}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toDouble()

double TQT_DBusData::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
okoptional 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()

Definition at line 549 of file tqdbusdata.cpp.

550{
552 {
553 if (ok != 0) *ok = false;
554 return 0.0;
555 }
556
557 if (ok != 0) *ok = true;
558
559 return d->value.doubleValue;
560}

References d, Double, TQT_DBusData::Private::doubleValue, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt16()

TQ_INT16 TQT_DBusData::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
okoptional 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()

Definition at line 411 of file tqdbusdata.cpp.

412{
413 if (d->type != TQT_DBusData::Int16)
414 {
415 if (ok != 0) *ok = false;
416 return 0;
417 }
418
419 if (ok != 0) *ok = true;
420
421 return d->value.int16Value;
422}

References d, Int16, TQT_DBusData::Private::int16Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt16KeyMap()

TQT_DBusDataMap< TQ_INT16 > TQT_DBusData::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
okoptional 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()

Definition at line 777 of file tqdbusdata.cpp.

778{
780 {
781 if (ok != 0) *ok = false;
783 }
784
785 if (ok != 0) *ok = true;
786
788}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt32()

TQ_INT32 TQT_DBusData::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
okoptional 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()

Definition at line 457 of file tqdbusdata.cpp.

458{
459 if (d->type != TQT_DBusData::Int32)
460 {
461 if (ok != 0) *ok = false;
462 return 0;
463 }
464
465 if (ok != 0) *ok = true;
466
467 return d->value.int32Value;
468}

References d, Int32, TQT_DBusData::Private::int32Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt32KeyMap()

TQT_DBusDataMap< TQ_INT32 > TQT_DBusData::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
okoptional 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()

Definition at line 826 of file tqdbusdata.cpp.

827{
829 {
830 if (ok != 0) *ok = false;
832 }
833
834 if (ok != 0) *ok = true;
835
837}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt64()

TQ_INT64 TQT_DBusData::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
okoptional 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()

Definition at line 503 of file tqdbusdata.cpp.

504{
505 if (d->type != TQT_DBusData::Int64)
506 {
507 if (ok != 0) *ok = false;
508 return 0;
509 }
510
511 if (ok != 0) *ok = true;
512
513 return d->value.int64Value;
514}

References d, Int64, TQT_DBusData::Private::int64Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toInt64KeyMap()

TQT_DBusDataMap< TQ_INT64 > TQT_DBusData::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
okoptional 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()

Definition at line 875 of file tqdbusdata.cpp.

876{
878 {
879 if (ok != 0) *ok = false;
881 }
882
883 if (ok != 0) *ok = true;
884
886}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toList()

TQT_DBusDataList TQT_DBusData::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
okoptional 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()

Definition at line 649 of file tqdbusdata.cpp.

650{
651 if (d->type != TQT_DBusData::List)
652 {
653 if (ok != 0) *ok = false;
654 return TQT_DBusDataList();
655 }
656
657 if (ok != 0) *ok = true;
658
659 return *((TQT_DBusDataList*)d->value.pointer);
660}

References d, List, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toObjectPath()

TQT_DBusObjectPath TQT_DBusData::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
okoptional 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()

Definition at line 598 of file tqdbusdata.cpp.

599{
601 {
602 if (ok != 0) *ok = false;
603 return TQT_DBusObjectPath();
604 }
605
606 if (ok != 0) *ok = true;
607
608 return *((TQT_DBusObjectPath*)d->value.pointer);
609}

References d, ObjectPath, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toObjectPathKeyMap()

TQT_DBusDataMap< TQT_DBusObjectPath > TQT_DBusData::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
okoptional 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()

Definition at line 948 of file tqdbusdata.cpp.

949{
950 if (d->type != TQT_DBusData::Map &&
952 {
953 if (ok != 0) *ok = false;
955 }
956
957 if (ok != 0) *ok = true;
958
960}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toString()

TQString TQT_DBusData::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
okoptional 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 TQString() if it fails
See also
fromString()

Definition at line 572 of file tqdbusdata.cpp.

573{
575 {
576 if (ok != 0) *ok = false;
577 return TQString();
578 }
579
580 if (ok != 0) *ok = true;
581
582 return *((TQString*)d->value.pointer);
583}

References d, TQT_DBusData::Private::pointer, String, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toStringKeyMap()

TQT_DBusDataMap< TQString > TQT_DBusData::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
okoptional 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()

Definition at line 924 of file tqdbusdata.cpp.

925{
927 {
928 if (ok != 0) *ok = false;
930 }
931
932 if (ok != 0) *ok = true;
933
935}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toStruct()

TQValueList< TQT_DBusData > TQT_DBusData::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
okoptional 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()

Definition at line 698 of file tqdbusdata.cpp.

699{
701 {
702 if (ok != 0) *ok = false;
704 }
705
706 if (ok != 0) *ok = true;
707
709}

References d, TQT_DBusData::Private::pointer, Struct, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toTQValueList()

TQValueList< TQT_DBusData > TQT_DBusData::toTQValueList ( bool *  ok = 0) const

Tries to get the encapsulated list.

Convenience overload for toList().

Parameters
okoptional 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
fromTQValueList()

Definition at line 667 of file tqdbusdata.cpp.

668{
669 bool internalOk = false;
670 TQT_DBusDataList list = toList(&internalOk);
671
672 if (!internalOk)
673 {
674 if (ok != 0) *ok = false;
676 }
677
678 return list.toTQValueList();
679}
TQValueList< TQT_DBusData > toTQValueList() const
Converts the list object into a TQValueList with TQT_DBusData elements.

References toList(), and TQT_DBusDataList::toTQValueList().

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

◆ toUInt16()

TQ_UINT16 TQT_DBusData::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
okoptional 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()

Definition at line 434 of file tqdbusdata.cpp.

435{
437 {
438 if (ok != 0) *ok = false;
439 return 0;
440 }
441
442 if (ok != 0) *ok = true;
443
444 return d->value.uint16Value;
445}

References d, TQT_DBusData::Private::type, UInt16, TQT_DBusData::Private::uint16Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUInt16KeyMap()

TQT_DBusDataMap< TQ_UINT16 > TQT_DBusData::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
okoptional 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()

Definition at line 801 of file tqdbusdata.cpp.

802{
803 if (d->type != TQT_DBusData::Map &&
805 {
806 if (ok != 0) *ok = false;
808 }
809
810 if (ok != 0) *ok = true;
811
813}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUInt32()

TQ_UINT32 TQT_DBusData::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
okoptional 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()

Definition at line 480 of file tqdbusdata.cpp.

481{
483 {
484 if (ok != 0) *ok = false;
485 return 0;
486 }
487
488 if (ok != 0) *ok = true;
489
490 return d->value.uint32Value;
491}

References d, TQT_DBusData::Private::type, UInt32, TQT_DBusData::Private::uint32Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUInt32KeyMap()

TQT_DBusDataMap< TQ_UINT32 > TQT_DBusData::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
okoptional 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()

Definition at line 850 of file tqdbusdata.cpp.

851{
852 if (d->type != TQT_DBusData::Map &&
854 {
855 if (ok != 0) *ok = false;
857 }
858
859 if (ok != 0) *ok = true;
860
862}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUInt64()

TQ_UINT64 TQT_DBusData::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
okoptional 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()

Definition at line 526 of file tqdbusdata.cpp.

527{
529 {
530 if (ok != 0) *ok = false;
531 return 0;
532 }
533
534 if (ok != 0) *ok = true;
535
536 return d->value.uint64Value;
537}

References d, TQT_DBusData::Private::type, UInt64, TQT_DBusData::Private::uint64Value, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUInt64KeyMap()

TQT_DBusDataMap< TQ_UINT64 > TQT_DBusData::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
okoptional 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()

Definition at line 899 of file tqdbusdata.cpp.

900{
901 if (d->type != TQT_DBusData::Map &&
903 {
904 if (ok != 0) *ok = false;
906 }
907
908 if (ok != 0) *ok = true;
909
911}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUnixFd()

TQT_DBusUnixFd TQT_DBusData::toUnixFd ( bool *  ok = 0) const

Tries to get the encapsulated unix file handle value.

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

Parameters
okoptional 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 UnixFd)
Returns
the encapsulated object path value or an empty and invalid object if it fails
See also
fromUnixFd()

Definition at line 624 of file tqdbusdata.cpp.

625{
627 {
628 if (ok != 0) *ok = false;
629 return TQT_DBusUnixFd();
630 }
631
632 if (ok != 0) *ok = true;
633
634 return *((TQT_DBusUnixFd*)d->value.pointer);
635}

References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, UnixFd, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toUnixFdKeyMap()

TQT_DBusDataMap< TQT_DBusUnixFd > TQT_DBusData::toUnixFdKeyMap ( 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 UnixFd this will fail, i.e. the parameter ok will be set to false if present.

Parameters
okoptional 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 UnixFd)
Returns
the encapsulated map or an empty and Invalid map if it fails
See also
fromUnixFdKeyMap()

Definition at line 973 of file tqdbusdata.cpp.

974{
975 if (d->type != TQT_DBusData::Map &&
977 {
978 if (ok != 0) *ok = false;
980 }
981
982 if (ok != 0) *ok = true;
983
985}

References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.

+ Here is the caller graph for this function:

◆ toVariant()

TQT_DBusVariant TQT_DBusData::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
okoptional 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()

Definition at line 721 of file tqdbusdata.cpp.

722{
724 {
725 if (ok != 0) *ok = false;
726 return TQT_DBusVariant();
727 }
728
729 if (ok != 0) *ok = true;
730
731 return *((TQT_DBusVariant*)d->value.pointer);
732}

References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusData::Private::value, and Variant.

+ Here is the caller graph for this function:

◆ type()

TQT_DBusData::Type TQT_DBusData::type ( ) const

Returns the Type of the data object.

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

Definition at line 317 of file tqdbusdata.cpp.

318{
319 return d->type;
320}

References d, and TQT_DBusData::Private::type.

+ Here is the caller graph for this function:

◆ typeName() [1/2]

const char * TQT_DBusData::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)

Definition at line 385 of file tqdbusdata.h.

385{ return typeName(type()); }

References typeName().

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

◆ typeName() [2/2]

const char * TQT_DBusData::typeName ( Type  type)
static

Returns the string representation for the given type.

Parameters
typethe Type to get the string representation for
Returns
an ASCII C-string for the given type
See also
type()
typeName()

Definition at line 329 of file tqdbusdata.cpp.

330{
331 switch (type)
332 {
333 case TQT_DBusData::Invalid: return "Invalid";
334 case TQT_DBusData::Bool: return "Bool";
335 case TQT_DBusData::Byte: return "Byte";
336 case TQT_DBusData::Int16: return "Int16";
337 case TQT_DBusData::UInt16: return "UInt16";
338 case TQT_DBusData::Int32: return "Int32";
339 case TQT_DBusData::UInt32: return "UInt32";
340 case TQT_DBusData::Int64: return "Int64";
341 case TQT_DBusData::UInt64: return "UInt64";
342 case TQT_DBusData::Double: return "Double";
343 case TQT_DBusData::String: return "String";
344 case TQT_DBusData::ObjectPath: return "ObjectPath";
345 case TQT_DBusData::UnixFd: return "UnixFd";
346 case TQT_DBusData::List: return "List";
347 case TQT_DBusData::Struct: return "Struct";
348 case TQT_DBusData::Variant: return "Variant";
349 case TQT_DBusData::Map: return "Map";
350 }
351
352 return 0;
353}

References Bool, Byte, Double, Int16, Int32, Int64, Invalid, List, Map, ObjectPath, String, Struct, type(), UInt16, UInt32, UInt64, UnixFd, and Variant.

+ Here is the call graph for this function:

Member Data Documentation

◆ d

Private* TQT_DBusData::d
private

Definition at line 1227 of file tqdbusdata.h.


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