File: //usr/share/gtk-doc/html/glib/glib-Double-ended-Queues.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Double-ended Queues</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists">
<link rel="next" href="glib-Trash-Stacks.html" title="Trash Stacks">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Singly-Linked-Lists.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Trash-Stacks.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3221925" class="shortcut">Top</a>
 | 
<a href="#id3223020" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-Double-ended-Queues"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3221925"></a><span class="refentrytitle">Double-ended Queues</span>
</h2>
<p>Double-ended Queues — double-ended queue data structure.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <glib.h>
<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a>;
<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a>* <a href="glib-Double-ended-Queues.html#g-queue-new">g_queue_new</a> (void);
void <a href="glib-Double-ended-Queues.html#g-queue-free">g_queue_free</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#gboolean">gboolean</a> <a href="glib-Double-ended-Queues.html#g-queue-is-empty">g_queue_is_empty</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#guint">guint</a> <a href="glib-Double-ended-Queues.html#g-queue-get-length">g_queue_get_length</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
void <a href="glib-Double-ended-Queues.html#g-queue-reverse">g_queue_reverse</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a>* <a href="glib-Double-ended-Queues.html#g-queue-copy">g_queue_copy</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
void <a href="glib-Double-ended-Queues.html#g-queue-foreach">g_queue_foreach</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GFunc">GFunc</a> func,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-find">g_queue_find</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-find-custom">g_queue_find_custom</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data,
<a href="glib-Doubly-Linked-Lists.html#GCompareFunc">GCompareFunc</a> func);
void <a href="glib-Double-ended-Queues.html#g-queue-sort">g_queue_sort</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> compare_func,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
void <a href="glib-Double-ended-Queues.html#g-queue-push-head">g_queue_push_head</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void <a href="glib-Double-ended-Queues.html#g-queue-push-tail">g_queue_push_tail</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void <a href="glib-Double-ended-Queues.html#g-queue-push-nth">g_queue_push_nth</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> data,
<a href="glib-Basic-Types.html#gint">gint</a> n);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-pop-head">g_queue_pop_head</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-pop-tail">g_queue_pop_tail</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-pop-nth">g_queue_pop_nth</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-peek-head">g_queue_peek_head</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-peek-tail">g_queue_peek_tail</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Basic-Types.html#gpointer">gpointer</a> <a href="glib-Double-ended-Queues.html#g-queue-peek-nth">g_queue_peek_nth</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-Double-ended-Queues.html#g-queue-index">g_queue_index</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);
void <a href="glib-Double-ended-Queues.html#g-queue-remove">g_queue_remove</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);
void <a href="glib-Double-ended-Queues.html#g-queue-remove-all">g_queue_remove_all</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);
void <a href="glib-Double-ended-Queues.html#g-queue-insert-before">g_queue_insert_before</a> (<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);
void <a href="glib-Double-ended-Queues.html#g-queue-insert-after">g_queue_insert_after</a> (<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);
void <a href="glib-Double-ended-Queues.html#g-queue-insert-sorted">g_queue_insert_sorted</a> (<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);
void <a href="glib-Double-ended-Queues.html#g-queue-push-head-link">g_queue_push_head_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);
void <a href="glib-Double-ended-Queues.html#g-queue-push-tail-link">g_queue_push_tail_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);
void <a href="glib-Double-ended-Queues.html#g-queue-push-nth-link">g_queue_push_nth_link</a> (<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_);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-pop-head-link">g_queue_pop_head_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-pop-tail-link">g_queue_pop_tail_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-pop-nth-link">g_queue_pop_nth_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-peek-head-link">g_queue_peek_head_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-peek-tail-link">g_queue_peek_tail_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* <a href="glib-Double-ended-Queues.html#g-queue-peek-nth-link">g_queue_peek_nth_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-Basic-Types.html#gint">gint</a> <a href="glib-Double-ended-Queues.html#g-queue-link-index">g_queue_link_index</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);
void <a href="glib-Double-ended-Queues.html#g-queue-unlink">g_queue_unlink</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);
void <a href="glib-Double-ended-Queues.html#g-queue-delete-link">g_queue_delete_link</a> (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3223020"></a><h2>Description</h2>
<p>
The <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a> structure and its associated functions provide a standard
queue data structure. Internally, <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a> uses the same data structure as
<a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> to store elements.
</p>
<p>
The data contained in each element can be either integer values, by using one
of the
<a href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros">Type Conversion Macros</a>,
or simply pointers to any type of data.
</p>
<p>
To create a new <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>, use <a href="glib-Double-ended-Queues.html#g-queue-new"><code class="function">g_queue_new()</code></a>.
</p>
<p>
To add elements, use <a href="glib-Double-ended-Queues.html#g-queue-push-head"><code class="function">g_queue_push_head()</code></a>, <a href="glib-Double-ended-Queues.html#g-queue-push-head-link"><code class="function">g_queue_push_head_link()</code></a>,
<a href="glib-Double-ended-Queues.html#g-queue-push-tail"><code class="function">g_queue_push_tail()</code></a> and <a href="glib-Double-ended-Queues.html#g-queue-push-tail-link"><code class="function">g_queue_push_tail_link()</code></a>.
</p>
<p>
To remove elements, use <a href="glib-Double-ended-Queues.html#g-queue-pop-head"><code class="function">g_queue_pop_head()</code></a> and <a href="glib-Double-ended-Queues.html#g-queue-pop-tail"><code class="function">g_queue_pop_tail()</code></a>.
</p>
<p>
To free the entire queue, use <a href="glib-Double-ended-Queues.html#g-queue-free"><code class="function">g_queue_free()</code></a>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3223182"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3223192"></a><h3>
<a name="GQueue"></a>GQueue</h3>
<a class="indexterm" name="id3223204"></a><pre class="programlisting">typedef struct {
GList *head;
GList *tail;
guint length;
} GQueue;
</pre>
<p>
Contains the public fields of a Queue.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *<em class="structfield"><code>head</code></em>;</span></td>
<td>a pointer to the first element of the queue.
</td>
</tr>
<tr>
<td>
<span class="term"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *<em class="structfield"><code>tail</code></em>;</span></td>
<td>a pointer to the last element of the queue.
</td>
</tr>
<tr>
<td>
<span class="term"><a href="glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>length</code></em>;</span></td>
<td>the number of elements in the queue.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3223296"></a><h3>
<a name="g-queue-new"></a>g_queue_new ()</h3>
<a class="indexterm" name="id3223308"></a><pre class="programlisting"><a href="glib-Double-ended-Queues.html#GQueue">GQueue</a>* g_queue_new (void);</pre>
<p>
Creates a new <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3223363"></a><h3>
<a name="g-queue-free"></a>g_queue_free ()</h3>
<a class="indexterm" name="id3223375"></a><pre class="programlisting">void g_queue_free (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Frees the memory allocated for the <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>.</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></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3223440"></a><h3>
<a name="g-queue-is-empty"></a>g_queue_is_empty ()</h3>
<a class="indexterm" name="id3223453"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_queue_is_empty (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the queue is empty.</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> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the queue is empty.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3223542"></a><h3>
<a name="g-queue-get-length"></a>g_queue_get_length ()</h3>
<a class="indexterm" name="id3223557"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a> g_queue_get_length (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns the number of items in <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"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The number of items in <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="id3223641"></a><h3>
<a name="g-queue-reverse"></a>g_queue_reverse ()</h3>
<a class="indexterm" name="id3223656"></a><pre class="programlisting">void g_queue_reverse (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Reverses the order of the items in <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></tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3223724"></a><h3>
<a name="g-queue-copy"></a>g_queue_copy ()</h3>
<a class="indexterm" name="id3223739"></a><pre class="programlisting"><a href="glib-Double-ended-Queues.html#GQueue">GQueue</a>* g_queue_copy (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Copies a <em class="parameter"><code>queue</code></em>. Note that is a shallow copy. If the elements in the
queue consist of pointers to data, the pointers are copied, but the
actual data is not.</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> A copy of <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="id3223825"></a><h3>
<a name="g-queue-foreach"></a>g_queue_foreach ()</h3>
<a class="indexterm" name="id3223840"></a><pre class="programlisting">void g_queue_foreach (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<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 <em class="parameter"><code>func</code></em> for each element in the queue passing <em class="parameter"><code>user_data</code></em> to the
function.</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>func</code></em> :</span></td>
<td> the function to call for 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 <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="id3223963"></a><h3>
<a name="g-queue-find"></a>g_queue_find ()</h3>
<a class="indexterm" name="id3223978"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_find (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);</pre>
<p>
Finds the first link 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 find
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The first link in <em class="parameter"><code>queue</code></em> which contains <em class="parameter"><code>data</code></em>.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224096"></a><h3>
<a name="g-queue-find-custom"></a>g_queue_find_custom ()</h3>
<a class="indexterm" name="id3224112"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_find_custom (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data,
<a href="glib-Doubly-Linked-Lists.html#GCompareFunc">GCompareFunc</a> func);</pre>
<p>
Finds an element in a <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a>, using a supplied function to find the
desired element. It iterates over the queue, calling the given function
which should return 0 when the desired element is found. The function
takes two gconstpointer arguments, the <a href="glib-Double-ended-Queues.html#GQueue"><span class="type">GQueue</span></a> element's data as the
first argument and the given user data as the second argument.</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> user data passed to <em class="parameter"><code>func</code></em>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>func</code></em> :</span></td>
<td> a <a href="glib-Doubly-Linked-Lists.html#GCompareFunc"><span class="type">GCompareFunc</span></a> to call for each element. It should return 0
when the desired element is found
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The found link, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it wasn't found
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224274"></a><h3>
<a name="g-queue-sort"></a>g_queue_sort ()</h3>
<a class="indexterm" name="id3224290"></a><pre class="programlisting">void g_queue_sort (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GCompareDataFunc">GCompareDataFunc</a> compare_func,
<a 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>
<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>compare_func</code></em> :</span></td>
<td> the <a 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>
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td> user data passed to <em class="parameter"><code>compare_func</code></em>
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224431"></a><h3>
<a name="g-queue-push-head"></a>g_queue_push_head ()</h3>
<a class="indexterm" name="id3224444"></a><pre class="programlisting">void g_queue_push_head (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a 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>
<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 for the new element.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224523"></a><h3>
<a name="g-queue-push-tail"></a>g_queue_push_tail ()</h3>
<a class="indexterm" name="id3224537"></a><pre class="programlisting">void g_queue_push_tail (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a 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>
<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 for the new element.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224616"></a><h3>
<a name="g-queue-push-nth"></a>g_queue_push_nth ()</h3>
<a class="indexterm" name="id3224631"></a><pre class="programlisting">void g_queue_push_nth (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gpointer">gpointer</a> data,
<a 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>
<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 for the new element
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n</code></em> :</span></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>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3224757"></a><h3>
<a name="g-queue-pop-head"></a>g_queue_pop_head ()</h3>
<a class="indexterm" name="id3224770"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_head (<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 data of the first element in the queue, or <a 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="id3224849"></a><h3>
<a name="g-queue-pop-tail"></a>g_queue_pop_tail ()</h3>
<a class="indexterm" name="id3224861"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_tail (<a 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>
<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 data of the last element in the queue, or <a 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="id3224940"></a><h3>
<a name="g-queue-pop-nth"></a>g_queue_pop_nth ()</h3>
<a class="indexterm" name="id3224955"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_pop_nth (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a 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>
<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 of the element.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the element's data, or <a 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>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3225082"></a><h3>
<a name="g-queue-peek-head"></a>g_queue_peek_head ()</h3>
<a class="indexterm" name="id3225095"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_peek_head (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns 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 data of the first element in the queue, or <a 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="id3225174"></a><h3>
<a name="g-queue-peek-tail"></a>g_queue_peek_tail ()</h3>
<a class="indexterm" name="id3225187"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_peek_tail (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns the last 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 data of the last element in the queue, or <a 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="id3225266"></a><h3>
<a name="g-queue-peek-nth"></a>g_queue_peek_nth ()</h3>
<a class="indexterm" name="id3225281"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_queue_peek_nth (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);</pre>
<p>
Returns 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>
<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 of the element.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The data for the <em class="parameter"><code>n</code></em>'th element of <em class="parameter"><code>queue</code></em>, or <a 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>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3225420"></a><h3>
<a name="g-queue-index"></a>g_queue_index ()</h3>
<a class="indexterm" name="id3225435"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_queue_index (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);</pre>
<p>
Returns the position of the first element 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> the data to find.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The position of the first element in <em class="parameter"><code>queue</code></em> which contains <em class="parameter"><code>data</code></em>, or -1 if no element in <em class="parameter"><code>queue</code></em> contains <em class="parameter"><code>data</code></em>.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3225566"></a><h3>
<a name="g-queue-remove"></a>g_queue_remove ()</h3>
<a class="indexterm" name="id3225581"></a><pre class="programlisting">void g_queue_remove (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> data);</pre>
<p>
Removes the first element in <em class="parameter"><code>queue</code></em> that 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="id3225676"></a><h3>
<a name="g-queue-remove-all"></a>g_queue_remove_all ()</h3>
<a class="indexterm" name="id3225692"></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="id3225787"></a><h3>
<a name="g-queue-insert-before"></a>g_queue_insert_before ()</h3>
<a class="indexterm" name="id3225803"></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="id3225958"></a><h3>
<a name="g-queue-insert-after"></a>g_queue_insert_after ()</h3>
<a class="indexterm" name="id3225973"></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="id3226127"></a><h3>
<a name="g-queue-insert-sorted"></a>g_queue_insert_sorted ()</h3>
<a class="indexterm" name="id3226143"></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 before 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="id3226319"></a><h3>
<a name="g-queue-push-head-link"></a>g_queue_push_head_link ()</h3>
<a class="indexterm" name="id3226332"></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="id3226423"></a><h3>
<a name="g-queue-push-tail-link"></a>g_queue_push_tail_link ()</h3>
<a class="indexterm" name="id3226436"></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="id3226528"></a><h3>
<a name="g-queue-push-nth-link"></a>g_queue_push_nth_link ()</h3>
<a class="indexterm" name="id3226543"></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="id3226679"></a><h3>
<a name="g-queue-pop-head-link"></a>g_queue_pop_head_link ()</h3>
<a class="indexterm" name="id3226692"></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 <a 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="id3226779"></a><h3>
<a name="g-queue-pop-tail-link"></a>g_queue_pop_tail_link ()</h3>
<a class="indexterm" name="id3226792"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_pop_tail_link (<a 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>
<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 tail of the queue, or <a 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="id3226879"></a><h3>
<a name="g-queue-pop-nth-link"></a>g_queue_pop_nth_link ()</h3>
<a class="indexterm" name="id3226895"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_pop_nth_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);</pre>
<p>
Removes and returns the link 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 link's position
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The <em class="parameter"><code>n</code></em>'th link, or <a 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>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3227017"></a><h3>
<a name="g-queue-peek-head-link"></a>g_queue_peek_head_link ()</h3>
<a class="indexterm" name="id3227032"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_peek_head_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns the first link in <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"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the first link in <em class="parameter"><code>queue</code></em>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>queue</code></em> is empty
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3227131"></a><h3>
<a name="g-queue-peek-tail-link"></a>g_queue_peek_tail_link ()</h3>
<a class="indexterm" name="id3227147"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_peek_tail_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue);</pre>
<p>
Returns the last link <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"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the last link in <em class="parameter"><code>queue</code></em>, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>queue</code></em> is empty
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3227247"></a><h3>
<a name="g-queue-peek-nth-link"></a>g_queue_peek_nth_link ()</h3>
<a class="indexterm" name="id3227263"></a><pre class="programlisting"><a href="glib-Doubly-Linked-Lists.html#GList">GList</a>* g_queue_peek_nth_link (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Basic-Types.html#guint">guint</a> n);</pre>
<p>
Returns the link 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 of the link
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The link at the <em class="parameter"><code>n</code></em>'th position, or <a 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 the list
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3227379"></a><h3>
<a name="g-queue-link-index"></a>g_queue_link_index ()</h3>
<a class="indexterm" name="id3227395"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a> g_queue_link_index (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);</pre>
<p>
Returns the position of <em class="parameter"><code>link_</code></em> in <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 <span class="type">Gqueue</span>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>link_</code></em> :</span></td>
<td> A <a href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> link
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The position of <em class="parameter"><code>link_</code></em>, or -1 if the link is
not part of <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="id3227521"></a><h3>
<a name="g-queue-unlink"></a>g_queue_unlink ()</h3>
<a class="indexterm" name="id3227536"></a><pre class="programlisting">void g_queue_unlink (<a href="glib-Double-ended-Queues.html#GQueue">GQueue</a> *queue,
<a href="glib-Doubly-Linked-Lists.html#GList">GList</a> *link_);</pre>
<p>
Unlinks <em class="parameter"><code>link_</code></em> so that it will no longer be part of <em class="parameter"><code>queue</code></em>. The link is
not freed.
</p>
<p>
<em class="parameter"><code>link_</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>link_</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>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3227664"></a><h3>
<a name="g-queue-delete-link"></a>g_queue_delete_link ()</h3>
<a class="indexterm" name="id3227679"></a><pre class="programlisting">void g_queue_delete_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>
Removes <em class="parameter"><code>link_</code></em> from <em class="parameter"><code>queue</code></em> and frees it.
</p>
<p>
<em class="parameter"><code>link_</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>link_</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>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
</div>
</div>
</body>
</html>