Tizen 2.1 base
[platform/upstream/glib2.0.git] / docs / reference / glib / html / glib-N-ary-Trees.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>N-ary Trees</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-data-types.html" title="GLib Data Types">
9 <link rel="prev" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees">
10 <link rel="next" href="glib-Quarks.html" title="Quarks">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="glib-Balanced-Binary-Trees.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GLib Reference Manual</th>
21 <td><a accesskey="n" href="glib-Quarks.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#glib-N-ary-Trees.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#glib-N-ary-Trees.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="glib-N-ary-Trees"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="glib-N-ary-Trees.top_of_page"></a>N-ary Trees</span></h2>
34 <p>N-ary Trees — trees of data with any number of branches</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="glib-N-ary-Trees.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">
41 #include &lt;glib.h&gt;
42
43 struct              <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode">GNode</a>;
44 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-new" title="g_node_new ()">g_node_new</a>                          (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
45 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-copy" title="g_node_copy ()">g_node_copy</a>                         (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
46 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            (<a class="link" href="glib-N-ary-Trees.html#GCopyFunc" title="GCopyFunc ()">*GCopyFunc</a>)                        (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> src</code></em>,
47                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
48 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-copy-deep" title="g_node_copy_deep ()">g_node_copy_deep</a>                    (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
49                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GCopyFunc" title="GCopyFunc ()"><span class="type">GCopyFunc</span></a> copy_func</code></em>,
50                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
51
52 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-insert" title="g_node_insert ()">g_node_insert</a>                       (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
53                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> position</code></em>,
54                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
55 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-before" title="g_node_insert_before ()">g_node_insert_before</a>                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
56                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *sibling</code></em>,
57                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
58 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-after" title="g_node_insert_after ()">g_node_insert_after</a>                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
59                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *sibling</code></em>,
60                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
61 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-append" title="g_node_append()">g_node_append</a>                       (parent,
62                                                          node)
63 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-prepend" title="g_node_prepend ()">g_node_prepend</a>                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
64                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
65
66 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data" title="g_node_insert_data()">g_node_insert_data</a>                  (parent,
67                                                          position,
68                                                          data)
69 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-after" title="g_node_insert_data_after()">g_node_insert_data_after</a>            (parent,
70                                                          sibling,
71                                                          data)
72 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-before" title="g_node_insert_data_before()">g_node_insert_data_before</a>           (parent,
73                                                          sibling,
74                                                          data)
75 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-append-data" title="g_node_append_data()">g_node_append_data</a>                  (parent,
76                                                          data)
77 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-prepend-data" title="g_node_prepend_data()">g_node_prepend_data</a>                 (parent,
78                                                          data)
79
80 <span class="returnvalue">void</span>                <a class="link" href="glib-N-ary-Trees.html#g-node-reverse-children" title="g_node_reverse_children ()">g_node_reverse_children</a>             (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
81 <span class="returnvalue">void</span>                <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()">g_node_traverse</a>                     (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
82                                                          <em class="parameter"><code><a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType" title="enum GTraverseType"><span class="type">GTraverseType</span></a> order</code></em>,
83                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
84                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_depth</code></em>,
85                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc" title="GNodeTraverseFunc ()"><span class="type">GNodeTraverseFunc</span></a> func</code></em>,
86                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
87 enum                <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags">GTraverseFlags</a>;
88 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc" title="GNodeTraverseFunc ()">*GNodeTraverseFunc</a>)                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
89                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
90 <span class="returnvalue">void</span>                <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach" title="g_node_children_foreach ()">g_node_children_foreach</a>             (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
91                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
92                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc" title="GNodeForeachFunc ()"><span class="type">GNodeForeachFunc</span></a> func</code></em>,
93                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
94 <span class="returnvalue">void</span>                (<a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc" title="GNodeForeachFunc ()">*GNodeForeachFunc</a>)                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
95                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
96
97 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-get-root" title="g_node_get_root ()">g_node_get_root</a>                     (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
98 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-find" title="g_node_find ()">g_node_find</a>                         (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
99                                                          <em class="parameter"><code><a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType" title="enum GTraverseType"><span class="type">GTraverseType</span></a> order</code></em>,
100                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
101                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
102 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-find-child" title="g_node_find_child ()">g_node_find_child</a>                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
103                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
104                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
105 <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-N-ary-Trees.html#g-node-child-index" title="g_node_child_index ()">g_node_child_index</a>                  (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
106                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);
107 <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-N-ary-Trees.html#g-node-child-position" title="g_node_child_position ()">g_node_child_position</a>               (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
108                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *child</code></em>);
109 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-first-child" title="g_node_first_child()">g_node_first_child</a>                  (node)
110 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-last-child" title="g_node_last_child ()">g_node_last_child</a>                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
111 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-nth-child" title="g_node_nth_child ()">g_node_nth_child</a>                    (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
112                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n</code></em>);
113 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-first-sibling" title="g_node_first_sibling ()">g_node_first_sibling</a>                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
114 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-next-sibling" title="g_node_next_sibling()">g_node_next_sibling</a>                 (node)
115 #define             <a class="link" href="glib-N-ary-Trees.html#g-node-prev-sibling" title="g_node_prev_sibling()">g_node_prev_sibling</a>                 (node)
116 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             <a class="link" href="glib-N-ary-Trees.html#g-node-last-sibling" title="g_node_last_sibling ()">g_node_last_sibling</a>                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
117
118 #define             <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-LEAF:CAPS" title="G_NODE_IS_LEAF()">G_NODE_IS_LEAF</a>                      (node)
119 #define             <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-ROOT:CAPS" title="G_NODE_IS_ROOT()">G_NODE_IS_ROOT</a>                      (node)
120 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-N-ary-Trees.html#g-node-depth" title="g_node_depth ()">g_node_depth</a>                        (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
121 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-N-ary-Trees.html#g-node-n-nodes" title="g_node_n_nodes ()">g_node_n_nodes</a>                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
122                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>);
123 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-N-ary-Trees.html#g-node-n-children" title="g_node_n_children ()">g_node_n_children</a>                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
124 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-N-ary-Trees.html#g-node-is-ancestor" title="g_node_is_ancestor ()">g_node_is_ancestor</a>                  (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
125                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *descendant</code></em>);
126 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-N-ary-Trees.html#g-node-max-height" title="g_node_max_height ()">g_node_max_height</a>                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>);
127
128 <span class="returnvalue">void</span>                <a class="link" href="glib-N-ary-Trees.html#g-node-unlink" title="g_node_unlink ()">g_node_unlink</a>                       (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);
129 <span class="returnvalue">void</span>                <a class="link" href="glib-N-ary-Trees.html#g-node-destroy" title="g_node_destroy ()">g_node_destroy</a>                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>);
130 </pre>
131 </div>
132 <div class="refsect1">
133 <a name="glib-N-ary-Trees.description"></a><h2>Description</h2>
134 <p>
135 The <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> struct and its associated functions provide a N-ary tree
136 data structure, where nodes in the tree can contain arbitrary data.
137 </p>
138 <p>
139 To create a new tree use <a class="link" href="glib-N-ary-Trees.html#g-node-new" title="g_node_new ()"><code class="function">g_node_new()</code></a>.
140 </p>
141 <p>
142 To insert a node into a tree use <a class="link" href="glib-N-ary-Trees.html#g-node-insert" title="g_node_insert ()"><code class="function">g_node_insert()</code></a>,
143 <a class="link" href="glib-N-ary-Trees.html#g-node-insert-before" title="g_node_insert_before ()"><code class="function">g_node_insert_before()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-append" title="g_node_append()"><code class="function">g_node_append()</code></a> and <a class="link" href="glib-N-ary-Trees.html#g-node-prepend" title="g_node_prepend ()"><code class="function">g_node_prepend()</code></a>.
144 </p>
145 <p>
146 To create a new node and insert it into a tree use
147 <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data" title="g_node_insert_data()"><code class="function">g_node_insert_data()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-after" title="g_node_insert_data_after()"><code class="function">g_node_insert_data_after()</code></a>,
148 <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-before" title="g_node_insert_data_before()"><code class="function">g_node_insert_data_before()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-append-data" title="g_node_append_data()"><code class="function">g_node_append_data()</code></a>
149 and <a class="link" href="glib-N-ary-Trees.html#g-node-prepend-data" title="g_node_prepend_data()"><code class="function">g_node_prepend_data()</code></a>.
150 </p>
151 <p>
152 To reverse the children of a node use <a class="link" href="glib-N-ary-Trees.html#g-node-reverse-children" title="g_node_reverse_children ()"><code class="function">g_node_reverse_children()</code></a>.
153 </p>
154 <p>
155 To find a node use <a class="link" href="glib-N-ary-Trees.html#g-node-get-root" title="g_node_get_root ()"><code class="function">g_node_get_root()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-find" title="g_node_find ()"><code class="function">g_node_find()</code></a>,
156 <a class="link" href="glib-N-ary-Trees.html#g-node-find-child" title="g_node_find_child ()"><code class="function">g_node_find_child()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-child-index" title="g_node_child_index ()"><code class="function">g_node_child_index()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-child-position" title="g_node_child_position ()"><code class="function">g_node_child_position()</code></a>,
157 <a class="link" href="glib-N-ary-Trees.html#g-node-first-child" title="g_node_first_child()"><code class="function">g_node_first_child()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-last-child" title="g_node_last_child ()"><code class="function">g_node_last_child()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-nth-child" title="g_node_nth_child ()"><code class="function">g_node_nth_child()</code></a>,
158 <a class="link" href="glib-N-ary-Trees.html#g-node-first-sibling" title="g_node_first_sibling ()"><code class="function">g_node_first_sibling()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-prev-sibling" title="g_node_prev_sibling()"><code class="function">g_node_prev_sibling()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-next-sibling" title="g_node_next_sibling()"><code class="function">g_node_next_sibling()</code></a>
159 or <a class="link" href="glib-N-ary-Trees.html#g-node-last-sibling" title="g_node_last_sibling ()"><code class="function">g_node_last_sibling()</code></a>.
160 </p>
161 <p>
162 To get information about a node or tree use <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-LEAF:CAPS" title="G_NODE_IS_LEAF()"><code class="function">G_NODE_IS_LEAF()</code></a>,
163 <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-ROOT:CAPS" title="G_NODE_IS_ROOT()"><code class="function">G_NODE_IS_ROOT()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-depth" title="g_node_depth ()"><code class="function">g_node_depth()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-n-nodes" title="g_node_n_nodes ()"><code class="function">g_node_n_nodes()</code></a>,
164 <a class="link" href="glib-N-ary-Trees.html#g-node-n-children" title="g_node_n_children ()"><code class="function">g_node_n_children()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-is-ancestor" title="g_node_is_ancestor ()"><code class="function">g_node_is_ancestor()</code></a> or <a class="link" href="glib-N-ary-Trees.html#g-node-max-height" title="g_node_max_height ()"><code class="function">g_node_max_height()</code></a>.
165 </p>
166 <p>
167 To traverse a tree, calling a function for each node visited in the
168 traversal, use <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()"><code class="function">g_node_traverse()</code></a> or <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach" title="g_node_children_foreach ()"><code class="function">g_node_children_foreach()</code></a>.
169 </p>
170 <p>
171 To remove a node or subtree from a tree use <a class="link" href="glib-N-ary-Trees.html#g-node-unlink" title="g_node_unlink ()"><code class="function">g_node_unlink()</code></a> or
172 <a class="link" href="glib-N-ary-Trees.html#g-node-destroy" title="g_node_destroy ()"><code class="function">g_node_destroy()</code></a>.
173 </p>
174 </div>
175 <div class="refsect1">
176 <a name="glib-N-ary-Trees.details"></a><h2>Details</h2>
177 <div class="refsect2">
178 <a name="GNode"></a><h3>struct GNode</h3>
179 <pre class="programlisting">struct GNode {
180   gpointer data;
181   GNode   *next;
182   GNode   *prev;
183   GNode   *parent;
184   GNode   *children;
185 };
186 </pre>
187 <p>
188 The <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> struct represents one node in a
189 <a class="link" href="glib-N-ary-Trees.html" title="N-ary Trees">N-ary Tree</a>. fields
190 </p>
191 <div class="variablelist"><table border="0">
192 <col align="left" valign="top">
193 <tbody>
194 <tr>
195 <td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> <em class="structfield"><code><a name="GNode.data"></a>data</code></em>;</span></p></td>
196 <td>contains the actual data of the node.</td>
197 </tr>
198 <tr>
199 <td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *<em class="structfield"><code><a name="GNode.next"></a>next</code></em>;</span></p></td>
200 <td>points to the node's next sibling (a sibling is another
201 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> with the same parent).</td>
202 </tr>
203 <tr>
204 <td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *<em class="structfield"><code><a name="GNode.prev"></a>prev</code></em>;</span></p></td>
205 <td>points to the node's previous sibling.</td>
206 </tr>
207 <tr>
208 <td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *<em class="structfield"><code><a name="GNode.parent"></a>parent</code></em>;</span></p></td>
209 <td>points to the parent of the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>, or is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the
210 <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is the root of the tree.</td>
211 </tr>
212 <tr>
213 <td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *<em class="structfield"><code><a name="GNode.children"></a>children</code></em>;</span></p></td>
214 <td>points to the first child of the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.  The other
215 children are accessed by using the <em class="parameter"><code>next</code></em> pointer of each
216 child.</td>
217 </tr>
218 </tbody>
219 </table></div>
220 </div>
221 <hr>
222 <div class="refsect2">
223 <a name="g-node-new"></a><h3>g_node_new ()</h3>
224 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_new                          (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
225 <p>
226 Creates a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> containing the given data.
227 Used to create the first node in a tree.
228 </p>
229 <div class="variablelist"><table border="0">
230 <col align="left" valign="top">
231 <tbody>
232 <tr>
233 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
234 <td>the data of the new node</td>
235 </tr>
236 <tr>
237 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
238 <td>a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
239 </td>
240 </tr>
241 </tbody>
242 </table></div>
243 </div>
244 <hr>
245 <div class="refsect2">
246 <a name="g-node-copy"></a><h3>g_node_copy ()</h3>
247 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_copy                         (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
248 <p>
249 Recursively copies a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> (but does not deep-copy the data inside the 
250 nodes, see <a class="link" href="glib-N-ary-Trees.html#g-node-copy-deep" title="g_node_copy_deep ()"><code class="function">g_node_copy_deep()</code></a> if you need that).
251 </p>
252 <div class="variablelist"><table border="0">
253 <col align="left" valign="top">
254 <tbody>
255 <tr>
256 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
257 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
258 </td>
259 </tr>
260 <tr>
261 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
262 <td>a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> containing the same data pointers</td>
263 </tr>
264 </tbody>
265 </table></div>
266 </div>
267 <hr>
268 <div class="refsect2">
269 <a name="GCopyFunc"></a><h3>GCopyFunc ()</h3>
270 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            (*GCopyFunc)                        (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> src</code></em>,
271                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
272 <p>
273 A function of this signature is used to copy the node data 
274 when doing a deep-copy of a tree.
275 </p>
276 <div class="variablelist"><table border="0">
277 <col align="left" valign="top">
278 <tbody>
279 <tr>
280 <td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
281 <td>A pointer to the data which should be copied</td>
282 </tr>
283 <tr>
284 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
285 <td>Additional data</td>
286 </tr>
287 <tr>
288 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
289 <td>A pointer to the copy</td>
290 </tr>
291 </tbody>
292 </table></div>
293 <p class="since">Since 2.4</p>
294 </div>
295 <hr>
296 <div class="refsect2">
297 <a name="g-node-copy-deep"></a><h3>g_node_copy_deep ()</h3>
298 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_copy_deep                    (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
299                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GCopyFunc" title="GCopyFunc ()"><span class="type">GCopyFunc</span></a> copy_func</code></em>,
300                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
301 <p>
302 Recursively copies a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> and its data.
303 </p>
304 <div class="variablelist"><table border="0">
305 <col align="left" valign="top">
306 <tbody>
307 <tr>
308 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
309 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
310 </td>
311 </tr>
312 <tr>
313 <td><p><span class="term"><em class="parameter"><code>copy_func</code></em> :</span></p></td>
314 <td>the function which is called to copy the data inside each node,
315 or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use the original data.</td>
316 </tr>
317 <tr>
318 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
319 <td>data to pass to <em class="parameter"><code>copy_func</code></em>
320 </td>
321 </tr>
322 <tr>
323 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
324 <td>a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> containing copies of the data in <em class="parameter"><code>node</code></em>.</td>
325 </tr>
326 </tbody>
327 </table></div>
328 <p class="since">Since 2.4</p>
329 </div>
330 <hr>
331 <div class="refsect2">
332 <a name="g-node-insert"></a><h3>g_node_insert ()</h3>
333 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_insert                       (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
334                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> position</code></em>,
335                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
336 <p>
337 Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> beneath the parent at the given position.
338 </p>
339 <div class="variablelist"><table border="0">
340 <col align="left" valign="top">
341 <tbody>
342 <tr>
343 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
344 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under</td>
345 </tr>
346 <tr>
347 <td><p><span class="term"><em class="parameter"><code>position</code></em> :</span></p></td>
348 <td>the position to place <em class="parameter"><code>node</code></em> at, with respect to its siblings
349 If position is -1, <em class="parameter"><code>node</code></em> is inserted as the last child of <em class="parameter"><code>parent</code></em>
350 </td>
351 </tr>
352 <tr>
353 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
354 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to insert</td>
355 </tr>
356 <tr>
357 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
358 <td>the inserted <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
359 </td>
360 </tr>
361 </tbody>
362 </table></div>
363 </div>
364 <hr>
365 <div class="refsect2">
366 <a name="g-node-insert-before"></a><h3>g_node_insert_before ()</h3>
367 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_insert_before                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
368                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *sibling</code></em>,
369                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
370 <p>
371 Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> beneath the parent before the given sibling.
372 </p>
373 <div class="variablelist"><table border="0">
374 <col align="left" valign="top">
375 <tbody>
376 <tr>
377 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
378 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under</td>
379 </tr>
380 <tr>
381 <td><p><span class="term"><em class="parameter"><code>sibling</code></em> :</span></p></td>
382 <td>the sibling <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> before.
383 If sibling is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the node is inserted as the last child of <em class="parameter"><code>parent</code></em>.</td>
384 </tr>
385 <tr>
386 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
387 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to insert</td>
388 </tr>
389 <tr>
390 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
391 <td>the inserted <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
392 </td>
393 </tr>
394 </tbody>
395 </table></div>
396 </div>
397 <hr>
398 <div class="refsect2">
399 <a name="g-node-insert-after"></a><h3>g_node_insert_after ()</h3>
400 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_insert_after                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
401                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *sibling</code></em>,
402                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
403 <p>
404 Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> beneath the parent after the given sibling.
405 </p>
406 <div class="variablelist"><table border="0">
407 <col align="left" valign="top">
408 <tbody>
409 <tr>
410 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
411 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under</td>
412 </tr>
413 <tr>
414 <td><p><span class="term"><em class="parameter"><code>sibling</code></em> :</span></p></td>
415 <td>the sibling <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> after.
416 If sibling is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the node is inserted as the first child of <em class="parameter"><code>parent</code></em>.</td>
417 </tr>
418 <tr>
419 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
420 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to insert</td>
421 </tr>
422 <tr>
423 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
424 <td>the inserted <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
425 </td>
426 </tr>
427 </tbody>
428 </table></div>
429 </div>
430 <hr>
431 <div class="refsect2">
432 <a name="g-node-append"></a><h3>g_node_append()</h3>
433 <pre class="programlisting">#define             g_node_append(parent, node)</pre>
434 <p>
435 Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> as the last child of the given parent.
436 </p>
437 <div class="variablelist"><table border="0">
438 <col align="left" valign="top">
439 <tbody>
440 <tr>
441 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
442 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
443 </tr>
444 <tr>
445 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
446 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to insert</td>
447 </tr>
448 <tr>
449 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
450 <td>the inserted <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
451 </td>
452 </tr>
453 </tbody>
454 </table></div>
455 </div>
456 <hr>
457 <div class="refsect2">
458 <a name="g-node-prepend"></a><h3>g_node_prepend ()</h3>
459 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_prepend                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *parent</code></em>,
460                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
461 <p>
462 Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> as the first child of the given parent.
463 </p>
464 <div class="variablelist"><table border="0">
465 <col align="left" valign="top">
466 <tbody>
467 <tr>
468 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
469 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
470 </tr>
471 <tr>
472 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
473 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to insert</td>
474 </tr>
475 <tr>
476 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
477 <td>the inserted <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
478 </td>
479 </tr>
480 </tbody>
481 </table></div>
482 </div>
483 <hr>
484 <div class="refsect2">
485 <a name="g-node-insert-data"></a><h3>g_node_insert_data()</h3>
486 <pre class="programlisting">#define             g_node_insert_data(parent, position, data)</pre>
487 <p>
488 Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> at the given position.
489 </p>
490 <div class="variablelist"><table border="0">
491 <col align="left" valign="top">
492 <tbody>
493 <tr>
494 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
495 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
496 </tr>
497 <tr>
498 <td><p><span class="term"><em class="parameter"><code>position</code></em> :</span></p></td>
499 <td>the position to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> at. If position is -1,
500 the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is inserted as the last child of <em class="parameter"><code>parent</code></em>
501 </td>
502 </tr>
503 <tr>
504 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
505 <td>the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
506 </td>
507 </tr>
508 <tr>
509 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
510 <td>the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
511 </td>
512 </tr>
513 </tbody>
514 </table></div>
515 </div>
516 <hr>
517 <div class="refsect2">
518 <a name="g-node-insert-data-after"></a><h3>g_node_insert_data_after()</h3>
519 <pre class="programlisting">#define             g_node_insert_data_after(parent, sibling, data)</pre>
520 <p>
521 Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> after the given sibling.
522 </p>
523 <div class="variablelist"><table border="0">
524 <col align="left" valign="top">
525 <tbody>
526 <tr>
527 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
528 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
529 </tr>
530 <tr>
531 <td><p><span class="term"><em class="parameter"><code>sibling</code></em> :</span></p></td>
532 <td>the sibling <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> after</td>
533 </tr>
534 <tr>
535 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
536 <td>the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
537 </td>
538 </tr>
539 <tr>
540 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
541 <td>the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
542 </td>
543 </tr>
544 </tbody>
545 </table></div>
546 </div>
547 <hr>
548 <div class="refsect2">
549 <a name="g-node-insert-data-before"></a><h3>g_node_insert_data_before()</h3>
550 <pre class="programlisting">#define             g_node_insert_data_before(parent, sibling, data)</pre>
551 <p>
552 Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> before the given sibling.
553 </p>
554 <div class="variablelist"><table border="0">
555 <col align="left" valign="top">
556 <tbody>
557 <tr>
558 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
559 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
560 </tr>
561 <tr>
562 <td><p><span class="term"><em class="parameter"><code>sibling</code></em> :</span></p></td>
563 <td>the sibling <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> before</td>
564 </tr>
565 <tr>
566 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
567 <td>the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
568 </td>
569 </tr>
570 <tr>
571 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
572 <td>the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
573 </td>
574 </tr>
575 </tbody>
576 </table></div>
577 </div>
578 <hr>
579 <div class="refsect2">
580 <a name="g-node-append-data"></a><h3>g_node_append_data()</h3>
581 <pre class="programlisting">#define             g_node_append_data(parent, data)</pre>
582 <p>
583 Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> as the last child of the given parent.
584 </p>
585 <div class="variablelist"><table border="0">
586 <col align="left" valign="top">
587 <tbody>
588 <tr>
589 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
590 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
591 </tr>
592 <tr>
593 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
594 <td>the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
595 </td>
596 </tr>
597 <tr>
598 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
599 <td>the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
600 </td>
601 </tr>
602 </tbody>
603 </table></div>
604 </div>
605 <hr>
606 <div class="refsect2">
607 <a name="g-node-prepend-data"></a><h3>g_node_prepend_data()</h3>
608 <pre class="programlisting">#define             g_node_prepend_data(parent, data)</pre>
609 <p>
610 Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> as the first child of the given parent.
611 </p>
612 <div class="variablelist"><table border="0">
613 <col align="left" valign="top">
614 <tbody>
615 <tr>
616 <td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
617 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> under</td>
618 </tr>
619 <tr>
620 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
621 <td>the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
622 </td>
623 </tr>
624 <tr>
625 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
626 <td>the new <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
627 </td>
628 </tr>
629 </tbody>
630 </table></div>
631 </div>
632 <hr>
633 <div class="refsect2">
634 <a name="g-node-reverse-children"></a><h3>g_node_reverse_children ()</h3>
635 <pre class="programlisting"><span class="returnvalue">void</span>                g_node_reverse_children             (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
636 <p>
637 Reverses the order of the children of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
638 (It doesn't change the order of the grandchildren.)
639 </p>
640 <div class="variablelist"><table border="0">
641 <col align="left" valign="top">
642 <tbody><tr>
643 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
644 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.</td>
645 </tr></tbody>
646 </table></div>
647 </div>
648 <hr>
649 <div class="refsect2">
650 <a name="g-node-traverse"></a><h3>g_node_traverse ()</h3>
651 <pre class="programlisting"><span class="returnvalue">void</span>                g_node_traverse                     (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
652                                                          <em class="parameter"><code><a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType" title="enum GTraverseType"><span class="type">GTraverseType</span></a> order</code></em>,
653                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
654                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> max_depth</code></em>,
655                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc" title="GNodeTraverseFunc ()"><span class="type">GNodeTraverseFunc</span></a> func</code></em>,
656                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
657 <p>
658 Traverses a tree starting at the given root <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
659 It calls the given function for each node visited.
660 The traversal can be halted at any point by returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> from <em class="parameter"><code>func</code></em>.
661 </p>
662 <div class="variablelist"><table border="0">
663 <col align="left" valign="top">
664 <tbody>
665 <tr>
666 <td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td>
667 <td>the root <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> of the tree to traverse</td>
668 </tr>
669 <tr>
670 <td><p><span class="term"><em class="parameter"><code>order</code></em> :</span></p></td>
671 <td>the order in which nodes are visited - <a class="link" href="glib-Balanced-Binary-Trees.html#G-IN-ORDER:CAPS"><code class="literal">G_IN_ORDER</code></a>,
672 <a class="link" href="glib-Balanced-Binary-Trees.html#G-PRE-ORDER:CAPS"><code class="literal">G_PRE_ORDER</code></a>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-POST-ORDER:CAPS"><code class="literal">G_POST_ORDER</code></a>, or <a class="link" href="glib-Balanced-Binary-Trees.html#G-LEVEL-ORDER:CAPS"><code class="literal">G_LEVEL_ORDER</code></a>.</td>
673 </tr>
674 <tr>
675 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
676 <td>which types of children are to be visited, one of
677 <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
678 </td>
679 </tr>
680 <tr>
681 <td><p><span class="term"><em class="parameter"><code>max_depth</code></em> :</span></p></td>
682 <td>the maximum depth of the traversal. Nodes below this
683 depth will not be visited. If max_depth is -1 all nodes in
684 the tree are visited. If depth is 1, only the root is visited.
685 If depth is 2, the root and its children are visited. And so on.</td>
686 </tr>
687 <tr>
688 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
689 <td>the function to call for each visited <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
690 </td>
691 </tr>
692 <tr>
693 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
694 <td>user data to pass to the function</td>
695 </tr>
696 </tbody>
697 </table></div>
698 </div>
699 <hr>
700 <div class="refsect2">
701 <a name="GTraverseFlags"></a><h3>enum GTraverseFlags</h3>
702 <pre class="programlisting">typedef enum {
703   G_TRAVERSE_LEAVES     = 1 &lt;&lt; 0,
704   G_TRAVERSE_NON_LEAVES = 1 &lt;&lt; 1,
705   G_TRAVERSE_ALL        = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES,
706   G_TRAVERSE_MASK       = 0x03,
707   G_TRAVERSE_LEAFS      = G_TRAVERSE_LEAVES,
708   G_TRAVERSE_NON_LEAFS  = G_TRAVERSE_NON_LEAVES
709 } GTraverseFlags;
710 </pre>
711 <p>
712 Specifies which nodes are visited during several of the tree
713 functions, including <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()"><code class="function">g_node_traverse()</code></a> and <a class="link" href="glib-N-ary-Trees.html#g-node-find" title="g_node_find ()"><code class="function">g_node_find()</code></a>.
714 </p>
715 <div class="variablelist"><table border="0">
716 <col align="left" valign="top">
717 <tbody>
718 <tr>
719 <td><p><a name="G-TRAVERSE-LEAVES:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_LEAVES</code></span></p></td>
720 <td>only leaf nodes should be visited. This name has
721                     been introduced in 2.6, for older version use
722                     <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAFS:CAPS"><code class="literal">G_TRAVERSE_LEAFS</code></a>.
723 </td>
724 </tr>
725 <tr>
726 <td><p><a name="G-TRAVERSE-NON-LEAVES:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_NON_LEAVES</code></span></p></td>
727 <td>only non-leaf nodes should be visited. This
728                         name has been introduced in 2.6, for older
729                         version use <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAFS:CAPS"><code class="literal">G_TRAVERSE_NON_LEAFS</code></a>.
730 </td>
731 </tr>
732 <tr>
733 <td><p><a name="G-TRAVERSE-ALL:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_ALL</code></span></p></td>
734 <td>all nodes should be visited.
735 </td>
736 </tr>
737 <tr>
738 <td><p><a name="G-TRAVERSE-MASK:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_MASK</code></span></p></td>
739 <td>a mask of all traverse flags.
740 </td>
741 </tr>
742 <tr>
743 <td><p><a name="G-TRAVERSE-LEAFS:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_LEAFS</code></span></p></td>
744 <td>identical to <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a>.
745 </td>
746 </tr>
747 <tr>
748 <td><p><a name="G-TRAVERSE-NON-LEAFS:CAPS"></a><span class="term"><code class="literal">G_TRAVERSE_NON_LEAFS</code></span></p></td>
749 <td>identical to <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>.
750 </td>
751 </tr>
752 </tbody>
753 </table></div>
754 </div>
755 <hr>
756 <div class="refsect2">
757 <a name="GNodeTraverseFunc"></a><h3>GNodeTraverseFunc ()</h3>
758 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (*GNodeTraverseFunc)                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
759                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
760 <p>
761 Specifies the type of function passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()"><code class="function">g_node_traverse()</code></a>. The
762 function is called with each of the nodes visited, together with the
763 user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()"><code class="function">g_node_traverse()</code></a>. If the function returns
764 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, then the traversal is stopped.
765 </p>
766 <div class="variablelist"><table border="0">
767 <col align="left" valign="top">
768 <tbody>
769 <tr>
770 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
771 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.</td>
772 </tr>
773 <tr>
774 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
775 <td>user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse" title="g_node_traverse ()"><code class="function">g_node_traverse()</code></a>.</td>
776 </tr>
777 <tr>
778 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
779 <td>
780 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> to stop the traversal.</td>
781 </tr>
782 </tbody>
783 </table></div>
784 </div>
785 <hr>
786 <div class="refsect2">
787 <a name="g-node-children-foreach"></a><h3>g_node_children_foreach ()</h3>
788 <pre class="programlisting"><span class="returnvalue">void</span>                g_node_children_foreach             (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
789                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
790                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc" title="GNodeForeachFunc ()"><span class="type">GNodeForeachFunc</span></a> func</code></em>,
791                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
792 <p>
793 Calls a function for each of the children of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
794 Note that it doesn't descend beneath the child nodes.
795 </p>
796 <div class="variablelist"><table border="0">
797 <col align="left" valign="top">
798 <tbody>
799 <tr>
800 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
801 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
802 </td>
803 </tr>
804 <tr>
805 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
806 <td>which types of children are to be visited, one of
807 <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
808 </td>
809 </tr>
810 <tr>
811 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
812 <td>the function to call for each visited node</td>
813 </tr>
814 <tr>
815 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
816 <td>user data to pass to the function</td>
817 </tr>
818 </tbody>
819 </table></div>
820 </div>
821 <hr>
822 <div class="refsect2">
823 <a name="GNodeForeachFunc"></a><h3>GNodeForeachFunc ()</h3>
824 <pre class="programlisting"><span class="returnvalue">void</span>                (*GNodeForeachFunc)                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
825                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
826 <p>
827 Specifies the type of function passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach" title="g_node_children_foreach ()"><code class="function">g_node_children_foreach()</code></a>.
828 The function is called with each child node, together with the user
829 data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach" title="g_node_children_foreach ()"><code class="function">g_node_children_foreach()</code></a>.
830 </p>
831 <div class="variablelist"><table border="0">
832 <col align="left" valign="top">
833 <tbody>
834 <tr>
835 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
836 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.</td>
837 </tr>
838 <tr>
839 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
840 <td>user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach" title="g_node_children_foreach ()"><code class="function">g_node_children_foreach()</code></a>.</td>
841 </tr>
842 </tbody>
843 </table></div>
844 </div>
845 <hr>
846 <div class="refsect2">
847 <a name="g-node-get-root"></a><h3>g_node_get_root ()</h3>
848 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_get_root                     (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
849 <p>
850 Gets the root of a tree.
851 </p>
852 <div class="variablelist"><table border="0">
853 <col align="left" valign="top">
854 <tbody>
855 <tr>
856 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
857 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
858 </td>
859 </tr>
860 <tr>
861 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
862 <td>the root of the tree</td>
863 </tr>
864 </tbody>
865 </table></div>
866 </div>
867 <hr>
868 <div class="refsect2">
869 <a name="g-node-find"></a><h3>g_node_find ()</h3>
870 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_find                         (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
871                                                          <em class="parameter"><code><a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType" title="enum GTraverseType"><span class="type">GTraverseType</span></a> order</code></em>,
872                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
873                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
874 <p>
875 Finds a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> in a tree.
876 </p>
877 <div class="variablelist"><table border="0">
878 <col align="left" valign="top">
879 <tbody>
880 <tr>
881 <td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td>
882 <td>the root <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> of the tree to search</td>
883 </tr>
884 <tr>
885 <td><p><span class="term"><em class="parameter"><code>order</code></em> :</span></p></td>
886 <td>the order in which nodes are visited - <a class="link" href="glib-Balanced-Binary-Trees.html#G-IN-ORDER:CAPS"><code class="literal">G_IN_ORDER</code></a>,
887 <a class="link" href="glib-Balanced-Binary-Trees.html#G-PRE-ORDER:CAPS"><code class="literal">G_PRE_ORDER</code></a>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-POST-ORDER:CAPS"><code class="literal">G_POST_ORDER</code></a>, or <a class="link" href="glib-Balanced-Binary-Trees.html#G-LEVEL-ORDER:CAPS"><code class="literal">G_LEVEL_ORDER</code></a>
888 </td>
889 </tr>
890 <tr>
891 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
892 <td>which types of children are to be searched, one of
893 <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
894 </td>
895 </tr>
896 <tr>
897 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
898 <td>the data to find</td>
899 </tr>
900 <tr>
901 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
902 <td>the found <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the data is not found</td>
903 </tr>
904 </tbody>
905 </table></div>
906 </div>
907 <hr>
908 <div class="refsect2">
909 <a name="g-node-find-child"></a><h3>g_node_find_child ()</h3>
910 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_find_child                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
911                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>,
912                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
913 <p>
914 Finds the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> with the given data.
915 </p>
916 <div class="variablelist"><table border="0">
917 <col align="left" valign="top">
918 <tbody>
919 <tr>
920 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
921 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
922 </td>
923 </tr>
924 <tr>
925 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
926 <td>which types of children are to be searched, one of
927 <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
928 </td>
929 </tr>
930 <tr>
931 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
932 <td>the data to find</td>
933 </tr>
934 <tr>
935 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
936 <td>the found child <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the data is not found</td>
937 </tr>
938 </tbody>
939 </table></div>
940 </div>
941 <hr>
942 <div class="refsect2">
943 <a name="g-node-child-index"></a><h3>g_node_child_index ()</h3>
944 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_node_child_index                  (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
945                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
946 <p>
947 Gets the position of the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> 
948 which contains the given data.
949 </p>
950 <div class="variablelist"><table border="0">
951 <col align="left" valign="top">
952 <tbody>
953 <tr>
954 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
955 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
956 </td>
957 </tr>
958 <tr>
959 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
960 <td>the data to find</td>
961 </tr>
962 <tr>
963 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
964 <td>the index of the child of <em class="parameter"><code>node</code></em> which contains
965 <em class="parameter"><code>data</code></em>, or -1 if the data is not found</td>
966 </tr>
967 </tbody>
968 </table></div>
969 </div>
970 <hr>
971 <div class="refsect2">
972 <a name="g-node-child-position"></a><h3>g_node_child_position ()</h3>
973 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_node_child_position               (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
974                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *child</code></em>);</pre>
975 <p>
976 Gets the position of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> with respect to its siblings.
977 <em class="parameter"><code>child</code></em> must be a child of <em class="parameter"><code>node</code></em>. The first child is numbered 0, 
978 the second 1, and so on.
979 </p>
980 <div class="variablelist"><table border="0">
981 <col align="left" valign="top">
982 <tbody>
983 <tr>
984 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
985 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
986 </td>
987 </tr>
988 <tr>
989 <td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td>
990 <td>a child of <em class="parameter"><code>node</code></em>
991 </td>
992 </tr>
993 <tr>
994 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
995 <td>the position of <em class="parameter"><code>child</code></em> with respect to its siblings</td>
996 </tr>
997 </tbody>
998 </table></div>
999 </div>
1000 <hr>
1001 <div class="refsect2">
1002 <a name="g-node-first-child"></a><h3>g_node_first_child()</h3>
1003 <pre class="programlisting">#define             g_node_first_child(node)</pre>
1004 <p>
1005 Gets the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1006 </p>
1007 <div class="variablelist"><table border="0">
1008 <col align="left" valign="top">
1009 <tbody>
1010 <tr>
1011 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1012 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1013 </td>
1014 </tr>
1015 <tr>
1016 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1017 <td>the first child of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
1018 or has no children</td>
1019 </tr>
1020 </tbody>
1021 </table></div>
1022 </div>
1023 <hr>
1024 <div class="refsect2">
1025 <a name="g-node-last-child"></a><h3>g_node_last_child ()</h3>
1026 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_last_child                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1027 <p>
1028 Gets the last child of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1029 </p>
1030 <div class="variablelist"><table border="0">
1031 <col align="left" valign="top">
1032 <tbody>
1033 <tr>
1034 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1035 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> (must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>)</td>
1036 </tr>
1037 <tr>
1038 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1039 <td>the last child of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> has no children</td>
1040 </tr>
1041 </tbody>
1042 </table></div>
1043 </div>
1044 <hr>
1045 <div class="refsect2">
1046 <a name="g-node-nth-child"></a><h3>g_node_nth_child ()</h3>
1047 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_nth_child                    (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
1048                                                          <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n</code></em>);</pre>
1049 <p>
1050 Gets a child of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>, using the given index.
1051 The first child is at index 0. If the index is 
1052 too big, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
1053 </p>
1054 <div class="variablelist"><table border="0">
1055 <col align="left" valign="top">
1056 <tbody>
1057 <tr>
1058 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1059 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1060 </td>
1061 </tr>
1062 <tr>
1063 <td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td>
1064 <td>the index of the desired child</td>
1065 </tr>
1066 <tr>
1067 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1068 <td>the child of <em class="parameter"><code>node</code></em> at index <em class="parameter"><code>n</code></em>
1069 </td>
1070 </tr>
1071 </tbody>
1072 </table></div>
1073 </div>
1074 <hr>
1075 <div class="refsect2">
1076 <a name="g-node-first-sibling"></a><h3>g_node_first_sibling ()</h3>
1077 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_first_sibling                (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1078 <p>
1079 Gets the first sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1080 This could possibly be the node itself.
1081 </p>
1082 <div class="variablelist"><table border="0">
1083 <col align="left" valign="top">
1084 <tbody>
1085 <tr>
1086 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1087 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1088 </td>
1089 </tr>
1090 <tr>
1091 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1092 <td>the first sibling of <em class="parameter"><code>node</code></em>
1093 </td>
1094 </tr>
1095 </tbody>
1096 </table></div>
1097 </div>
1098 <hr>
1099 <div class="refsect2">
1100 <a name="g-node-next-sibling"></a><h3>g_node_next_sibling()</h3>
1101 <pre class="programlisting">#define             g_node_next_sibling(node)</pre>
1102 <p>
1103 Gets the next sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1104 </p>
1105 <div class="variablelist"><table border="0">
1106 <col align="left" valign="top">
1107 <tbody>
1108 <tr>
1109 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1110 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1111 </td>
1112 </tr>
1113 <tr>
1114 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1115 <td>the next sibling of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is the last node
1116 or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
1117 </td>
1118 </tr>
1119 </tbody>
1120 </table></div>
1121 </div>
1122 <hr>
1123 <div class="refsect2">
1124 <a name="g-node-prev-sibling"></a><h3>g_node_prev_sibling()</h3>
1125 <pre class="programlisting">#define             g_node_prev_sibling(node)</pre>
1126 <p>
1127 Gets the previous sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1128 </p>
1129 <div class="variablelist"><table border="0">
1130 <col align="left" valign="top">
1131 <tbody>
1132 <tr>
1133 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1134 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1135 </td>
1136 </tr>
1137 <tr>
1138 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1139 <td>the previous sibling of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is the first
1140 node or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
1141 </td>
1142 </tr>
1143 </tbody>
1144 </table></div>
1145 </div>
1146 <hr>
1147 <div class="refsect2">
1148 <a name="g-node-last-sibling"></a><h3>g_node_last_sibling ()</h3>
1149 <pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="returnvalue">GNode</span></a> *             g_node_last_sibling                 (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1150 <p>
1151 Gets the last sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1152 This could possibly be the node itself.
1153 </p>
1154 <div class="variablelist"><table border="0">
1155 <col align="left" valign="top">
1156 <tbody>
1157 <tr>
1158 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1159 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1160 </td>
1161 </tr>
1162 <tr>
1163 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1164 <td>the last sibling of <em class="parameter"><code>node</code></em>
1165 </td>
1166 </tr>
1167 </tbody>
1168 </table></div>
1169 </div>
1170 <hr>
1171 <div class="refsect2">
1172 <a name="G-NODE-IS-LEAF:CAPS"></a><h3>G_NODE_IS_LEAF()</h3>
1173 <pre class="programlisting">#define      G_NODE_IS_LEAF(node) (((GNode*) (node))-&gt;children == NULL)
1174 </pre>
1175 <p>
1176 Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is a leaf node.
1177 </p>
1178 <div class="variablelist"><table border="0">
1179 <col align="left" valign="top">
1180 <tbody>
1181 <tr>
1182 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1183 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1184 </td>
1185 </tr>
1186 <tr>
1187 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1188 <td>
1189 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is a leaf node
1190 (i.e. it has no children)</td>
1191 </tr>
1192 </tbody>
1193 </table></div>
1194 </div>
1195 <hr>
1196 <div class="refsect2">
1197 <a name="G-NODE-IS-ROOT:CAPS"></a><h3>G_NODE_IS_ROOT()</h3>
1198 <pre class="programlisting">#define             G_NODE_IS_ROOT(node)</pre>
1199 <p>
1200 Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is the root of a tree.
1201 </p>
1202 <div class="variablelist"><table border="0">
1203 <col align="left" valign="top">
1204 <tbody>
1205 <tr>
1206 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1207 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1208 </td>
1209 </tr>
1210 <tr>
1211 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1212 <td>
1213 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> is the root of a tree
1214 (i.e. it has no parent or siblings)</td>
1215 </tr>
1216 </tbody>
1217 </table></div>
1218 </div>
1219 <hr>
1220 <div class="refsect2">
1221 <a name="g-node-depth"></a><h3>g_node_depth ()</h3>
1222 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_node_depth                        (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1223 <p>
1224 Gets the depth of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1225 </p>
1226 <p>
1227 If <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> the depth is 0. The root node has a depth of 1.
1228 For the children of the root node the depth is 2. And so on.
1229 </p>
1230 <div class="variablelist"><table border="0">
1231 <col align="left" valign="top">
1232 <tbody>
1233 <tr>
1234 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1235 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1236 </td>
1237 </tr>
1238 <tr>
1239 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1240 <td>the depth of the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1241 </td>
1242 </tr>
1243 </tbody>
1244 </table></div>
1245 </div>
1246 <hr>
1247 <div class="refsect2">
1248 <a name="g-node-n-nodes"></a><h3>g_node_n_nodes ()</h3>
1249 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_node_n_nodes                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>,
1250                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GTraverseFlags" title="enum GTraverseFlags"><span class="type">GTraverseFlags</span></a> flags</code></em>);</pre>
1251 <p>
1252 Gets the number of nodes in a tree.
1253 </p>
1254 <div class="variablelist"><table border="0">
1255 <col align="left" valign="top">
1256 <tbody>
1257 <tr>
1258 <td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td>
1259 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1260 </td>
1261 </tr>
1262 <tr>
1263 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
1264 <td>which types of children are to be counted, one of
1265 <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
1266 </td>
1267 </tr>
1268 <tr>
1269 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1270 <td>the number of nodes in the tree</td>
1271 </tr>
1272 </tbody>
1273 </table></div>
1274 </div>
1275 <hr>
1276 <div class="refsect2">
1277 <a name="g-node-n-children"></a><h3>g_node_n_children ()</h3>
1278 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_node_n_children                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1279 <p>
1280 Gets the number of children of a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1281 </p>
1282 <div class="variablelist"><table border="0">
1283 <col align="left" valign="top">
1284 <tbody>
1285 <tr>
1286 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1287 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1288 </td>
1289 </tr>
1290 <tr>
1291 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1292 <td>the number of children of <em class="parameter"><code>node</code></em>
1293 </td>
1294 </tr>
1295 </tbody>
1296 </table></div>
1297 </div>
1298 <hr>
1299 <div class="refsect2">
1300 <a name="g-node-is-ancestor"></a><h3>g_node_is_ancestor ()</h3>
1301 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_node_is_ancestor                  (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>,
1302                                                          <em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *descendant</code></em>);</pre>
1303 <p>
1304 Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>node</code></em> is an ancestor of <em class="parameter"><code>descendant</code></em>.
1305 This is true if node is the parent of <em class="parameter"><code>descendant</code></em>, 
1306 or if node is the grandparent of <em class="parameter"><code>descendant</code></em> etc.
1307 </p>
1308 <div class="variablelist"><table border="0">
1309 <col align="left" valign="top">
1310 <tbody>
1311 <tr>
1312 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1313 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1314 </td>
1315 </tr>
1316 <tr>
1317 <td><p><span class="term"><em class="parameter"><code>descendant</code></em> :</span></p></td>
1318 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1319 </td>
1320 </tr>
1321 <tr>
1322 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1323 <td>
1324 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>node</code></em> is an ancestor of <em class="parameter"><code>descendant</code></em>
1325 </td>
1326 </tr>
1327 </tbody>
1328 </table></div>
1329 </div>
1330 <hr>
1331 <div class="refsect2">
1332 <a name="g-node-max-height"></a><h3>g_node_max_height ()</h3>
1333 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_node_max_height                   (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>);</pre>
1334 <p>
1335 Gets the maximum height of all branches beneath a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>.
1336 This is the maximum distance from the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to all leaf nodes.
1337 </p>
1338 <p>
1339 If <em class="parameter"><code>root</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, 0 is returned. If <em class="parameter"><code>root</code></em> has no children, 
1340 1 is returned. If <em class="parameter"><code>root</code></em> has children, 2 is returned. And so on.
1341 </p>
1342 <div class="variablelist"><table border="0">
1343 <col align="left" valign="top">
1344 <tbody>
1345 <tr>
1346 <td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td>
1347 <td>a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a>
1348 </td>
1349 </tr>
1350 <tr>
1351 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1352 <td>the maximum height of the tree beneath <em class="parameter"><code>root</code></em>
1353 </td>
1354 </tr>
1355 </tbody>
1356 </table></div>
1357 </div>
1358 <hr>
1359 <div class="refsect2">
1360 <a name="g-node-unlink"></a><h3>g_node_unlink ()</h3>
1361 <pre class="programlisting"><span class="returnvalue">void</span>                g_node_unlink                       (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *node</code></em>);</pre>
1362 <p>
1363 Unlinks a <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> from a tree, resulting in two separate trees.
1364 </p>
1365 <div class="variablelist"><table border="0">
1366 <col align="left" valign="top">
1367 <tbody><tr>
1368 <td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
1369 <td>the <a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> to unlink, which becomes the root of a new tree</td>
1370 </tr></tbody>
1371 </table></div>
1372 </div>
1373 <hr>
1374 <div class="refsect2">
1375 <a name="g-node-destroy"></a><h3>g_node_destroy ()</h3>
1376 <pre class="programlisting"><span class="returnvalue">void</span>                g_node_destroy                      (<em class="parameter"><code><a class="link" href="glib-N-ary-Trees.html#GNode" title="struct GNode"><span class="type">GNode</span></a> *root</code></em>);</pre>
1377 <p>
1378 Removes <em class="parameter"><code>root</code></em> and its children from the tree, freeing any memory
1379 allocated.
1380 </p>
1381 <div class="variablelist"><table border="0">
1382 <col align="left" valign="top">
1383 <tbody><tr>
1384 <td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td>
1385 <td>the root of the tree/subtree to destroy</td>
1386 </tr></tbody>
1387 </table></div>
1388 </div>
1389 </div>
1390 </div>
1391 <div class="footer">
1392 <hr>
1393           Generated by GTK-Doc V1.18</div>
1394 </body>
1395 </html>