📄 glib-doubly-linked-lists.html
字号:
<a name="id3108336"></a><h3><a name="GCompareDataFunc"></a>GCompareDataFunc ()</h3><a class="indexterm" name="id3108346"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> (*GCompareDataFunc) (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> a, <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> b, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Specifies the type of a comparison function used to compare twovalues. The function should return a negative integer if the firstvalue comes before the second, 0 if they are equal, or a positiveinteger if the first value comes after the second.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>a</code></em> :</span></td><td>a value.</td></tr><tr><td><span class="term"><em class="parameter"><code>b</code></em> :</span></td><td>a value to compare with.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data to pass to comparison function.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>negative value if <em class="parameter"><code>a</code></em> < <em class="parameter"><code>b</code></em>; zero if <em class="parameter"><code>a</code></em> = <em class="parameter"><code>b</code></em>; positive valueif <em class="parameter"><code>a</code></em> > <em class="parameter"><code>b</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3108485"></a><h3><a name="g-list-concat"></a>g_list_concat ()</h3><a class="indexterm" name="id3108495"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_list_concat (<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list1, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list2);</pre><p>Adds the second <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> onto the end of the first <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.Note that the elements of the second <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> are not copied.They are used directly.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list1</code></em> :</span></td><td>a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>list2</code></em> :</span></td><td>the <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> to add to the end of the first <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the start of the new <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3108631"></a><h3><a name="g-list-foreach"></a>g_list_foreach ()</h3><a class="indexterm" name="id3108642"></a><pre class="programlisting">void g_list_foreach (<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list, <a href="glib-Doubly-Linked-Lists.html#GFunc">GFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Calls a function for each element of a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call with each element's data.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_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="id3108748"></a><h3><a name="GFunc"></a>GFunc ()</h3><a class="indexterm" name="id3108758"></a><pre class="programlisting">void (*GFunc) (<a href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Specifies the type of functions passed to <a href="glib-Doubly-Linked-Lists.html#g-list-foreach"><code class="function">g_list_foreach()</code></a> and<a href="glib-Singly-Linked-Lists.html#g-slist-foreach"><code class="function">g_slist_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>data</code></em> :</span></td><td>the element's data.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data passed to <a href="glib-Doubly-Linked-Lists.html#g-list-foreach"><code class="function">g_list_foreach()</code></a> or <a href="glib-Singly-Linked-Lists.html#g-slist-foreach"><code class="function">g_slist_foreach()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3108870"></a><h3><a name="g-list-first"></a>g_list_first ()</h3><a class="indexterm" name="id3108881"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_list_first (<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list);</pre><p>Gets the first element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the first element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>, or <code class="literal">NULL</code> if the <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> has no elements.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3108976"></a><h3><a name="g-list-last"></a>g_list_last ()</h3><a class="indexterm" name="id3108986"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_list_last (<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list);</pre><p>Gets the last element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the last element in the <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>, or <code class="literal">NULL</code> if the <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> has noelements.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3109080"></a><h3><a name="g-list-previous"></a>g_list_previous()</h3><a class="indexterm" name="id3109090"></a><pre class="programlisting">#define g_list_previous(list)</pre><p>A convenience macro to gets the previous element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>an element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the previous element, or <code class="literal">NULL</code> if there are no previous elements.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3109158"></a><h3><a name="g-list-next"></a>g_list_next()</h3><a class="indexterm" name="id3109168"></a><pre class="programlisting">#define g_list_next(list)</pre><p>A convenience macro to gets the next element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>an element in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the next element, or <code class="literal">NULL</code> if there are no more elements.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3109235"></a><h3><a name="g-list-nth"></a>g_list_nth ()</h3><a class="indexterm" name="id3109245"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_list_nth (<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *list, <a href="glib-Basic-Types.html#guint">guint</a> n);</pre><p>Gets the element at the given position in a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>list</code></em> :</span></td><td>a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>n</code></em> :</span></td><td>the position of the element, counting from 0.</td></tr><tr><td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -