{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool' maintains a collection of @/GParamSpecs/@ which can be
-- quickly accessed by owner and name. The implementation of the t'GI.GObject.Objects.Object.Object' property
-- system uses such a pool to store the @/GParamSpecs/@ of the properties all object
-- types.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GObject.Structs.ParamSpecPool
    ( 

-- * Exported types
    ParamSpecPool(..)                       ,
    noParamSpecPool                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveParamSpecPoolMethod              ,
#endif


-- ** insert #method:insert#

#if defined(ENABLE_OVERLOADING)
    ParamSpecPoolInsertMethodInfo           ,
#endif
    paramSpecPoolInsert                     ,


-- ** listOwned #method:listOwned#

#if defined(ENABLE_OVERLOADING)
    ParamSpecPoolListOwnedMethodInfo        ,
#endif
    paramSpecPoolListOwned                  ,


-- ** lookup #method:lookup#

#if defined(ENABLE_OVERLOADING)
    ParamSpecPoolLookupMethodInfo           ,
#endif
    paramSpecPoolLookup                     ,


-- ** new #method:new#

    paramSpecPoolNew                        ,


-- ** remove #method:remove#

#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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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 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


-- | Memory-managed wrapper type.
newtype ParamSpecPool = ParamSpecPool (ManagedPtr ParamSpecPool)
    deriving (ParamSpecPool -> ParamSpecPool -> Bool
(ParamSpecPool -> ParamSpecPool -> Bool)
-> (ParamSpecPool -> ParamSpecPool -> Bool) -> Eq ParamSpecPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParamSpecPool -> ParamSpecPool -> Bool
$c/= :: ParamSpecPool -> ParamSpecPool -> Bool
== :: ParamSpecPool -> ParamSpecPool -> Bool
$c== :: ParamSpecPool -> ParamSpecPool -> Bool
Eq)
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr ParamSpecPool where
    wrappedPtrCalloc :: IO (Ptr ParamSpecPool)
wrappedPtrCalloc = Ptr ParamSpecPool -> IO (Ptr ParamSpecPool)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ParamSpecPool
forall a. Ptr a
nullPtr
    wrappedPtrCopy :: ParamSpecPool -> IO ParamSpecPool
wrappedPtrCopy = ParamSpecPool -> IO ParamSpecPool
forall (m :: * -> *) a. Monad m => a -> m a
return
    wrappedPtrFree :: Maybe (GDestroyNotify ParamSpecPool)
wrappedPtrFree = Maybe (GDestroyNotify ParamSpecPool)
forall a. Maybe a
Nothing

-- | A convenience alias for `Nothing` :: `Maybe` `ParamSpecPool`.
noParamSpecPool :: Maybe ParamSpecPool
noParamSpecPool :: Maybe ParamSpecPool
noParamSpecPool = Maybe ParamSpecPool
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ParamSpecPool
type instance O.AttributeList ParamSpecPool = ParamSpecPoolAttributeList
type ParamSpecPoolAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method ParamSpecPool::insert
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "pool"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "ParamSpecPool" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GParamSpecPool." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pspec"
--           , argType = TParamSpec
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GParamSpec to insert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "owner_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GType identifying the owner of @pspec"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_param_spec_pool_insert" g_param_spec_pool_insert :: 
    Ptr ParamSpecPool ->                    -- pool : TInterface (Name {namespace = "GObject", name = "ParamSpecPool"})
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    CGType ->                               -- owner_type : TBasicType TGType
    IO ()

-- | Inserts a t'GI.GObject.Objects.ParamSpec.ParamSpec' in the pool.
paramSpecPoolInsert ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ParamSpecPool
    -- ^ /@pool@/: a t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'.
    -> GParamSpec
    -- ^ /@pspec@/: the t'GI.GObject.Objects.ParamSpec.ParamSpec' to insert
    -> GType
    -- ^ /@ownerType@/: a t'GType' identifying the owner of /@pspec@/
    -> m ()
paramSpecPoolInsert :: ParamSpecPool -> GParamSpec -> GType -> m ()
paramSpecPoolInsert pool :: ParamSpecPool
pool pspec :: GParamSpec
pspec ownerType :: GType
ownerType = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr ParamSpecPool
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
    Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
    let ownerType' :: CGType
ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
    Ptr ParamSpecPool -> Ptr GParamSpec -> CGType -> IO ()
g_param_spec_pool_insert Ptr ParamSpecPool
pool' Ptr GParamSpec
pspec' CGType
ownerType'
    ParamSpecPool -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ParamSpecPool
pool
    GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolInsertMethodInfo
instance (signature ~ (GParamSpec -> GType -> m ()), MonadIO m) => O.MethodInfo ParamSpecPoolInsertMethodInfo ParamSpecPool signature where
    overloadedMethod = paramSpecPoolInsert

#endif

-- XXX Could not generate method ParamSpecPool::list
-- Error was : Not implemented: "unpackCArray : Don't know how to unpack C Array of type TParamSpec"
-- method ParamSpecPool::list_owned
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "pool"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "ParamSpecPool" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GParamSpecPool" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "owner_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the owner to look for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGList TParamSpec)
-- throws : False
-- Skip return : False

foreign import ccall "g_param_spec_pool_list_owned" g_param_spec_pool_list_owned :: 
    Ptr ParamSpecPool ->                    -- pool : TInterface (Name {namespace = "GObject", name = "ParamSpecPool"})
    CGType ->                               -- owner_type : TBasicType TGType
    IO (Ptr (GList (Ptr GParamSpec)))

-- | Gets an t'GI.GLib.Structs.List.List' of all @/GParamSpecs/@ owned by /@ownerType@/ in
-- the pool.
paramSpecPoolListOwned ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ParamSpecPool
    -- ^ /@pool@/: a t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'
    -> GType
    -- ^ /@ownerType@/: the owner to look for
    -> m [GParamSpec]
    -- ^ __Returns:__ a
    --          t'GI.GLib.Structs.List.List' of all @/GParamSpecs/@ owned by /@ownerType@/ in
    --          the pool@/GParamSpecs/@.
paramSpecPoolListOwned :: ParamSpecPool -> GType -> m [GParamSpec]
paramSpecPoolListOwned pool :: ParamSpecPool
pool ownerType :: GType
ownerType = IO [GParamSpec] -> m [GParamSpec]
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
    Ptr ParamSpecPool
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
    let ownerType' :: CGType
ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
    Ptr (GList (Ptr GParamSpec))
result <- Ptr ParamSpecPool -> CGType -> IO (Ptr (GList (Ptr GParamSpec)))
g_param_spec_pool_list_owned Ptr ParamSpecPool
pool' CGType
ownerType'
    [Ptr GParamSpec]
result' <- Ptr (GList (Ptr GParamSpec)) -> IO [Ptr GParamSpec]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr GParamSpec))
result
    [GParamSpec]
result'' <- (Ptr GParamSpec -> IO GParamSpec)
-> [Ptr GParamSpec] -> IO [GParamSpec]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Ptr GParamSpec -> IO GParamSpec
B.GParamSpec.newGParamSpecFromPtr [Ptr GParamSpec]
result'
    Ptr (GList (Ptr GParamSpec)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr GParamSpec))
result
    ParamSpecPool -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ParamSpecPool
pool
    [GParamSpec] -> IO [GParamSpec]
forall (m :: * -> *) a. Monad m => a -> m a
return [GParamSpec]
result''

#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolListOwnedMethodInfo
instance (signature ~ (GType -> m [GParamSpec]), MonadIO m) => O.MethodInfo ParamSpecPoolListOwnedMethodInfo ParamSpecPool signature where
    overloadedMethod = paramSpecPoolListOwned

#endif

-- method ParamSpecPool::lookup
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "pool"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "ParamSpecPool" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GParamSpecPool" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "param_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name to look for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "owner_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the owner to look for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "walk_ancestors"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "If %TRUE, also try to find a #GParamSpec with @param_name\n owned by an ancestor of @owner_type."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TParamSpec
-- throws : False
-- Skip return : False

foreign import ccall "g_param_spec_pool_lookup" g_param_spec_pool_lookup :: 
    Ptr ParamSpecPool ->                    -- pool : TInterface (Name {namespace = "GObject", name = "ParamSpecPool"})
    CString ->                              -- param_name : TBasicType TUTF8
    CGType ->                               -- owner_type : TBasicType TGType
    CInt ->                                 -- walk_ancestors : TBasicType TBoolean
    IO (Ptr GParamSpec)

-- | Looks up a t'GI.GObject.Objects.ParamSpec.ParamSpec' in the pool.
paramSpecPoolLookup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ParamSpecPool
    -- ^ /@pool@/: a t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'
    -> T.Text
    -- ^ /@paramName@/: the name to look for
    -> GType
    -- ^ /@ownerType@/: the owner to look for
    -> Bool
    -- ^ /@walkAncestors@/: If 'P.True', also try to find a t'GI.GObject.Objects.ParamSpec.ParamSpec' with /@paramName@/
    --  owned by an ancestor of /@ownerType@/.
    -> m GParamSpec
    -- ^ __Returns:__ The found t'GI.GObject.Objects.ParamSpec.ParamSpec', or 'P.Nothing' if no
    -- matching t'GI.GObject.Objects.ParamSpec.ParamSpec' was found.
paramSpecPoolLookup :: ParamSpecPool -> Text -> GType -> Bool -> m GParamSpec
paramSpecPoolLookup pool :: ParamSpecPool
pool paramName :: Text
paramName ownerType :: GType
ownerType walkAncestors :: Bool
walkAncestors = IO GParamSpec -> m GParamSpec
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
    Ptr ParamSpecPool
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
    CString
paramName' <- Text -> IO CString
textToCString Text
paramName
    let ownerType' :: CGType
ownerType' = GType -> CGType
gtypeToCGType GType
ownerType
    let walkAncestors' :: CInt
