Marshalling to dbus dict

Sanel Zukan sanelz at gmail.com
Fri Mar 7 07:33:34 PST 2008


> Dictionaries are serialized as and array of dict entries.  A dict entry
> is just a struct with two values a key and a value (e.g. {key, value}).
> What you need to do is iterate over all the keys in a dictionary and for
> each key construct a dict entry and append that to the array. To
> demarshal you simply iterate over the array and place each key value
> pair back into a dictionary.  There is no way for D-Bus to marshal a
> dictionary in it's binary form since every language, in fact every dict
> implementation, has it's own format at hash algorithm.
> 
> Remember, all elements in an array are of the same type so to check if
> an array is a dictionary you simply look at the signature the array
> contains. If it is a dict entry that array is a dictionary.

Ah yes, :) after reading your mail, I revamped dictionary serialization 
code and... it works! 

Still pending case is when dict contains another complex type as value, 
but that will be not an issue due working base.

Thanks a lot for simplifying me this :)

Best,
-- 
Sanel Zukan
http://equinox-project.org


More information about the dbus mailing list