DBUS C++ bindings?
aribrei at arcor.de
Sat Feb 25 10:30:33 PST 2006
Am Samstag, den 25.02.2006, 18:56 +0100 schrieb Thiago Macieira:
> 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.
Actually, if you look at boost::any (which can easily be cloned), C++ is
easily capable of storing data of ANY type, be it char or short or
structs or ints or whatever. The only drawbacks I see are speed (but,
probably not enough to be serious) and type-safety, which is actually
what we not want. Oh and it requires RTTI.
By the way: I already wrote an extended version of boost::any which I
could give away, if MPL/GPL/LGPL-triple is not what you want, we could
talk about other licenses. My version eliminates some drawbacks of
boost::any - but it's not yet finished. And it might be too complex. In
that case, writing a trivial clone of boost::any is a matter of 30
If you don't like RTTI, it's possible to write an unsafe version which
does not use RTTI. I would not recommend this.
More information about the dbus