Top | ![]() |
![]() |
![]() |
![]() |
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 * 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
.
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. |
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. |
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
.
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.
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.