Extended introspection
Thiago Macieira
thiago at kde.org
Tue Jun 17 08:23:53 PDT 2008
On Tuesday 17 June 2008 14:07:59 Thorvald Natvig wrote:
> Some of the DBus bindings (Java, C#, possibly more) require you to
> manually type up an interface definition in that language matching the
> interface to be used. I've been toying with the idea of writing a
> xml-to-stub generator like that which is used for ICE, Thrift, CORBA
> etc, but I run into a problem with structs. Take this snippet:
> <arg name="players" type="a(isss)" direction="out"/>
> We know the parameter is called "players", and it returns an array. But
> what type is the array element? 'struct playersStruct { int i1; char
> *string1}' etc doesn't really work, and forcing the user to define the
> interface on his own means the struct members have different names in
> the different languages. While adding enums, typedefs etc would be nice,
> it's complete overkill and ruins the simple nature of the introspection
> XML. But without the struct definitions, it's impossible to define the
> interfaces in quite a few of the supported languages. Are there any
> plans to address this?
The way I dealt with this issue in QtDBus was to require an annotation
specifying which type the argument is, if it's not one of the basic types
(basic types are the one-letter types, plus "as" [QStringList] and "ay"
[QByteArray]).
So, for an argument of type a(isss), it'll require you to declare to
qdbusxml2cpp that it's something like QList<Players> or
std::list<playersStruct> or PlayersArray, etc. The code generator doesn't
care about the memory layout or structure of the data. All it needs is the
type name to generate the code. With the proper #include in place, some
template magic will resolve the functions for marshalling and demarshalling.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080617/af95cbdc/attachment.pgp
More information about the dbus
mailing list