libtreestore

diff src/treestore.h @ 1:a31eae25c0e6

partial implementation of ts_node and ts_attr
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 12 Apr 2014 13:46:00 +0300
parents 740fec9866b1
children
line diff
     1.1 --- a/src/treestore.h	Fri Apr 11 08:56:46 2014 +0300
     1.2 +++ b/src/treestore.h	Sat Apr 12 13:46:00 2014 +0300
     1.3 @@ -56,12 +56,23 @@
     1.4  /** treestore node attribute */
     1.5  struct ts_attr {
     1.6  	char *name;
     1.7 -
     1.8  	struct ts_value val;
     1.9  
    1.10  	struct ts_attr *next;
    1.11  };
    1.12  
    1.13 +int ts_init_attr(struct ts_attr *attr);
    1.14 +void ts_destroy_attr(struct ts_attr *attr);
    1.15 +
    1.16 +struct ts_attr *ts_alloc_attr(void);		/**< also calls ts_init_attr */
    1.17 +void ts_free_attr(struct ts_attr *attr);	/**< also calls ts_destroy_attr */
    1.18 +
    1.19 +/** perform a deep-copy of a ts_attr */
    1.20 +int ts_copy_attr(struct ts_attr *dest, struct ts_attr *src);
    1.21 +
    1.22 +int ts_set_attr_name(struct ts_attr *attr, const char *name);
    1.23 +
    1.24 +
    1.25  
    1.26  /** treestore node */
    1.27  struct ts_node {
    1.28 @@ -77,8 +88,12 @@
    1.29  	struct ts_node *next;	/* next sibling */
    1.30  };
    1.31  
    1.32 -struct ts_node *ts_create_node(void);
    1.33 -void ts_free_node(struct ts_node *n);
    1.34 +int ts_init_node(struct ts_node *node);
    1.35 +void ts_destroy_node(struct ts_node *node);
    1.36 +
    1.37 +struct ts_node *ts_alloc_node(void);	/**< also calls ts_init_node */
    1.38 +void ts_free_node(struct ts_node *n);	/**< also calls ts_destroy_node */
    1.39 +
    1.40  void ts_free_tree(struct ts_node *tree);
    1.41  
    1.42  #ifdef __cplusplus