{-# LANGUAGE TypeApplications #-}
#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif
module GI.GObject.Structs.ParamSpecPool
(
ParamSpecPool(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveParamSpecPoolMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ParamSpecPoolInsertMethodInfo ,
#endif
paramSpecPoolInsert ,
#if defined(ENABLE_OVERLOADING)
ParamSpecPoolListOwnedMethodInfo ,
#endif
paramSpecPoolListOwned ,
#if defined(ENABLE_OVERLOADING)
ParamSpecPoolLookupMethodInfo ,
#endif
paramSpecPoolLookup ,
#if defined(ENABLE_OVERLOADING)
ParamSpecPoolRemoveMethodInfo ,
#endif
paramSpecPoolRemove ,
) 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 ParamSpecPool = ParamSpecPool (SP.ManagedPtr ParamSpecPool)
deriving (ParamSpecPool -> ParamSpecPool -> Bool
(ParamSpecPool -> ParamSpecPool -> Bool)
-> (ParamSpecPool -> ParamSpecPool -> Bool) -> Eq ParamSpecPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParamSpecPool -> ParamSpecPool -> Bool
== :: ParamSpecPool -> ParamSpecPool -> Bool
$c/= :: ParamSpecPool -> ParamSpecPool -> Bool
/= :: ParamSpecPool -> ParamSpecPool -> Bool
Eq)
instance SP.ManagedPtrNewtype ParamSpecPool where
toManagedPtr :: ParamSpecPool -> ManagedPtr ParamSpecPool
toManagedPtr (ParamSpecPool ManagedPtr ParamSpecPool
p) = ManagedPtr ParamSpecPool
p
instance BoxedPtr ParamSpecPool where
boxedPtrCopy :: ParamSpecPool -> IO ParamSpecPool
boxedPtrCopy = ParamSpecPool -> IO ParamSpecPool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: ParamSpecPool -> IO ()
boxedPtrFree = \ParamSpecPool
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ParamSpecPool
type instance O.AttributeList ParamSpecPool = ParamSpecPoolAttributeList
type ParamSpecPoolAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_param_spec_pool_insert" g_param_spec_pool_insert ::
Ptr ParamSpecPool ->
Ptr GParamSpec ->
CGType ->
IO ()
paramSpecPoolInsert ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParamSpecPool
-> GParamSpec
-> GType
-> m ()
paramSpecPoolInsert :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ParamSpecPool -> GParamSpec -> GType -> m ()
paramSpecPoolInsert ParamSpecPool
pool GParamSpec
pspec GType
ownerType = 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
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
pspec' <- unsafeManagedPtrGetPtr pspec
let ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
g_param_spec_pool_insert pool' pspec' ownerType'
touchManagedPtr pool
touchManagedPtr pspec
return ()
#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolInsertMethodInfo
instance (signature ~ (GParamSpec -> GType -> m ()), MonadIO m) => O.OverloadedMethod ParamSpecPoolInsertMethodInfo ParamSpecPool signature where
overloadedMethod = paramSpecPoolInsert
instance O.OverloadedMethodInfo ParamSpecPoolInsertMethodInfo ParamSpecPool where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.ParamSpecPool.paramSpecPoolInsert",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.31/docs/GI-GObject-Structs-ParamSpecPool.html#v:paramSpecPoolInsert"
})
#endif
foreign import ccall "g_param_spec_pool_list_owned" g_param_spec_pool_list_owned ::
Ptr ParamSpecPool ->
CGType ->
IO (Ptr (GList (Ptr GParamSpec)))
paramSpecPoolListOwned ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParamSpecPool
-> GType
-> m [GParamSpec]
paramSpecPoolListOwned :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ParamSpecPool -> GType -> m [GParamSpec]
paramSpecPoolListOwned ParamSpecPool
pool GType
ownerType = IO [GParamSpec] -> m [GParamSpec]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [GParamSpec] -> m [GParamSpec])
-> IO [GParamSpec] -> m [GParamSpec]
forall a b. (a -> b) -> a -> b
$ do
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
let ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
result <- g_param_spec_pool_list_owned pool' ownerType'
result' <- unpackGList result
result'' <- mapM B.GParamSpec.newGParamSpecFromPtr result'
g_list_free result
touchManagedPtr pool
return result''
#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolListOwnedMethodInfo
instance (signature ~ (GType -> m [GParamSpec]), MonadIO m) => O.OverloadedMethod ParamSpecPoolListOwnedMethodInfo ParamSpecPool signature where
overloadedMethod = paramSpecPoolListOwned
instance O.OverloadedMethodInfo ParamSpecPoolListOwnedMethodInfo ParamSpecPool where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.ParamSpecPool.paramSpecPoolListOwned",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.31/docs/GI-GObject-Structs-ParamSpecPool.html#v:paramSpecPoolListOwned"
})
#endif
foreign import ccall "g_param_spec_pool_lookup" g_param_spec_pool_lookup ::
Ptr ParamSpecPool ->
CString ->
CGType ->
CInt ->
IO (Ptr GParamSpec)
paramSpecPoolLookup ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParamSpecPool
-> T.Text
-> GType
-> Bool
-> m (Maybe GParamSpec)
paramSpecPoolLookup :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ParamSpecPool -> Text -> GType -> Bool -> m (Maybe GParamSpec)
paramSpecPoolLookup ParamSpecPool
pool Text
paramName GType
ownerType Bool
walkAncestors = IO (Maybe GParamSpec) -> m (Maybe GParamSpec)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe GParamSpec) -> m (Maybe GParamSpec))
-> IO (Maybe GParamSpec) -> m (Maybe GParamSpec)
forall a b. (a -> b) -> a -> b
$ do
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
paramName' <- textToCString paramName
let ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
let walkAncestors' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
walkAncestors
result <- g_param_spec_pool_lookup pool' paramName' ownerType' walkAncestors'
maybeResult <- convertIfNonNull result $ \Ptr GParamSpec
result' -> do
result'' <- Ptr GParamSpec -> IO GParamSpec
B.GParamSpec.newGParamSpecFromPtr Ptr GParamSpec
result'
return result''
touchManagedPtr pool
freeMem paramName'
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolLookupMethodInfo
instance (signature ~ (T.Text -> GType -> Bool -> m (Maybe GParamSpec)), MonadIO m) => O.OverloadedMethod ParamSpecPoolLookupMethodInfo ParamSpecPool signature where
overloadedMethod = paramSpecPoolLookup
instance O.OverloadedMethodInfo ParamSpecPoolLookupMethodInfo ParamSpecPool where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.ParamSpecPool.paramSpecPoolLookup",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.31/docs/GI-GObject-Structs-ParamSpecPool.html#v:paramSpecPoolLookup"
})
#endif
foreign import ccall "g_param_spec_pool_remove" g_param_spec_pool_remove ::
Ptr ParamSpecPool ->
Ptr GParamSpec ->
IO ()
paramSpecPoolRemove ::
(B.CallStack.HasCallStack, MonadIO m) =>
ParamSpecPool
-> GParamSpec
-> m ()
paramSpecPoolRemove :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ParamSpecPool -> GParamSpec -> m ()
paramSpecPoolRemove ParamSpecPool
pool GParamSpec
pspec = 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
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
pspec' <- unsafeManagedPtrGetPtr pspec
g_param_spec_pool_remove pool' pspec'
touchManagedPtr pool
touchManagedPtr pspec
return ()
#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolRemoveMethodInfo
instance (signature ~ (GParamSpec -> m ()), MonadIO m) => O.OverloadedMethod ParamSpecPoolRemoveMethodInfo ParamSpecPool signature where
overloadedMethod = paramSpecPoolRemove
instance O.OverloadedMethodInfo ParamSpecPoolRemoveMethodInfo ParamSpecPool where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.ParamSpecPool.paramSpecPoolRemove",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.31/docs/GI-GObject-Structs-ParamSpecPool.html#v:paramSpecPoolRemove"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveParamSpecPoolMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveParamSpecPoolMethod "insert" o = ParamSpecPoolInsertMethodInfo
ResolveParamSpecPoolMethod "listOwned" o = ParamSpecPoolListOwnedMethodInfo
ResolveParamSpecPoolMethod "lookup" o = ParamSpecPoolLookupMethodInfo
ResolveParamSpecPoolMethod "remove" o = ParamSpecPoolRemoveMethodInfo
ResolveParamSpecPoolMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveParamSpecPoolMethod t ParamSpecPool, O.OverloadedMethod info ParamSpecPool p) => OL.IsLabel t (ParamSpecPool -> 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 ~ ResolveParamSpecPoolMethod t ParamSpecPool, O.OverloadedMethod info ParamSpecPool p, R.HasField t ParamSpecPool p) => R.HasField t ParamSpecPool p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveParamSpecPoolMethod t ParamSpecPool, O.OverloadedMethodInfo info ParamSpecPool) => OL.IsLabel t (O.MethodProxy info ParamSpecPool) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif