X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgnode.c;h=b529f48dc224ed6e9b82e5a7600abe23a3a06c2a;hb=ea4f9ce8a060d53cbc299e4c384089f6cc926caa;hp=9fef8f7e6281b6dac9e6583bbf32bc3889f47bb9;hpb=d85b722734a6fcfe94032f6113de9e5c190fd7c3;p=platform%2Fupstream%2Fglib.git diff --git a/glib/gnode.c b/glib/gnode.c index 9fef8f7..b529f48 100644 --- a/glib/gnode.c +++ b/glib/gnode.c @@ -15,9 +15,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library; if not, see . */ /* @@ -53,8 +51,9 @@ * g_node_insert_before(), g_node_append() and g_node_prepend(). * * To create a new node and insert it into a tree use - * g_node_insert_data(), g_node_insert_data_before(), - * g_node_append_data() and g_node_prepend_data(). + * g_node_insert_data(), g_node_insert_data_after(), + * g_node_insert_data_before(), g_node_append_data() + * and g_node_prepend_data(). * * To reverse the children of a node use g_node_reverse_children(). * @@ -87,8 +86,7 @@ * children are accessed by using the @next pointer of each * child. * - * The #GNode struct represents one node in a - * N-ary Tree. fields + * The #GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees]. **/ #define g_node_alloc0() g_slice_new0 (GNode) @@ -176,7 +174,7 @@ g_node_unlink (GNode *node) * * Recursively copies a #GNode and its data. * - * Return value: a new #GNode containing copies of the data in @node. + * Returns: a new #GNode containing copies of the data in @node. * * Since: 2.4 **/ @@ -819,6 +817,35 @@ g_node_depth_traverse_level (GNode *node, * It calls the given function for each node visited. * The traversal can be halted at any point by returning %TRUE from @func. */ + +/** + * GTraverseType: + * @G_IN_ORDER: vists a node's left child first, then the node itself, + * then its right child. This is the one to use if you + * want the output sorted according to the compare + * function. + * @G_PRE_ORDER: visits a node, then its children. + * @G_POST_ORDER: visits the node's children, then the node itself. + * @G_LEVEL_ORDER: is not implemented for + * [balanced binary trees][glib-Balanced-Binary-Trees]. + * For [n-ary trees][glib-N-ary-Trees], it + * vists the root node first, then its children, then + * its grandchildren, and so on. Note that this is less + * efficient than the other orders. + * + * Specifies the type of traveral performed by g_tree_traverse(), + * g_node_traverse() and g_node_find(). The different orders are + * illustrated here: + * - In order: A, B, C, D, E, F, G, H, I + * ![](Sorted_binary_tree_inorder.svg) + * - Pre order: F, B, A, D, C, E, G, I, H + * ![](Sorted_binary_tree_preorder.svg) + * - Post order: A, C, E, D, B, H, I, G, F + * ![](Sorted_binary_tree_postorder.svg) + * - Level order: F, B, G, A, D, I, C, E, H + * ![](Sorted_binary_tree_breadth-first_traversal.svg) + */ + /** * GTraverseFlags: * @G_TRAVERSE_LEAVES: only leaf nodes should be visited. This name has @@ -839,12 +866,13 @@ g_node_depth_traverse_level (GNode *node, * GNodeTraverseFunc: * @node: a #GNode. * @data: user data passed to g_node_traverse(). - * @Returns: %TRUE to stop the traversal. * * 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. + * + * Returns: %TRUE to stop the traversal. **/ void g_node_traverse (GNode *root,