{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint' is an opaque data structure and can only be accessed
using the following functions.
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Structs.IOExtensionPoint
    ( 

-- * Exported types
    IOExtensionPoint(..)                    ,
    noIOExtensionPoint                      ,


 -- * Methods
-- ** getExtensionByName #method:getExtensionByName#

#if ENABLE_OVERLOADING
    IOExtensionPointGetExtensionByNameMethodInfo,
#endif
    iOExtensionPointGetExtensionByName      ,


-- ** getExtensions #method:getExtensions#

#if ENABLE_OVERLOADING
    IOExtensionPointGetExtensionsMethodInfo ,
#endif
    iOExtensionPointGetExtensions           ,


-- ** getRequiredType #method:getRequiredType#

#if ENABLE_OVERLOADING
    IOExtensionPointGetRequiredTypeMethodInfo,
#endif
    iOExtensionPointGetRequiredType         ,


-- ** implement #method:implement#

    iOExtensionPointImplement               ,


-- ** lookup #method:lookup#

    iOExtensionPointLookup                  ,


-- ** register #method:register#

    iOExtensionPointRegister                ,


-- ** setRequiredType #method:setRequiredType#

#if ENABLE_OVERLOADING
    IOExtensionPointSetRequiredTypeMethodInfo,
#endif
    iOExtensionPointSetRequiredType         ,




    ) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import {-# SOURCE #-} qualified GI.Gio.Structs.IOExtension as Gio.IOExtension

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

-- | A convenience alias for `Nothing` :: `Maybe` `IOExtensionPoint`.
noIOExtensionPoint :: Maybe IOExtensionPoint
noIOExtensionPoint :: Maybe IOExtensionPoint
noIOExtensionPoint = Maybe IOExtensionPoint
forall a. Maybe a
Nothing


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

-- method IOExtensionPoint::get_extension_by_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "extension_point", argType = TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GIOExtensionPoint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the extension to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOExtension"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_get_extension_by_name" g_io_extension_point_get_extension_by_name :: 
    Ptr IOExtensionPoint ->                 -- extension_point : TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gio.IOExtension.IOExtension)

{- |
Finds a 'GI.Gio.Structs.IOExtension.IOExtension' for an extension point by name.
-}
iOExtensionPointGetExtensionByName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IOExtensionPoint
    {- ^ /@extensionPoint@/: a 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint' -}
    -> T.Text
    {- ^ /@name@/: the name of the extension to get -}
    -> m Gio.IOExtension.IOExtension
    {- ^ __Returns:__ the 'GI.Gio.Structs.IOExtension.IOExtension' for /@extensionPoint@/ that has the
   given name, or 'Nothing' if there is no extension with that name -}
iOExtensionPointGetExtensionByName :: IOExtensionPoint -> Text -> m IOExtension
iOExtensionPointGetExtensionByName extensionPoint :: IOExtensionPoint
extensionPoint name :: Text
name = IO IOExtension -> m IOExtension
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOExtension -> m IOExtension)
-> IO IOExtension -> m IOExtension
forall a b. (a -> b) -> a -> b
$ do
    Ptr IOExtensionPoint
extensionPoint' <- IOExtensionPoint -> IO (Ptr IOExtensionPoint)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtensionPoint
extensionPoint
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr IOExtension
result <- Ptr IOExtensionPoint -> CString -> IO (Ptr IOExtension)
g_io_extension_point_get_extension_by_name Ptr IOExtensionPoint
extensionPoint' CString
name'
    Text -> Ptr IOExtension -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "iOExtensionPointGetExtensionByName" Ptr IOExtension
result
    IOExtension
result' <- ((ManagedPtr IOExtension -> IOExtension)
-> Ptr IOExtension -> IO IOExtension
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOExtension -> IOExtension
Gio.IOExtension.IOExtension) Ptr IOExtension
result
    IOExtensionPoint -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOExtensionPoint
extensionPoint
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    IOExtension -> IO IOExtension
forall (m :: * -> *) a. Monad m => a -> m a
return IOExtension
result'

#if ENABLE_OVERLOADING
data IOExtensionPointGetExtensionByNameMethodInfo
instance (signature ~ (T.Text -> m Gio.IOExtension.IOExtension), MonadIO m) => O.MethodInfo IOExtensionPointGetExtensionByNameMethodInfo IOExtensionPoint signature where
    overloadedMethod _ = iOExtensionPointGetExtensionByName

