{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.OSTree.Structs.RepoPruneOptions
(
RepoPruneOptions(..) ,
newZeroRepoPruneOptions ,
#if defined(ENABLE_OVERLOADING)
ResolveRepoPruneOptionsMethod ,
#endif
getRepoPruneOptionsFlags ,
#if defined(ENABLE_OVERLOADING)
repoPruneOptions_flags ,
#endif
setRepoPruneOptionsFlags ,
clearRepoPruneOptionsReachable ,
getRepoPruneOptionsReachable ,
#if defined(ENABLE_OVERLOADING)
repoPruneOptions_reachable ,
#endif
setRepoPruneOptionsReachable ,
) 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.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 {-# SOURCE #-} qualified GI.OSTree.Flags as OSTree.Flags
newtype RepoPruneOptions = RepoPruneOptions (SP.ManagedPtr RepoPruneOptions)
deriving (RepoPruneOptions -> RepoPruneOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepoPruneOptions -> RepoPruneOptions -> Bool
$c/= :: RepoPruneOptions -> RepoPruneOptions -> Bool
== :: RepoPruneOptions -> RepoPruneOptions -> Bool
$c== :: RepoPruneOptions -> RepoPruneOptions -> Bool
Eq)
instance SP.ManagedPtrNewtype RepoPruneOptions where
toManagedPtr :: RepoPruneOptions -> ManagedPtr RepoPruneOptions
toManagedPtr (RepoPruneOptions ManagedPtr RepoPruneOptions
p) = ManagedPtr RepoPruneOptions
p
instance BoxedPtr RepoPruneOptions where
boxedPtrCopy :: RepoPruneOptions -> IO RepoPruneOptions
boxedPtrCopy = \RepoPruneOptions
p -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RepoPruneOptions
p (forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
84 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 RepoPruneOptions -> RepoPruneOptions
RepoPruneOptions)
boxedPtrFree :: RepoPruneOptions -> IO ()
boxedPtrFree = \RepoPruneOptions
x -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr RepoPruneOptions
x forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr RepoPruneOptions where
boxedPtrCalloc :: IO (Ptr RepoPruneOptions)
boxedPtrCalloc = forall a. Int -> IO (Ptr a)
callocBytes Int
84
newZeroRepoPruneOptions :: MonadIO m => m RepoPruneOptions
newZeroRepoPruneOptions :: forall (m :: * -> *). MonadIO m => m RepoPruneOptions
newZeroRepoPruneOptions = 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 RepoPruneOptions -> RepoPruneOptions
RepoPruneOptions
instance tag ~ 'AttrSet => Constructible RepoPruneOptions tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr RepoPruneOptions -> RepoPruneOptions)
-> [AttrOp RepoPruneOptions tag] -> m RepoPruneOptions
new ManagedPtr RepoPruneOptions -> RepoPruneOptions
_ [AttrOp RepoPruneOptions tag]
attrs = do
RepoPruneOptions
o <- forall (m :: * -> *). MonadIO m => m RepoPruneOptions
newZeroRepoPruneOptions
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set RepoPruneOptions
o [AttrOp RepoPruneOptions tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return RepoPruneOptions
o
getRepoPruneOptionsFlags :: MonadIO m => RepoPruneOptions -> m [OSTree.Flags.RepoPruneFlags]
getRepoPruneOptionsFlags :: forall (m :: * -> *).
MonadIO m =>
RepoPruneOptions -> m [RepoPruneFlags]
getRepoPruneOptionsFlags RepoPruneOptions
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 RepoPruneOptions
s forall a b. (a -> b) -> a -> b
$ \Ptr RepoPruneOptions
ptr -> do
CUInt
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr RepoPruneOptions
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CUInt
let val' :: [RepoPruneFlags]
val' = forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
val
forall (m :: * -> *) a. Monad m => a -> m a
return [RepoPruneFlags]
val'
setRepoPruneOptionsFlags :: MonadIO m => RepoPruneOptions -> [OSTree.Flags.RepoPruneFlags] -> m ()
setRepoPruneOptionsFlags :: forall (m :: * -> *).
MonadIO m =>
RepoPruneOptions -> [RepoPruneFlags] -> m ()
setRepoPruneOptionsFlags RepoPruneOptions
s [RepoPruneFlags]
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 RepoPruneOptions
s forall a b. (a -> b) -> a -> b
$ \Ptr RepoPruneOptions
ptr -> do
let val' :: CUInt
val' = forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [RepoPruneFlags]
val
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RepoPruneOptions
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CUInt
val' :: CUInt)
#if defined(ENABLE_OVERLOADING)
data RepoPruneOptionsFlagsFieldInfo
instance AttrInfo RepoPruneOptionsFlagsFieldInfo where
type AttrBaseTypeConstraint RepoPruneOptionsFlagsFieldInfo = (~) RepoPruneOptions
type AttrAllowedOps RepoPruneOptionsFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RepoPruneOptionsFlagsFieldInfo = (~) [OSTree.Flags.RepoPruneFlags]
type AttrTransferTypeConstraint RepoPruneOptionsFlagsFieldInfo = (~)[OSTree.Flags.RepoPruneFlags]
type AttrTransferType RepoPruneOptionsFlagsFieldInfo = [OSTree.Flags.RepoPruneFlags]
type AttrGetType RepoPruneOptionsFlagsFieldInfo = [OSTree.Flags.RepoPruneFlags]
type AttrLabel RepoPruneOptionsFlagsFieldInfo = "flags"
type AttrOrigin RepoPruneOptionsFlagsFieldInfo = RepoPruneOptions
attrGet = getRepoPruneOptionsFlags
attrSet = setRepoPruneOptionsFlags
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.RepoPruneOptions.flags"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-RepoPruneOptions.html#g:attr:flags"
})
repoPruneOptions_flags :: AttrLabelProxy "flags"
repoPruneOptions_flags = AttrLabelProxy
#endif
getRepoPruneOptionsReachable :: MonadIO m => RepoPruneOptions -> m (Maybe (Map.Map (Ptr ()) (Ptr ())))
getRepoPruneOptionsReachable :: forall (m :: * -> *).
MonadIO m =>
RepoPruneOptions -> m (Maybe (Map (Ptr ()) (Ptr ())))
getRepoPruneOptionsReachable RepoPruneOptions
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 RepoPruneOptions
s forall a b. (a -> b) -> a -> b
$ \Ptr RepoPruneOptions
ptr -> do
Ptr (GHashTable (Ptr ()) (Ptr ()))
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr RepoPruneOptions
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO (Ptr (GHashTable (Ptr ()) (Ptr ())))
Maybe (Map (Ptr ()) (Ptr ()))
result <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr (GHashTable (Ptr ()) (Ptr ()))
val forall a b. (a -> b) -> a -> b
$ \Ptr (GHashTable (Ptr ()) (Ptr ()))
val' -> do
[(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
val'' <- forall a b.
Ptr (GHashTable a b) -> IO [(PtrWrapped a, PtrWrapped b)]
unpackGHashTable Ptr (GHashTable (Ptr ()) (Ptr ()))
val'
let val''' :: [(Ptr (), PtrWrapped (Ptr ()))]
val''' = forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst forall a. PtrWrapped (Ptr a) -> Ptr a
B.GHT.ptrUnpackPtr [(PtrWrapped (Ptr ()), PtrWrapped (Ptr ()))]
val''
let val'''' :: [(Ptr (), Ptr ())]
val'''' = forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond forall a. PtrWrapped (Ptr a) -> Ptr a
B.GHT.ptrUnpackPtr [(Ptr (), PtrWrapped (Ptr ()))]
val'''
let val''''' :: Map (Ptr ()) (Ptr ())
val''''' = forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Ptr (), Ptr ())]
val''''
forall (m :: * -> *) a. Monad m => a -> m a
return Map (Ptr ()) (Ptr ())
val'''''
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (Map (Ptr ()) (Ptr ()))
result
setRepoPruneOptionsReachable :: MonadIO m => RepoPruneOptions -> Ptr (GHashTable (Ptr ()) (Ptr ())) -> m ()
setRepoPruneOptionsReachable :: forall (m :: * -> *).
MonadIO m =>
RepoPruneOptions -> Ptr (GHashTable (Ptr ()) (Ptr ())) -> m ()
setRepoPruneOptionsReachable RepoPruneOptions
s Ptr (GHashTable (Ptr ()) (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 RepoPruneOptions
s forall a b. (a -> b) -> a -> b
$ \Ptr RepoPruneOptions
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RepoPruneOptions
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Ptr (GHashTable (Ptr ()) (Ptr ()))
val :: Ptr (GHashTable (Ptr ()) (Ptr ())))
clearRepoPruneOptionsReachable :: MonadIO m => RepoPruneOptions -> m ()
clearRepoPruneOptionsReachable :: forall (m :: * -> *). MonadIO m => RepoPruneOptions -> m ()
clearRepoPruneOptionsReachable RepoPruneOptions
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 RepoPruneOptions
s forall a b. (a -> b) -> a -> b
$ \Ptr RepoPruneOptions
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RepoPruneOptions
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (forall a. Ptr a
FP.nullPtr :: Ptr (GHashTable (Ptr ()) (Ptr ())))
#if defined(ENABLE_OVERLOADING)
data RepoPruneOptionsReachableFieldInfo
instance AttrInfo RepoPruneOptionsReachableFieldInfo where
type AttrBaseTypeConstraint RepoPruneOptionsReachableFieldInfo = (~) RepoPruneOptions
type AttrAllowedOps RepoPruneOptionsReachableFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RepoPruneOptionsReachableFieldInfo = (~) (Ptr (GHashTable (Ptr ()) (Ptr ())))
type AttrTransferTypeConstraint RepoPruneOptionsReachableFieldInfo = (~)(Ptr (GHashTable (Ptr ()) (Ptr ())))
type AttrTransferType RepoPruneOptionsReachableFieldInfo = (Ptr (GHashTable (Ptr ()) (Ptr ())))
type AttrGetType RepoPruneOptionsReachableFieldInfo = Maybe (Map.Map (Ptr ()) (Ptr ()))
type AttrLabel RepoPruneOptionsReachableFieldInfo = "reachable"
type AttrOrigin RepoPruneOptionsReachableFieldInfo = RepoPruneOptions
attrGet = getRepoPruneOptionsReachable
attrSet = setRepoPruneOptionsReachable
attrConstruct = undefined
attrClear = clearRepoPruneOptionsReachable
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Structs.RepoPruneOptions.reachable"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-RepoPruneOptions.html#g:attr:reachable"
})
repoPruneOptions_reachable :: AttrLabelProxy "reachable"
repoPruneOptions_reachable = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RepoPruneOptions
type instance O.AttributeList RepoPruneOptions = RepoPruneOptionsAttributeList
type RepoPruneOptionsAttributeList = ('[ '("flags", RepoPruneOptionsFlagsFieldInfo), '("reachable", RepoPruneOptionsReachableFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRepoPruneOptionsMethod (t :: Symbol) (o :: *) :: * where
ResolveRepoPruneOptionsMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRepoPruneOptionsMethod t RepoPruneOptions, O.OverloadedMethod info RepoPruneOptions p) => OL.IsLabel t (RepoPruneOptions -> 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 ~ ResolveRepoPruneOptionsMethod t RepoPruneOptions, O.OverloadedMethod info RepoPruneOptions p, R.HasField t RepoPruneOptions p) => R.HasField t RepoPruneOptions p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRepoPruneOptionsMethod t RepoPruneOptions, O.OverloadedMethodInfo info RepoPruneOptions) => OL.IsLabel t (O.MethodProxy info RepoPruneOptions) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif