📄 glib-n-ary-trees.html
字号:
<a class="indexterm" name="id3340845"></a><pre class="programlisting">void (*GNodeForeachFunc) (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Specifies the type of function passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.The function is called with each child node, together with the user datapassed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td>a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3340956"></a><h3><a name="g-node-get-root"></a>g_node_get_root ()</h3><a class="indexterm" name="id3340969"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_get_root (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>Gets the root of a tree.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the root of the tree</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3341037"></a><h3><a name="g-node-find"></a>g_node_find ()</h3><a class="indexterm" name="id3341049"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_find (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root, <a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order, <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Finds a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> in a tree.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td><td> the root <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to search</td></tr><tr><td><p><span class="term"><em class="parameter"><code>order</code></em> :</span></p></td><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>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-PRE-ORDER:CAPS"><code class="literal">G_PRE_ORDER</code></a>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-POST-ORDER:CAPS"><code class="literal">G_POST_ORDER</code></a>, or <a class="link" href="glib-Balanced-Binary-Trees.html#G-LEVEL-ORDER:CAPS"><code class="literal">G_LEVEL_ORDER</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td><td> which types of children are to be searched, one of <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></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data to find</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the found <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the data is not found</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3341285"></a><h3><a name="g-node-find-child"></a>g_node_find_child ()</h3><a class="indexterm" name="id3341298"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_find_child (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Finds the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with the given data.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td><td> which types of children are to be searched, one of <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></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data to find</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the found child <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the data is not found</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3341470"></a><h3><a name="g-node-child-index"></a>g_node_child_index ()</h3><a class="indexterm" name="id3341483"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_node_child_index (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Gets the position of the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> which contains the given data.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data to find</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the index of the child of <em class="parameter"><code>node</code></em> which contains <em class="parameter"><code>data</code></em>, or -1 if the data is not found</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3341594"></a><h3><a name="g-node-child-position"></a>g_node_child_position ()</h3><a class="indexterm" name="id3341608"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_node_child_position (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *child);</pre><p>Gets the position of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with respect to its siblings.<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, the second 1, and so on.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td><td> a child of <em class="parameter"><code>node</code></em></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the position of <em class="parameter"><code>child</code></em> with respect to its siblings</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3341731"></a><h3><a name="g-node-first-child"></a>g_node_first_child()</h3><a class="indexterm" name="id3341745"></a><pre class="programlisting">#define g_node_first_child(node)</pre><p>Gets the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td><td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the first child of <em class="parameter"><code>n
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -