DBus-1-TQt  1.0
TQT_DBusVariant Class Reference

#include <tqdbusvariant.h>

+ Collaboration diagram for TQT_DBusVariant:

Public Member Functions

 TQT_DBusVariant ()
 
 TQT_DBusVariant (const TQT_DBusVariant &other)
 
bool operator== (const TQT_DBusVariant &other) const
 
bool operator!= (const TQT_DBusVariant &other) const
 

Public Attributes

TQString signature
 
TQT_DBusData value
 

Detailed Description

Data type for representing a D-Bus variant.

When D-Bus methods or signal require that a paramater can have any of the D-Bus data types, a D-Bus variant can be used.

Basically a D-Bus variant includes the actual data and a D-Bus data signature to allow a receiver to determine the contents.

Since the TQT_DBusVariant's value member will already be fully de-marshalled, a receiver using this bindings can savely ignore the signature if it doesn't need it for a different purpose (e.g. logging).

However, when creating a TQT_DBusVariant object for sending, make sure the signature member is correctly setup, for example by using the value member's buildDBusSignature() method.

variant.value = TQT_DBusData::fromInt32(131719);
variant.signature = variant.value.buildDBusSignature();

Definition at line 56 of file tqdbusvariant.h.

Constructor & Destructor Documentation

◆ TQT_DBusVariant() [1/2]

TQT_DBusVariant::TQT_DBusVariant ( )
inline

Creates an empty variant object.

Definition at line 62 of file tqdbusvariant.h.

62 {}

◆ TQT_DBusVariant() [2/2]

TQT_DBusVariant::TQT_DBusVariant ( const TQT_DBusVariant other)
inline

Copies the given other variant object.

Parameters
otherthe variant object to copy from

Definition at line 69 of file tqdbusvariant.h.

70  {
71  signature = other.signature;
72  value = other.value;
73  }

References signature, and value.

Member Function Documentation

◆ operator!=()

bool TQT_DBusVariant::operator!= ( const TQT_DBusVariant other) const
inline

Checks if the given other variant is not equal to this one.

Parameters
otherthe variant object to compare with
Returns
true if either signature or value is different, otherwise false

Definition at line 98 of file tqdbusvariant.h.

99  {
100  if (&other == this) return false;
101 
102  return signature != other.signature || value != other.value;
103  }

References signature, and value.

◆ operator==()

bool TQT_DBusVariant::operator== ( const TQT_DBusVariant other) const
inline

Checks if the given other variant is equal to this one.

Parameters
otherthe variant object to compare with
Returns
true if both signature and value are equal, otherwise false

Definition at line 83 of file tqdbusvariant.h.

84  {
85  if (&other == this) return true;
86 
87  return signature == other.signature && value == other.value;
88  }

References signature, and value.

Member Data Documentation

◆ signature

TQString TQT_DBusVariant::signature

The D-Bus data signature of the data contained in value.

See also
TQT_DBusData::buildDBusSignature()

Definition at line 111 of file tqdbusvariant.h.

◆ value

TQT_DBusData TQT_DBusVariant::value

The D-Bus data type to transport as a variant.

Definition at line 116 of file tqdbusvariant.h.


The documentation for this class was generated from the following file:
TQT_DBusVariant::signature
TQString signature
The D-Bus data signature of the data contained in value.
Definition: tqdbusvariant.h:111
TQT_DBusData::fromInt32
static TQT_DBusData fromInt32(TQ_INT32 value)
Creates a data object for the given signed 32-bit integer value.
Definition: tqdbusdata.cpp:447
TQT_DBusVariant::value
TQT_DBusData value
The D-Bus data type to transport as a variant.
Definition: tqdbusvariant.h:116
TQT_DBusVariant
Data type for representing a D-Bus variant.
Definition: tqdbusvariant.h:56
TQT_DBusData::buildDBusSignature
TQCString buildDBusSignature() const
Creates the data objects D-Bus signature.
Definition: tqdbusdata.cpp:1034