⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trees-nary.sgml

📁 GLib是GTK+和GNOME工程的基础底层核心程序库
💻 SGML
📖 第 1 页 / 共 4 页
字号:
<programlisting>#define     g_node_next_sibling(node)</programlisting><para>Gets the next sibling of a <link linkend="GNode">GNode</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the next sibling of <parameter>node</parameter>, or <literal>NULL</literal> if <parameter>node</parameter> is <literal>NULL</literal>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-prev-sibling">g_node_prev_sibling()</title><programlisting>#define     g_node_prev_sibling(node)</programlisting><para>Gets the previous sibling of a <link linkend="GNode">GNode</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the previous sibling of <parameter>node</parameter>, or <literal>NULL</literal> if <parameter>node</parameter> is <literal>NULL</literal>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-last-sibling">g_node_last_sibling ()</title><programlisting><link linkend="GNode">GNode</link>*      g_node_last_sibling             (<link linkend="GNode">GNode</link> *node);</programlisting><para>Gets the last sibling of a <link linkend="GNode">GNode</link>.This could possibly be the node itself.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the last sibling of <parameter>node</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-NODE-IS-LEAF-CAPS">G_NODE_IS_LEAF()</title><programlisting>#define	 G_NODE_IS_LEAF(node)	(((GNode*) (node))-&gt;children == NULL)</programlisting><para>Returns <literal>TRUE</literal> if a <link linkend="GNode">GNode</link> is a leaf node.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GNode">GNode</link> is a leaf node (i.e. it has no children).</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-NODE-IS-ROOT-CAPS">G_NODE_IS_ROOT()</title><programlisting>#define     G_NODE_IS_ROOT(node)</programlisting><para>Returns <literal>TRUE</literal> if a <link linkend="GNode">GNode</link> is the root of a tree.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GNode">GNode</link> is the root of a tree (i.e. it has no parentor siblings).</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-depth">g_node_depth ()</title><programlisting><link linkend="guint">guint</link>       g_node_depth                    (<link linkend="GNode">GNode</link> *node);</programlisting><para>Gets the depth of a <link linkend="GNode">GNode</link>.</para><para>If <parameter>node</parameter> is <literal>NULL</literal> the depth is 0.The root node has a depth of 1.For the children of the root node the depth is 2. And so on.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the depth of the <link linkend="GNode">GNode</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-n-nodes">g_node_n_nodes ()</title><programlisting><link linkend="guint">guint</link>       g_node_n_nodes                  (<link linkend="GNode">GNode</link> *root,                                             <link linkend="GTraverseFlags">GTraverseFlags</link> flags);</programlisting><para>Gets the number of nodes in a tree.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>root</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><parameter>flags</parameter>&nbsp;:</entry><entry>which types of children are to be counted, one of <literal>G_TRAVERSE_ALL</literal>,<literal>G_TRAVERSE_LEAFS</literal> and <literal>G_TRAVERSE_NON_LEAFS</literal>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the number of nodes in the tree.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-n-children">g_node_n_children ()</title><programlisting><link linkend="guint">guint</link>       g_node_n_children               (<link linkend="GNode">GNode</link> *node);</programlisting><para>Gets the number of children of a <link linkend="GNode">GNode</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the number of children of <parameter>node</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-is-ancestor">g_node_is_ancestor ()</title><programlisting><link linkend="gboolean">gboolean</link>    g_node_is_ancestor              (<link linkend="GNode">GNode</link> *node,                                             <link linkend="GNode">GNode</link> *descendant);</programlisting><para>Returns <literal>TRUE</literal> if <parameter>node</parameter> is an ancestor of <parameter>descendant</parameter>.This is true if node is the parent of <parameter>descendant</parameter>, or if node is thegrandparent of <parameter>descendant</parameter> etc.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><parameter>descendant</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if <parameter>node</parameter> is an ancestor of <parameter>descendant</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-max-height">g_node_max_height ()</title><programlisting><link linkend="guint">guint</link>       g_node_max_height               (<link linkend="GNode">GNode</link> *root);</programlisting><para>Gets the maximum height of all branches beneath a <link linkend="GNode">GNode</link>.This is the maximum distance from the <link linkend="GNode">GNode</link> to all leaf nodes.</para><para>If <parameter>root</parameter> is <literal>NULL</literal>, 0 is returned. If <parameter>root</parameter> has no children, 1 is returned.If <parameter>root</parameter> has children, 2 is returned. And so on.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>root</parameter>&nbsp;:</entry><entry>a <link linkend="GNode">GNode</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the maximum height of the tree beneath <parameter>root</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-unlink">g_node_unlink ()</title><programlisting>void        g_node_unlink                   (<link linkend="GNode">GNode</link> *node);</programlisting><para>Unlinks a <link linkend="GNode">GNode</link> from a tree, resulting in two separate trees.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>node</parameter>&nbsp;:</entry><entry>the <link linkend="GNode">GNode</link> to unlink, which becomes the root of a new tree.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-destroy">g_node_destroy ()</title><programlisting>void        g_node_destroy                  (<link linkend="GNode">GNode</link> *root);</programlisting><para>Removes the <link linkend="GNode">GNode</link> and its children from the tree, freeing any memoryallocated.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>root</parameter>&nbsp;:</entry><entry>the root of the tree/subtree to destroy.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-push-allocator">g_node_push_allocator ()</title><programlisting>void        g_node_push_allocator           (<link linkend="GAllocator">GAllocator</link> *allocator);</programlisting><para>Sets the allocator to use to allocate <link linkend="GNode">GNode</link> elements.Use <link linkend="g-node-pop-allocator">g_node_pop_allocator</link>() to restore the previous allocator.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>allocator</parameter>&nbsp;:</entry><entry>the <link linkend="GAllocator">GAllocator</link> to use when allocating <link linkend="GNode">GNode</link> elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-node-pop-allocator">g_node_pop_allocator ()</title><programlisting>void        g_node_pop_allocator            (void);</programlisting><para>Restores the previous <link linkend="GAllocator">GAllocator</link>, used when allocating <link linkend="GNode">GNode</link> elements.</para></refsect2></refsect1></refentry>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -