gi-glib-0.2.46.13: GI/GLib/Structs/TrashStack.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)
Each piece of memory that is pushed onto the stack
is cast to a GTrashStack*.
-}
module GI.GLib.Structs.TrashStack
(
-- * Exported types
TrashStack(..) ,
newZeroTrashStack ,
noTrashStack ,
-- * Methods
-- ** trashStackHeight
trashStackHeight ,
-- ** trashStackPush
trashStackPush ,
-- * Properties
-- ** Next
trashStackReadNext ,
) 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 TrashStack = TrashStack (ForeignPtr TrashStack)
-- | Construct a `TrashStack` struct initialized to zero.
newZeroTrashStack :: MonadIO m => m TrashStack
newZeroTrashStack = liftIO $ callocBytes 8 >>= wrapPtr TrashStack
noTrashStack :: Maybe TrashStack
noTrashStack = Nothing
trashStackReadNext :: TrashStack -> IO TrashStack
trashStackReadNext s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr TrashStack)
val' <- (newPtr 8 TrashStack) val
return val'
-- method TrashStack::height
-- method type : MemberFunction
-- Args : [Arg {argCName = "stack_p", argType = TInterface "GLib" "TrashStack", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_trash_stack_height" g_trash_stack_height ::
Ptr TrashStack -> -- stack_p : TInterface "GLib" "TrashStack"
IO Word32
trashStackHeight ::
(MonadIO m) =>
TrashStack -- stackP
-> m Word32 -- result
trashStackHeight stackP = liftIO $ do
let stackP' = unsafeManagedPtrGetPtr stackP
result <- g_trash_stack_height stackP'
touchManagedPtr stackP
return result
-- method TrashStack::push
-- method type : MemberFunction
-- Args : [Arg {argCName = "stack_p", argType = TInterface "GLib" "TrashStack", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data_p", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_trash_stack_push" g_trash_stack_push ::
Ptr TrashStack -> -- stack_p : TInterface "GLib" "TrashStack"
Ptr () -> -- data_p : TBasicType TVoid
IO ()
trashStackPush ::
(MonadIO m) =>
TrashStack -- stackP
-> Ptr () -- dataP
-> m () -- result
trashStackPush stackP dataP = liftIO $ do
let stackP' = unsafeManagedPtrGetPtr stackP
g_trash_stack_push stackP' dataP
touchManagedPtr stackP
return ()
type family ResolveTrashStackMethod (t :: Symbol) (o :: *) :: * where
ResolveTrashStackMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveTrashStackMethod t TrashStack, MethodInfo info TrashStack p) => IsLabelProxy t (TrashStack -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTrashStackMethod t TrashStack, MethodInfo info TrashStack p) => IsLabel t (TrashStack -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif