structs, custom type

Havoc Pennington hp@redhat.com
Wed Mar 10 21:09:40 PST 2004


On Wed, 2004-03-10 at 13:51, Olivier Andrieu wrote:
> That's a weird idea (I think) : I thought the DBUS_TYPE_CUSTOM was
> intended for application-specific binary data. If you start to put
> dbus typecodes in the CUSTOM data that means apps (and bindings) will
> have to be aware of the dbus protocol (typecodes, data representation,
> etc.)

Type custom could be:
 name = org.freedesktop.Point
 type = struct of int, int
 data = 10, 20

The API would just continue the DBusMessage iterator API, you recurse
into this just as you recurse into an array. For DCOP-style usage:
 name = org.kde.QPoint
 type = byte array
 data = QDataStream serialization of QPoint

>  > Otherwise you have to have a DAny/DVariant object that has all the
>  > same unpacking iterators found on DBusMessage, so you can bind
>  > structs to that in C.
> 
> Sure, what's the problem ? We already have iterators for messages. And
> a struct/tuple is conceptually not different : just a sub-collection
> of values. 

We can have the DBusMessage iterator able to dive into a struct/tuple
yes as it does for arrays. What I don't want is a thing separate from
DBusMessage with its own whole API. i.e. no QVariant/GValue/CORBA_any
equivalent and no struct representation distinct from the native type
system of the binding.

Havoc






More information about the dbus mailing list