FoNode

FoNode —

Synopsis




struct      FoNode;
struct      FoNodeClass;
FoNode*     fo_node_new                     (void);
gboolean    (*FoNodeTraverseFunc)           (FoNode *fo_node,
                                             gpointer data);
void        (*FoNodeForeachFunc)            (FoNode *fo_node,
                                             gpointer data);
#define     FO_NODE_IS_ROOT                 (fo_node)
#define     FO_NODE_IS_LEAF                 (fo_node)
FoNode*     fo_node_get_ancestor_or_self_by_type
                                            (FoNode *node,
                                             const GType type);
FoNode*     fo_node_get_ancestor_or_self_by_name
                                            (FoNode *node,
                                             const gchar *name);
FoNode*     fo_node_get_child_by_type       (FoNode *node,
                                             const GType type);
FoNode*     fo_node_get_child_by_name       (FoNode *node,
                                             const gchar *name);
FoNode*     fo_node_insert                  (FoNode *parent,
                                             gint position,
                                             FoNode *fo_node);
FoNode*     fo_node_insert_before           (FoNode *parent,
                                             FoNode *sibling,
                                             FoNode *fo_node);
FoNode*     fo_node_insert_after            (FoNode *parent,
                                             FoNode *sibling,
                                             FoNode *fo_node);
FoNode*     fo_node_prepend                 (FoNode *parent,
                                             FoNode *fo_node);
#define     fo_node_n_nodes                 (root, flags)
#define     fo_node_get_root                (root)
#define     fo_node_is_ancestor             (fo_node, descendant)
#define     fo_node_depth                   (fo_node)
FoNode*     fo_node_append                  (FoNode *parent,
                                             FoNode *fo_node);
void        fo_node_traverse                (FoNode *root,
                                             GTraverseType order,
                                             GTraverseFlags flags,
                                             gint max_depth,
                                             FoNodeTraverseFunc func,
                                             gpointer data);
#define     fo_node_max_height              (root)
void        fo_node_children_foreach        (FoNode *fo_node,
                                             GTraverseFlags flags,
                                             FoNodeForeachFunc func,
                                             gpointer data);
#define     fo_node_reverse_children        (fo_node)
#define     fo_node_n_children              (fo_node)
#define     fo_node_nth_child               (fo_node, n)
#define     fo_node_last_child              (fo_node)
#define     fo_node_child_position          (fo_node, child)
#define     fo_node_first_sibling           (fo_node)
#define     fo_node_last_sibling            (fo_node)
#define     fo_node_prev_sibling            (fo_node)
FoNode*     fo_node_next_sibling            (FoNode *fo_node);
FoNode*     fo_node_first_child             (FoNode *fo_node);
FoNode*     fo_node_parent                  (FoNode *fo_node);
#define     fo_node_unlink                  (fo_node)
void        fo_node_unlink_with_next_siblings
                                            (FoNode *fo_node);
FoNode*     fo_node_insert_with_next_siblings
                                            (FoNode *parent,
                                             gint position,
                                             FoNode *fo_node);
void        fo_node_debug_dump_tree         (FoNode *fo_node,
                                             gint depth);

Object Hierarchy


  GObject
   +----FoObject
         +----FoNode

Properties


  "first-child"          FoNode               : Read
  "next-sibling"         FoNode               : Read
  "parent"               FoNode               : Read

Description

Details

struct FoNode

struct FoNode;


struct FoNodeClass

struct FoNodeClass;


fo_node_new ()

FoNode*     fo_node_new                     (void);

Creates a new FoNode initialized to default value.

Returns : the new FoNode

FoNodeTraverseFunc ()

gboolean    (*FoNodeTraverseFunc)           (FoNode *fo_node,
                                             gpointer data);

fo_node :
data :
Returns :

FoNodeForeachFunc ()

void        (*FoNodeForeachFunc)            (FoNode *fo_node,
                                             gpointer data);

fo_node :
data :

FO_NODE_IS_ROOT()

#define     FO_NODE_IS_ROOT(fo_node)

fo_node :

FO_NODE_IS_LEAF()

#define     FO_NODE_IS_LEAF(fo_node)

fo_node :

fo_node_get_ancestor_or_self_by_type ()

FoNode*     fo_node_get_ancestor_or_self_by_type
                                            (FoNode *node,
                                             const GType type);

Find the nearest ancestor node, or node itself, with the same GType as type.

Does not change the ref count of any node.

node : FoNode at which to begin.
type : Required GType of ancestor node.
Returns : FoNode ancestor (or self) with required GType, or NULL.

fo_node_get_ancestor_or_self_by_name ()

FoNode*     fo_node_get_ancestor_or_self_by_name
                                            (FoNode *node,
                                             const gchar *name);

Find the nearest ancestor node, or node itself, with the same name as name.

Does not change the ref count of any node.

node : FoNode at which to begin.
name : Required name of ancestor node.
Returns : FoNode ancestor (or self) with required GType, or NULL.

fo_node_get_child_by_type ()

FoNode*     fo_node_get_child_by_type       (FoNode *node,
                                             const GType type);

Find the first child of node with GType matching type value.

Does not change the ref count of any node.

Allows 0 as value of type since may have been called by fo_node_get_child_by_name for a type that has yet to be instantiated. Of course, if type is 0, this function returns NULL.

node : FoNode that is parent of nodes to be tested for matching GType.
type : GType value.
Returns : First child of specified type, or NULL.

fo_node_get_child_by_name ()

FoNode*     fo_node_get_child_by_name       (FoNode *node,
                                             const gchar *name);

Find the first child of node with type name matching name value.

Does not change the ref count of any node.

node : FoNode that is parent of nodes to be tested for type name.
name : Name of type.
Returns : First child of specified type, or NULL.

fo_node_insert ()

FoNode*     fo_node_insert                  (FoNode *parent,
                                             gint position,
                                             FoNode *fo_node);

Inserts an FoNode beneath the parent at the given position.

parent : The FoNode to place fo_node under.
position : The position to place fo_node at, with respect to its siblings. If position is -1, fo_node is inserted as the last child of parent.
fo_node : The FoNode to insert.
Returns : The inserted FoNode.

fo_node_insert_before ()

FoNode*     fo_node_insert_before           (FoNode *parent,
                                             FoNode *sibling,
                                             FoNode *fo_node);

Inserts an FoNode beneath the parent before the given sibling.

parent : The FoNode to place fo_node under.
sibling : The sibling FoNode to place fo_node before. If sibling is NULL, fo_node is inserted as the last child of parent.
fo_node : The FoNode to insert.
Returns : The inserted FoNode.

fo_node_insert_after ()

FoNode*     fo_node_insert_after            (FoNode *parent,
                                             FoNode *sibling,
                                             FoNode *fo_node);

Inserts an FoNode beneath the parent after the given sibling.

parent : The FoNode to place fo_node under.
sibling : The sibling FoNode to place fo_node after. If sibling is NULL, fo_node is inserted as the first child of parent.
fo_node : The FoNode to insert.
Returns : The inserted FoNode.

fo_node_prepend ()

FoNode*     fo_node_prepend                 (FoNode *parent,
                                             FoNode *fo_node);

Inserts an FoNode as the first child of the given parent.

parent : The FoNode to place fo_node under.
fo_node : The FoNode to insert.
Returns : The inserted FoNode.

fo_node_n_nodes()

#define     fo_node_n_nodes(root, flags)

root :
flags :

fo_node_get_root()

#define     fo_node_get_root(root)

root :

fo_node_is_ancestor()

#define     fo_node_is_ancestor(fo_node, descendant)

fo_node :
descendant :

fo_node_depth()

#define     fo_node_depth(fo_node)

fo_node :

fo_node_append ()

FoNode*     fo_node_append                  (FoNode *parent,
                                             FoNode *fo_node);

Inserts an FoNode as the last child of the given parent.

parent : The FoNode to place fo_node under.
fo_node : The FoNode to insert.
Returns : The inserted FoNode.

fo_node_traverse ()

void        fo_node_traverse                (FoNode *root,
                                             GTraverseType order,
                                             GTraverseFlags flags,
                                             gint max_depth,
                                             FoNodeTraverseFunc func,
                                             gpointer data);

Traverses a tree starting at the given root FoNode. It calls the given function for each node visited. The traversal can be halted at any point by returning TRUE from func.

root : The root FoNode of the tree to traverse.
order : The order in which nodes are visited - G_IN_ORDER, G_PRE_ORDER, G_POST_ORDER, or G_LEVEL_ORDER.
flags : Which types of children are to be visited, one of G_TRAVERSE_ALL, G_TRAVERSE_LEAFS and G_TRAVERSE_NON_LEAFS.
max_depth : The maximum depth of the traversal. Nodes below this depth will not be visited. If max_depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on.
func : The function to call for each visited GNode.
data : User data to pass to the function.

fo_node_max_height()

#define     fo_node_max_height(root)

root :

fo_node_children_foreach ()

void        fo_node_children_foreach        (FoNode *fo_node,
                                             GTraverseFlags flags,
                                             FoNodeForeachFunc func,
                                             gpointer data);

Calls a function for each of the children of an FoNode. Note that it doesn't descend beneath the child nodes.

fo_node : An FoNode.
flags : Which types of children are to be visited, one of G_TRAVERSE_ALL, G_TRAVERSE_LEAFS and G_TRAVERSE_NON_LEAFS.
func : The function to call for each visited node.
data : User data to pass to the function.

fo_node_reverse_children()

#define     fo_node_reverse_children(fo_node)

fo_node :

fo_node_n_children()

#define     fo_node_n_children(fo_node)

fo_node :

fo_node_nth_child()

#define     fo_node_nth_child(fo_node, n)

fo_node :
n :

fo_node_last_child()

#define     fo_node_last_child(fo_node)

fo_node :

fo_node_child_position()

#define     fo_node_child_position(fo_node, child)

fo_node :
child :

fo_node_first_sibling()

#define     fo_node_first_sibling(fo_node)

fo_node :

fo_node_last_sibling()

#define     fo_node_last_sibling(fo_node)

fo_node :

fo_node_prev_sibling()

#define     fo_node_prev_sibling(fo_node)

fo_node :

fo_node_next_sibling ()

FoNode*     fo_node_next_sibling            (FoNode *fo_node);

Gets the next sibling FoNode of fo_node.

fo_node : The FoNode.
Returns : The next sibling of fo_node, or NULL.

fo_node_first_child ()

FoNode*     fo_node_first_child             (FoNode *fo_node);

Gets the first child FoNode of fo_node.

fo_node : The FoNode.
Returns : The first child of fo_node, or NULL.

fo_node_parent ()

FoNode*     fo_node_parent                  (FoNode *fo_node);

Gets the parent FoNode of fo_node.

fo_node : The FoNode.
Returns : The parent of fo_node.

fo_node_unlink()

#define     fo_node_unlink(fo_node)

fo_node :

fo_node_unlink_with_next_siblings ()

void        fo_node_unlink_with_next_siblings
                                            (FoNode *fo_node);

Unlink fo_node and its next siblings (i.e., 'following siblings' in XPath parlance) from their place in their current FoNode tree.

fo_node and its next siblings remain linked together, and any of those nodes keep their child nodes. Neither fo_node nor any of its following siblings are valid roots since they each have a next and/or a previous sibling, even if they don't have a parent.

fo_node : First FoNode to be unlinked

fo_node_insert_with_next_siblings ()

FoNode*     fo_node_insert_with_next_siblings
                                            (FoNode *parent,
                                             gint position,
                                             FoNode *fo_node);

Insert fo_node and its next siblings (i.e., 'following siblings' in XPath parlance) beneath parent at the given position.

fo_node and its next siblings should not already have a parent FoNode.

parent : The FoNode to place fo_node under.
position : The position to place fo_node at, with respect to its siblings. If position is -1, fo_node is inserted as the last child of parent.
fo_node : First FoNode to be inserted.
Returns : The inserted FoNode.

fo_node_debug_dump_tree ()

void        fo_node_debug_dump_tree         (FoNode *fo_node,
                                             gint depth);

Logs the tree structure beginning at fo_node.

fo_node : FoNode to be dumped.
depth : Relative indent to add to the output.

Properties

"first-child" (FoNode : Read)

"next-sibling" (FoNode : Read)

"parent" (FoNode : Read)