| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.GLib.Structs.Queue
Description
Contains the public fields of a [Queue][glib-Double-ended-Queues].
Synopsis
- newtype Queue = Queue (ManagedPtr Queue)
- newZeroQueue :: MonadIO m => m Queue
- queueClear :: (HasCallStack, MonadIO m) => Queue -> m ()
- queueClearFull :: (HasCallStack, MonadIO m) => Queue -> Maybe DestroyNotify -> m ()
- queueForeach :: (HasCallStack, MonadIO m) => Queue -> Func -> m ()
- queueFree :: (HasCallStack, MonadIO m) => Queue -> m ()
- queueFreeFull :: (HasCallStack, MonadIO m) => Queue -> DestroyNotify -> m ()
- queueGetLength :: (HasCallStack, MonadIO m) => Queue -> m Word32
- queueIndex :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> m Int32
- queueInit :: (HasCallStack, MonadIO m) => Queue -> m ()
- queueInsertSorted :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> CompareDataFunc -> m ()
- queueIsEmpty :: (HasCallStack, MonadIO m) => Queue -> m Bool
- queuePeekHead :: (HasCallStack, MonadIO m) => Queue -> m (Ptr ())
- queuePeekNth :: (HasCallStack, MonadIO m) => Queue -> Word32 -> m (Ptr ())
- queuePeekTail :: (HasCallStack, MonadIO m) => Queue -> m (Ptr ())
- queuePopHead :: (HasCallStack, MonadIO m) => Queue -> m (Ptr ())
- queuePopNth :: (HasCallStack, MonadIO m) => Queue -> Word32 -> m (Ptr ())
- queuePopTail :: (HasCallStack, MonadIO m) => Queue -> m (Ptr ())
- queuePushHead :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> m ()
- queuePushNth :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> Int32 -> m ()
- queuePushTail :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> m ()
- queueRemove :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> m Bool
- queueRemoveAll :: (HasCallStack, MonadIO m) => Queue -> Ptr () -> m Word32
- queueReverse :: (HasCallStack, MonadIO m) => Queue -> m ()
- queueSort :: (HasCallStack, MonadIO m) => Queue -> CompareDataFunc -> m ()
- clearQueueHead :: MonadIO m => Queue -> m ()
- getQueueHead :: MonadIO m => Queue -> m [Ptr ()]
- setQueueHead :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m ()
- getQueueLength :: MonadIO m => Queue -> m Word32
- setQueueLength :: MonadIO m => Queue -> Word32 -> m ()
- clearQueueTail :: MonadIO m => Queue -> m ()
- getQueueTail :: MonadIO m => Queue -> m [Ptr ()]
- setQueueTail :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m ()
Exported types
Memory-managed wrapper type.
Instances
| Eq Queue Source # | |
| BoxedPtr Queue Source # | |
Defined in GI.GLib.Structs.Queue | |
| CallocPtr Queue Source # | |
Defined in GI.GLib.Structs.Queue Methods boxedPtrCalloc :: IO (Ptr Queue) | |
| ManagedPtrNewtype Queue Source # | |
Defined in GI.GLib.Structs.Queue Methods toManagedPtr :: Queue -> ManagedPtr Queue | |
| tag ~ 'AttrSet => Constructible Queue tag Source # | |
Methods
Click to display all available methods, including inherited ones
clear
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m () |
Removes all the elements in queue. If queue elements contain
dynamically-allocated memory, they should be freed first.
Since: 2.14
clearFull
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Maybe DestroyNotify |
|
| -> m () |
foreach
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Func |
|
| -> m () |
Calls func for each element in the queue passing userData to the
function.
It is safe for func to remove the element from queue, but it must
not modify any part of the queue after that element.
Since: 2.4
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m () |
Frees the memory allocated for the Queue. Only call this function
if queue was created with g_queue_new(). If queue elements contain
dynamically-allocated memory, they should be freed first.
If queue elements contain dynamically-allocated memory, you should
either use queueFreeFull or free them manually first.
freeFull
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> DestroyNotify |
|
| -> m () |
Convenience method, which frees all the memory used by a Queue,
and calls the specified destroy function on every element's data.
freeFunc should not modify the queue (eg, by removing the freed
element from it).
Since: 2.32
getLength
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m Word32 | Returns: the number of items in |
Returns the number of items in queue.
Since: 2.4
index
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> m Int32 | Returns: the position of the first element in |
Returns the position of the first element in queue which contains data.
Since: 2.4
init
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m () |
A statically-allocated Queue 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
insertSorted
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> CompareDataFunc |
|
| -> m () |
Inserts data into queue using func to determine the new position.
Since: 2.4
isEmpty
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m Bool | Returns: |
Returns True if the queue is empty.
peekHead
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m (Ptr ()) | Returns: the data of the first element in the queue, or |
Returns the first element of the queue.
peekNth
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Word32 |
|
| -> m (Ptr ()) | Returns: the data for the |
Returns the n'th element of queue.
Since: 2.4
peekTail
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m (Ptr ()) | Returns: the data of the last element in the queue, or |
Returns the last element of the queue.
popHead
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m (Ptr ()) | Returns: the data of the first element in the queue, or |
Removes the first element of the queue and returns its data.
popNth
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Word32 |
|
| -> m (Ptr ()) | Returns: the element's data, or |
Removes the n'th element of queue and returns its data.
Since: 2.4
popTail
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m (Ptr ()) | Returns: the data of the last element in the queue, or |
Removes the last element of the queue and returns its data.
pushHead
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> m () |
Adds a new element at the head of the queue.
pushNth
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> Int32 |
|
| -> m () |
Inserts a new element into queue at the given position.
Since: 2.4
pushTail
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> m () |
Adds a new element at the tail of the queue.
remove
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> m Bool | Returns: |
Removes the first element in queue that contains data.
Since: 2.4
removeAll
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> Ptr () |
|
| -> m Word32 | Returns: the number of elements removed from |
Remove all elements whose data equals data from queue.
Since: 2.4
reverse
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> m () |
Reverses the order of the items in queue.
Since: 2.4
sort
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Queue |
|
| -> CompareDataFunc |
|
| -> m () |
Sorts queue using compareFunc.
Since: 2.4
Properties
head
a pointer to the first element of the queue
clearQueueHead :: MonadIO m => Queue -> m () Source #
Set the value of the “head” field to Nothing.
When overloading is enabled, this is equivalent to
clear #head
getQueueHead :: MonadIO m => Queue -> m [Ptr ()] Source #
Get the value of the “head” field.
When overloading is enabled, this is equivalent to
get queue #head
setQueueHead :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m () Source #
Set the value of the “head” field.
When overloading is enabled, this is equivalent to
setqueue [ #head:=value ]
length
the number of elements in the queue
getQueueLength :: MonadIO m => Queue -> m Word32 Source #
Get the value of the “length” field.
When overloading is enabled, this is equivalent to
get queue #length
setQueueLength :: MonadIO m => Queue -> Word32 -> m () Source #
Set the value of the “length” field.
When overloading is enabled, this is equivalent to
setqueue [ #length:=value ]
tail
a pointer to the last element of the queue
clearQueueTail :: MonadIO m => Queue -> m () Source #
Set the value of the “tail” field to Nothing.
When overloading is enabled, this is equivalent to
clear #tail
getQueueTail :: MonadIO m => Queue -> m [Ptr ()] Source #
Get the value of the “tail” field.
When overloading is enabled, this is equivalent to
get queue #tail
setQueueTail :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m () Source #
Set the value of the “tail” field.
When overloading is enabled, this is equivalent to
setqueue [ #tail:=value ]