#endif

-- method IOExtensionPoint::get_extensions
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "extension_point", argType = TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GIOExtensionPoint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gio", name = "IOExtension"})))
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_get_extensions" g_io_extension_point_get_extensions :: 
    Ptr IOExtensionPoint ->                 -- extension_point : TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"})
    IO (Ptr (GList (Ptr Gio.IOExtension.IOExtension)))

{- |
Gets a list of all extensions that implement this extension point.
The list is sorted by priority, beginning with the highest priority.
-}
iOExtensionPointGetExtensions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IOExtensionPoint
    {- ^ /@extensionPoint@/: a 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint' -}
    -> m [Gio.IOExtension.IOExtension]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    @/GIOExtensions/@. The list is owned by GIO and should not be
    modified. -}
iOExtensionPointGetExtensions :: IOExtensionPoint -> m [IOExtension]
iOExtensionPointGetExtensions extensionPoint :: IOExtensionPoint
extensionPoint = IO [IOExtension] -> m [IOExtension]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [IOExtension] -> m [IOExtension])
-> IO [IOExtension] -> m [IOExtension]
forall a b. (a -> b) -> a -> b
$ do
    Ptr IOExtensionPoint
extensionPoint' <- IOExtensionPoint -> IO (Ptr IOExtensionPoint)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtensionPoint
extensionPoint
    Ptr (GList (Ptr IOExtension))
result <- Ptr IOExtensionPoint -> IO (Ptr (GList (Ptr IOExtension)))
g_io_extension_point_get_extensions Ptr IOExtensionPoint
extensionPoint'
    [Ptr IOExtension]
result' <- Ptr (GList (Ptr IOExtension)) -> IO [Ptr IOExtension]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr IOExtension))
result
    [IOExtension]
result'' <- (Ptr IOExtension -> IO IOExtension)
-> [Ptr IOExtension] -> IO [IOExtension]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr IOExtension -> IOExtension)
-> Ptr IOExtension -> IO IOExtension
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOExtension -> IOExtension
Gio.IOExtension.IOExtension) [Ptr IOExtension]
result'
    IOExtensionPoint -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOExtensionPoint
extensionPoint
    [IOExtension] -> IO [IOExtension]
forall (m :: * -> *) a. Monad m => a -> m a
return [IOExtension]
result''

#if ENABLE_OVERLOADING
data IOExtensionPointGetExtensionsMethodInfo
instance (signature ~ (m [Gio.IOExtension.IOExtension]), MonadIO m) => O.MethodInfo IOExtensionPointGetExtensionsMethodInfo IOExtensionPoint signature where
    overloadedMethod _ = iOExtensionPointGetExtensions

#endif

-- method IOExtensionPoint::get_required_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "extension_point", argType = TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GIOExtensionPoint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_get_required_type" g_io_extension_point_get_required_type :: 
    Ptr IOExtensionPoint ->                 -- extension_point : TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"})
    IO CGType

{- |
Gets the required type for /@extensionPoint@/.
-}
iOExtensionPointGetRequiredType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IOExtensionPoint
    {- ^ /@extensionPoint@/: a 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' that all implementations must have,
    or @/G_TYPE_INVALID/@ if the extension point has no required type -}
iOExtensionPointGetRequiredType :: IOExtensionPoint -> m GType
iOExtensionPointGetRequiredType extensionPoint :: IOExtensionPoint
extensionPoint = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr IOExtensionPoint
extensionPoint' <- IOExtensionPoint -> IO (Ptr IOExtensionPoint)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtensionPoint
extensionPoint
    CGType
result <- Ptr IOExtensionPoint -> IO CGType
g_io_extension_point_get_required_type Ptr IOExtensionPoint
extensionPoint'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    IOExtensionPoint -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOExtensionPoint
extensionPoint
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data IOExtensionPointGetRequiredTypeMethodInfo
instance (signature ~ (m GType), MonadIO m) => O.MethodInfo IOExtensionPointGetRequiredTypeMethodInfo IOExtensionPoint signature where
    overloadedMethod _ = iOExtensionPointGetRequiredType

