gqueue.h File Reference

__G_QUEUE_H__

Typedef GQueue

typedef typedefG_BEGIN_DECLS struct _GQueueGQueue

G_QUEUE_INIT

g_queue_new ( void )

IMPORT_C GQueue *g_queue_new(void)

g_queue_new:

Creates a new GQueue.

Returns: a new GQueue.

g_queue_free ( GQueue * )

IMPORT_C voidg_queue_free(GQueue *queue)

g_queue_free: : a GQueue.

Frees the memory allocated for the GQueue. Only call this function if was created with g_queue_new(). If queue elements contain dynamically-allocated memory, they should be freed first.

g_queue_init ( GQueue * )

IMPORT_C voidg_queue_init(GQueue *queue)

g_queue_init: : an uninitialized GQueue

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().

Since: 2.14

g_queue_clear ( GQueue * )

IMPORT_C voidg_queue_clear(GQueue *queue)

g_queue_clear: : a GQueue

Removes all the elements in . If queue elements contain dynamically-allocated memory, they should be freed first.

Since: 2.14

g_queue_is_empty ( GQueue * )

IMPORT_C gbooleang_queue_is_empty(GQueue *queue)

g_queue_is_empty: : a GQueue.

Returns TRUE if the queue is empty.

Returns: TRUE if the queue is empty.

g_queue_get_length ( GQueue * )

IMPORT_C guintg_queue_get_length(GQueue *queue)

g_queue_get_length: : a GQueue

Returns the number of items in .

Return value: The number of items in .

Since: 2.4

g_queue_reverse ( GQueue * )

IMPORT_C voidg_queue_reverse(GQueue *queue)

g_queue_reverse: : a GQueue

Reverses the order of the items in .

Since: 2.4

g_queue_copy ( GQueue * )

IMPORT_C GQueue *g_queue_copy(GQueue *queue)

g_queue_copy: : a GQueue

Copies a . 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.

Return value: A copy of

Since: 2.4

g_queue_foreach ( GQueue *, GFunc, gpointer )

IMPORT_C voidg_queue_foreach(GQueue *queue,
GFuncfunc,
gpointeruser_data
)

g_queue_foreach: : a GQueue : the function to call for each element's data : user data to pass to

Calls for each element in the queue passing to the function.

Since: 2.4

g_queue_find ( GQueue *, gconstpointer )

IMPORT_C GList *g_queue_find(GQueue *queue,
gconstpointerdata
)

g_queue_find: : a GQueue : data to find

Finds the first link in which contains .

Return value: The first link in which contains .

Since: 2.4

g_queue_find_custom ( GQueue *, gconstpointer, GCompareFunc )

IMPORT_C GList *g_queue_find_custom(GQueue *queue,
gconstpointerdata,
GCompareFuncfunc
)

g_queue_find_custom: : a GQueue : user data passed to : a GCompareFunc to call for each element. It should return 0 when the desired element is found

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.

Return value: The found link, or NULL if it wasn't found

Since: 2.4

g_queue_sort ( GQueue *, GCompareDataFunc, gpointer )

IMPORT_C voidg_queue_sort(GQueue *queue,
GCompareDataFunccompare_func,
gpointeruser_data
)

g_queue_sort: : a GQueue : the GCompareDataFunc used to sort . 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. : user data passed to

Sorts using .

Since: 2.4

g_queue_push_head ( GQueue *, gpointer )

IMPORT_C voidg_queue_push_head(GQueue *queue,
gpointerdata
)

g_queue_push_head: : a GQueue. : the data for the new element.

Adds a new element at the head of the queue.

g_queue_push_tail ( GQueue *, gpointer )

IMPORT_C voidg_queue_push_tail(GQueue *queue,
gpointerdata
)

g_queue_push_tail: : a GQueue. : the data for the new element.

Adds a new element at the tail of the queue.

g_queue_push_nth ( GQueue *, gpointer, gint )

IMPORT_C voidg_queue_push_nth(GQueue *queue,
gpointerdata,
gintn
)

g_queue_push_nth: : a GQueue : the data for the new element : the position to insert the new element. If is negative or larger than the number of elements in the , the element is added to the end of the queue.

Inserts a new element into at the given position

Since: 2.4

g_queue_pop_head ( GQueue * )

IMPORT_C gpointerg_queue_pop_head(GQueue *queue)

g_queue_pop_head: : a GQueue.

Removes the first element of the queue.

Returns: the data of the first element in the queue, or NULL if the queue is empty.

g_queue_pop_tail ( GQueue * )

IMPORT_C gpointerg_queue_pop_tail(GQueue *queue)

g_queue_pop_tail: : a GQueue.

Removes the last element of the queue.

Returns: the data of the last element in the queue, or NULL if the queue is empty.

g_queue_pop_nth ( GQueue *, guint )

IMPORT_C gpointerg_queue_pop_nth(GQueue *queue,
guintn
)

g_queue_pop_nth: : a GQueue : the position of the element.

Removes the 'th element of .

Return value: the element's data, or NULL if is off the end of .

Since: 2.4

g_queue_peek_head ( GQueue * )

IMPORT_C gpointerg_queue_peek_head(GQueue *queue)

g_queue_peek_head: : a GQueue.

Returns the first element of the queue.

Returns: the data of the first element in the queue, or NULL if the queue is empty.

g_queue_peek_tail ( GQueue * )

IMPORT_C gpointerg_queue_peek_tail(GQueue *queue)

g_queue_peek_tail: : a GQueue.

Returns the last element of the queue.

Returns: the data of the last element in the queue, or NULL if the queue is empty.

g_queue_peek_nth ( GQueue *, guint )

IMPORT_C gpointerg_queue_peek_nth(GQueue *queue,
guintn
)

g_queue_peek_nth: : a GQueue : the position of the element.

Returns the 'th element of .

Return value: The data for the 'th element of , or NULL if is off the end of .

Since: 2.4

g_queue_index ( GQueue *, gconstpointer )

IMPORT_C gintg_queue_index(GQueue *queue,
gconstpointerdata
)

g_queue_index: : a GQueue : the data to find.

Returns the position of the first element in which contains .

Return value: The position of the first element in which contains , or -1 if no element in contains .

Since: 2.4

g_queue_remove ( GQueue *, gconstpointer )

IMPORT_C voidg_queue_remove(GQueue *queue,
gconstpointerdata
)

g_queue_remove: : a GQueue : data to remove.

Removes the first element in that contains .

Since: 2.4

g_queue_remove_all ( GQueue *, gconstpointer )

IMPORT_C voidg_queue_remove_all(GQueue *queue,
gconstpointerdata
)

g_queue_remove_all: : a GQueue : data to remove

Remove all elemeents in which contains .

Since: 2.4

g_queue_insert_before ( GQueue *, GList *, gpointer )

IMPORT_C voidg_queue_insert_before(GQueue *queue,
GList *sibling,
gpointerdata
)

g_queue_insert_before: : a GQueue : a GList link that <emphasis>must</emphasis> be part of : the data to insert

Inserts into before .

must be part of .

Since: 2.4

g_queue_insert_after ( GQueue *, GList *, gpointer )

IMPORT_C voidg_queue_insert_after(GQueue *queue,
GList *sibling,
gpointerdata
)

g_queue_insert_after: : a GQueue : a GList link that <emphasis>must</emphasis> be part of : the data to insert

Inserts into after

must be part of

Since: 2.4

g_queue_insert_sorted ( GQueue *, gpointer, GCompareDataFunc, gpointer )

IMPORT_C voidg_queue_insert_sorted(GQueue *queue,
gpointerdata,
GCompareDataFuncfunc,
gpointeruser_data
)

g_queue_insert_sorted: : a GQueue : the data to insert : the GCompareDataFunc used to compare elements in the queue. It is called with two elements of the and . 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. : user data passed to .

Inserts into using to determine the new position.

Since: 2.4

g_queue_push_head_link ( GQueue *, GList * )

IMPORT_C voidg_queue_push_head_link(GQueue *queue,
GList *link_
)

g_queue_push_head_link: : a GQueue. : a single GList element, <emphasis>not</emphasis> a list with more than one element.

Adds a new element at the head of the queue.

g_queue_push_tail_link ( GQueue *, GList * )

IMPORT_C voidg_queue_push_tail_link(GQueue *queue,
GList *link_
)

g_queue_push_tail_link: : a GQueue. : a single GList element, <emphasis>not</emphasis> a list with more than one element.

Adds a new element at the tail of the queue.

g_queue_push_nth_link ( GQueue *, gint, GList * )

IMPORT_C voidg_queue_push_nth_link(GQueue *queue,
gintn,
GList *link_
)

g_queue_push_nth_link: : a GQueue : the position to insert the link. If this is negative or larger than the number of elements in , the link is added to the end of . : the link to add to

Inserts at the given position. Since: 2.4

g_queue_pop_head_link ( GQueue * )

IMPORT_C GList *g_queue_pop_head_link(GQueue *queue)

g_queue_pop_head_link: : a GQueue.

Removes the first element of the queue.

Returns: the GList element at the head of the queue, or NULL if the queue is empty.

g_queue_pop_tail_link ( GQueue * )

IMPORT_C GList *g_queue_pop_tail_link(GQueue *queue)

g_queue_pop_tail_link: : a GQueue.

Removes the last element of the queue.

Returns: the GList element at the tail of the queue, or NULL if the queue is empty.

g_queue_pop_nth_link ( GQueue *, guint )

IMPORT_C GList *g_queue_pop_nth_link(GQueue *queue,
guintn
)

g_queue_pop_nth_link: : a GQueue : the link's position

Removes and returns the link at the given position.

Return value: The 'th link, or NULL if is off the end of .

Since: 2.4

g_queue_peek_head_link ( GQueue * )

IMPORT_C GList *g_queue_peek_head_link(GQueue *queue)

g_queue_peek_head_link: : a GQueue

Returns the first link in

Return value: the first link in , or NULL if is empty

Since: 2.4

g_queue_peek_tail_link ( GQueue * )

IMPORT_C GList *g_queue_peek_tail_link(GQueue *queue)

g_queue_peek_tail_link: : a GQueue

Returns the last link .

Return value: the last link in , or NULL if is empty

Since: 2.4

g_queue_peek_nth_link ( GQueue *, guint )

IMPORT_C GList *g_queue_peek_nth_link(GQueue *queue,
guintn
)

g_queue_peek_nth_link: : a GQueue : the position of the link

Returns the link at the given position

Return value: The link at the 'th position, or NULL if is off the end of the list

Since: 2.4

g_queue_link_index ( GQueue *, GList * )

IMPORT_C gintg_queue_link_index(GQueue *queue,
GList *link_
)

g_queue_link_index: : a #Gqueue : A GList link

Returns the position of in .

Return value: The position of , or -1 if the link is not part of

Since: 2.4

g_queue_unlink ( GQueue *, GList * )

IMPORT_C voidg_queue_unlink(GQueue *queue,
GList *link_
)

g_queue_unlink : a GQueue : a GList link that <emphasis>must</emphasis> be part of

Unlinks so that it will no longer be part of . The link is not freed.

must be part of ,

Since: 2.4

g_queue_delete_link ( GQueue *, GList * )

IMPORT_C voidg_queue_delete_link(GQueue *queue,
GList *link_
)

g_queue_delete_link: : a GQueue : a GList link that <emphasis>must</emphasis> be part of

Removes from and frees it.

must be part of .

Since: 2.4