Class for accurately representing D-Bus data types. More...
#include <tqdbusdata.h>
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_DBusData & | operator= (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_DBusData > | toTQValueList (bool *ok=0) const |
| TQValueList< TQT_DBusData > | toStruct (bool *ok=0) const |
| TQT_DBusVariant | toVariant (bool *ok=0) const |
| 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_DBusObjectPath > | toObjectPathKeyMap (bool *ok=0) const |
| TQT_DBusDataMap< TQT_DBusUnixFd > | toUnixFdKeyMap (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 | |
| Private * | d |
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.
Definition at line 58 of file tqdbusdata.h.
| enum TQT_DBusData::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)
| 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.
|
| Bool |
Type when encapsulating a boolean value.
|
| Byte |
Type when encapsulating a byte (unsigned char) value.
|
| Int16 |
Type when encapsulating a signed 16-bit integer value.
|
| UInt16 |
Type when encapsulating an unsigned 16-bit integer value.
|
| Int32 |
Type when encapsulating a signed 32-bit integer value.
|
| UInt32 |
Type when encapsulating an unsigned 32-bit integer value.
|
| Int64 |
Type when encapsulating a signed 64-bit integer value.
|
| UInt64 |
Type when encapsulating an unsigned 64-bit integer value.
|
| Double |
Type when encapsulating a double value.
|
| String |
Type when encapsulating a string value. All strings are converted to UTF-8 during transmission
|
| 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.
|
| UnixFd |
Type when encapsulating a D-Bus unix file handle.
|
| List |
Type when encapsulating a list of values. The D-Bus type this maps to is called 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.
|
| 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); TQValueList<TQT_DBusData> memberList; memberList << TQT_DBusData::fromInt32(rect.x()); memberList << TQT_DBusData::fromInt32(rect.y()); memberList << TQT_DBusData::fromInt32(rect.width()); memberList << TQT_DBusData::fromInt32(rect.height()); TQT_DBusData data = TQT_DBusData: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 = TQRect(x, y, w, h);
|
| Variant |
Type when encapsulating a special variable container value. See TQT_DBusVariant for details on variant usage.
|
| Map |
Type when encapsulating a map of keys to values. The D-Bus type this maps to is called 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.
|
Definition at line 73 of file tqdbusdata.h.
00074 { 00084 Invalid = 0, 00085 00091 Bool, 00092 00098 Byte, 00099 00105 Int16, 00106 00112 UInt16, 00113 00119 Int32, 00120 00126 UInt32, 00127 00133 Int64, 00134 00140 UInt64, 00141 00147 Double, 00148 00156 String, 00157 00173 ObjectPath, 00174 00180 UnixFd, 00181 00196 List, 00197 00236 Struct, 00237 00245 Variant, 00246 00280 Map 00281 };
| TQT_DBusData::TQT_DBusData | ( | ) |
Creates an empty, Invalid data object.
Definition at line 176 of file tqdbusdata.cpp.
00176 : d(new Private()) 00177 { 00178 }
| 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.
| other | the object to copy |
Definition at line 180 of file tqdbusdata.cpp.
References d.
| 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.
References d.
| 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.
Definition at line 1026 of file tqdbusdata.cpp.
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_DBusDataList::type(), TQT_DBusData::Private::type, UInt16, UInt32, UInt64, UnixFd, and TQT_DBusData::Private::value.
01027 { 01028 TQCString signature; 01029 01030 switch (d->type) 01031 { 01032 case TQT_DBusData::List: 01033 { 01034 TQT_DBusDataList* list = (TQT_DBusDataList*) d->value.pointer; 01035 signature = DBUS_TYPE_ARRAY_AS_STRING; 01036 if (list->hasContainerItemType()) 01037 signature += list->containerItemType().buildDBusSignature(); 01038 else 01039 signature += qDBusTypeForTQT_DBusType(list->type()); 01040 break; 01041 } 01042 01043 case TQT_DBusData::Struct: 01044 { 01045 signature += DBUS_STRUCT_BEGIN_CHAR; 01046 01047 TQValueList<TQT_DBusData>* memberList = 01048 (TQValueList<TQT_DBusData>*) d->value.pointer; 01049 01050 TQValueList<TQT_DBusData>::const_iterator it = (*memberList).begin(); 01051 TQValueList<TQT_DBusData>::const_iterator endIt = (*memberList).end(); 01052 for (; it != endIt; ++it) 01053 { 01054 signature += (*it).buildDBusSignature(); 01055 } 01056 signature += DBUS_STRUCT_END_CHAR; 01057 break; 01058 } 01059 01060 case TQT_DBusData::Map: 01061 signature += DBUS_TYPE_ARRAY_AS_STRING; 01062 signature += DBUS_DICT_ENTRY_BEGIN_CHAR; 01063 01064 signature += qDBusTypeForTQT_DBusType(keyType()); 01065 01066 switch (keyType()) 01067 { 01068 case TQT_DBusData::Byte: 01069 signature += qDBusSignatureForMapValue<TQ_UINT8>( 01070 *((TQT_DBusDataMap<TQ_UINT8>*) d->value.pointer)); 01071 break; 01072 case TQT_DBusData::Int16: 01073 signature += qDBusSignatureForMapValue<TQ_INT16>( 01074 *((TQT_DBusDataMap<TQ_INT16>*) d->value.pointer)); 01075 break; 01076 case TQT_DBusData::UInt16: 01077 signature += qDBusSignatureForMapValue<TQ_UINT16>( 01078 *((TQT_DBusDataMap<TQ_UINT16>*) d->value.pointer)); 01079 break; 01080 case TQT_DBusData::Int32: 01081 signature += qDBusSignatureForMapValue<TQ_INT32>( 01082 *((TQT_DBusDataMap<TQ_INT32>*) d->value.pointer)); 01083 break; 01084 case TQT_DBusData::UInt32: 01085 signature += qDBusSignatureForMapValue<TQ_UINT32>( 01086 *((TQT_DBusDataMap<TQ_UINT32>*) d->value.pointer)); 01087 break; 01088 case TQT_DBusData::Int64: 01089 signature += qDBusSignatureForMapValue<TQ_INT64>( 01090 *((TQT_DBusDataMap<TQ_INT64>*) d->value.pointer)); 01091 break; 01092 case TQT_DBusData::UInt64: 01093 signature += qDBusSignatureForMapValue<TQ_UINT64>( 01094 *((TQT_DBusDataMap<TQ_UINT64>*) d->value.pointer)); 01095 break; 01096 case TQT_DBusData::String: 01097 signature += qDBusSignatureForMapValue<TQString>( 01098 *((TQT_DBusDataMap<TQString>*) d->value.pointer)); 01099 break; 01100 case TQT_DBusData::ObjectPath: 01101 signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>( 01102 *((TQT_DBusDataMap<TQT_DBusObjectPath>*) d->value.pointer)); 01103 break; 01104 case TQT_DBusData::UnixFd: 01105 signature += qDBusSignatureForMapValue<TQT_DBusUnixFd>( 01106 *((TQT_DBusDataMap<TQT_DBusUnixFd>*) d->value.pointer)); 01107 break; 01108 default: 01109 break; 01110 } 01111 01112 signature += DBUS_DICT_ENTRY_END_CHAR; 01113 break; 01114 01115 default: 01116 signature = qDBusTypeForTQT_DBusType(d->type); 01117 break; 01118 } 01119 01120 return signature; 01121 }
| TQT_DBusData TQT_DBusData::fromBool | ( | bool | value | ) | [static] |
Creates a data object for the given boolean value.
| value | the value to encapsulate |
value Definition at line 355 of file tqdbusdata.cpp.
References Bool, TQT_DBusData::Private::boolValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00356 { 00357 TQT_DBusData data; 00358 00359 data.d->type = TQT_DBusData::Bool; 00360 data.d->value.boolValue = value; 00361 00362 return data; 00363 }
| TQT_DBusData TQT_DBusData::fromByte | ( | TQ_UINT8 | value | ) | [static] |
Creates a data object for the given byte (unsigned char) value.
| value | the value to encapsulate |
value Definition at line 378 of file tqdbusdata.cpp.
References Byte, TQT_DBusData::Private::byteValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00379 { 00380 TQT_DBusData data; 00381 00382 data.d->type = TQT_DBusData::Byte; 00383 data.d->value.byteValue = value; 00384 00385 return data; 00386 }
| TQT_DBusData TQT_DBusData::fromByteKeyMap | ( | const TQT_DBusDataMap< TQ_UINT8 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to Byte.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 734 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00735 { 00736 TQT_DBusData data; 00737 00738 data.d->type = TQT_DBusData::Map; 00739 data.d->keyType = map.keyType(); 00740 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT8>(map); 00741 00742 return data; 00743 }
| TQT_DBusData TQT_DBusData::fromDouble | ( | double | value | ) | [static] |
Creates a data object for the given double value.
| value | the value to encapsulate |
value Definition at line 539 of file tqdbusdata.cpp.
References d, Double, TQT_DBusData::Private::doubleValue, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00540 { 00541 TQT_DBusData data; 00542 00543 data.d->type = TQT_DBusData::Double; 00544 data.d->value.doubleValue = value; 00545 00546 return data; 00547 }
| TQT_DBusData TQT_DBusData::fromInt16 | ( | TQ_INT16 | value | ) | [static] |
Creates a data object for the given signed 16-bit integer value.
| value | the value to encapsulate |
value Definition at line 401 of file tqdbusdata.cpp.
References d, Int16, TQT_DBusData::Private::int16Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00402 { 00403 TQT_DBusData data; 00404 00405 data.d->type = TQT_DBusData::Int16; 00406 data.d->value.int16Value = value; 00407 00408 return data; 00409 }
| TQT_DBusData TQT_DBusData::fromInt16KeyMap | ( | const TQT_DBusDataMap< TQ_INT16 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to Int16.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 758 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00759 { 00760 TQT_DBusData data; 00761 00762 data.d->type = TQT_DBusData::Map; 00763 data.d->keyType = map.keyType(); 00764 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT16>(map); 00765 00766 return data; 00767 }
| TQT_DBusData TQT_DBusData::fromInt32 | ( | TQ_INT32 | value | ) | [static] |
Creates a data object for the given signed 32-bit integer value.
| value | the value to encapsulate |
value Definition at line 447 of file tqdbusdata.cpp.
References d, Int32, TQT_DBusData::Private::int32Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00448 { 00449 TQT_DBusData data; 00450 00451 data.d->type = TQT_DBusData::Int32; 00452 data.d->value.int32Value = value; 00453 00454 return data; 00455 }
| TQT_DBusData TQT_DBusData::fromInt32KeyMap | ( | const TQT_DBusDataMap< TQ_INT32 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to Int32.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 807 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00808 { 00809 TQT_DBusData data; 00810 00811 data.d->type = TQT_DBusData::Map; 00812 data.d->keyType = map.keyType(); 00813 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT32>(map); 00814 00815 return data; 00816 }
| TQT_DBusData TQT_DBusData::fromInt64 | ( | TQ_INT64 | value | ) | [static] |
Creates a data object for the given signed 64-bit integer value.
| value | the value to encapsulate |
value Definition at line 493 of file tqdbusdata.cpp.
References d, Int64, TQT_DBusData::Private::int64Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00494 { 00495 TQT_DBusData data; 00496 00497 data.d->type = TQT_DBusData::Int64; 00498 data.d->value.int64Value = value; 00499 00500 return data; 00501 }
| TQT_DBusData TQT_DBusData::fromInt64KeyMap | ( | const TQT_DBusDataMap< TQ_INT64 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to Int64.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 856 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00857 { 00858 TQT_DBusData data; 00859 00860 data.d->type = TQT_DBusData::Map; 00861 data.d->keyType = map.keyType(); 00862 data.d->value.pointer = new TQT_DBusDataMap<TQ_INT64>(map); 00863 00864 return data; 00865 }
| TQT_DBusData TQT_DBusData::fromList | ( | const TQT_DBusDataList & | list | ) | [static] |
Creates a data object for the given list.
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.
| list | the list to encapsulate |
list or an Invalid object if the list's type is InvalidDefinition at line 637 of file tqdbusdata.cpp.
References d, Invalid, List, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusDataList::type(), and TQT_DBusData::Private::value.
00638 { 00639 TQT_DBusData data; 00640 00641 if (list.type() == TQT_DBusData::Invalid) return data; 00642 00643 data.d->type = TQT_DBusData::List; 00644 data.d->value.pointer = new TQT_DBusDataList(list); 00645 00646 return data; 00647 }
| TQT_DBusData TQT_DBusData::fromObjectPath | ( | const TQT_DBusObjectPath & | value | ) | [static] |
Creates a data object for the given object path value.
| value | the value to encapsulate |
value Definition at line 585 of file tqdbusdata.cpp.
References d, TQT_DBusObjectPath::isValid(), ObjectPath, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00586 { 00587 TQT_DBusData data; 00588 00589 if (value.isValid()) 00590 { 00591 data.d->type = TQT_DBusData::ObjectPath; 00592 data.d->value.pointer = new TQT_DBusObjectPath(value); 00593 } 00594 00595 return data; 00596 }
| TQT_DBusData TQT_DBusData::fromObjectPathKeyMap | ( | const TQT_DBusDataMap< TQT_DBusObjectPath > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to ObjectPath.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 929 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00930 { 00931 TQT_DBusData data; 00932 00933 data.d->type = TQT_DBusData::Map; 00934 data.d->keyType = map.keyType(); 00935 data.d->value.pointer = new TQT_DBusDataMap<TQT_DBusObjectPath>(map); 00936 00937 return data; 00938 }
| TQT_DBusData TQT_DBusData::fromString | ( | const TQString & | value | ) | [static] |
Creates a data object for the given string value.
| value | the value to encapsulate |
value Definition at line 562 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, String, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00563 { 00564 TQT_DBusData data; 00565 00566 data.d->type = TQT_DBusData::String; 00567 data.d->value.pointer = new TQString(value); 00568 00569 return data; 00570 }
| TQT_DBusData TQT_DBusData::fromStringKeyMap | ( | const TQT_DBusDataMap< TQString > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to String.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 905 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00906 { 00907 TQT_DBusData data; 00908 00909 data.d->type = TQT_DBusData::Map; 00910 data.d->keyType = map.keyType(); 00911 data.d->value.pointer = new TQT_DBusDataMap<TQString>(map); 00912 00913 return data; 00914 }
| 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.
| memberList | the list of already encapsulated struct members |
memberList Definition at line 681 of file tqdbusdata.cpp.
References d, Invalid, TQT_DBusData::Private::pointer, Struct, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00682 { 00683 TQT_DBusData data; 00684 00685 TQValueList<TQT_DBusData>::const_iterator it = memberList.begin(); 00686 TQValueList<TQT_DBusData>::const_iterator endIt = memberList.end(); 00687 for (; it != endIt; ++it) 00688 { 00689 if ((*it).d->type == Invalid) return data; 00690 } 00691 00692 data.d->type = TQT_DBusData::Struct; 00693 data.d->value.pointer = new TQValueList<TQT_DBusData>(memberList); 00694 00695 return data; 00696 }
| TQT_DBusData TQT_DBusData::fromTQValueList | ( | const TQValueList< TQT_DBusData > & | list | ) | [static] |
Creates a data object for the given list.
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.
| list | the list to encapsulate |
list or an Invalid object if the list is empty or if elements have different types.Definition at line 662 of file tqdbusdata.cpp.
References fromList().
00663 { 00664 return fromList(TQT_DBusDataList(list)); 00665 }
| TQT_DBusData TQT_DBusData::fromUInt16 | ( | TQ_UINT16 | value | ) | [static] |
Creates a data object for the given unsigned 16-bit integer value.
| value | the value to encapsulate |
value Definition at line 424 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt16, TQT_DBusData::Private::uint16Value, and TQT_DBusData::Private::value.
00425 { 00426 TQT_DBusData data; 00427 00428 data.d->type = TQT_DBusData::UInt16; 00429 data.d->value.uint16Value = value; 00430 00431 return data; 00432 }
| TQT_DBusData TQT_DBusData::fromUInt16KeyMap | ( | const TQT_DBusDataMap< TQ_UINT16 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to UInt16.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 782 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00783 { 00784 TQT_DBusData data; 00785 00786 data.d->type = TQT_DBusData::Map; 00787 data.d->keyType = map.keyType(); 00788 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT16>(map); 00789 00790 return data; 00791 }
| TQT_DBusData TQT_DBusData::fromUInt32 | ( | TQ_UINT32 | value | ) | [static] |
Creates a data object for the given unsigned 32-bit integer value.
| value | the value to encapsulate |
value Definition at line 470 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt32, TQT_DBusData::Private::uint32Value, and TQT_DBusData::Private::value.
00471 { 00472 TQT_DBusData data; 00473 00474 data.d->type = TQT_DBusData::UInt32; 00475 data.d->value.uint32Value = value; 00476 00477 return data; 00478 }
| TQT_DBusData TQT_DBusData::fromUInt32KeyMap | ( | const TQT_DBusDataMap< TQ_UINT32 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to UInt32.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 831 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00832 { 00833 TQT_DBusData data; 00834 00835 data.d->type = TQT_DBusData::Map; 00836 data.d->keyType = map.keyType(); 00837 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT32>(map); 00838 00839 return data; 00840 }
| TQT_DBusData TQT_DBusData::fromUInt64 | ( | TQ_UINT64 | value | ) | [static] |
Creates a data object for the given unsigned 64-bit integer value.
| value | the value to encapsulate |
value Definition at line 516 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt64, TQT_DBusData::Private::uint64Value, and TQT_DBusData::Private::value.
00517 { 00518 TQT_DBusData data; 00519 00520 data.d->type = TQT_DBusData::UInt64; 00521 data.d->value.uint64Value = value; 00522 00523 return data; 00524 }
| TQT_DBusData TQT_DBusData::fromUInt64KeyMap | ( | const TQT_DBusDataMap< TQ_UINT64 > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to UInt64.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 880 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00881 { 00882 TQT_DBusData data; 00883 00884 data.d->type = TQT_DBusData::Map; 00885 data.d->keyType = map.keyType(); 00886 data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT64>(map); 00887 00888 return data; 00889 }
| TQT_DBusData TQT_DBusData::fromUnixFd | ( | const TQT_DBusUnixFd & | value | ) | [static] |
Creates a data object for the given unix file handle value.
| value | the value to encapsulate |
value Definition at line 611 of file tqdbusdata.cpp.
References d, TQT_DBusUnixFd::isValid(), TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, UnixFd, and TQT_DBusData::Private::value.
00612 { 00613 TQT_DBusData data; 00614 00615 if (value.isValid()) 00616 { 00617 data.d->type = TQT_DBusData::UnixFd; 00618 data.d->value.pointer = new TQT_DBusUnixFd(value); 00619 } 00620 00621 return data; 00622 }
| TQT_DBusData TQT_DBusData::fromUnixFdKeyMap | ( | const TQT_DBusDataMap< TQT_DBusUnixFd > & | map | ) | [static] |
Creates a data object for the given map.
The resulting data object will have the keyType() set to UnixFd.
| map | the map to encapsulate |
map or an Invalid object if the map's value type is InvalidDefinition at line 954 of file tqdbusdata.cpp.
References d, TQT_DBusDataMap< T >::keyType(), TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00955 { 00956 TQT_DBusData data; 00957 00958 data.d->type = TQT_DBusData::Map; 00959 data.d->keyType = map.keyType(); 00960 data.d->value.pointer = new TQT_DBusDataMap<TQT_DBusUnixFd>(map); 00961 00962 return data; 00963 }
| TQT_DBusData TQT_DBusData::fromVariant | ( | const TQT_DBusVariant & | value | ) | [static] |
Creates a data object for the given variant value.
| value | the value to encapsulate |
value Definition at line 711 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusData::Private::value, and Variant.
00712 { 00713 TQT_DBusData data; 00714 00715 data.d->type = TQT_DBusData::Variant; 00716 data.d->value.pointer = new TQT_DBusVariant(value); 00717 00718 return data; 00719 }
| 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
true if the data object is valid, otherwise false Definition at line 349 of file tqdbusdata.h.
References Invalid.
00349 { return type() != TQT_DBusData::Invalid; }
| 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
Definition at line 322 of file tqdbusdata.cpp.
References d, Invalid, TQT_DBusData::Private::keyType, Map, and TQT_DBusData::Private::type.
00323 { 00324 if (d->type != TQT_DBusData::Map) return TQT_DBusData::Invalid; 00325 00326 return d->keyType; 00327 }
| bool TQT_DBusData::operator!= | ( | const TQT_DBusData & | other | ) | const |
Checks if the given other data object is different from this instance.
| other | the object to compare with |
false if the two data objects are not equal, otherwise false Definition at line 312 of file tqdbusdata.cpp.
References operator==().
00313 { 00314 return !operator==(other); 00315 }
| 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.
| other | the object to copy |
Definition at line 192 of file tqdbusdata.cpp.
References d.
00193 { 00194 if (&other == this) return *this; 00195 00196 if (d->deref()) delete d; 00197 00198 d = other.d; 00199 00200 d->ref(); 00201 00202 return *this; 00203 }
| 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.
| other | the object to compare with |
true if the two data objects are equal, otherwise false Definition at line 205 of file tqdbusdata.cpp.
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.
00206 { 00207 if (&other == this) return true; 00208 00209 if (d == other.d) return true; 00210 00211 if (d->type == other.d->type) 00212 { 00213 switch (d->type) 00214 { 00215 case TQT_DBusData::Invalid: 00216 return true; 00217 00218 case TQT_DBusData::Bool: 00219 return d->value.boolValue == other.d->value.boolValue; 00220 00221 case TQT_DBusData::Byte: 00222 return d->value.byteValue == other.d->value.byteValue; 00223 00224 case TQT_DBusData::Int16: 00225 return d->value.int16Value == other.d->value.int16Value; 00226 00227 case TQT_DBusData::UInt16: 00228 return d->value.uint16Value == other.d->value.uint16Value; 00229 00230 case TQT_DBusData::Int32: 00231 return d->value.int32Value == other.d->value.int32Value; 00232 00233 case TQT_DBusData::UInt32: 00234 return d->value.uint32Value == other.d->value.uint64Value; 00235 00236 case TQT_DBusData::Int64: 00237 return d->value.int64Value == other.d->value.int64Value; 00238 00239 case TQT_DBusData::UInt64: 00240 return d->value.uint64Value == other.d->value.uint64Value; 00241 00242 case TQT_DBusData::Double: 00243 // FIXME: should not compare doubles for equality like this 00244 return d->value.doubleValue == other.d->value.doubleValue; 00245 00246 case TQT_DBusData::String: 00247 return toString() == other.toString(); 00248 00249 case TQT_DBusData::ObjectPath: 00250 return toObjectPath() == other.toObjectPath(); 00251 00252 case TQT_DBusData::UnixFd: 00253 return toUnixFd() == other.toUnixFd(); 00254 00255 case TQT_DBusData::List: 00256 return toList() == other.toList(); 00257 00258 case TQT_DBusData::Struct: 00259 return toStruct() == other.toStruct(); 00260 00261 case TQT_DBusData::Variant: 00262 return toVariant() == other.toVariant(); 00263 00264 case TQT_DBusData::Map: 00265 if (d->keyType != other.d->keyType) return false; 00266 00267 switch (d->keyType) 00268 { 00269 case TQT_DBusData::Byte: 00270 return toByteKeyMap() == other.toByteKeyMap(); 00271 00272 case TQT_DBusData::Int16: 00273 return toInt16KeyMap() == other.toInt16KeyMap(); 00274 00275 case TQT_DBusData::UInt16: 00276 return toUInt16KeyMap() == other.toUInt16KeyMap(); 00277 00278 case TQT_DBusData::Int32: 00279 return toInt32KeyMap() == other.toInt32KeyMap(); 00280 00281 case TQT_DBusData::UInt32: 00282 return toUInt32KeyMap() == other.toUInt32KeyMap(); 00283 00284 case TQT_DBusData::Int64: 00285 return toInt64KeyMap() == other.toInt64KeyMap(); 00286 00287 case TQT_DBusData::UInt64: 00288 return toUInt64KeyMap() == other.toUInt64KeyMap(); 00289 00290 case TQT_DBusData::String: 00291 return toStringKeyMap() == other.toStringKeyMap(); 00292 00293 case TQT_DBusData::ObjectPath: 00294 return toObjectPathKeyMap() == other.toObjectPathKeyMap(); 00295 00296 case TQT_DBusData::UnixFd: 00297 return toUnixFdKeyMap() == other.toUnixFdKeyMap(); 00298 00299 default: 00300 tqFatal("TQT_DBusData operator== unhandled map key type %d(%s)", 00301 d->keyType, TQT_DBusData::typeName(d->keyType)); 00302 break; 00303 } 00304 00305 break; 00306 } 00307 } 00308 00309 return false; 00310 }
| 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.
| 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) |
false if it failsDefinition at line 365 of file tqdbusdata.cpp.
References Bool, TQT_DBusData::Private::boolValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00366 { 00367 if (d->type != TQT_DBusData::Bool) 00368 { 00369 if (ok != 0) *ok = false; 00370 return false; 00371 } 00372 00373 if (ok != 0) *ok = true; 00374 00375 return d->value.boolValue; 00376 }
| 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.
| 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) |
0 if it failsDefinition at line 388 of file tqdbusdata.cpp.
References Byte, TQT_DBusData::Private::byteValue, d, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00389 { 00390 if (d->type != TQT_DBusData::Byte) 00391 { 00392 if (ok != 0) *ok = false; 00393 return 0; 00394 } 00395 00396 if (ok != 0) *ok = true; 00397 00398 return d->value.byteValue; 00399 }
| 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.
| 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) |
Definition at line 745 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00746 { 00747 if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_UINT8>::m_keyType) 00748 { 00749 if (ok != 0) *ok = false; 00750 return TQT_DBusDataMap<TQ_UINT8>(); 00751 } 00752 00753 if (ok != 0) *ok = true; 00754 00755 return *((TQT_DBusDataMap<TQ_UINT8>*)d->value.pointer); 00756 }
| 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.
| 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) |
0.0 if it failsDefinition at line 549 of file tqdbusdata.cpp.
References d, Double, TQT_DBusData::Private::doubleValue, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00550 { 00551 if (d->type != TQT_DBusData::Double) 00552 { 00553 if (ok != 0) *ok = false; 00554 return 0.0; 00555 } 00556 00557 if (ok != 0) *ok = true; 00558 00559 return d->value.doubleValue; 00560 }
| 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.
| 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) |
0 if it failsDefinition at line 411 of file tqdbusdata.cpp.
References d, Int16, TQT_DBusData::Private::int16Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00412 { 00413 if (d->type != TQT_DBusData::Int16) 00414 { 00415 if (ok != 0) *ok = false; 00416 return 0; 00417 } 00418 00419 if (ok != 0) *ok = true; 00420 00421 return d->value.int16Value; 00422 }
| 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.
| 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) |
Definition at line 769 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00770 { 00771 if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT16>::m_keyType) 00772 { 00773 if (ok != 0) *ok = false; 00774 return TQT_DBusDataMap<TQ_INT16>(); 00775 } 00776 00777 if (ok != 0) *ok = true; 00778 00779 return *((TQT_DBusDataMap<TQ_INT16>*)d->value.pointer); 00780 }
| 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.
| 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) |
0 if it failsDefinition at line 457 of file tqdbusdata.cpp.
References d, Int32, TQT_DBusData::Private::int32Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00458 { 00459 if (d->type != TQT_DBusData::Int32) 00460 { 00461 if (ok != 0) *ok = false; 00462 return 0; 00463 } 00464 00465 if (ok != 0) *ok = true; 00466 00467 return d->value.int32Value; 00468 }
| 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.
| 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) |
Definition at line 818 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00819 { 00820 if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT32>::m_keyType) 00821 { 00822 if (ok != 0) *ok = false; 00823 return TQT_DBusDataMap<TQ_INT32>(); 00824 } 00825 00826 if (ok != 0) *ok = true; 00827 00828 return *((TQT_DBusDataMap<TQ_INT32>*)d->value.pointer); 00829 }
| 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.
| 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) |
0 if it failsDefinition at line 503 of file tqdbusdata.cpp.
References d, Int64, TQT_DBusData::Private::int64Value, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00504 { 00505 if (d->type != TQT_DBusData::Int64) 00506 { 00507 if (ok != 0) *ok = false; 00508 return 0; 00509 } 00510 00511 if (ok != 0) *ok = true; 00512 00513 return d->value.int64Value; 00514 }
| 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.
| 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) |
Definition at line 867 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00868 { 00869 if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQ_INT64>::m_keyType) 00870 { 00871 if (ok != 0) *ok = false; 00872 return TQT_DBusDataMap<TQ_INT64>(); 00873 } 00874 00875 if (ok != 0) *ok = true; 00876 00877 return *((TQT_DBusDataMap<TQ_INT64>*)d->value.pointer); 00878 }
| 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.
| 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) |
Definition at line 649 of file tqdbusdata.cpp.
References d, List, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00650 { 00651 if (d->type != TQT_DBusData::List) 00652 { 00653 if (ok != 0) *ok = false; 00654 return TQT_DBusDataList(); 00655 } 00656 00657 if (ok != 0) *ok = true; 00658 00659 return *((TQT_DBusDataList*)d->value.pointer); 00660 }
| 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.
| 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) |
Definition at line 598 of file tqdbusdata.cpp.
References d, ObjectPath, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00599 { 00600 if (d->type != TQT_DBusData::ObjectPath) 00601 { 00602 if (ok != 0) *ok = false; 00603 return TQT_DBusObjectPath(); 00604 } 00605 00606 if (ok != 0) *ok = true; 00607 00608 return *((TQT_DBusObjectPath*)d->value.pointer); 00609 }
| 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.
| 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) |
Definition at line 940 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00941 { 00942 if (d->type != TQT_DBusData::Map && 00943 d->keyType != TQT_DBusDataMap<TQT_DBusObjectPath>::m_keyType) 00944 { 00945 if (ok != 0) *ok = false; 00946 return TQT_DBusDataMap<TQT_DBusObjectPath>(); 00947 } 00948 00949 if (ok != 0) *ok = true; 00950 00951 return *((TQT_DBusDataMap<TQT_DBusObjectPath>*)d->value.pointer); 00952 }
| 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.
| 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) |
TQString() if it failsDefinition at line 572 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, String, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00573 { 00574 if (d->type != TQT_DBusData::String) 00575 { 00576 if (ok != 0) *ok = false; 00577 return TQString(); 00578 } 00579 00580 if (ok != 0) *ok = true; 00581 00582 return *((TQString*)d->value.pointer); 00583 }
| 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.
| 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) |
Definition at line 916 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00917 { 00918 if (d->type != TQT_DBusData::Map && d->keyType != TQT_DBusDataMap<TQString>::m_keyType) 00919 { 00920 if (ok != 0) *ok = false; 00921 return TQT_DBusDataMap<TQString>(); 00922 } 00923 00924 if (ok != 0) *ok = true; 00925 00926 return *((TQT_DBusDataMap<TQString>*)d->value.pointer); 00927 }
| 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.
| 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) |
Definition at line 698 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, Struct, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00699 { 00700 if (d->type != TQT_DBusData::Struct) 00701 { 00702 if (ok != 0) *ok = false; 00703 return TQValueList<TQT_DBusData>(); 00704 } 00705 00706 if (ok != 0) *ok = true; 00707 00708 return *((TQValueList<TQT_DBusData>*)d->value.pointer); 00709 }
| TQValueList< TQT_DBusData > TQT_DBusData::toTQValueList | ( | bool * | ok = 0 |
) | const |
Tries to get the encapsulated list.
Convenience overload for toList().
| 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) |
Definition at line 667 of file tqdbusdata.cpp.
References toList(), and TQT_DBusDataList::toTQValueList().
00668 { 00669 bool internalOk = false; 00670 TQT_DBusDataList list = toList(&internalOk); 00671 00672 if (!internalOk) 00673 { 00674 if (ok != 0) *ok = false; 00675 return TQValueList<TQT_DBusData>(); 00676 } 00677 00678 return list.toTQValueList(); 00679 }
| 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.
| 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) |
0 if it failsDefinition at line 434 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt16, TQT_DBusData::Private::uint16Value, and TQT_DBusData::Private::value.
00435 { 00436 if (d->type != TQT_DBusData::UInt16) 00437 { 00438 if (ok != 0) *ok = false; 00439 return 0; 00440 } 00441 00442 if (ok != 0) *ok = true; 00443 00444 return d->value.uint16Value; 00445 }
| 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.
| 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) |
Definition at line 793 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00794 { 00795 if (d->type != TQT_DBusData::Map && 00796 d->keyType != TQT_DBusDataMap<TQ_UINT16>::m_keyType) 00797 { 00798 if (ok != 0) *ok = false; 00799 return TQT_DBusDataMap<TQ_UINT16>(); 00800 } 00801 00802 if (ok != 0) *ok = true; 00803 00804 return *((TQT_DBusDataMap<TQ_UINT16>*)d->value.pointer); 00805 }
| 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.
| 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) |
0 if it failsDefinition at line 480 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt32, TQT_DBusData::Private::uint32Value, and TQT_DBusData::Private::value.
00481 { 00482 if (d->type != TQT_DBusData::UInt32) 00483 { 00484 if (ok != 0) *ok = false; 00485 return 0; 00486 } 00487 00488 if (ok != 0) *ok = true; 00489 00490 return d->value.uint32Value; 00491 }
| 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.
| 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) |
Definition at line 842 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00843 { 00844 if (d->type != TQT_DBusData::Map && 00845 d->keyType != TQT_DBusDataMap<TQ_UINT32>::m_keyType) 00846 { 00847 if (ok != 0) *ok = false; 00848 return TQT_DBusDataMap<TQ_UINT32>(); 00849 } 00850 00851 if (ok != 0) *ok = true; 00852 00853 return *((TQT_DBusDataMap<TQ_UINT32>*)d->value.pointer); 00854 }
| 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.
| 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) |
0 if it failsDefinition at line 526 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::type, UInt64, TQT_DBusData::Private::uint64Value, and TQT_DBusData::Private::value.
00527 { 00528 if (d->type != TQT_DBusData::UInt64) 00529 { 00530 if (ok != 0) *ok = false; 00531 return 0; 00532 } 00533 00534 if (ok != 0) *ok = true; 00535 00536 return d->value.uint64Value; 00537 }
| 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.
| 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) |
Definition at line 891 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00892 { 00893 if (d->type != TQT_DBusData::Map && 00894 d->keyType != TQT_DBusDataMap<TQ_UINT64>::m_keyType) 00895 { 00896 if (ok != 0) *ok = false; 00897 return TQT_DBusDataMap<TQ_UINT64>(); 00898 } 00899 00900 if (ok != 0) *ok = true; 00901 00902 return *((TQT_DBusDataMap<TQ_UINT64>*)d->value.pointer); 00903 }
| 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.
| 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 UnixFd) |
Definition at line 624 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, UnixFd, and TQT_DBusData::Private::value.
00625 { 00626 if (d->type != TQT_DBusData::UnixFd) 00627 { 00628 if (ok != 0) *ok = false; 00629 return TQT_DBusUnixFd(); 00630 } 00631 00632 if (ok != 0) *ok = true; 00633 00634 return *((TQT_DBusUnixFd*)d->value.pointer); 00635 }
| 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.
| 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 UnixFd) |
Definition at line 965 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::keyType, Map, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, and TQT_DBusData::Private::value.
00966 { 00967 if (d->type != TQT_DBusData::Map && 00968 d->keyType != TQT_DBusDataMap<TQT_DBusUnixFd>::m_keyType) 00969 { 00970 if (ok != 0) *ok = false; 00971 return TQT_DBusDataMap<TQT_DBusUnixFd>(); 00972 } 00973 00974 if (ok != 0) *ok = true; 00975 00976 return *((TQT_DBusDataMap<TQT_DBusUnixFd>*)d->value.pointer); 00977 }
| 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.
| 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) |
Definition at line 721 of file tqdbusdata.cpp.
References d, TQT_DBusData::Private::pointer, TQT_DBusData::Private::type, TQT_DBusData::Private::value, and Variant.
00722 { 00723 if (d->type != TQT_DBusData::Variant) 00724 { 00725 if (ok != 0) *ok = false; 00726 return TQT_DBusVariant(); 00727 } 00728 00729 if (ok != 0) *ok = true; 00730 00731 return *((TQT_DBusVariant*)d->value.pointer); 00732 }
| TQT_DBusData::Type TQT_DBusData::type | ( | ) | const |
Returns the Type of the data object.
Definition at line 317 of file tqdbusdata.cpp.
References d, and TQT_DBusData::Private::type.
| const char * TQT_DBusData::typeName | ( | Type | type | ) | [static] |
Returns the string representation for the given type.
| type | the Type to get the string representation for |
type Definition at line 329 of file tqdbusdata.cpp.
References Bool, Byte, Double, Int16, Int32, Int64, Invalid, List, Map, ObjectPath, String, Struct, UInt16, UInt32, UInt64, UnixFd, and Variant.
00330 { 00331 switch (type) 00332 { 00333 case TQT_DBusData::Invalid: return "Invalid"; 00334 case TQT_DBusData::Bool: return "Bool"; 00335 case TQT_DBusData::Byte: return "Byte"; 00336 case TQT_DBusData::Int16: return "Int16"; 00337 case TQT_DBusData::UInt16: return "UInt16"; 00338 case TQT_DBusData::Int32: return "Int32"; 00339 case TQT_DBusData::UInt32: return "UInt32"; 00340 case TQT_DBusData::Int64: return "Int64"; 00341 case TQT_DBusData::UInt64: return "UInt64"; 00342 case TQT_DBusData::Double: return "Double"; 00343 case TQT_DBusData::String: return "String"; 00344 case TQT_DBusData::ObjectPath: return "ObjectPath"; 00345 case TQT_DBusData::UnixFd: return "UnixFd"; 00346 case TQT_DBusData::List: return "List"; 00347 case TQT_DBusData::Struct: return "Struct"; 00348 case TQT_DBusData::Variant: return "Variant"; 00349 case TQT_DBusData::Map: return "Map"; 00350 } 00351 00352 return 0; 00353 }
| const char* TQT_DBusData::typeName | ( | ) | const [inline] |
Returns the string representation of the object's Type.
Definition at line 385 of file tqdbusdata.h.
References typeName().
Private* TQT_DBusData::d [private] |
Definition at line 1219 of file tqdbusdata.h.
1.6.3