#endif

-- method IOExtensionPoint::set_required_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "extension_point", argType = TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GIOExtensionPoint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType to require", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_set_required_type" g_io_extension_point_set_required_type :: 
    Ptr IOExtensionPoint ->                 -- extension_point : TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"})
    CGType ->                               -- type : TBasicType TGType
    IO ()

{- |
Sets the required type for /@extensionPoint@/ to /@type@/.
All implementations must henceforth have this type.
-}
iOExtensionPointSetRequiredType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IOExtensionPoint
    {- ^ /@extensionPoint@/: a 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint' -}
    -> GType
    {- ^ /@type@/: the 'GType' to require -}
    -> m ()
iOExtensionPointSetRequiredType :: IOExtensionPoint -> GType -> m ()
iOExtensionPointSetRequiredType extensionPoint :: IOExtensionPoint
extensionPoint type_ :: GType
type_ = 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 IOExtensionPoint
extensionPoint' <- IOExtensionPoint -> IO (Ptr IOExtensionPoint)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtensionPoint
extensionPoint
    let type_' :: CGType
type_' = GType -> CGType
gtypeToCGType GType
type_
    Ptr IOExtensionPoint -> CGType -> IO ()
g_io_extension_point_set_required_type Ptr IOExtensionPoint
extensionPoint' CGType
type_'
    IOExtensionPoint -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOExtensionPoint
extensionPoint
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data IOExtensionPointSetRequiredTypeMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m) => O.MethodInfo IOExtensionPointSetRequiredTypeMethodInfo IOExtensionPoint signature where
    overloadedMethod _ = iOExtensionPointSetRequiredType

#endif

-- method IOExtensionPoint::implement
-- method type : MemberFunction
-- Args : [Arg {argCName = "extension_point_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the extension point", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GType to register as extension", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "extension_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name for the extension", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the priority for the extension", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOExtension"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_implement" g_io_extension_point_implement :: 
    CString ->                              -- extension_point_name : TBasicType TUTF8
    CGType ->                               -- type : TBasicType TGType
    CString ->                              -- extension_name : TBasicType TUTF8
    Int32 ->                                -- priority : TBasicType TInt
    IO (Ptr Gio.IOExtension.IOExtension)

{- |
Registers /@type@/ as extension for the extension point with name
/@extensionPointName@/.

If /@type@/ has already been registered as an extension for this
extension point, the existing 'GI.Gio.Structs.IOExtension.IOExtension' object is returned.
-}
iOExtensionPointImplement ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@extensionPointName@/: the name of the extension point -}
    -> GType
    {- ^ /@type@/: the 'GType' to register as extension -}
    -> T.Text
    {- ^ /@extensionName@/: the name for the extension -}
    -> Int32
    {- ^ /@priority@/: the priority for the extension -}
    -> m Gio.IOExtension.IOExtension
    {- ^ __Returns:__ a 'GI.Gio.Structs.IOExtension.IOExtension' object for 'GType' -}
iOExtensionPointImplement :: Text -> GType -> Text -> Int32 -> m IOExtension
iOExtensionPointImplement extensionPointName :: Text
extensionPointName type_ :: GType
type_ extensionName :: Text
extensionName priority :: Int32
priority = IO IOExtension -> m IOExtension
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOExtension -> m IOExtension)
-> IO IOExtension -> m IOExtension
forall a b. (a -> b) -> a -> b
$ do
    CString
extensionPointName' <- Text -> IO CString
textToCString Text
extensionPointName
    let type_' :: CGType
type_' = GType -> CGType
gtypeToCGType GType
type_
    CString
extensionName' <- Text -> IO CString
textToCString Text
extensionName
    Ptr IOExtension
result <- CString -> CGType -> CString -> Int32 -> IO (Ptr IOExtension)
g_io_extension_point_implement CString
extensionPointName' CGType
type_' CString
extensionName' Int32
priority
    Text -> Ptr IOExtension -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "iOExtensionPointImplement" Ptr IOExtension
result
    IOExtension
result' <- ((ManagedPtr IOExtension -> IOExtension)
-> Ptr IOExtension -> IO IOExtension
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOExtension -> IOExtension
Gio.IOExtension.IOExtension) Ptr IOExtension
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
extensionPointName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
extensionName'
    IOExtension -> IO IOExtension
