xmlroff Reference Manual |
---|
FoNode —
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, constGType type); FoNode* fo_node_get_ancestor_or_self_by_name (FoNode *node, constgchar *name); FoNode* fo_node_get_child_by_type (FoNode *node, constGType type); FoNode* fo_node_get_child_by_name (FoNode *node, constgchar *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);
fo_node : | |
data : | |
Returns : |
FoNode* fo_node_get_ancestor_or_self_by_type (FoNode *node, constGType type);
Find the nearest ancestor node, or node itself, with the same
Does not change the ref count of any node.
FoNode* fo_node_get_ancestor_or_self_by_name (FoNode *node, constgchar *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, constGType type);
Find the first child of node with
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 |
type : | |
Returns : | First child of specified type, or NULL. |
FoNode* fo_node_get_child_by_name (FoNode *node, constgchar *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. |
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.
fo_node : | The FoNode. |
Returns : | The next sibling of fo_node, or NULL. |
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. |
FoNode* fo_node_parent (FoNode *fo_node);
Gets the parent FoNode of fo_node.
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.
fo_node : | 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.
<< FoNode is wonderful | Interfaces are truly wonderful >> |