DBus-1-TQt 1.0
|
#include <tqdbusdataconverter.h>
Public Types | |
enum | Result { Success , InvalidSignature , InvalidArgument } |
Static Public Member Functions | |
template<class T > | |
static Result | convertFromTQT_DBusData (const TQT_DBusData &dbusData, T &typeData) |
template<class T > | |
static Result | convertToTQT_DBusData (const T &typeData, TQT_DBusData &dbusData) |
template<> | |
TQT_DBusDataConverter::Result | convertFromTQT_DBusData (const TQT_DBusData &dbusData, TQRect &typeData) |
template<> | |
TQT_DBusDataConverter::Result | convertToTQT_DBusData (const TQRect &typeData, TQT_DBusData &dbusData) |
template<> | |
TQT_DBusDataConverter::Result | convertFromTQT_DBusData (const TQT_DBusData &dbusData, TQPoint &typeData) |
template<> | |
TQT_DBusDataConverter::Result | convertToTQT_DBusData (const TQPoint &typeData, TQT_DBusData &dbusData) |
template<> | |
TQT_DBusDataConverter::Result | convertFromTQT_DBusData (const TQT_DBusData &dbusData, TQSize &typeData) |
template<> | |
TQT_DBusDataConverter::Result | convertToTQT_DBusData (const TQSize &typeData, TQT_DBusData &dbusData) |
Template based converter for getting complex data into or from TQT_DBusData objects.
Any data to transport over D-Bus, i.e. method/signal paramaters or properties, need to be converted into a TQT_DBusData instance.
For complex types, e.g. structures or nested containers, this can be quite some code, and will likely be needed for more than one call. Therefore it is more convenient to implement the conversions once per complex type.
Example: sending and recieving a TQRect over D-Bus. In D-Bus terminology a TQRect is a struct of four 32-bit signed integers. The code to do this manually looks like this:
and reverse (without the error checking)
Rather than implementing it in the method which performs the D-Bus call, basically the same code can be used as a spezialisation of the TQT_DBusDataConverter methods and then used like this:
and
Definition at line 87 of file tqdbusdataconverter.h.
Conversion result values.
Enumerator | |
---|---|
Success | Conversion successfull |
InvalidSignature | Conversion failed because the passed TQT_DBusData instance does not contain data of the needed signature, e.g. too few to too many members for a struct or wrong types. |
InvalidArgument | Conversion failed because the passed TQT_DBusData contained values which are not allowed, e.g. out of range for a numerical type used a an enum or flags.
|
Definition at line 93 of file tqdbusdataconverter.h.
|
static |
Conversion from a filled TQT_DBusData instance to a native type.
For example the implementation for TQPoint looks like this:
And then can be used like this:
dbusData | the binding's data instance to get the content from |
typeData | the native type instance to put the content into |
|
static |
Definition at line 72 of file tqdbusdataconverter.cpp.
References InvalidSignature, TQT_DBusData::Struct, Success, TQT_DBusData::toStruct(), and TQT_DBusData::type().
|
static |
Definition at line 33 of file tqdbusdataconverter.cpp.
References InvalidSignature, TQT_DBusData::Struct, Success, TQT_DBusData::toStruct(), and TQT_DBusData::type().
|
static |
Definition at line 109 of file tqdbusdataconverter.cpp.
References InvalidSignature, TQT_DBusData::Struct, Success, TQT_DBusData::toStruct(), and TQT_DBusData::type().
|
static |
Conversion from a native type to a TQT_DBusData instance.
For example the implementation for TQPoint looks like this:
And then can be used like this:
typeData | the native type instance to get the content from |
dbusData | the binding's data instance to put the content into |
|
static |
Definition at line 96 of file tqdbusdataconverter.cpp.
References TQT_DBusData::fromInt32(), TQT_DBusData::fromStruct(), and Success.
|
static |
Definition at line 57 of file tqdbusdataconverter.cpp.
References TQT_DBusData::fromInt32(), TQT_DBusData::fromStruct(), and Success.
|
static |
Definition at line 133 of file tqdbusdataconverter.cpp.
References TQT_DBusData::fromInt32(), TQT_DBusData::fromStruct(), and Success.