walkAncestors' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
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
fromEnum) Bool
walkAncestors
    Ptr GParamSpec
result <- Ptr ParamSpecPool
-> CString -> CGType -> CInt -> IO (Ptr GParamSpec)
g_param_spec_pool_lookup Ptr ParamSpecPool
pool' CString
paramName' CGType
ownerType' CInt
walkAncestors'
    Text -> Ptr GParamSpec -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "paramSpecPoolLookup" Ptr GParamSpec
result
    GParamSpec
result' <- Ptr GParamSpec -> IO GParamSpec
B.GParamSpec.newGParamSpecFromPtr Ptr GParamSpec
result
    ParamSpecPool -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ParamSpecPool
pool
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
paramName'
    GParamSpec -> IO GParamSpec
forall (m :: * -> *) a. Monad m => a -> m a
return GParamSpec
result'

#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolLookupMethodInfo
instance (signature ~ (T.Text -> GType -> Bool -> m GParamSpec), MonadIO m) => O.MethodInfo ParamSpecPoolLookupMethodInfo ParamSpecPool signature where
    overloadedMethod = paramSpecPoolLookup

#endif

-- method ParamSpecPool::remove
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "pool"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "ParamSpecPool" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GParamSpecPool" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pspec"
--           , argType = TParamSpec
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GParamSpec to remove"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_param_spec_pool_remove" g_param_spec_pool_remove :: 
    Ptr ParamSpecPool ->                    -- pool : TInterface (Name {namespace = "GObject", name = "ParamSpecPool"})
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    IO ()

-- | Removes a t'GI.GObject.Objects.ParamSpec.ParamSpec' from the pool.
paramSpecPoolRemove ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ParamSpecPool
    -- ^ /@pool@/: a t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'
    -> GParamSpec
    -- ^ /@pspec@/: the t'GI.GObject.Objects.ParamSpec.ParamSpec' to remove
    -> m ()
paramSpecPoolRemove :: ParamSpecPool -> GParamSpec -> m ()
paramSpecPoolRemove pool :: ParamSpecPool
pool pspec :: GParamSpec
pspec = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr ParamSpecPool
pool' <- ParamSpecPool -> IO (Ptr ParamSpecPool)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParamSpecPool
pool
    Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
    Ptr ParamSpecPool -> Ptr GParamSpec -> IO ()
g_param_spec_pool_remove Ptr ParamSpecPool
pool' Ptr GParamSpec
pspec'
    ParamSpecPool -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ParamSpecPool
pool
    GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ParamSpecPoolRemoveMethodInfo
instance (signature ~ (GParamSpec -> m ()), MonadIO m) => O.MethodInfo ParamSpecPoolRemoveMethodInfo ParamSpecPool signature where
    overloadedMethod = paramSpecPoolRemove

#endif

-- method ParamSpecPool::new
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "type_prefixing"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Whether the pool will support type-prefixed property names."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GObject" , name = "ParamSpecPool" })
-- throws : False
-- Skip return : False

foreign import ccall "g_param_spec_pool_new" g_param_spec_pool_new :: 
    CInt ->                                 -- type_prefixing : TBasicType TBoolean
    IO (Ptr ParamSpecPool)

-- | Creates a new t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'.
-- 
-- If /@typePrefixing@/ is 'P.True', lookups in the newly created pool will
-- allow to specify the owner as a colon-separated prefix of the
-- property name, like \"GtkContainer:border-width\". This feature is
-- deprecated, so you should always set /@typePrefixing@/ to 'P.False'.
paramSpecPoolNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@typePrefixing@/: Whether the pool will support type-prefixed property names.
    -> m ParamSpecPool
    -- ^ __Returns:__ a newly allocated t'GI.GObject.Structs.ParamSpecPool.ParamSpecPool'.
paramSpecPoolNew :: Bool -> m ParamSpecPool
paramSpecPoolNew typePrefixing :: Bool
typePrefixing = IO ParamSpecPool -> m ParamSpecPool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ParamSpecPool -> m ParamSpecPool)
-> IO ParamSpecPool -> m ParamSpecPool
forall a b. (a -> b) -> a -> b
$ do
    let typePrefixing' :: CInt
typePrefixing' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
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
fromEnum) Bool
typePrefixing
    Ptr ParamSpecPool
result <- CInt -> IO (Ptr ParamSpecPool)
g_param_spec_pool_new CInt
typePrefixing'
    Text -> Ptr ParamSpecPool -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "paramSpecPoolNew" Ptr ParamSpecPool
result
    ParamSpecPool
result' <- ((ManagedPtr ParamSpecPool -> ParamSpecPool)
-> Ptr ParamSpecPool -> IO ParamSpecPool
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr ParamSpecPool -> ParamSpecPool
ParamSpecPool) Ptr ParamSpecPool
result
    ParamSpecPool -> IO ParamSpecPool
forall (m :: * -> *) a. Monad m => a -> m a
return ParamSpecPool
result'

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveParamSpecPoolMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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

#endif