make _dbus_type_to_string public?

Andrew Cann shum at canndrew.org
Tue Dec 24 02:15:53 PST 2013


On Tue, Dec 24, 2013 at 03:38:27PM +0800, Yang Chengwei wrote:
> On Sun, Dec 22, 2013 at 05:59:38PM +0800, Andrew Cann wrote:
> > Would it be possible to expose _dbus_type_to_string through the C API? It would
> > be useful to me and I don't really see why it should be considered an internal
> > implementation detail.
> 
> How does your using scenario looks like?
> 

I'm just using it to generate error messages for my DBus library, the same way 
one might use dbus_message_type_to_string.

> > 
> > If I submitted a patch to do this is likely to be accepted? Or is there some
> > other function I should be using?
> 
> From my point of view, the built-in type system in DBus is part of the
> DBus Specification, and as part of the message wire protocol. The higher
> level applications only see messages and can handle message with APIs,
> they don't care about the message internals.
> 

For clarification, _dbus_type_to_string just takes a type code and returns a
string desription of that type. So
    _dbus_type_to_string(DBUS_TYPE_STRING) -> "string"
    _dbus_type_to_string(DBUS_TYPE_ARRAY)  -> "array"
    etc.
It has nothing to do with the wire protocol or message internals.
I can easily implement this function myself, and have, but it's a copy-paste of
the function that's in libdbus. It seems silly to have to reimplement it, 
it already exists in libdbus, it's convenient, and it's only for handling
concepts that users of the DBus API already have to deal with (ie. DBus type
codes and strings).

 - Andrew



More information about the dbus mailing list