MAYBE types?

Alex Merry kde at
Fri Dec 10 12:14:25 PST 2010

I was wondering if there was an elegant situation someone has already thought 
of for the following situation.

I have a property that is a structure - it's of type (oss).  This property may 
or may not have a value.  In C, I would return a point to a struct or NULL.  
In C++, I might have a class with an isValid() method.

Is there a nice way to do something similar in D-Bus?  I could return an 
array, and state that it will never have more than one element, or I could 
return a variant (losing type info in the introspection), but neither of these 
are nice solutions.

If it was a method, returning an error message would be sensible, but I'm not 
sure that's a sensible approach to take for properties: I imagine that not all 
bindings allow properties to return either a value or a user error on the fly 
(thinking about applications that implement this interface).

Any advice?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the dbus mailing list