DBUS C++ bindings?
thiago.macieira at trolltech.com
Sat Feb 25 09:56:30 PST 2006
Aristid Breitkreuz wrote:
>> However, if the signal parameters (and return type) are decided at run
>> time then neither of these compile-time type-safe signal APIs will be
>> very useful.
>I disagree. Something like a dbus::value_container could be used which
>can save any data DBus has a notion of. However, as code usually deals
>with one certain type, templates could probably come to the rescue.
Maybe some inspiration will help: in the Qt bindings (both of them), we're
using QVariant to hold the values. By overloading the constructor, it can
hold almost any of the D-Bus types (short and char are not supported,
though), including lists of QVariants and maps of QVariants.
The tricky part is structs, since you can't add a type number for each
possible struct (too many combinations). Here's where virtual methods
should be useful.
Thiago José Macieira - thiago.macieira AT trolltech.com
Trolltech AS - Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060225/d938fab3/attachment.pgp
More information about the dbus