Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> GNode; GNode* g_node_new (gpointer data); GNode* g_node_copy (GNode *node); gpointer (*GCopyFunc) (gconstpointer src, gpointer data); GNode* g_node_copy_deep (GNode *node, GCopyFunc copy_func, gpointer data); GNode* g_node_insert (GNode *parent, gint position, GNode *node); GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node); GNode* g_node_insert_after (GNode *parent, GNode *sibling, GNode *node); #define g_node_append (parent, node) GNode* g_node_prepend (GNode *parent, GNode *node); #define g_node_insert_data (parent, position, data) #define g_node_insert_data_before (parent, sibling, data) #define g_node_append_data (parent, data) #define g_node_prepend_data (parent, data) void g_node_reverse_children (GNode *node); void g_node_traverse (GNode *root, GTraverseType order, GTraverseFlags flags, gint max_depth, GNodeTraverseFunc func, gpointer data); enum GTraverseFlags; gboolean (*GNodeTraverseFunc) (GNode *node, gpointer data); void g_node_children_foreach (GNode *node, GTraverseFlags flags, GNodeForeachFunc func, gpointer data); void (*GNodeForeachFunc) (GNode *node, gpointer data); GNode* g_node_get_root (GNode *node); GNode* g_node_find (GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data); GNode* g_node_find_child (GNode *node, GTraverseFlags flags, gpointer data); gint g_node_child_index (GNode *node, gpointer data); gint g_node_child_position (GNode *node, GNode *child); #define g_node_first_child (node) GNode* g_node_last_child (GNode *node); GNode* g_node_nth_child (GNode *node, guint n); GNode* g_node_first_sibling (GNode *node); #define g_node_next_sibling (node) #define g_node_prev_sibling (node) GNode* g_node_last_sibling (GNode *node); #define G_NODE_IS_LEAF (node) #define G_NODE_IS_ROOT (node) guint g_node_depth (GNode *node); guint g_node_n_nodes (GNode *root, GTraverseFlags flags); guint g_node_n_children (GNode *node); gboolean g_node_is_ancestor (GNode *node, GNode *descendant); guint g_node_max_height (GNode *root); void g_node_unlink (GNode *node); void g_node_destroy (GNode *root); void g_node_push_allocator (GAllocator *allocator); void g_node_pop_allocator (void); DescriptionThe GNode struct and its associated functions provide a N-ary tree data structure, where nodes in the tree can contain arbitrary data.
To create a new tree use
To insert a node into a tree use
To create a new node and insert it into a tree use
To reverse the children of a node use
To find a node use
To get information about a node or tree use
To traverse a tree, calling a function for each node visited in the
traversal, use
To remove a node or subtree from a tree use DetailsGNodetypedef struct { gpointer data; GNode *next; GNode *prev; GNode *parent; GNode *children; } GNode;
The GNode struct represents one node in a
N-ary Tree.
The g_node_new ()GNode* g_node_new (gpointer data); Creates a new GNode containing the given data. Used to create the first node in a tree.
g_node_copy ()GNode* g_node_copy (GNode *node);
Recursively copies a GNode (but does not deep-copy the data inside the nodes,
see GCopyFunc ()gpointer (*GCopyFunc) (gconstpointer src, gpointer data); A function of this signature is used to copy the node data when doing a deep-copy of a tree.
Since 2.4 g_node_copy_deep ()GNode* g_node_copy_deep (GNode *node, GCopyFunc copy_func, gpointer data); Recursively copies a GNode and its data.
Since 2.4 g_node_insert ()GNode* g_node_insert (GNode *parent, gint position, GNode *node); Inserts a GNode beneath the parent at the given position. g_node_insert_before ()GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node); Inserts a GNode beneath the parent before the given sibling. g_node_insert_after ()GNode* g_node_insert_after (GNode *parent, GNode *sibling, GNode *node); Inserts a GNode beneath the parent after the given sibling. g_node_append()#define g_node_append(parent, node) Inserts a GNode as the last child of the given parent. g_node_prepend ()GNode* g_node_prepend (GNode *parent, GNode *node); Inserts a GNode as the first child of the given parent. g_node_insert_data()#define g_node_insert_data(parent, position, data) Inserts a new GNode at the given position. g_node_insert_data_before()#define g_node_insert_data_before(parent, sibling, data) Inserts a new GNode before the given sibling. g_node_append_data()#define g_node_append_data(parent, data) Inserts a new GNode as the last child of the given parent. g_node_prepend_data()#define g_node_prepend_data(parent, data) Inserts a new GNode as the first child of the given parent. g_node_reverse_children ()void g_node_reverse_children (GNode *node); Reverses the order of the children of a GNode. (It doesn't change the order of the grandchildren.)
g_node_traverse ()void g_node_traverse (GNode *root, GTraverseType order, GTraverseFlags flags, gint max_depth, GNodeTraverseFunc func, gpointer data);
Traverses a tree starting at the given root GNode.
It calls the given function for each node visited.
The traversal can be halted at any point by returning
enum GTraverseFlagstypedef enum { G_TRAVERSE_LEAVES = 1 << 0, G_TRAVERSE_NON_LEAVES = 1 << 1, G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES, G_TRAVERSE_MASK = 0x03, G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES, G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES } GTraverseFlags;
Specifies which nodes are visited during several of the tree functions,
including
GNodeTraverseFunc ()gboolean (*GNodeTraverseFunc) (GNode *node, gpointer data);
Specifies the type of function passed to
g_node_children_foreach ()void g_node_children_foreach (GNode *node, GTraverseFlags flags, GNodeForeachFunc func, gpointer data); Calls a function for each of the children of a GNode. Note that it doesn't descend beneath the child nodes.
GNodeForeachFunc ()void (*GNodeForeachFunc) (GNode *node, gpointer data);
Specifies the type of function passed to
g_node_get_root ()GNode* g_node_get_root (GNode *node); Gets the root of a tree.
g_node_find ()GNode* g_node_find (GNode *root, GTraverseType order, GTraverseFlags flags, gpointer data); Finds a GNode in a tree.
g_node_find_child ()GNode* g_node_find_child (GNode *node, GTraverseFlags flags, gpointer data); Finds the first child of a GNode with the given data. g_node_child_index ()gint g_node_child_index (GNode *node, gpointer data); Gets the position of the first child of a GNode which contains the given data.
g_node_child_position ()gint g_node_child_position (GNode *node, GNode *child);
Gets the position of a GNode with respect to its siblings.
g_node_first_child()#define g_node_first_child(node) Gets the first child of a GNode.
g_node_last_child ()GNode* g_node_last_child (GNode *node); Gets the last child of a GNode.
g_node_nth_child ()GNode* g_node_nth_child (GNode *node, guint n);
Gets a child of a GNode, using the given index.
The first child is at index 0. If the index is too big,
g_node_first_sibling ()GNode* g_node_first_sibling (GNode *node); Gets the first sibling of a GNode. This could possibly be the node itself.
g_node_next_sibling()#define g_node_next_sibling(node) Gets the next sibling of a GNode.
g_node_prev_sibling()#define g_node_prev_sibling(node) Gets the previous sibling of a GNode.
g_node_last_sibling ()GNode* g_node_last_sibling (GNode *node); Gets the last sibling of a GNode. This could possibly be the node itself.
G_NODE_IS_LEAF()#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)
Returns g_node_depth ()guint g_node_depth (GNode *node); Gets the depth of a GNode.
If g_node_n_nodes ()guint g_node_n_nodes (GNode *root, GTraverseFlags flags); Gets the number of nodes in a tree.
g_node_n_children ()guint g_node_n_children (GNode *node); Gets the number of children of a GNode.
g_node_is_ancestor ()gboolean g_node_is_ancestor (GNode *node, GNode *descendant);
Returns g_node_max_height ()guint g_node_max_height (GNode *root); Gets the maximum height of all branches beneath a GNode. This is the maximum distance from the GNode to all leaf nodes.
If
g_node_unlink ()void g_node_unlink (GNode *node); Unlinks a GNode from a tree, resulting in two separate trees.
g_node_destroy ()void g_node_destroy (GNode *root); Removes the GNode and its children from the tree, freeing any memory allocated.
g_node_push_allocator ()void g_node_push_allocator (GAllocator *allocator);
Sets the allocator to use to allocate GNode elements.
Use
Note that this function is not available if GLib has been compiled
with
g_node_pop_allocator ()void g_node_pop_allocator (void); Restores the previous GAllocator, used when allocating GNode elements.
Note that this function is not available if GLib has been compiled
with
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0039 ]-- |