{-# 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
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
#else
#endif
newtype CollectionRef = CollectionRef (SP.ManagedPtr CollectionRef)
deriving (CollectionRef -> CollectionRef -> Bool
(CollectionRef -> CollectionRef -> Bool)
-> (CollectionRef -> CollectionRef -> Bool) -> Eq CollectionRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CollectionRef -> CollectionRef -> Bool
== :: CollectionRef -> CollectionRef -> Bool
$c/= :: CollectionRef -> CollectionRef -> Bool
/= :: 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 = Ptr GValue -> Ptr CollectionRef -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr CollectionRef
forall a. Ptr a
FP.nullPtr :: FP.Ptr CollectionRef)
gvalueSet_ Ptr GValue
gv (P.Just CollectionRef
obj) = CollectionRef -> (Ptr CollectionRef -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CollectionRef
obj (Ptr GValue -> Ptr CollectionRef -> IO ()
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 <- Ptr GValue -> IO (Ptr CollectionRef)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr CollectionRef)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newBoxed CollectionRef ptr
else return P.Nothing
newZeroCollectionRef :: MonadIO m => m CollectionRef
newZeroCollectionRef :: forall (m :: * -> *). MonadIO m => m CollectionRef
newZeroCollectionRef = IO CollectionRef -> m CollectionRef
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CollectionRef -> m CollectionRef)
-> IO CollectionRef -> m CollectionRef
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr CollectionRef)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
8 IO (Ptr CollectionRef)
-> (Ptr CollectionRef -> IO CollectionRef) -> IO CollectionRef
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr CollectionRef -> CollectionRef)
-> Ptr CollectionRef -> IO CollectionRef
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
o <- m CollectionRef
forall (m :: * -> *). MonadIO m => m CollectionRef
newZeroCollectionRef
GI.Attributes.set o attrs
return o
getCollectionRefCollectionId :: MonadIO m => CollectionRef -> m (Maybe T.Text)
getCollectionRefCollectionId :: forall (m :: * -> *). MonadIO m => CollectionRef -> m (Maybe Text)
getCollectionRefCollectionId CollectionRef
s = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ CollectionRef
-> (Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CString
result <- SP.convertIfNonNull val $ \CString
val' -> do
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
return val''
return result
setCollectionRefCollectionId :: MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefCollectionId :: forall (m :: * -> *). MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefCollectionId CollectionRef
s CString
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ CollectionRef -> (Ptr CollectionRef -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO ()) -> IO ())
-> (Ptr CollectionRef -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
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 = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ CollectionRef -> (Ptr CollectionRef -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO ()) -> IO ())
-> (Ptr CollectionRef -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
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.19/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 = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ CollectionRef
-> (Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr CollectionRef -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO CString
result <- SP.convertIfNonNull val $ \CString
val' -> do
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
return val''
return result
setCollectionRefRefName :: MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefRefName :: forall (m :: * -> *). MonadIO m => CollectionRef -> CString -> m ()
setCollectionRefRefName CollectionRef
s CString
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ CollectionRef -> (Ptr CollectionRef -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO ()) -> IO ())
-> (Ptr CollectionRef -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (CString
val :: CString)
clearCollectionRefRefName :: MonadIO m => CollectionRef -> m ()
clearCollectionRefRefName :: forall (m :: * -> *). MonadIO m => CollectionRef -> m ()
clearCollectionRefRefName CollectionRef
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ CollectionRef -> (Ptr CollectionRef -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr CollectionRef
s ((Ptr CollectionRef -> IO ()) -> IO ())
-> (Ptr CollectionRef -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CollectionRef
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CollectionRef
ptr Ptr CollectionRef -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (CString
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.19/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 = IO CollectionRef -> m CollectionRef
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CollectionRef -> m CollectionRef)
-> IO CollectionRef -> m CollectionRef
forall a b. (a -> b) -> a -> b
$ do
maybeCollectionId <- case Maybe Text
collectionId of
Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
FP.nullPtr
Just Text
jCollectionId -> do
jCollectionId' <- Text -> IO CString
textToCString Text
jCollectionId
return jCollectionId'
refName' <- textToCString refName
result <- ostree_collection_ref_new maybeCollectionId refName'
checkUnexpectedReturnNULL "collectionRefNew" result
result' <- (wrapBoxed CollectionRef) result
freeMem maybeCollectionId
freeMem refName'
return 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 = IO CollectionRef -> m CollectionRef
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CollectionRef -> m CollectionRef)
-> IO CollectionRef -> m CollectionRef
forall a b. (a -> b) -> a -> b
$ do
ref' <- CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref
result <- ostree_collection_ref_dup ref'
checkUnexpectedReturnNULL "collectionRefDup" result
result' <- (wrapBoxed CollectionRef) result
touchManagedPtr ref
return 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.19/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 = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
ref1' <- CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref1
ref2' <- unsafeManagedPtrGetPtr ref2
result <- ostree_collection_ref_equal ref1' ref2'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr ref1
touchManagedPtr ref2
return 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.19/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 = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
ref' <- CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed CollectionRef
ref
ostree_collection_ref_free ref'
touchManagedPtr ref
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.19/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 = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
ref' <- CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr CollectionRef
ref
result <- ostree_collection_ref_hash ref'
touchManagedPtr ref
return 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.19/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 = IO [CollectionRef] -> m [CollectionRef]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [CollectionRef] -> m [CollectionRef])
-> IO [CollectionRef] -> m [CollectionRef]
forall a b. (a -> b) -> a -> b
$ do
refs' <- (CollectionRef -> IO (Ptr CollectionRef))
-> [CollectionRef] -> IO [Ptr CollectionRef]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [CollectionRef]
refs
refs'' <- packZeroTerminatedPtrArray refs'
result <- ostree_collection_ref_dupv refs''
checkUnexpectedReturnNULL "collectionRefDupv" result
result' <- unpackZeroTerminatedPtrArray result
result'' <- mapM (wrapBoxed CollectionRef) result'
freeMem result
mapM_ touchManagedPtr refs
freeMem refs''
return 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 = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
refs' <- (CollectionRef -> IO (Ptr CollectionRef))
-> [CollectionRef] -> IO [Ptr CollectionRef]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM CollectionRef -> IO (Ptr CollectionRef)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed [CollectionRef]
refs
refs'' <- packZeroTerminatedPtrArray refs'
ostree_collection_ref_freev refs''
mapM_ touchManagedPtr refs
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