📄 linked_lists_double.sgml
字号:
<colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the last element in the <link linkend="GList">GList</link>, or <literal>NULL</literal> if the <link linkend="GList">GList</link> has noelements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-previous">g_list_previous()</title><programlisting>#define g_list_previous(list)</programlisting><para>A convenience macro to gets the previous element in a <link linkend="GList">GList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>an element in a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the previous element, or <literal>NULL</literal> if there are no previous elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-next">g_list_next()</title><programlisting>#define g_list_next(list)</programlisting><para>A convenience macro to gets the next element in a <link linkend="GList">GList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>an element in a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the next element, or <literal>NULL</literal> if there are no more elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-nth">g_list_nth ()</title><programlisting><link linkend="GList">GList</link>* g_list_nth (<link linkend="GList">GList</link> *list, <link linkend="guint">guint</link> n);</programlisting><para>Gets the element at the given position in a <link linkend="GList">GList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>n</parameter> :</entry><entry>the position of the element, counting from 0.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the element, or <literal>NULL</literal> if the position is off the end of the <link linkend="GList">GList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-nth-data">g_list_nth_data ()</title><programlisting><link linkend="gpointer">gpointer</link> g_list_nth_data (<link linkend="GList">GList</link> *list, <link linkend="guint">guint</link> n);</programlisting><para>Gets the data of the element at the given position.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>n</parameter> :</entry><entry>the position of the element.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the element's data, or <literal>NULL</literal> if the position is off the end of the<link linkend="GList">GList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-nth-prev">g_list_nth_prev ()</title><programlisting><link linkend="GList">GList</link>* g_list_nth_prev (<link linkend="GList">GList</link> *list, <link linkend="guint">guint</link> n);</programlisting><para>Gets the element <parameter>n</parameter> places before <parameter>list</parameter>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>n</parameter> :</entry><entry>the position of the element, counting from 0.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the element, or <literal>NULL</literal> if the position is off the end of the <link linkend="GList">GList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-find">g_list_find ()</title><programlisting><link linkend="GList">GList</link>* g_list_find (<link linkend="GList">GList</link> *list, <link linkend="gconstpointer">gconstpointer</link> data);</programlisting><para>Finds the element in a <link linkend="GList">GList</link> which contains the given data.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the element data to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the found <link linkend="GList">GList</link> element, or <literal>NULL</literal> if it is not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-find-custom">g_list_find_custom ()</title><programlisting><link linkend="GList">GList</link>* g_list_find_custom (<link linkend="GList">GList</link> *list, <link linkend="gconstpointer">gconstpointer</link> data, <link linkend="GCompareFunc">GCompareFunc</link> func);</programlisting><para>Finds an element in a <link linkend="GList">GList</link>, using a supplied function to find the desiredelement.It iterates over the list, calling the given function which should return 0when the desired element is found.The function takes two <link linkend="gconstpointer">gconstpointer</link> arguments, the <link linkend="GList">GList</link> element's dataand the given user data.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>user data passed to the function.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call for each element. It should return 0 when thedesired element is found.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the found <link linkend="GList">GList</link> element, or <literal>NULL</literal> if it is not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-position">g_list_position ()</title><programlisting><link linkend="gint">gint</link> g_list_position (<link linkend="GList">GList</link> *list, <link linkend="GList">GList</link> *llink);</programlisting><para>Gets the position of the given element in the <link linkend="GList">GList</link> (starting from 0).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>llink</parameter> :</entry><entry>an element in the <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the position of the element in the <link linkend="GList">GList</link>, or -1 if the element isnot found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-index">g_list_index ()</title><programlisting><link linkend="gint">gint</link> g_list_index (<link linkend="GList">GList</link> *list, <link linkend="gconstpointer">gconstpointer</link> data);</programlisting><para>Gets the position of the element containing the given data (starting from 0).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list</parameter> :</entry><entry>a <link linkend="GList">GList</link>.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the data to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the index of the element containing the data, or -1 if the datais not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-push-allocator">g_list_push_allocator ()</title><programlisting>void g_list_push_allocator (<link linkend="GAllocator">GAllocator</link> *allocator);</programlisting><para>Sets the allocator to use to allocate <link linkend="GList">GList</link> elements.Use <link linkend="g-list-pop-allocator">g_list_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> :</entry><entry>the <link linkend="GAllocator">GAllocator</link> to use when allocating <link linkend="GList">GList</link> elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-list-pop-allocator">g_list_pop_allocator ()</title><programlisting>void g_list_pop_allocator (void);</programlisting><para>Restores the previous <link linkend="GAllocator">GAllocator</link>, used when allocating <link linkend="GList">GList</link> elements.</para></refsect2></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -