📄 glib-n-ary-trees.html
字号:
<a name="g-node-children-foreach"></a>g_node_children_foreach ()</h3><a class="indexterm" name="id3181145"></a><pre class="programlisting">void g_node_children_foreach (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags, <a href="glib-N-ary-Trees.html#GNodeForeachFunc">GNodeForeachFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Calls a function for each of the children of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.Note that it doesn't descend beneath the child nodes.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td><td>which types of children are to be visited, one of <code class="literal">G_TRAVERSE_ALL</code>,<code class="literal">G_TRAVERSE_LEAVES</code> and <code class="literal">G_TRAVERSE_NON_LEAVES</code>.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call for each visited node.</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>user data to pass to the function.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3181293"></a><h3><a name="GNodeForeachFunc"></a>GNodeForeachFunc ()</h3><a class="indexterm" name="id3181303"></a><pre class="programlisting">void (*GNodeForeachFunc) (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Specifies the type of function passed to <a 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 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><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>user data passed to <a 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="id3181414"></a><h3><a name="g-node-get-root"></a>g_node_get_root ()</h3><a class="indexterm" name="id3181424"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_get_root (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>Gets the root of a tree.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the root of the tree.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3181489"></a><h3><a name="g-node-find"></a>g_node_find ()</h3><a class="indexterm" name="id3181499"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_find (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root, <a href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order, <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Finds a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> in a tree.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>root</code></em> :</span></td><td>the root <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to search.</td></tr><tr><td><span class="term"><em class="parameter"><code>order</code></em> :</span></td><td>the order in which nodes are visited - <code class="literal">G_IN_ORDER</code>, <code class="literal">G_PRE_ORDER</code>,<code class="literal">G_POST_ORDER</code>, or <code class="literal">G_LEVEL_ORDER</code>.</td></tr><tr><td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td><td>which types of children are to be searched, one of <code class="literal">G_TRAVERSE_ALL</code>,<code class="literal">G_TRAVERSE_LEAVES</code> and <code class="literal">G_TRAVERSE_NON_LEAVES</code>.</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>the data to find.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the found <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <code class="literal">NULL</code> if the data is not found.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3181694"></a><h3><a name="g-node-find-child"></a>g_node_find_child ()</h3><a class="indexterm" name="id3181705"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>* g_node_find_child (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Finds the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with the given data.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td><td>which types of children are to be searched, one of <code class="literal">G_TRAVERSE_ALL</code>,<code class="literal">G_TRAVERSE_LEAVES</code> and <code class="literal">G_TRAVERSE_NON_LEAVES</code>.</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>the data to find.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the found child <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <code class="literal">NULL</code> if the data is not found.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3181854"></a><h3><a name="g-node-child-index"></a>g_node_child_index ()</h3><a class="indexterm" name="id3181866"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_node_child_index (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Gets the position of the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> which contains the given data.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>the data to find.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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 -1if the data is not found.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3181973"></a><h3><a name="g-node-child-position"></a>g_node_child_position ()</h3><a class="indexterm" name="id3181984"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_node_child_position (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node, <a href="glib-N-ary-Trees.html#GNode">GNode</a> *child);</pre><p>Gets the position of a <a 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><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>child</code></em> :</span></td><td>a child of <em class="parameter"><code>node</code></em>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></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="id3182104"></a><h3><a name="g-node-first-child"></a>g_node_first_child()</h3><a class="indexterm" name="id3182115"></a><pre class="programlisting">#define g_node_first_child(node)</pre><p>Gets the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>node</code></em> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the last child of <em class="parameter"><code>node</code></em>, or <code class="literal">NULL</code> if <em class="parameter"><code>node</code></em> is <code class="literal">NULL</code> or has no children.</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -