{-# LANGUAGE TypeApplications #-} -- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria -- -- Contains the public fields of a -- [Queue][glib-Double-ended-Queues]. #if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__)) #define ENABLE_OVERLOADING #endif module GI.GLib.Structs.Queue ( -- * Exported types Queue(..) , newZeroQueue , noQueue , -- * Methods -- ** Overloaded methods #method:Overloaded methods# #if defined(ENABLE_OVERLOADING) ResolveQueueMethod , #endif -- ** clear #method:clear# #if defined(ENABLE_OVERLOADING) QueueClearMethodInfo , #endif queueClear , -- ** clearFull #method:clearFull# #if defined(ENABLE_OVERLOADING) QueueClearFullMethodInfo , #endif queueClearFull , -- ** free #method:free# #if defined(ENABLE_OVERLOADING) QueueFreeMethodInfo , #endif queueFree , -- ** freeFull #method:freeFull# #if defined(ENABLE_OVERLOADING) QueueFreeFullMethodInfo , #endif queueFreeFull , -- ** getLength #method:getLength# #if defined(ENABLE_OVERLOADING) QueueGetLengthMethodInfo , #endif queueGetLength , -- ** index #method:index# #if defined(ENABLE_OVERLOADING) QueueIndexMethodInfo , #endif queueIndex , -- ** init #method:init# #if defined(ENABLE_OVERLOADING) QueueInitMethodInfo , #endif queueInit , -- ** isEmpty #method:isEmpty# #if defined(ENABLE_OVERLOADING) QueueIsEmptyMethodInfo , #endif queueIsEmpty , -- ** peekHead #method:peekHead# #if defined(ENABLE_OVERLOADING) QueuePeekHeadMethodInfo , #endif queuePeekHead , -- ** peekNth #method:peekNth# #if defined(ENABLE_OVERLOADING) QueuePeekNthMethodInfo , #endif queuePeekNth , -- ** peekTail #method:peekTail# #if defined(ENABLE_OVERLOADING) QueuePeekTailMethodInfo , #endif queuePeekTail , -- ** popHead #method:popHead# #if defined(ENABLE_OVERLOADING) QueuePopHeadMethodInfo , #endif queuePopHead , -- ** popNth #method:popNth# #if defined(ENABLE_OVERLOADING) QueuePopNthMethodInfo , #endif queuePopNth , -- ** popTail #method:popTail# #if defined(ENABLE_OVERLOADING) QueuePopTailMethodInfo , #endif queuePopTail , -- ** pushHead #method:pushHead# #if defined(ENABLE_OVERLOADING) QueuePushHeadMethodInfo , #endif queuePushHead , -- ** pushNth #method:pushNth# #if defined(ENABLE_OVERLOADING) QueuePushNthMethodInfo , #endif queuePushNth , -- ** pushTail #method:pushTail# #if defined(ENABLE_OVERLOADING) QueuePushTailMethodInfo , #endif queuePushTail , -- ** remove #method:remove# #if defined(ENABLE_OVERLOADING) QueueRemoveMethodInfo , #endif queueRemove , -- ** removeAll #method:removeAll# #if defined(ENABLE_OVERLOADING) QueueRemoveAllMethodInfo , #endif queueRemoveAll , -- ** reverse #method:reverse# #if defined(ENABLE_OVERLOADING) QueueReverseMethodInfo , #endif queueReverse , -- * Properties -- ** head #attr:head# -- | a pointer to the first element of the queue clearQueueHead , getQueueHead , #if defined(ENABLE_OVERLOADING) queue_head , #endif setQueueHead , -- ** length #attr:length# -- | the number of elements in the queue getQueueLength , #if defined(ENABLE_OVERLOADING) queue_length , #endif setQueueLength , -- ** tail #attr:tail# -- | a pointer to the last element of the queue clearQueueTail , getQueueTail , #if defined(ENABLE_OVERLOADING) queue_tail , #endif setQueueTail , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.GI.Base.Signals as B.Signals import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GI.GLib.Callbacks as GLib.Callbacks -- | Memory-managed wrapper type. newtype Queue = Queue (ManagedPtr Queue) deriving (Eq) instance WrappedPtr Queue where wrappedPtrCalloc = callocBytes 12 wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 12 >=> wrapPtr Queue) wrappedPtrFree = Just ptr_to_g_free -- | Construct a `Queue` struct initialized to zero. newZeroQueue :: MonadIO m => m Queue newZeroQueue = liftIO $ wrappedPtrCalloc >>= wrapPtr Queue instance tag ~ 'AttrSet => Constructible Queue tag where new _ attrs = do o <- newZeroQueue GI.Attributes.set o attrs return o -- | A convenience alias for `Nothing` :: `Maybe` `Queue`. noQueue :: Maybe Queue noQueue = Nothing -- | Get the value of the “@head@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.get' queue #head -- @ getQueueHead :: MonadIO m => Queue -> m ([Ptr ()]) getQueueHead s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO (Ptr (GList (Ptr ()))) val' <- unpackGList val return val' -- | Set the value of the “@head@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.set' queue [ #head 'Data.GI.Base.Attributes.:=' value ] -- @ setQueueHead :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m () setQueueHead s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 0) (val :: Ptr (GList (Ptr ()))) -- | Set the value of the “@head@” field to `Nothing`. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.clear' #head -- @ clearQueueHead :: MonadIO m => Queue -> m () clearQueueHead s = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 0) (FP.nullPtr :: Ptr (GList (Ptr ()))) #if defined(ENABLE_OVERLOADING) data QueueHeadFieldInfo instance AttrInfo QueueHeadFieldInfo where type AttrBaseTypeConstraint QueueHeadFieldInfo = (~) Queue type AttrAllowedOps QueueHeadFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint QueueHeadFieldInfo = (~) (Ptr (GList (Ptr ()))) type AttrTransferTypeConstraint QueueHeadFieldInfo = (~)(Ptr (GList (Ptr ()))) type AttrTransferType QueueHeadFieldInfo = (Ptr (GList (Ptr ()))) type AttrGetType QueueHeadFieldInfo = [Ptr ()] type AttrLabel QueueHeadFieldInfo = "head" type AttrOrigin QueueHeadFieldInfo = Queue attrGet = getQueueHead attrSet = setQueueHead attrConstruct = undefined attrClear = clearQueueHead attrTransfer _ v = do return v queue_head :: AttrLabelProxy "head" queue_head = AttrLabelProxy #endif -- | Get the value of the “@tail@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.get' queue #tail -- @ getQueueTail :: MonadIO m => Queue -> m ([Ptr ()]) getQueueTail s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO (Ptr (GList (Ptr ()))) val' <- unpackGList val return val' -- | Set the value of the “@tail@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.set' queue [ #tail 'Data.GI.Base.Attributes.:=' value ] -- @ setQueueTail :: MonadIO m => Queue -> Ptr (GList (Ptr ())) -> m () setQueueTail s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 4) (val :: Ptr (GList (Ptr ()))) -- | Set the value of the “@tail@” field to `Nothing`. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.clear' #tail -- @ clearQueueTail :: MonadIO m => Queue -> m () clearQueueTail s = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 4) (FP.nullPtr :: Ptr (GList (Ptr ()))) #if defined(ENABLE_OVERLOADING) data QueueTailFieldInfo instance AttrInfo QueueTailFieldInfo where type AttrBaseTypeConstraint QueueTailFieldInfo = (~) Queue type AttrAllowedOps QueueTailFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint QueueTailFieldInfo = (~) (Ptr (GList (Ptr ()))) type AttrTransferTypeConstraint QueueTailFieldInfo = (~)(Ptr (GList (Ptr ()))) type AttrTransferType QueueTailFieldInfo = (Ptr (GList (Ptr ()))) type AttrGetType QueueTailFieldInfo = [Ptr ()] type AttrLabel QueueTailFieldInfo = "tail" type AttrOrigin QueueTailFieldInfo = Queue attrGet = getQueueTail attrSet = setQueueTail attrConstruct = undefined attrClear = clearQueueTail attrTransfer _ v = do return v queue_tail :: AttrLabelProxy "tail" queue_tail = AttrLabelProxy #endif -- | Get the value of the “@length@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.get' queue #length -- @ getQueueLength :: MonadIO m => Queue -> m Word32 getQueueLength s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Word32 return val -- | Set the value of the “@length@” field. -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to -- -- @ -- 'Data.GI.Base.Attributes.set' queue [ #length 'Data.GI.Base.Attributes.:=' value ] -- @ setQueueLength :: MonadIO m => Queue -> Word32 -> m () setQueueLength s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 8) (val :: Word32) #if defined(ENABLE_OVERLOADING) data QueueLengthFieldInfo instance AttrInfo QueueLengthFieldInfo where type AttrBaseTypeConstraint QueueLengthFieldInfo = (~) Queue type AttrAllowedOps QueueLengthFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint QueueLengthFieldInfo = (~) Word32 type AttrTransferTypeConstraint QueueLengthFieldInfo = (~)Word32 type AttrTransferType QueueLengthFieldInfo = Word32 type AttrGetType QueueLengthFieldInfo = Word32 type AttrLabel QueueLengthFieldInfo = "length" type AttrOrigin QueueLengthFieldInfo = Queue attrGet = getQueueLength attrSet = setQueueLength attrConstruct = undefined attrClear = undefined attrTransfer _ v = do return v queue_length :: AttrLabelProxy "length" queue_length = AttrLabelProxy #endif #if defined(ENABLE_OVERLOADING) instance O.HasAttributeList Queue type instance O.AttributeList Queue = QueueAttributeList type QueueAttributeList = ('[ '("head", QueueHeadFieldInfo), '("tail", QueueTailFieldInfo), '("length", QueueLengthFieldInfo)] :: [(Symbol, *)]) #endif -- method Queue::clear -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_clear" g_queue_clear :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO () -- | Removes all the elements in /@queue@/. If queue elements contain -- dynamically-allocated memory, they should be freed first. -- -- /Since: 2.14/ queueClear :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m () queueClear queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_clear queue' touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueClearMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo QueueClearMethodInfo Queue signature where overloadedMethod = queueClear #endif -- method Queue::clear_full -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a pointer to a #GQueue" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "free_func" -- , argType = -- TInterface Name { namespace = "GLib" , name = "DestroyNotify" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "the function to be called to free memory allocated" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_clear_full" g_queue_clear_full :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) FunPtr GLib.Callbacks.C_DestroyNotify -> -- free_func : TInterface (Name {namespace = "GLib", name = "DestroyNotify"}) IO () -- | Convenience method, which frees all the memory used by a t'GI.GLib.Structs.Queue.Queue', -- and calls the provided /@freeFunc@/ on each item in the t'GI.GLib.Structs.Queue.Queue'. -- -- /Since: 2.60/ queueClearFull :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a pointer to a t'GI.GLib.Structs.Queue.Queue' -> Maybe (GLib.Callbacks.DestroyNotify) -- ^ /@freeFunc@/: the function to be called to free memory allocated -> m () queueClearFull queue freeFunc = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue maybeFreeFunc <- case freeFunc of Nothing -> return (castPtrToFunPtr nullPtr) Just jFreeFunc -> do ptrfreeFunc <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify)) jFreeFunc' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrfreeFunc) jFreeFunc) poke ptrfreeFunc jFreeFunc' return jFreeFunc' g_queue_clear_full queue' maybeFreeFunc touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueClearFullMethodInfo instance (signature ~ (Maybe (GLib.Callbacks.DestroyNotify) -> m ()), MonadIO m) => O.MethodInfo QueueClearFullMethodInfo Queue signature where overloadedMethod = queueClearFull #endif -- method Queue::free -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_free" g_queue_free :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO () -- | Frees the memory allocated for the t'GI.GLib.Structs.Queue.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 'GI.GLib.Structs.Queue.queueFreeFull' or free them manually first. queueFree :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m () queueFree queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_free queue' touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo QueueFreeMethodInfo Queue signature where overloadedMethod = queueFree #endif -- method Queue::free_full -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a pointer to a #GQueue" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "free_func" -- , argType = -- TInterface Name { namespace = "GLib" , name = "DestroyNotify" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "the function to be called to free each element's data" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_free_full" g_queue_free_full :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) FunPtr GLib.Callbacks.C_DestroyNotify -> -- free_func : TInterface (Name {namespace = "GLib", name = "DestroyNotify"}) IO () -- | Convenience method, which frees all the memory used by a t'GI.GLib.Structs.Queue.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/ queueFreeFull :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a pointer to a t'GI.GLib.Structs.Queue.Queue' -> GLib.Callbacks.DestroyNotify -- ^ /@freeFunc@/: the function to be called to free each element\'s data -> m () queueFreeFull queue freeFunc = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue ptrfreeFunc <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify)) freeFunc' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrfreeFunc) freeFunc) poke ptrfreeFunc freeFunc' g_queue_free_full queue' freeFunc' touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueFreeFullMethodInfo instance (signature ~ (GLib.Callbacks.DestroyNotify -> m ()), MonadIO m) => O.MethodInfo QueueFreeFullMethodInfo Queue signature where overloadedMethod = queueFreeFull #endif -- method Queue::get_length -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_queue_get_length" g_queue_get_length :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO Word32 -- | Returns the number of items in /@queue@/. -- -- /Since: 2.4/ queueGetLength :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m Word32 -- ^ __Returns:__ the number of items in /@queue@/ queueGetLength queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_get_length queue' touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueueGetLengthMethodInfo instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueueGetLengthMethodInfo Queue signature where overloadedMethod = queueGetLength #endif -- method Queue::index -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data to find" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_queue_index" g_queue_index :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr IO Int32 -- | Returns the position of the first element in /@queue@/ which contains /@data@/. -- -- /Since: 2.4/ queueIndex :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.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@/ queueIndex queue data_ = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_index queue' data_ touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueueIndexMethodInfo instance (signature ~ (Ptr () -> m Int32), MonadIO m) => O.MethodInfo QueueIndexMethodInfo Queue signature where overloadedMethod = queueIndex #endif -- method Queue::init -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an uninitialized #GQueue" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_init" g_queue_init :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO () -- | A statically-allocated t'GI.GLib.Structs.Queue.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/ queueInit :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: an uninitialized t'GI.GLib.Structs.Queue.Queue' -> m () queueInit queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_init queue' touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueInitMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo QueueInitMethodInfo Queue signature where overloadedMethod = queueInit #endif -- method Queue::is_empty -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_queue_is_empty" g_queue_is_empty :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO CInt -- | Returns 'P.True' if the queue is empty. queueIsEmpty :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue'. -> m Bool -- ^ __Returns:__ 'P.True' if the queue is empty queueIsEmpty queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_is_empty queue' let result' = (/= 0) result touchManagedPtr queue return result' #if defined(ENABLE_OVERLOADING) data QueueIsEmptyMethodInfo instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo QueueIsEmptyMethodInfo Queue signature where overloadedMethod = queueIsEmpty #endif -- method Queue::peek_head -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_peek_head" g_queue_peek_head :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO (Ptr ()) -- | Returns the first element of the queue. queuePeekHead :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m (Ptr ()) -- ^ __Returns:__ the data of the first element in the queue, or 'P.Nothing' -- if the queue is empty queuePeekHead queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_peek_head queue' touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePeekHeadMethodInfo instance (signature ~ (m (Ptr ())), MonadIO m) => O.MethodInfo QueuePeekHeadMethodInfo Queue signature where overloadedMethod = queuePeekHead #endif -- method Queue::peek_nth -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the position of the element" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_peek_nth" g_queue_peek_nth :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Word32 -> -- n : TBasicType TUInt IO (Ptr ()) -- | Returns the /@n@/\'th element of /@queue@/. -- -- /Since: 2.4/ queuePeekNth :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> Word32 -- ^ /@n@/: the position of the element -> m (Ptr ()) -- ^ __Returns:__ the data for the /@n@/\'th element of /@queue@/, -- or 'P.Nothing' if /@n@/ is off the end of /@queue@/ queuePeekNth queue n = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_peek_nth queue' n touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePeekNthMethodInfo instance (signature ~ (Word32 -> m (Ptr ())), MonadIO m) => O.MethodInfo QueuePeekNthMethodInfo Queue signature where overloadedMethod = queuePeekNth #endif -- method Queue::peek_tail -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_peek_tail" g_queue_peek_tail :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO (Ptr ()) -- | Returns the last element of the queue. queuePeekTail :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m (Ptr ()) -- ^ __Returns:__ the data of the last element in the queue, or 'P.Nothing' -- if the queue is empty queuePeekTail queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_peek_tail queue' touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePeekTailMethodInfo instance (signature ~ (m (Ptr ())), MonadIO m) => O.MethodInfo QueuePeekTailMethodInfo Queue signature where overloadedMethod = queuePeekTail #endif -- method Queue::pop_head -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_pop_head" g_queue_pop_head :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO (Ptr ()) -- | Removes the first element of the queue and returns its data. queuePopHead :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m (Ptr ()) -- ^ __Returns:__ the data of the first element in the queue, or 'P.Nothing' -- if the queue is empty queuePopHead queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_pop_head queue' touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePopHeadMethodInfo instance (signature ~ (m (Ptr ())), MonadIO m) => O.MethodInfo QueuePopHeadMethodInfo Queue signature where overloadedMethod = queuePopHead #endif -- method Queue::pop_nth -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the position of the element" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_pop_nth" g_queue_pop_nth :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Word32 -> -- n : TBasicType TUInt IO (Ptr ()) -- | Removes the /@n@/\'th element of /@queue@/ and returns its data. -- -- /Since: 2.4/ queuePopNth :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> Word32 -- ^ /@n@/: the position of the element -> m (Ptr ()) -- ^ __Returns:__ the element\'s data, or 'P.Nothing' if /@n@/ is off the end of /@queue@/ queuePopNth queue n = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_pop_nth queue' n touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePopNthMethodInfo instance (signature ~ (Word32 -> m (Ptr ())), MonadIO m) => O.MethodInfo QueuePopNthMethodInfo Queue signature where overloadedMethod = queuePopNth #endif -- method Queue::pop_tail -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_queue_pop_tail" g_queue_pop_tail :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO (Ptr ()) -- | Removes the last element of the queue and returns its data. queuePopTail :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m (Ptr ()) -- ^ __Returns:__ the data of the last element in the queue, or 'P.Nothing' -- if the queue is empty queuePopTail queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_pop_tail queue' touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueuePopTailMethodInfo instance (signature ~ (m (Ptr ())), MonadIO m) => O.MethodInfo QueuePopTailMethodInfo Queue signature where overloadedMethod = queuePopTail #endif -- method Queue::push_head -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data for the new element." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_push_head" g_queue_push_head :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr IO () -- | Adds a new element at the head of the queue. queuePushHead :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue'. -> Ptr () -- ^ /@data@/: the data for the new element. -> m () queuePushHead queue data_ = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_push_head queue' data_ touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueuePushHeadMethodInfo instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.MethodInfo QueuePushHeadMethodInfo Queue signature where overloadedMethod = queuePushHead #endif -- method Queue::push_nth -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data for the new element" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the position to insert the new element. If @n is negative or\n larger than the number of elements in the @queue, the element is\n added to the end of the queue." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_push_nth" g_queue_push_nth :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr Int32 -> -- n : TBasicType TInt IO () -- | Inserts a new element into /@queue@/ at the given position. -- -- /Since: 2.4/ queuePushNth :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.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 () queuePushNth queue data_ n = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_push_nth queue' data_ n touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueuePushNthMethodInfo instance (signature ~ (Ptr () -> Int32 -> m ()), MonadIO m) => O.MethodInfo QueuePushNthMethodInfo Queue signature where overloadedMethod = queuePushNth #endif -- method Queue::push_tail -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data for the new element" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_push_tail" g_queue_push_tail :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr IO () -- | Adds a new element at the tail of the queue. queuePushTail :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> Ptr () -- ^ /@data@/: the data for the new element -> m () queuePushTail queue data_ = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_push_tail queue' data_ touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueuePushTailMethodInfo instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.MethodInfo QueuePushTailMethodInfo Queue signature where overloadedMethod = queuePushTail #endif -- method Queue::remove -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data to remove" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_queue_remove" g_queue_remove :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr IO CInt -- | Removes the first element in /@queue@/ that contains /@data@/. -- -- /Since: 2.4/ queueRemove :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> Ptr () -- ^ /@data@/: the data to remove -> m Bool -- ^ __Returns:__ 'P.True' if /@data@/ was found and removed from /@queue@/ queueRemove queue data_ = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_remove queue' data_ let result' = (/= 0) result touchManagedPtr queue return result' #if defined(ENABLE_OVERLOADING) data QueueRemoveMethodInfo instance (signature ~ (Ptr () -> m Bool), MonadIO m) => O.MethodInfo QueueRemoveMethodInfo Queue signature where overloadedMethod = queueRemove #endif -- method Queue::remove_all -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data to remove" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_queue_remove_all" g_queue_remove_all :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) Ptr () -> -- data : TBasicType TPtr IO Word32 -- | Remove all elements whose data equals /@data@/ from /@queue@/. -- -- /Since: 2.4/ queueRemoveAll :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> Ptr () -- ^ /@data@/: the data to remove -> m Word32 -- ^ __Returns:__ the number of elements removed from /@queue@/ queueRemoveAll queue data_ = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue result <- g_queue_remove_all queue' data_ touchManagedPtr queue return result #if defined(ENABLE_OVERLOADING) data QueueRemoveAllMethodInfo instance (signature ~ (Ptr () -> m Word32), MonadIO m) => O.MethodInfo QueueRemoveAllMethodInfo Queue signature where overloadedMethod = queueRemoveAll #endif -- method Queue::reverse -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "queue" -- , argType = TInterface Name { namespace = "GLib" , name = "Queue" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GQueue" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_queue_reverse" g_queue_reverse :: Ptr Queue -> -- queue : TInterface (Name {namespace = "GLib", name = "Queue"}) IO () -- | Reverses the order of the items in /@queue@/. -- -- /Since: 2.4/ queueReverse :: (B.CallStack.HasCallStack, MonadIO m) => Queue -- ^ /@queue@/: a t'GI.GLib.Structs.Queue.Queue' -> m () queueReverse queue = liftIO $ do queue' <- unsafeManagedPtrGetPtr queue g_queue_reverse queue' touchManagedPtr queue return () #if defined(ENABLE_OVERLOADING) data QueueReverseMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo QueueReverseMethodInfo Queue signature where overloadedMethod = queueReverse #endif #if defined(ENABLE_OVERLOADING) type family ResolveQueueMethod (t :: Symbol) (o :: *) :: * where ResolveQueueMethod "clear" o = QueueClearMethodInfo ResolveQueueMethod "clearFull" o = QueueClearFullMethodInfo ResolveQueueMethod "free" o = QueueFreeMethodInfo ResolveQueueMethod "freeFull" o = QueueFreeFullMethodInfo ResolveQueueMethod "index" o = QueueIndexMethodInfo ResolveQueueMethod "init" o = QueueInitMethodInfo ResolveQueueMethod "isEmpty" o = QueueIsEmptyMethodInfo ResolveQueueMethod "peekHead" o = QueuePeekHeadMethodInfo ResolveQueueMethod "peekNth" o = QueuePeekNthMethodInfo ResolveQueueMethod "peekTail" o = QueuePeekTailMethodInfo ResolveQueueMethod "popHead" o = QueuePopHeadMethodInfo ResolveQueueMethod "popNth" o = QueuePopNthMethodInfo ResolveQueueMethod "popTail" o = QueuePopTailMethodInfo ResolveQueueMethod "pushHead" o = QueuePushHeadMethodInfo ResolveQueueMethod "pushNth" o = QueuePushNthMethodInfo ResolveQueueMethod "pushTail" o = QueuePushTailMethodInfo ResolveQueueMethod "remove" o = QueueRemoveMethodInfo ResolveQueueMethod "removeAll" o = QueueRemoveAllMethodInfo ResolveQueueMethod "reverse" o = QueueReverseMethodInfo ResolveQueueMethod "getLength" o = QueueGetLengthMethodInfo ResolveQueueMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveQueueMethod t Queue, O.MethodInfo info Queue p) => OL.IsLabel t (Queue -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod @info #else fromLabel _ = O.overloadedMethod @info #endif #endif