GdaTree

GdaTree — A tree-structure

Synopsis

                    GdaTree;
GdaTree*            gda_tree_new                        (void);
void                gda_tree_add_manager                (GdaTree *tree,
                                                         GdaTreeManager *manager);
void                gda_tree_clean                      (GdaTree *tree);
gboolean            gda_tree_update_all                 (GdaTree *tree,
                                                         GError **error);
gboolean            gda_tree_update_part                (GdaTree *tree,
                                                         GdaTreeNode *node,
                                                         GError **error);
GSList*             gda_tree_get_nodes_in_path          (GdaTree *tree,
                                                         const gchar *tree_path,
                                                         gboolean use_names);
GdaTreeNode*        gda_tree_get_node                   (GdaTree *tree,
                                                         const gchar *tree_path,
                                                         gboolean use_names);
void                gda_tree_set_attribute              (GdaTree *tree,
                                                         const gchar *attribute,
                                                         const GValue *value,
                                                         GDestroyNotify destroy);
void                gda_tree_dump                       (GdaTree *tree,
                                                         GdaTreeNode *node,
                                                         FILE *stream);

Object Hierarchy

  GObject
   +----GdaTree

Description

The GdaTree is the top level object representing hierarchically structured data. From this object it is also possible (depending on the tree managers it uses), to clean (remove all the nodes) the whole tree, or to request a complete or partial update of the nodes.

It is also possible to set attributes to the tree itself (as it is possible to do for tree nodes), or to dump the whole or part of a tree in an indented and easy to read fashion.

Details

GdaTree

typedef struct _GdaTree GdaTree;


gda_tree_new ()

GdaTree*            gda_tree_new                        (void);

Creates a new GdaTree object

Returns :

a new GdaTree object

Since 4.2


gda_tree_add_manager ()

void                gda_tree_add_manager                (GdaTree *tree,
                                                         GdaTreeManager *manager);

Sets manager as a top GdaTreeManager object, which will be responsible for creating top level nodes in tree.

tree :

a GdaTree object

manager :

a GdaTreeManager object

Since 4.2


gda_tree_clean ()

void                gda_tree_clean                      (GdaTree *tree);

Removes any node in tree

tree :

a GdaTree object

Since 4.2


gda_tree_update_all ()

gboolean            gda_tree_update_all                 (GdaTree *tree,
                                                         GError **error);

Requests that tree be populated with nodes. If an error occurs, then tree's contents is left unchanged, and otherwise tree's previous contents is completely replaced by the new one.

tree :

a GdaTree object

error :

a place to store errors, or NULL

Returns :

TRUE if no error occurred.

Since 4.2


gda_tree_update_part ()

gboolean            gda_tree_update_part                (GdaTree *tree,
                                                         GdaTreeNode *node,
                                                         GError **error);

Requests that tree be populated with nodes, starting from node

tree :

a GdaTree object

node :

a GdaTreeNode node in tree

error :

a place to store errors, or NULL

Returns :

TRUE if no error occurred.

Since 4.2


gda_tree_get_nodes_in_path ()

GSList*             gda_tree_get_nodes_in_path          (GdaTree *tree,
                                                         const gchar *tree_path,
                                                         gboolean use_names);

tree :

tree_path :

use_names :

Returns :


gda_tree_get_node ()

GdaTreeNode*        gda_tree_get_node                   (GdaTree *tree,
                                                         const gchar *tree_path,
                                                         gboolean use_names);

Locates a GdaTreeNode using the tree_path path.

tree :

a GdaTree object

tree_path :

full path to the required nodes (if use_names is TRUE, then it must start with '/')

use_names :

if TRUE, then tree_path will be interpreted as a unix style path, and if FALSE, then tree_path will be interpreted similarly to the GtkTreePath's string representation.

Returns :

the requested GdaTreeNode pointer, or NULL if not found

Since 4.2


gda_tree_set_attribute ()

void                gda_tree_set_attribute              (GdaTree *tree,
                                                         const gchar *attribute,
                                                         const GValue *value,
                                                         GDestroyNotify destroy);

Sets an attribute to tree, which will be accessible to any node in it.

tree :

a GdaTree object

attribute :

attribute name

value :

a GValue, or NULL

destroy :

a function to be called when attribute is not needed anymore, or NULL

Since 4.2


gda_tree_dump ()

void                gda_tree_dump                       (GdaTree *tree,
                                                         GdaTreeNode *node,
                                                         FILE *stream);

Dumps the contents of tree to stream, using a hierarchical view.

tree :

a GdaTree

node :

a GdaTreeNode to start the dump from, or NULL for a full dump

stream :

a stream to send the dump to, or NULL for STDOUT

Since 4.2