Hi Luca,
I'm not sure it's really safe and cleaner since it's working only because proto_item = proto_tree = proto_node and the legend says that nothing guarantees it won't change. Then it is working now but be aware that one day it might not work anymore.
Regards,
Sebastien Tandel
On Mon, Mar 23, 2009 at 18:48, Luca Ceresoli
<list@xxxxxxxxxxxxxxxx> wrote:
Sébastien Tandel ha scritto:
> Therefore you could then do what you want with something like the following :
> it = proto_tree_add_text(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor),
> ptvcursor_current_offset(cursor), length, "foo");
> my_tree = ptvcursor_add_subtree_item(cursor, it, ...);
Thanks Sébastien,
that looks fine, except ptvcursor_add_subtree_item() is not (currently) declared in any header file, so that does not compile.
Apart from dumbly declaring it, I found this alternative:
my_tree = ptvcursor_add_text_with_subtree(cursor, ..., "foo");
my_item = proto_tree_get_parent(my_tree);
/* ... */
proto_item_set_text(my_item, "<%s>", my_string);
To me it looks safe and cleaner, am I missing anything?