gi-glib-2.0.22: GLib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.Queue

Contents

Description

Contains the public fields of a [Queue][glib-Double-ended-Queues].

Synopsis

Exported types

newtype Queue Source #

Memory-managed wrapper type.

Constructors

Queue (ManagedPtr Queue) 
Instances
WrappedPtr Queue Source # 
Instance details

Defined in GI.GLib.Structs.Queue

tag ~ AttrSet => Constructible Queue tag Source # 
Instance details

Defined in GI.GLib.Structs.Queue

Methods

new :: MonadIO m => (ManagedPtr Queue -> Queue) -> [AttrOp Queue tag] -> m Queue #

newZeroQueue :: MonadIO m => m Queue Source #

Construct a Queue struct initialized to zero.

noQueue :: Maybe Queue Source #

A convenience alias for Nothing :: Maybe Queue.

Methods

clear

queueClear Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m () 

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

Since: 2.14

clearFull

queueClearFull Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a pointer to a Queue

-> Maybe DestroyNotify

freeFunc: the function to be called to free memory allocated

-> m () 

Convenience method, which frees all the memory used by a Queue, and calls the provided freeFunc on each item in the Queue.

Since: 2.60

free

queueFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a 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

queueFreeFull Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a pointer to a Queue

-> DestroyNotify

freeFunc: the function to be called to free each element's data

-> 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

queueGetLength Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m Word32

Returns: the number of items in queue

Returns the number of items in queue.

Since: 2.4

index

queueIndex Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Ptr ()

data: the data to find

-> m Int32

Returns: the position of the first element in queue which contains data, or -1 if no element in queue contains data

Returns the position of the first element in queue which contains data.

Since: 2.4

init

queueInit Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: an uninitialized 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

isEmpty

queueIsEmpty Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue.

-> m Bool

Returns: True if the queue is empty

Returns True if the queue is empty.

peekHead

queuePeekHead Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m (Ptr ())

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

Returns the first element of the queue.

peekNth

queuePeekNth Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Word32

n: the position of the element

-> m (Ptr ())

Returns: the data for the n'th element of queue, or Nothing if n is off the end of queue

Returns the n'th element of queue.

Since: 2.4

peekTail

queuePeekTail Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m (Ptr ())

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

Returns the last element of the queue.

popHead

queuePopHead Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m (Ptr ())

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

Removes the first element of the queue and returns its data.

popNth

queuePopNth Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Word32

n: the position of the element

-> m (Ptr ())

Returns: the element's data, or Nothing if n is off the end of queue

Removes the n'th element of queue and returns its data.

Since: 2.4

popTail

queuePopTail Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m (Ptr ())

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

Removes the last element of the queue and returns its data.

pushHead

queuePushHead Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue.

-> Ptr ()

data: the data for the new element.

-> m () 

Adds a new element at the head of the queue.

pushNth

queuePushNth Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Ptr ()

data: the data for the new element

-> Int32

n: the position to insert the new element. If n is negative or larger than the number of elements in the queue, the element is added to the end of the queue.

-> m () 

Inserts a new element into queue at the given position.

Since: 2.4

pushTail

queuePushTail Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Ptr ()

data: the data for the new element

-> m () 

Adds a new element at the tail of the queue.

remove

queueRemove Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Ptr ()

data: the data to remove

-> m Bool

Returns: True if data was found and removed from queue

Removes the first element in queue that contains data.

Since: 2.4

removeAll

queueRemoveAll Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> Ptr ()

data: the data to remove

-> m Word32

Returns: the number of elements removed from queue

Remove all elements whose data equals data from queue.

Since: 2.4

reverse

queueReverse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Queue

queue: a Queue

-> m () 

Reverses the order of the items in queue.

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

set queue [ #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

set queue [ #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

set queue [ #tail := value ]