Struct
GLibQueue
Functions
g_queue_new
Creates a new GQueue
.
Instance methods
g_queue_clear
Removes all the elements in queue
. If queue elements contain
dynamically-allocated memory, they should be freed first.
Available since: 2.14
g_queue_clear_full
Convenience method, which frees all the memory used by a GQueue
,
and calls the provided free_func
on each item in the GQueue
.
Available since: 2.60
g_queue_copy
Copies a queue
. 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.
Available since: 2.4
g_queue_find_custom
Finds an element in a GQueue
, 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 GQueue
element’s data as the
first argument and the given user data as the second argument.
Available since: 2.4
g_queue_foreach
Calls func
for each element in the queue passing user_data
to the function.
Available since: 2.4
g_queue_free
Frees the memory allocated for the GQueue
. Only call this function
if queue
was created with g_queue_new(). If queue elements contain
dynamically-allocated memory, they should be freed first.
g_queue_free_full
Convenience method, which frees all the memory used by a GQueue
,
and calls the specified destroy function on every element’s data.
Available since: 2.32
g_queue_index
Returns the position of the first element in queue
which contains data
.
Available since: 2.4
g_queue_init
A statically-allocated GQueue
must be initialized with this function
before it can be used. Alternatively you can initialize it with
G_QUEUE_INIT
. It is not necessary to initialize queues created with g_queue_new().
Available since: 2.14
g_queue_insert_sorted
Inserts data
into queue
using func
to determine the new position.
Available since: 2.4
g_queue_is_empty
Returns TRUE
if the queue is empty.
g_queue_peek_head
Returns the first element of the queue.
g_queue_peek_tail
Returns the last element of the queue.
g_queue_pop_head
Removes the first element of the queue and returns its data.
g_queue_pop_head_link
Removes and returns the first element of the queue.
g_queue_pop_tail
Removes the last element of the queue and returns its data.
g_queue_pop_tail_link
Removes and returns the last element of the queue.
g_queue_push_head
Adds a new element at the head of the queue.
g_queue_push_head_link
Adds a new element at the head of the queue.
g_queue_push_tail
Adds a new element at the tail of the queue.
g_queue_push_tail_link
Adds a new element at the tail of the queue.
g_queue_unlink
Unlinks link_
so that it will no longer be part of queue
.
The link is not freed.
Available since: 2.4