[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Marshalling to dbus dict
From:       Sanel Zukan <sanelz () gmail ! com>
Date:       2008-03-07 15:33:34
Message-ID: 20080307153334.GA22543 () stigmata ! pmf ! unsa ! ba
[Download RAW message or body]

> 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
_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic