coherentsolutions/kowhai — pull request #4 by othane (2014-05-18 07:15:59+00:00)
Title: adds a new [de]serialize method for nodes only

summary of changes:
* add kowhai_[de]serialize_nodes() to serialise the tree in a flat
jason file where the tree path is encoded in a string .. this is
more useful for editing by hand in a file, or if you just want to
write part of a tree, ie writing every instance of bar in foo, but
only bar not the other surrounding elements of foo, ie:
element:
struct
{
int untouched1;
int bar;
int untouched2;
} foo[4];
note that this api does not rebuild a kowhai_tree from scratch given
the serialised file, instead it merges the data it has into an
existing tree with a similar structure (see kowahi_node_not_found_t
callback for merging options) .. also it _requires_ (cannot be NULL)
as kowahi_get_symbol_t callback to convert a symbol string to a node
id and a kowahi_get_symbol_name_t (like the tree api) ... if human
readable symbol strings are not used you can just printf and scanf
the numbers into the tree, if symbol names are used they must not
include '.' or '[' or ']' characters (these are special delimiters
in path encoding.
* renamed kowhai_[de]serialize() -> kowhai_[de]serialize_tree() ...
functionality remains unchanged (done just to make clear what type
of serialization is being performed, ie not nodes)
* add new error types for new api's
* replace a union type for all kowhai type that was being redefined
over and over with a named union called anytype_t
* unit test updated for api name changes and cover all foreseeable
error conditions on new kowhai_[de]serialize() api, and of course
the successful condition of serializing and de-serializing a kowahi
tee's nodes is done