forall (m :: * -> *) a. Monad m => a -> m a
return IOExtension
result'

#if ENABLE_OVERLOADING
#endif

-- method IOExtensionPoint::lookup
-- method type : MemberFunction
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the extension point", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_lookup" g_io_extension_point_lookup :: 
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr IOExtensionPoint)

{- |
Looks up an existing extension point.
-}
iOExtensionPointLookup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: the name of the extension point -}
    -> m IOExtensionPoint
    {- ^ __Returns:__ the 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint', or 'Nothing' if there
   is no registered extension point with the given name. -}
iOExtensionPointLookup :: Text -> m IOExtensionPoint
iOExtensionPointLookup name :: Text
name = IO IOExtensionPoint -> m IOExtensionPoint
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOExtensionPoint -> m IOExtensionPoint)
-> IO IOExtensionPoint -> m IOExtensionPoint
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr IOExtensionPoint
result <- CString -> IO (Ptr IOExtensionPoint)
g_io_extension_point_lookup CString
name'
    Text -> Ptr IOExtensionPoint -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "iOExtensionPointLookup" Ptr IOExtensionPoint
result
    IOExtensionPoint
result' <- ((ManagedPtr IOExtensionPoint -> IOExtensionPoint)
-> Ptr IOExtensionPoint -> IO IOExtensionPoint
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOExtensionPoint -> IOExtensionPoint
IOExtensionPoint) Ptr IOExtensionPoint
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    IOExtensionPoint -> IO IOExtensionPoint
forall (m :: * -> *) a. Monad m => a -> m a
return IOExtensionPoint
result'

#if ENABLE_OVERLOADING
#endif

-- method IOExtensionPoint::register
-- method type : MemberFunction
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The name of the extension point", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOExtensionPoint"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_io_extension_point_register" g_io_extension_point_register :: 
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr IOExtensionPoint)

{- |
Registers an extension point.
-}
iOExtensionPointRegister ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: The name of the extension point -}
    -> m IOExtensionPoint
    {- ^ __Returns:__ the new 'GI.Gio.Structs.IOExtensionPoint.IOExtensionPoint'. This object is
   owned by GIO and should not be freed. -}
iOExtensionPointRegister :: Text -> m IOExtensionPoint
iOExtensionPointRegister name :: Text
name = IO IOExtensionPoint -> m IOExtensionPoint
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOExtensionPoint -> m IOExtensionPoint)
-> IO IOExtensionPoint -> m IOExtensionPoint
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr IOExtensionPoint
result <- CString -> IO (Ptr IOExtensionPoint)
g_io_extension_point_register CString
name'
    Text -> Ptr IOExtensionPoint -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "iOExtensionPointRegister" Ptr IOExtensionPoint
result
    IOExtensionPoint
result' <- ((ManagedPtr IOExtensionPoint -> IOExtensionPoint)
-> Ptr IOExtensionPoint -> IO IOExtensionPoint
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr IOExtensionPoint -> IOExtensionPoint
IOExtensionPoint) Ptr IOExtensionPoint
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    IOExtensionPoint -> IO IOExtensionPoint
forall (m :: * -> *) a. Monad m => a -> m a
return IOExtensionPoint
result'

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveIOExtensionPointMethod (t :: Symbol) (o :: *) :: * where
    ResolveIOExtensionPointMethod "getExtensionByName" o = IOExtensionPointGetExtensionByNameMethodInfo
    ResolveIOExtensionPointMethod "getExtensions" o = IOExtensionPointGetExtensionsMethodInfo
    ResolveIOExtensionPointMethod "getRequiredType" o = IOExtensionPointGetRequiredTypeMethodInfo
    ResolveIOExtensionPointMethod "setRequiredType" o = IOExtensionPointSetRequiredTypeMethodInfo
    ResolveIOExtensionPointMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveIOExtensionPointMethod t IOExtensionPoint, O.MethodInfo info IOExtensionPoint p) => O.IsLabelProxy t (IOExtensionPoint -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveIOExtensionPointMethod t IOExtensionPoint, O.MethodInfo info IOExtensionPoint p) => O.IsLabel t (IOExtensionPoint -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif