{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.OSTree.Structs.CollectionRef
(
CollectionRef(..) ,
newZeroCollectionRef ,
#if defined(ENABLE_OVERLOADING)
ResolveCollectionRefMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
CollectionRefDupMethodInfo ,
#endif
collectionRefDup ,
collectionRefDupv ,
#if defined(ENABLE_OVERLOADING)
CollectionRefEqualMethodInfo ,
#endif
collectionRefEqual ,
#if defined(ENABLE_OVERLOADING)
CollectionRefFreeMethodInfo ,
#endif
collectionRefFree ,
collectionRefFreev ,
#if defined(ENABLE_OVERLOADING)
CollectionRefHashMethodInfo ,
#endif
collectionRefHash ,
collectionRefNew ,
clearCollectionRefCollectionId ,
#if defined(ENABLE_OVERLOADING)
collectionRef_collectionId ,
#endif
getCollectionRefCollectionId ,
setCollectionRefCollectionId ,
clearCollectionRefRefName ,
#if defined(ENABLE_OVERLOADING)
collectionRef_refName ,
#endif
getCollectionRefRefName ,
setCollectionRefRefName ,
) 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 CollectionRef = CollectionRef (SP.ManagedPtr CollectionRef)
deriving (CollectionRef -> CollectionRef -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CollectionRef -> CollectionRef -> Bool
$c/= :: CollectionRef -> CollectionRef -> Bool
== :: CollectionRef -> CollectionRef -> Bool
$c== :: CollectionRef -> CollectionRef -> Bool
Eq)
instance SP.ManagedPtrNewtype CollectionRef where
toManagedPtr :: CollectionRef -> ManagedPtr CollectionRef
toManagedPtr (CollectionRef ManagedPtr CollectionRef
p) = ManagedPtr CollectionRef
p
foreign import ccall "ostree_collection_ref_get_type" c_ostree_collection_ref_get_type ::
IO GType
type instance O.ParentTypes CollectionRef = '[]
instance O.HasParentTypes CollectionRef
instance B.Types.TypedObject CollectionRef where
glibType :: IO GType
glibType = IO GType
c_ostree_collection_ref_get_type
instance B.Types.GBoxed CollectionRef
instance B.GValue.IsGValue (Maybe CollectionRef) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ostree_collection_ref_get_type
gvalueSet_ :: Ptr GValue -> Maybe CollectionRef -> IO ()
gvalueSet_ Ptr GValue
gv Maybe CollectionRef
P.Nothing = forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr CollectionRef)
gvalueSet_ Ptr GValue
gv (P.Just CollectionRef
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CollectionRef
obj (forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe CollectionRef)
gvalueGet_ Ptr GValue
gv = do
Ptr CollectionRef
ptr <- forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr CollectionRef)
if Ptr CollectionRef
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr CollectionRef -> CollectionRef
CollectionRef Ptr CollectionRef
ptr
else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
newZeroCollectionRef :: MonadIO m => m CollectionRef
newZeroCollectionRef :: forall (m :: * -> *). MonadIO m => m CollectionRef
newZeroCollectionRef = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
16 forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr CollectionRef -> CollectionRef
CollectionRef
instance tag ~ 'AttrSet => Constructible CollectionRef tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr CollectionRef -> CollectionRef)
-> [AttrOp CollectionRef tag] -> m CollectionRef
new ManagedPtr CollectionRef -> CollectionRef
_ [AttrOp CollectionRef tag]
attrs = do
CollectionRef
o <- forall (m :: * -> *). MonadIO m => m CollectionRef
newZeroCollectionRef
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set CollectionRef
o [AttrOp CollectionRef tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return CollectionRef
o
getCollectionRefCollectionId :: MonadIO m => CollectionRef -> m (Maybe T.Text)
getCollectionRefCollectionId :: forall (m :: * -> *). MonadIO m => CollectionRef -> m (Maybe Text)
getCollectionRefCollectionId CollectionRef
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
CString
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CString
Maybe Text
result <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
cstringToText CString
val'
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setCollectionRefCollectionId :: MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefCollectionId :: forall (m :: * -> *). MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefCollectionId CollectionRef
s CString
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
val :: CString)
clearCollectionRefCollectionId :: MonadIO m => CollectionRef -> m ()
clearCollectionRefCollectionId :: forall (m :: * -> *). MonadIO m => CollectionRef -> m ()
clearCollectionRefCollectionId CollectionRef
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data CollectionRefCollectionIdFieldInfo
instance AttrInfo CollectionRefCollectionIdFieldInfo where
type AttrBaseTypeConstraint CollectionRefCollectionIdFieldInfo = (~) CollectionRef
type AttrAllowedOps CollectionRefCollectionIdFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CollectionRefCollectionIdFieldInfo = (~) CString
type AttrTransferTypeConstraint CollectionRefCollectionIdFieldInfo = (~)CString
type AttrTransferType CollectionRefCollectionIdFieldInfo = CString
type AttrGetType CollectionRefCollectionIdFieldInfo = Maybe T.Text
type AttrLabel CollectionRefCollectionIdFieldInfo = "collection_id"
type AttrOrigin CollectionRefCollectionIdFieldInfo = CollectionRef
attrGet = getCollectionRefCollectionId
attrSet = setCollectionRefCollectionId
attrConstruct = undefined
attrClear = clearCollectionRefCollectionId
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.collectionId"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#g:attr:collectionId"
})
collectionRef_collectionId :: AttrLabelProxy "collectionId"
collectionRef_collectionId = AttrLabelProxy
#endif
getCollectionRefRefName :: MonadIO m => CollectionRef -> m (Maybe T.Text)
getCollectionRefRefName :: forall (m :: * -> *). MonadIO m => CollectionRef -> m (Maybe Text)
getCollectionRefRefName CollectionRef
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
CString
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CString
Maybe Text
result <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
cstringToText CString
val'
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setCollectionRefRefName :: MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefRefName :: forall (m :: * -> *). MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefRefName CollectionRef
s CString
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
val :: CString)
clearCollectionRefRefName :: MonadIO m => CollectionRef -> m ()
clearCollectionRefRefName :: forall (m :: * -> *). MonadIO m => CollectionRef -> m ()
clearCollectionRefRefName CollectionRef
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 CollectionRef
s forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data CollectionRefRefNameFieldInfo
instance AttrInfo CollectionRefRefNameFieldInfo where
type AttrBaseTypeConstraint CollectionRefRefNameFieldInfo = (~) CollectionRef
type AttrAllowedOps CollectionRefRefNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint CollectionRefRefNameFieldInfo = (~) CString
type AttrTransferTypeConstraint CollectionRefRefNameFieldInfo = (~)CString
type AttrTransferType CollectionRefRefNameFieldInfo = CString
type AttrGetType CollectionRefRefNameFieldInfo = Maybe T.Text
type AttrLabel CollectionRefRefNameFieldInfo = "ref_name"
type AttrOrigin CollectionRefRefNameFieldInfo = CollectionRef
attrGet = getCollectionRefRefName
attrSet = setCollectionRefRefName
attrConstruct = undefined
attrClear = clearCollectionRefRefName
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.refName"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#g:attr:refName"
})
collectionRef_refName :: AttrLabelProxy "refName"
collectionRef_refName = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CollectionRef
type instance O.AttributeList CollectionRef = CollectionRefAttributeList
type CollectionRefAttributeList = ('[ '("collectionId", CollectionRefCollectionIdFieldInfo), '("refName", CollectionRefRefNameFieldInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "ostree_collection_ref_new" ostree_collection_ref_new ::
CString ->
CString ->
IO (Ptr CollectionRef)
collectionRefNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> T.Text
-> m CollectionRef
collectionRefNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> Text -> m CollectionRef
collectionRefNew Maybe Text
collectionId Text
refName = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
CString
maybeCollectionId <- case Maybe Text
collectionId of
Maybe Text
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just Text
jCollectionId -> do
CString
jCollectionId' <- Text -> IO CString
textToCString Text
jCollectionId
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jCollectionId'
CString
refName' <- Text -> IO CString
textToCString Text
refName
Ptr CollectionRef
result <- CString -> CString -> IO (Ptr CollectionRef)
ostree_collection_ref_new CString
maybeCollectionId CString
refName'
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"collectionRefNew" Ptr CollectionRef
result
CollectionRef
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr CollectionRef -> CollectionRef
CollectionRef) Ptr CollectionRef
result
forall a. Ptr a -> IO ()
freeMem CString
maybeCollectionId
forall a. Ptr a -> IO ()
freeMem CString
refName'
forall (m :: * -> *) a. Monad m => a -> m a
return CollectionRef
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ostree_collection_ref_dup" ostree_collection_ref_dup ::
Ptr CollectionRef ->
IO (Ptr CollectionRef)
collectionRefDup ::
(B.CallStack.HasCallStack, MonadIO m) =>
CollectionRef
-> m CollectionRef
collectionRefDup :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
CollectionRef -> m CollectionRef
collectionRefDup CollectionRef
ref = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr CollectionRef
ref' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref
Ptr CollectionRef
result <- Ptr CollectionRef -> IO (Ptr CollectionRef)
ostree_collection_ref_dup Ptr CollectionRef
ref'
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"collectionRefDup" Ptr CollectionRef
result
CollectionRef
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr CollectionRef -> CollectionRef
CollectionRef) Ptr CollectionRef
result
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectionRef
ref
forall (m :: * -> *) a. Monad m => a -> m a
return CollectionRef
result'
#if defined(ENABLE_OVERLOADING)
data CollectionRefDupMethodInfo
instance (signature ~ (m CollectionRef), MonadIO m) => O.OverloadedMethod CollectionRefDupMethodInfo CollectionRef signature where
overloadedMethod = collectionRefDup
instance O.OverloadedMethodInfo CollectionRefDupMethodInfo CollectionRef where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.collectionRefDup",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#v:collectionRefDup"
})
#endif
foreign import ccall "ostree_collection_ref_equal" ostree_collection_ref_equal ::
Ptr CollectionRef ->
Ptr CollectionRef ->
IO CInt
collectionRefEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
CollectionRef
-> CollectionRef
-> m Bool
collectionRefEqual :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
CollectionRef -> CollectionRef -> m Bool
collectionRefEqual CollectionRef
ref1 CollectionRef
ref2 = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr CollectionRef
ref1' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref1
Ptr CollectionRef
ref2' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref2
CInt
result <- Ptr CollectionRef -> Ptr CollectionRef -> IO CInt
ostree_collection_ref_equal Ptr CollectionRef
ref1' Ptr CollectionRef
ref2'
let result' :: Bool
result' = (forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectionRef
ref1
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectionRef
ref2
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data CollectionRefEqualMethodInfo
instance (signature ~ (CollectionRef -> m Bool), MonadIO m) => O.OverloadedMethod CollectionRefEqualMethodInfo CollectionRef signature where
overloadedMethod = collectionRefEqual
instance O.OverloadedMethodInfo CollectionRefEqualMethodInfo CollectionRef where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.collectionRefEqual",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#v:collectionRefEqual"
})
#endif
foreign import ccall "ostree_collection_ref_free" ostree_collection_ref_free ::
Ptr CollectionRef ->
IO ()
collectionRefFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
CollectionRef
-> m ()
collectionRefFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
CollectionRef -> m ()
collectionRefFree CollectionRef
ref = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr CollectionRef
ref' <- forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed CollectionRef
ref
Ptr CollectionRef -> IO ()
ostree_collection_ref_free Ptr CollectionRef
ref'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectionRef
ref
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CollectionRefFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod CollectionRefFreeMethodInfo CollectionRef signature where
overloadedMethod = collectionRefFree
instance O.OverloadedMethodInfo CollectionRefFreeMethodInfo CollectionRef where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.collectionRefFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#v:collectionRefFree"
})
#endif
foreign import ccall "ostree_collection_ref_hash" ostree_collection_ref_hash ::
Ptr CollectionRef ->
IO Word32
collectionRefHash ::
(B.CallStack.HasCallStack, MonadIO m) =>
CollectionRef
-> m Word32
collectionRefHash :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
CollectionRef -> m Word32
collectionRefHash CollectionRef
ref = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr CollectionRef
ref' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref
Word32
result <- Ptr CollectionRef -> IO Word32
ostree_collection_ref_hash Ptr CollectionRef
ref'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr CollectionRef
ref
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data CollectionRefHashMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.OverloadedMethod CollectionRefHashMethodInfo CollectionRef signature where
overloadedMethod = collectionRefHash
instance O.OverloadedMethodInfo CollectionRefHashMethodInfo CollectionRef where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.CollectionRef.collectionRefHash",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-CollectionRef.html#v:collectionRefHash"
})
#endif
foreign import ccall "ostree_collection_ref_dupv" ostree_collection_ref_dupv ::
Ptr (Ptr CollectionRef) ->
IO (Ptr (Ptr CollectionRef))
collectionRefDupv ::
(B.CallStack.HasCallStack, MonadIO m) =>
[CollectionRef]
-> m [CollectionRef]
collectionRefDupv :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[CollectionRef] -> m [CollectionRef]
collectionRefDupv [CollectionRef]
refs = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
[Ptr CollectionRef]
refs' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [CollectionRef]
refs
Ptr (Ptr CollectionRef)
refs'' <- forall a. [Ptr a] -> IO (Ptr (Ptr a))
packZeroTerminatedPtrArray [Ptr CollectionRef]
refs'
Ptr (Ptr CollectionRef)
result <- Ptr (Ptr CollectionRef) -> IO (Ptr (Ptr CollectionRef))
ostree_collection_ref_dupv Ptr (Ptr CollectionRef)
refs''
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"collectionRefDupv" Ptr (Ptr CollectionRef)
result
[Ptr CollectionRef]
result' <- forall a. Ptr (Ptr a) -> IO [Ptr a]
unpackZeroTerminatedPtrArray Ptr (Ptr CollectionRef)
result
[CollectionRef]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr CollectionRef -> CollectionRef
CollectionRef) [Ptr CollectionRef]
result'
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CollectionRef)
result
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [CollectionRef]
refs
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CollectionRef)
refs''
forall (m :: * -> *) a. Monad m => a -> m a
return [CollectionRef]
result''
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ostree_collection_ref_freev" ostree_collection_ref_freev ::
Ptr (Ptr CollectionRef) ->
IO ()
collectionRefFreev ::
(B.CallStack.HasCallStack, MonadIO m) =>
[CollectionRef]
-> m ()
collectionRefFreev :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[CollectionRef] -> m ()
collectionRefFreev [CollectionRef]
refs = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
[Ptr CollectionRef]
refs' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed [CollectionRef]
refs
Ptr (Ptr CollectionRef)
refs'' <- forall a. [Ptr a] -> IO (Ptr (Ptr a))
packZeroTerminatedPtrArray [Ptr CollectionRef]
refs'
Ptr (Ptr CollectionRef) -> IO ()
ostree_collection_ref_freev Ptr (Ptr CollectionRef)
refs''
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [CollectionRef]
refs
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveCollectionRefMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveCollectionRefMethod "dup" o = CollectionRefDupMethodInfo
ResolveCollectionRefMethod "equal" o = CollectionRefEqualMethodInfo
ResolveCollectionRefMethod "free" o = CollectionRefFreeMethodInfo
ResolveCollectionRefMethod "hash" o = CollectionRefHashMethodInfo
ResolveCollectionRefMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCollectionRefMethod t CollectionRef, O.OverloadedMethod info CollectionRef p) => OL.IsLabel t (CollectionRef -> 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 ~ ResolveCollectionRefMethod t CollectionRef, O.OverloadedMethod info CollectionRef p, R.HasField t CollectionRef p) => R.HasField t CollectionRef p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveCollectionRefMethod t CollectionRef, O.OverloadedMethodInfo info CollectionRef) => OL.IsLabel t (O.MethodProxy info CollectionRef) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif