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