{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.OutputVector
(
OutputVector(..) ,
newZeroOutputVector ,
#if defined(ENABLE_OVERLOADING)
ResolveOutputVectorMethod ,
#endif
clearOutputVectorBuffer ,
getOutputVectorBuffer ,
#if defined(ENABLE_OVERLOADING)
outputVector_buffer ,
#endif
setOutputVectorBuffer ,
getOutputVectorSize ,
#if defined(ENABLE_OVERLOADING)
outputVector_size ,
#endif
setOutputVectorSize ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
newtype OutputVector = OutputVector (SP.ManagedPtr OutputVector)
deriving (OutputVector -> OutputVector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputVector -> OutputVector -> Bool
$c/= :: OutputVector -> OutputVector -> Bool
== :: OutputVector -> OutputVector -> Bool
$c== :: OutputVector -> OutputVector -> Bool
Eq)
instance SP.ManagedPtrNewtype OutputVector where
toManagedPtr :: OutputVector -> ManagedPtr OutputVector
toManagedPtr (OutputVector ManagedPtr OutputVector
p) = ManagedPtr OutputVector
p
instance BoxedPtr OutputVector where
boxedPtrCopy :: OutputVector -> IO OutputVector
boxedPtrCopy = \OutputVector
p -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr OutputVector
p (forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
8 forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr OutputVector -> OutputVector
OutputVector)
boxedPtrFree :: OutputVector -> IO ()
boxedPtrFree = \OutputVector
x -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr OutputVector
x forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr OutputVector where
boxedPtrCalloc :: IO (Ptr OutputVector)
boxedPtrCalloc = forall a. Int -> IO (Ptr a)
callocBytes Int
8
newZeroOutputVector :: MonadIO m => m OutputVector
newZeroOutputVector :: forall (m :: * -> *). MonadIO m => m OutputVector
newZeroOutputVector = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr OutputVector -> OutputVector
OutputVector
instance tag ~ 'AttrSet => Constructible OutputVector tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr OutputVector -> OutputVector)
-> [AttrOp OutputVector tag] -> m OutputVector
new ManagedPtr OutputVector -> OutputVector
_ [AttrOp OutputVector tag]
attrs = do
OutputVector
o <- forall (m :: * -> *). MonadIO m => m OutputVector
newZeroOutputVector
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set OutputVector
o [AttrOp OutputVector tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return OutputVector
o
getOutputVectorBuffer :: MonadIO m => OutputVector -> m (Ptr ())
getOutputVectorBuffer :: forall (m :: * -> *). MonadIO m => OutputVector -> m (Ptr ())
getOutputVectorBuffer OutputVector
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OutputVector
s forall a b. (a -> b) -> a -> b
$ \Ptr OutputVector
ptr -> do
Ptr ()
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr OutputVector
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
val
setOutputVectorBuffer :: MonadIO m => OutputVector -> Ptr () -> m ()
setOutputVectorBuffer :: forall (m :: * -> *). MonadIO m => OutputVector -> Ptr () -> m ()
setOutputVectorBuffer OutputVector
s Ptr ()
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OutputVector
s forall a b. (a -> b) -> a -> b
$ \Ptr OutputVector
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr OutputVector
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
val :: Ptr ())
clearOutputVectorBuffer :: MonadIO m => OutputVector -> m ()
clearOutputVectorBuffer :: forall (m :: * -> *). MonadIO m => OutputVector -> m ()
clearOutputVectorBuffer OutputVector
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OutputVector
s forall a b. (a -> b) -> a -> b
$ \Ptr OutputVector
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr OutputVector
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (forall a. Ptr a
FP.nullPtr :: Ptr ())
#if defined(ENABLE_OVERLOADING)
data OutputVectorBufferFieldInfo
instance AttrInfo OutputVectorBufferFieldInfo where
type AttrBaseTypeConstraint OutputVectorBufferFieldInfo = (~) OutputVector
type AttrAllowedOps OutputVectorBufferFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint OutputVectorBufferFieldInfo = (~) (Ptr ())
type AttrTransferTypeConstraint OutputVectorBufferFieldInfo = (~)(Ptr ())
type AttrTransferType OutputVectorBufferFieldInfo = (Ptr ())
type AttrGetType OutputVectorBufferFieldInfo = Ptr ()
type AttrLabel OutputVectorBufferFieldInfo = "buffer"
type AttrOrigin OutputVectorBufferFieldInfo = OutputVector
attrGet = getOutputVectorBuffer
attrSet = setOutputVectorBuffer
attrConstruct = undefined
attrClear = clearOutputVectorBuffer
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.OutputVector.buffer"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Structs-OutputVector.html#g:attr:buffer"
})
outputVector_buffer :: AttrLabelProxy "buffer"
outputVector_buffer = AttrLabelProxy
#endif
getOutputVectorSize :: MonadIO m => OutputVector -> m Word32
getOutputVectorSize :: forall (m :: * -> *). MonadIO m => OutputVector -> m Word32
getOutputVectorSize OutputVector
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OutputVector
s forall a b. (a -> b) -> a -> b
$ \Ptr OutputVector
ptr -> do
Word32
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr OutputVector
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setOutputVectorSize :: MonadIO m => OutputVector -> Word32 -> m ()
setOutputVectorSize :: forall (m :: * -> *). MonadIO m => OutputVector -> Word32 -> m ()
setOutputVectorSize OutputVector
s Word32
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OutputVector
s forall a b. (a -> b) -> a -> b
$ \Ptr OutputVector
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr OutputVector
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data OutputVectorSizeFieldInfo
instance AttrInfo OutputVectorSizeFieldInfo where
type AttrBaseTypeConstraint OutputVectorSizeFieldInfo = (~) OutputVector
type AttrAllowedOps OutputVectorSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint OutputVectorSizeFieldInfo = (~) Word32
type AttrTransferTypeConstraint OutputVectorSizeFieldInfo = (~)Word32
type AttrTransferType OutputVectorSizeFieldInfo = Word32
type AttrGetType OutputVectorSizeFieldInfo = Word32
type AttrLabel OutputVectorSizeFieldInfo = "size"
type AttrOrigin OutputVectorSizeFieldInfo = OutputVector
attrGet = getOutputVectorSize
attrSet = setOutputVectorSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.OutputVector.size"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Structs-OutputVector.html#g:attr:size"
})
outputVector_size :: AttrLabelProxy "size"
outputVector_size = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList OutputVector
type instance O.AttributeList OutputVector = OutputVectorAttributeList
type OutputVectorAttributeList = ('[ '("buffer", OutputVectorBufferFieldInfo), '("size", OutputVectorSizeFieldInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveOutputVectorMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveOutputVectorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveOutputVectorMethod t OutputVector, O.OverloadedMethod info OutputVector p) => OL.IsLabel t (OutputVector -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveOutputVectorMethod t OutputVector, O.OverloadedMethod info OutputVector p, R.HasField t OutputVector p) => R.HasField t OutputVector p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveOutputVectorMethod t OutputVector, O.OverloadedMethodInfo info OutputVector) => OL.IsLabel t (O.MethodProxy info OutputVector) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif