![]() |
![]() |
![]() |
xmlroff Reference Manual | ![]() |
---|---|---|---|---|
FoNode; 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);
FoNode* fo_node_new (void);
Creates a new FoNode initialized to default value.
Returns : |
the new FoNode |
gboolean (*FoNodeTraverseFunc) (FoNode *fo_node, gpointer data);
|
|
|
|
Returns : |
#define FO_NODE_IS_ROOT(fo_node) (G_NODE_IS_ROOT(((FoNode*) (fo_node))->node))
|
#define FO_NODE_IS_LEAF(fo_node) (G_NODE_IS_LEAF(((FoNode*) (fo_node))->node))
|
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.
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.
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.
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.
|
FoNode that is parent of nodes to be tested for type name. |
|
Name of type. |
Returns : |
First child of specified type, or NULL. |
FoNode* fo_node_insert (FoNode *parent, gint position, FoNode *fo_node);
Inserts an FoNode beneath the parent at the given position.
FoNode* fo_node_insert_before (FoNode *parent, FoNode *sibling, FoNode *fo_node);
Inserts an FoNode beneath the parent before the given sibling.
FoNode* fo_node_insert_after (FoNode *parent, FoNode *sibling, FoNode *fo_node);
Inserts an FoNode beneath the parent after the given sibling.
FoNode* fo_node_prepend (FoNode *parent, FoNode *fo_node);
Inserts an FoNode as the first child of the given parent.
FoNode* fo_node_append (FoNode *parent, FoNode *fo_node);
Inserts an FoNode as the last child of the given parent.
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
.
|
The root FoNode of the tree to traverse. |
|
The order in which nodes are visited - G_IN_ORDER, G_PRE_ORDER, G_POST_ORDER, or G_LEVEL_ORDER. |
|
Which types of children are to be visited, one of G_TRAVERSE_ALL, G_TRAVERSE_LEAFS and G_TRAVERSE_NON_LEAFS. |
|
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. |
|
The function to call for each visited GNode. |
|
User data to pass to the function. |
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.
|
An FoNode. |
|
Which types of children are to be visited, one of G_TRAVERSE_ALL, G_TRAVERSE_LEAFS and G_TRAVERSE_NON_LEAFS. |
|
The function to call for each visited node. |
|
User data to pass to the function. |
FoNode* fo_node_next_sibling (FoNode *fo_node);
Gets the next sibling FoNode of fo_node
.
FoNode* fo_node_first_child (FoNode *fo_node);
Gets the first child FoNode of fo_node
.
FoNode* fo_node_parent (FoNode *fo_node);
Gets the parent FoNode of fo_node
.
|
The FoNode. |
Returns : |
The parent of fo_node .
|
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.
|
First FoNode to be unlinked |
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.