nested arrays and get_element_type
Evan Martin
martine at danga.com
Fri Jul 28 01:29:23 PDT 2006
If I'm iterating through a message (via the dbus_message_iter_* APIs),
what does an empty (array of (array of (array of string))) look like?
To keep that in your head easier, note that it'll have signature
"aaas".
Imagine we have an iter i that points at the empty array. It seems
obvious that get_arg_type(i) == ARRAY and get_element_type(i) ==
ARRAY. It appears from the docs that you can recurse() into i, so
let's call that iter j. (It's not clear to me what the utility of
being able to recurse() into an empty i is...)
Q1) How can I tell that the iterator j is not pointing at anything?
Should I have used get_array_len(i)?
Q2) How can I discover what types j holds? Since it doesn't point at
a value, it would seem that get_element_type(j) is probably invalid.
If it does work, arg_type(j) and element_type(j) are should both be
ARRAY.
Q3) But you can't recurse further -- so is there any way to discover
the existence of that innermost string in the type?
I need to know what the full type is so if I want to take this
de-serialized message and re-serialize it back into a different
DBusMessage I can pass the appropriate args to open_container()...
right?
More information about the dbus
mailing list