📄 glib-double-ended-queues.html
字号:
<p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> user data passed to <em class="parameter"><code>func</code></em></td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td> a <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareFunc"><span class="type">GCompareFunc</span></a> to call for each element. It should return 0when the desired element is found</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> The found link, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it wasn't found</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3262697"></a><h3><a name="g-queue-sort"></a>g_queue_sort ()</h3><a class="indexterm" name="id3262712"></a><pre class="programlisting">void g_queue_sort (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> compare_func, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Sorts <em class="parameter"><code>queue</code></em> using <em class="parameter"><code>compare_func</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>compare_func</code></em> :</span></p></td><td> the <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc"><span class="type">GCompareDataFunc</span></a> used to sort <em class="parameter"><code>queue</code></em>. This function is passed two elements of the queue and should return 0 if they are equal, a negative value if the first comes before the second, and a positive value if the second comes before the first.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td><td> user data passed to <em class="parameter"><code>compare_func</code></em></td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3262856"></a><h3><a name="g-queue-push-head"></a>g_queue_push_head ()</h3><a class="indexterm" name="id3262870"></a><pre class="programlisting">void g_queue_push_head (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</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><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data for the new element.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3262949"></a><h3><a name="g-queue-push-tail"></a>g_queue_push_tail ()</h3><a class="indexterm" name="id3262963"></a><pre class="programlisting">void g_queue_push_tail (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</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><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data for the new element.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3263042"></a><h3><a name="g-queue-push-nth"></a>g_queue_push_nth ()</h3><a class="indexterm" name="id3263057"></a><pre class="programlisting">void g_queue_push_nth (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="glib-Basic-Types.html#gint">gint</a> n);</pre><p>Inserts a new element 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><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> the data for the new element</td></tr><tr><td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td><td> the position to insert the new element. If <em class="parameter"><code>n</code></em> is negative or larger than the number of elements in the <em class="parameter"><code>queue</code></em>, the element is added to the end of the queue.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3263186"></a><h3><a name="g-queue-pop-head"></a>g_queue_pop_head ()</h3><a class="indexterm" name="id3263198"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_head (<a class="link" 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><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the data of the first element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the queue is empty.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3263278"></a><h3><a name="g-queue-pop-tail"></a>g_queue_pop_tail ()</h3><a class="indexterm" name="id3263290"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_tail (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre><p>Removes the last element of the queue.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the data of the last element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the queue is empty.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3263370"></a><h3><a name="g-queue-pop-nth"></a>g_queue_pop_nth ()</h3><a class="indexterm" name="id3263384"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_nth (<a class="link" href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue, <a class="link" href="glib-Basic-Types.html#guint">guint</a> n);</pre><p>Removes the <em class="parameter"><code>n</code></em>'th element 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><p><span class="term"><em class="parameter"><code>queue</code></em> :</span></p></td><td> a <a class="link" href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td><td> the position of the element.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the element's data, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>n</code></em> is off the end of <em class="parameter"><code>queue</code></em>.</td></tr></tbody></table></div><p class="since">Since 2.4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -