X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=docs%2Freference%2Fglib%2Ftmpl%2Ftrees-nary.sgml;h=b72abd46c3a31f3e442bfbdd5cc1db98e941f357;hb=81e39b7858a489d02328e01bf8a3aae018d90a0b;hp=d45683127f1f4c51cc65121acd10da9fa1a03a69;hpb=92314620894caea5c092cb53bbb77f6bc3d0811d;p=platform%2Fupstream%2Fglib.git diff --git a/docs/reference/glib/tmpl/trees-nary.sgml b/docs/reference/glib/tmpl/trees-nary.sgml index d456831..b72abd4 100644 --- a/docs/reference/glib/tmpl/trees-nary.sgml +++ b/docs/reference/glib/tmpl/trees-nary.sgml @@ -51,16 +51,16 @@ g_node_destroy(). -The #GNode struct represents one node in a +The GNode struct represents one node in a N-ary Tree. The data field contains the actual data of the node. The next and prev -fields point to the node's siblings (a sibling is another #GNode with the +fields point to the node's siblings (a sibling is another GNode with the same parent). -The parent field points to the parent of the #GNode, -or is NULL if the #GNode is the root of the tree. +The parent field points to the parent of the GNode, +or is %NULL if the GNode is the root of the tree. The children field points to the first child of the -#GNode. The other children are accessed by using the +GNode. The other children are accessed by using the next pointer of each child. @@ -80,6 +80,39 @@ Used to create the first node in a tree. @Returns: a new #GNode. + + +Recursively copies a #GNode (but does not deep-copy the data inside the nodes, +see g_node_copy_deep() if you need that). + + +@node: a #GNode. +@Returns: a new #GNode containing the same data pointers. + + + + +A function of this signature is used to copy the node data when doing a deep-copy +of a tree. + + +@src: A pointer to the data which should be copied. +@data: Additional data. +@Returns: A pointer to the copy. +@Since: 2.4 + + + + + + + +@node: +@copy_func: +@data: +@Returns: + + Inserts a #GNode beneath the parent at the given position. @@ -98,12 +131,24 @@ Inserts a #GNode beneath the parent before the given sibling. @parent: the #GNode to place @node under. -@sibling: the sibling #GNode to place @node before. If sibling is NULL, +@sibling: the sibling #GNode to place @node before. If sibling is %NULL, the node is inserted as the last child of @parent. @node: the #GNode to insert. @Returns: the inserted #GNode. + + +Inserts a #GNode beneath the parent after the given sibling. + + +@parent: the #GNode to place @node under. +@sibling: the sibling #GNode to place @node after. If sibling is %NULL, +the node is inserted as the first child of @parent. +@node: the #GNode to insert. +@Returns: the inserted #GNode. + + Inserts a #GNode as the last child of the given parent. @@ -180,7 +225,7 @@ Reverses the order of the children of a #GNode. 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 TRUE from @func. +The traversal can be halted at any point by returning %TRUE from @func. @root: the root #GNode of the tree to traverse. @@ -200,22 +245,11 @@ and its children are visited. And so on. Specifies which nodes are visited during several of the tree functions, including g_node_traverse() and g_node_find(). - - -%G_TRAVERSE_LEAFS specifies that only leaf nodes should be visited. - - -%G_TRAVERSE_NON_LEAFS specifies that only non-leaf nodes should be visited. - - -%G_TRAVERSE_ALL specifies that all nodes should be visited. - - - - -@G_TRAVERSE_LEAFS: -@G_TRAVERSE_NON_LEAFS: -@G_TRAVERSE_ALL: + + +@G_TRAVERSE_LEAFS: only leaf nodes should be visited. +@G_TRAVERSE_NON_LEAFS: only non-leaf nodes should be visited. +@G_TRAVERSE_ALL: all nodes should be visited. @G_TRAVERSE_MASK: @@ -223,12 +257,12 @@ including g_node_traverse() and g_node_find(). Specifies the type of function passed to g_node_traverse(). The function is called with each of the nodes visited, together with the user data passed to g_node_traverse(). -If the function returns TRUE, then the traversal is stopped. +If the function returns %TRUE, then the traversal is stopped. @node: a #GNode. @data: user data passed to g_node_traverse(). -@Returns: TRUE to stop the traversal. +@Returns: %TRUE to stop the traversal. @@ -275,7 +309,7 @@ Finds a #GNode in a tree. @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAFS and %G_TRAVERSE_NON_LEAFS. @data: the data to find. -@Returns: the found #GNode, or NULL if the data is not found. +@Returns: the found #GNode, or %NULL if the data is not found. @@ -287,7 +321,7 @@ Finds the first child of a #GNode with the given data. @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAFS and %G_TRAVERSE_NON_LEAFS. @data: the data to find. -@Returns: the found child #GNode, or NULL if the data is not found. +@Returns: the found child #GNode, or %NULL if the data is not found. @@ -319,7 +353,7 @@ Gets the first child of a #GNode. @node: a #GNode. -@Returns: the last child of @node, or NULL if @node is NULL or has no children. +@Returns: the last child of @node, or %NULL if @node is %NULL or has no children. @@ -327,14 +361,14 @@ Gets the first child of a #GNode. Gets the last child of a #GNode. -@node: a #GNode (must not be NULL). -@Returns: the last child of @node, or NULL if @node has no children. +@node: a #GNode (must not be %NULL). +@Returns: the last child of @node, or %NULL if @node has no children. Gets a child of a #GNode, using the given index. -The first child is at index 0. If the index is too big, NULL is returned. +The first child is at index 0. If the index is too big, %NULL is returned. @node: a #GNode. @@ -358,7 +392,7 @@ Gets the next sibling of a #GNode. @node: a #GNode. -@Returns: the next sibling of @node, or NULL if @node is NULL. +@Returns: the next sibling of @node, or %NULL if @node is %NULL. @@ -367,7 +401,7 @@ Gets the previous sibling of a #GNode. @node: a #GNode. -@Returns: the previous sibling of @node, or NULL if @node is NULL. +@Returns: the previous sibling of @node, or %NULL if @node is %NULL. @@ -382,20 +416,20 @@ This could possibly be the node itself. -Returns TRUE if a #GNode is a leaf node. +Returns %TRUE if a #GNode is a leaf node. @node: a #GNode. -@Returns: TRUE if the #GNode is a leaf node (i.e. it has no children). +@Returns: %TRUE if the #GNode is a leaf node (i.e. it has no children). -Returns TRUE if a #GNode is the root of a tree. +Returns %TRUE if a #GNode is the root of a tree. @node: a #GNode. -@Returns: TRUE if the #GNode is the root of a tree (i.e. it has no parent +@Returns: %TRUE if the #GNode is the root of a tree (i.e. it has no parent or siblings). @@ -404,7 +438,7 @@ or siblings). Gets the depth of a #GNode. -If @node is NULL the depth is 0. +If @node is %NULL the depth is 0. The root node has a depth of 1. For the children of the root node the depth is 2. And so on. @@ -435,14 +469,14 @@ Gets the number of children of a #GNode. -Returns TRUE if @node is an ancestor of @descendant. -This is true if node is the parent of descendant, or if node is the -grandparent of descendant etc. +Returns %TRUE if @node is an ancestor of @descendant. +This is true if node is the parent of @descendant, or if node is the +grandparent of @descendant etc. @node: a #GNode. @descendant: a #GNode. -@Returns: TRUE if @node is an ancestor of @descendant. +@Returns: %TRUE if @node is an ancestor of @descendant. @@ -451,7 +485,7 @@ Gets the maximum height of all branches beneath a #GNode. This is the maximum distance from the #GNode to all leaf nodes. -If @root is NULL, 0 is returned. If @root has no children, 1 is returned. +If @root is %NULL, 0 is returned. If @root has no children, 1 is returned. If @root has children, 2 is returned. And so on. @@ -476,18 +510,19 @@ allocated. @root: the root of the tree/subtree to destroy. - + - +Sets the allocator to use to allocate #GNode elements. +Use g_node_pop_allocator() to restore the previous allocator. +@allocator: the #GAllocator to use when allocating #GNode elements. - + - +Restores the previous #GAllocator, used when allocating #GNode elements. -@allocator: