DBUS C++ bindings?

Murray Cumming murrayc at murrayc.com
Sat Feb 25 11:31:33 PST 2006


On Sat, 2006-02-25 at 18:56 +0100, Thiago Macieira wrote:
> 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.

Glib::Value might be a good equivalent. However, one Glib::Value only
contains one value. It can't contain x ints, y strings, and z booleans.

> 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.

-- 
Murray Cumming
murrayc at murrayc.com
www.murrayc.com
www.openismus.com



More information about the dbus mailing list