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

📄 linked_lists_single.sgml

📁 GLib是GTK+和GNOME工程的基础底层核心程序库
💻 SGML
📖 第 1 页 / 共 3 页
字号:
<tbody><row><entry align="right"><parameter>list</parameter>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link></entry></row><row><entry align="right"><parameter>compare_func</parameter>&nbsp;:</entry><entry>comparison function.</entry></row><row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry><entry>data to pass to comparison function.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>new head of the list.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-concat">g_slist_concat ()</title><programlisting><link linkend="GSList">GSList</link>*     g_slist_concat                  (<link linkend="GSList">GSList</link> *list1,                                             <link linkend="GSList">GSList</link> *list2);</programlisting><para>Adds the second <link linkend="GSList">GSList</link> onto the end of the first <link linkend="GSList">GSList</link>.Note that the elements of the second <link linkend="GSList">GSList</link> are not copied.They are used directly.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>list1</parameter>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>list2</parameter>&nbsp;:</entry><entry>the <link linkend="GSList">GSList</link> to add to the end of the first <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the start of the new <link linkend="GSList">GSList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-foreach">g_slist_foreach ()</title><programlisting>void        g_slist_foreach                 (<link linkend="GSList">GSList</link> *list,                                             <link linkend="GFunc">GFunc</link> func,                                             <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Calls a function for each element of a <link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>func</parameter>&nbsp;:</entry><entry>the function to call with each element's data.</entry></row><row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry><entry>user data to pass to the function.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-last">g_slist_last ()</title><programlisting><link linkend="GSList">GSList</link>*     g_slist_last                    (<link linkend="GSList">GSList</link> *list);</programlisting><para>Gets the last element in a <link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the last element in the <link linkend="GSList">GSList</link>, or <literal>NULL</literal> if the <link linkend="GSList">GSList</link> has noelements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-next">g_slist_next()</title><programlisting>#define     g_slist_next(slist)</programlisting><para>A convenience macro to gets the next element in a <link linkend="GSList">GSList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>slist</parameter>&nbsp;:</entry><entry>an element in a <link linkend="GSList">GSList</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-slist-nth">g_slist_nth ()</title><programlisting><link linkend="GSList">GSList</link>*     g_slist_nth                     (<link linkend="GSList">GSList</link> *list,                                             <link linkend="guint">guint</link> n);</programlisting><para>Gets the element at the given position in a <link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>n</parameter>&nbsp;:</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="GSList">GSList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-nth-data">g_slist_nth_data ()</title><programlisting><link linkend="gpointer">gpointer</link>    g_slist_nth_data                (<link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>n</parameter>&nbsp;:</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="GSList">GSList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-find">g_slist_find ()</title><programlisting><link linkend="GSList">GSList</link>*     g_slist_find                    (<link linkend="GSList">GSList</link> *list,                                             <link linkend="gconstpointer">gconstpointer</link> data);</programlisting><para>Finds the element in a <link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>data</parameter>&nbsp;:</entry><entry>the element data to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the found <link linkend="GSList">GSList</link> element, or <literal>NULL</literal> if it is not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-find-custom">g_slist_find_custom ()</title><programlisting><link linkend="GSList">GSList</link>*     g_slist_find_custom             (<link linkend="GSList">GSList</link> *list,                                             <link linkend="gconstpointer">gconstpointer</link> data,                                             <link linkend="GCompareFunc">GCompareFunc</link> func);</programlisting><para>Finds an element in a <link linkend="GSList">GSList</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="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>data</parameter>&nbsp;:</entry><entry>user data passed to the function.</entry></row><row><entry align="right"><parameter>func</parameter>&nbsp;:</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="GSList">GSList</link> element, or <literal>NULL</literal> if it is not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-position">g_slist_position ()</title><programlisting><link linkend="gint">gint</link>        g_slist_position                (<link linkend="GSList">GSList</link> *list,                                             <link linkend="GSList">GSList</link> *llink);</programlisting><para>Gets the position of the given element in the <link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>llink</parameter>&nbsp;:</entry><entry>an element in the <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the position of the element in the <link linkend="GSList">GSList</link>, or -1 if the elementis not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-index">g_slist_index ()</title><programlisting><link linkend="gint">gint</link>        g_slist_index                   (<link linkend="GSList">GSList</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>&nbsp;:</entry><entry>a <link linkend="GSList">GSList</link>.</entry></row><row><entry align="right"><parameter>data</parameter>&nbsp;:</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-slist-push-allocator">g_slist_push_allocator ()</title><programlisting>void        g_slist_push_allocator          (<link linkend="GAllocator">GAllocator</link> *allocator);</programlisting><para>Sets the allocator to use to allocate <link linkend="GSList">GSList</link> elements.Use <link linkend="g-slist-pop-allocator">g_slist_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="GSList">GSList</link> elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-slist-pop-allocator">g_slist_pop_allocator ()</title><programlisting>void        g_slist_pop_allocator           (void);</programlisting><para>Restores the previous <link linkend="GAllocator">GAllocator</link>, used when allocating <link linkend="GSList">GSList</link> elements.</para></refsect2></refsect1></refentry>

⌨️ 快捷键说明

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