gi-glib-0.2.44.12: GI/GLib/Structs/Queue.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Contains the public fields of a
[Queue][glib-Double-ended-Queues].
-}
module GI.GLib.Structs.Queue
(
-- * Exported types
Queue(..) ,
noQueue ,
-- * Methods
-- ** queueClear
queueClear ,
-- ** queueFree
queueFree ,
-- ** queueFreeFull
queueFreeFull ,
-- ** queueGetLength
queueGetLength ,
-- ** queueIndex
queueIndex ,
-- ** queueInit
queueInit ,
-- ** queueIsEmpty
queueIsEmpty ,
-- ** queuePushHead
queuePushHead ,
-- ** queuePushNth
queuePushNth ,
-- ** queuePushTail
queuePushTail ,
-- ** queueRemove
queueRemove ,
-- ** queueRemoveAll
queueRemoveAll ,
-- ** queueReverse
queueReverse ,
-- * Properties
-- ** Head
queueReadHead ,
-- ** Length
queueReadLength ,
-- ** Tail
queueReadTail ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.GLib.Types
import GI.GLib.Callbacks
newtype Queue = Queue (ForeignPtr Queue)
noQueue :: Maybe Queue
noQueue = Nothing
queueReadHead :: Queue -> IO ([Ptr ()])
queueReadHead s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr (GList (Ptr ())))
val' <- unpackGList val
return val'
queueReadTail :: Queue -> IO ([Ptr ()])
queueReadTail s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr (GList (Ptr ())))
val' <- unpackGList val
return val'
queueReadLength :: Queue -> IO Word32
queueReadLength s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Word32
return val
-- method Queue::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_clear" g_queue_clear ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO ()
queueClear ::
(MonadIO m) =>
Queue -> -- _obj
m ()
queueClear _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_clear _obj'
touchManagedPtr _obj
return ()
-- method Queue::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_free" g_queue_free ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO ()
queueFree ::
(MonadIO m) =>
Queue -> -- _obj
m ()
queueFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_free _obj'
touchManagedPtr _obj
return ()
-- method Queue::free_full
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "free_func", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_free_full" g_queue_free_full ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
FunPtr DestroyNotifyC -> -- free_func : TInterface "GLib" "DestroyNotify"
IO ()
queueFreeFull ::
(MonadIO m) =>
Queue -> -- _obj
DestroyNotify -> -- free_func
m ()
queueFreeFull _obj free_func = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
ptrfree_func <- callocMem :: IO (Ptr (FunPtr DestroyNotifyC))
free_func' <- mkDestroyNotify (destroyNotifyWrapper (Just ptrfree_func) free_func)
poke ptrfree_func free_func'
g_queue_free_full _obj' free_func'
touchManagedPtr _obj
return ()
-- method Queue::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_get_length" g_queue_get_length ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO Word32
queueGetLength ::
(MonadIO m) =>
Queue -> -- _obj
m Word32
queueGetLength _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_queue_get_length _obj'
touchManagedPtr _obj
return result
-- method Queue::index
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_index" g_queue_index ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
IO Int32
queueIndex ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
m Int32
queueIndex _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_queue_index _obj' data_
touchManagedPtr _obj
return result
-- method Queue::init
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_init" g_queue_init ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO ()
queueInit ::
(MonadIO m) =>
Queue -> -- _obj
m ()
queueInit _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_init _obj'
touchManagedPtr _obj
return ()
-- method Queue::is_empty
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_is_empty" g_queue_is_empty ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO CInt
queueIsEmpty ::
(MonadIO m) =>
Queue -> -- _obj
m Bool
queueIsEmpty _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_queue_is_empty _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Queue::push_head
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_push_head" g_queue_push_head ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
IO ()
queuePushHead ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
m ()
queuePushHead _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_push_head _obj' data_
touchManagedPtr _obj
return ()
-- method Queue::push_nth
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_push_nth" g_queue_push_nth ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
Int32 -> -- n : TBasicType TInt32
IO ()
queuePushNth ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
Int32 -> -- n
m ()
queuePushNth _obj data_ n = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_push_nth _obj' data_ n
touchManagedPtr _obj
return ()
-- method Queue::push_tail
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_push_tail" g_queue_push_tail ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
IO ()
queuePushTail ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
m ()
queuePushTail _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_push_tail _obj' data_
touchManagedPtr _obj
return ()
-- method Queue::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_remove" g_queue_remove ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
IO CInt
queueRemove ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
m Bool
queueRemove _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_queue_remove _obj' data_
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Queue::remove_all
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_remove_all" g_queue_remove_all ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
Ptr () -> -- data : TBasicType TVoid
IO Word32
queueRemoveAll ::
(MonadIO m) =>
Queue -> -- _obj
Ptr () -> -- data
m Word32
queueRemoveAll _obj data_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_queue_remove_all _obj' data_
touchManagedPtr _obj
return result
-- method Queue::reverse
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Queue", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_queue_reverse" g_queue_reverse ::
Ptr Queue -> -- _obj : TInterface "GLib" "Queue"
IO ()
queueReverse ::
(MonadIO m) =>
Queue -> -- _obj
m ()
queueReverse _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_queue_reverse _obj'
touchManagedPtr _obj
return ()