📄 glib-double-ended-queues.html
字号:
<hr><div class="refsect2" lang="en"><a name="id3127787"></a><h3><a name="g-queue-remove-all"></a>g_queue_remove_all ()</h3><a class="indexterm" name="id3127798"></a><pre class="programlisting">void g_queue_remove_all (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);</pre><p>Remove all elemeents in <em class="parameter"><code>queue</code></em> which contains <em class="parameter"><code>data</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td> data to remove</td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3127894"></a><h3><a name="g-queue-insert-before"></a>g_queue_insert_before ()</h3><a class="indexterm" name="id3127905"></a><pre class="programlisting">void g_queue_insert_before (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *sibling, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Inserts <em class="parameter"><code>data</code></em> into <em class="parameter"><code>queue</code></em> before <em class="parameter"><code>sibling</code></em>.</p><p><em class="parameter"><code>sibling</code></em> must be part of <em class="parameter"><code>queue</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>sibling</code></em> :</span></td><td> a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> link that <span class="emphasis"><em>must</em></span> be part of <em class="parameter"><code>queue</code></em></td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td> the data to insert</td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3128060"></a><h3><a name="g-queue-insert-after"></a>g_queue_insert_after ()</h3><a class="indexterm" name="id3128071"></a><pre class="programlisting">void g_queue_insert_after (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *sibling, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Inserts <em class="parameter"><code>data</code></em> into <em class="parameter"><code>queue</code></em> after <em class="parameter"><code>sibling</code></em></p><p><em class="parameter"><code>sibling</code></em> must be part of <em class="parameter"><code>queue</code></em></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>sibling</code></em> :</span></td><td> a <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> link that <span class="emphasis"><em>must</em></span> be part of <em class="parameter"><code>queue</code></em></td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td> the data to insert</td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3128225"></a><h3><a name="g-queue-insert-sorted"></a>g_queue_insert_sorted ()</h3><a class="indexterm" name="id3128236"></a><pre class="programlisting">void g_queue_insert_sorted (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Inserts <em class="parameter"><code>data</code></em> into <em class="parameter"><code>queue</code></em> using <em class="parameter"><code>func</code></em> to determine the new position.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td> the data to insert</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td> the <a href="glib-Doubly-Linked-Lists.html#GCompareDataFunc"><span class="type">GCompareDataFunc</span></a> used to compare elements in the queue. It is called with two elements of the <em class="parameter"><code>queue</code></em> and <em class="parameter"><code>user_data</code></em>. It should return 0 if the elements are equal, a negative value if the first element comes before the second, and a positive value if the second element comes after the first.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td> user data passed to <em class="parameter"><code>func</code></em>.</td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3128412"></a><h3><a name="g-queue-push-head-link"></a>g_queue_push_head_link ()</h3><a class="indexterm" name="id3128422"></a><pre class="programlisting">void g_queue_push_head_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);</pre><p>Adds a new element at the head of the queue.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>link_</code></em> :</span></td><td> a single <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> element, <span class="emphasis"><em>not</em></span> a list with more than one element.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3128513"></a><h3><a name="g-queue-push-tail-link"></a>g_queue_push_tail_link ()</h3><a class="indexterm" name="id3128524"></a><pre class="programlisting">void g_queue_push_tail_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);</pre><p>Adds a new element at the tail of the queue.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>link_</code></em> :</span></td><td> a single <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> element, <span class="emphasis"><em>not</em></span> a list with more than one element.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3128616"></a><h3><a name="g-queue-push-nth-link"></a>g_queue_push_nth_link ()</h3><a class="indexterm" name="id3128626"></a><pre class="programlisting">void g_queue_push_nth_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a href="glib-Basic-Types.html#gint">gint</a> n, <a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);</pre><p>Inserts <em class="parameter"><code>link</code></em> into <em class="parameter"><code>queue</code></em> at the given position.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>n</code></em> :</span></td><td> the position to insert the link. If this is negative or larger than the number of elements in <em class="parameter"><code>queue</code></em>, the link is added to the end of <em class="parameter"><code>queue</code></em>.</td></tr><tr><td><span class="term"><em class="parameter"><code>link_</code></em> :</span></td><td> the link to add to <em class="parameter"><code>queue</code></em></td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3128762"></a><h3><a name="g-queue-pop-head-link"></a>g_queue_pop_head_link ()</h3><a class="indexterm" name="id3128774"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_pop_head_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre><p>Removes the first element of the queue.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>queue</code></em> :</span></td><td> a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> element at the head of the queue, or <code class="literal">NULL</code> if the queue is empty.</td></tr></tbody>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -