{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An opaque structure used as the base of all interface types.

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

module GI.GObject.Structs.TypeInterface
    ( 

-- * Exported types
    TypeInterface(..)                       ,
    newZeroTypeInterface                    ,
    noTypeInterface                         ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveTypeInterfaceMethod              ,
#endif


-- ** addPrerequisite #method:addPrerequisite#

    typeInterfaceAddPrerequisite            ,


-- ** getPlugin #method:getPlugin#

    typeInterfaceGetPlugin                  ,


-- ** peek #method:peek#

    typeInterfacePeek                       ,


-- ** peekParent #method:peekParent#

#if defined(ENABLE_OVERLOADING)
    TypeInterfacePeekParentMethodInfo       ,
#endif
    typeInterfacePeekParent                 ,


-- ** prerequisites #method:prerequisites#

    typeInterfacePrerequisites              ,




    ) 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

import {-# SOURCE #-} qualified GI.GObject.Interfaces.TypePlugin as GObject.TypePlugin
import {-# SOURCE #-} qualified GI.GObject.Structs.TypeClass as GObject.TypeClass

-- | Memory-managed wrapper type.
newtype TypeInterface = TypeInterface (ManagedPtr TypeInterface)
    deriving (TypeInterface -> TypeInterface -> Bool
(TypeInterface -> TypeInterface -> Bool)
-> (TypeInterface -> TypeInterface -> Bool) -> Eq TypeInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeInterface -> TypeInterface -> Bool
$c/= :: TypeInterface -> TypeInterface -> Bool
== :: TypeInterface -> TypeInterface -> Bool
$c== :: TypeInterface -> TypeInterface -> Bool
Eq)
instance WrappedPtr TypeInterface where
    wrappedPtrCalloc :: IO (Ptr TypeInterface)
wrappedPtrCalloc = Int -> IO (Ptr TypeInterface)
forall a. Int -> IO (Ptr a)
callocBytes 16
    wrappedPtrCopy :: TypeInterface -> IO TypeInterface
wrappedPtrCopy = \p :: TypeInterface
p -> TypeInterface
-> (Ptr TypeInterface -> IO TypeInterface) -> IO TypeInterface
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeInterface
p (Int -> Ptr TypeInterface -> IO (Ptr TypeInterface)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 16 (Ptr TypeInterface -> IO (Ptr TypeInterface))
-> (Ptr TypeInterface -> IO TypeInterface)
-> Ptr TypeInterface
-> IO TypeInterface
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr TypeInterface -> TypeInterface)
-> Ptr TypeInterface -> IO TypeInterface
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TypeInterface -> TypeInterface
TypeInterface)
    wrappedPtrFree :: Maybe (GDestroyNotify TypeInterface)
wrappedPtrFree = GDestroyNotify TypeInterface
-> Maybe (GDestroyNotify TypeInterface)
forall a. a -> Maybe a
Just GDestroyNotify TypeInterface
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free

-- | Construct a `TypeInterface` struct initialized to zero.
newZeroTypeInterface :: MonadIO m => m TypeInterface
newZeroTypeInterface :: m TypeInterface
newZeroTypeInterface = IO TypeInterface -> m TypeInterface
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TypeInterface -> m TypeInterface)
-> IO TypeInterface -> m TypeInterface
forall a b. (a -> b) -> a -> b
$ IO (Ptr TypeInterface)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr TypeInterface)
-> (Ptr TypeInterface -> IO TypeInterface) -> IO TypeInterface
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr TypeInterface -> TypeInterface)
-> Ptr TypeInterface -> IO TypeInterface
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TypeInterface -> TypeInterface
TypeInterface

instance tag ~ 'AttrSet => Constructible TypeInterface tag where
    new :: (ManagedPtr TypeInterface -> TypeInterface)
-> [AttrOp TypeInterface tag] -> m TypeInterface
new _ attrs :: [AttrOp TypeInterface tag]
attrs = do
        TypeInterface
o <- m TypeInterface
forall (m :: * -> *). MonadIO m => m TypeInterface
newZeroTypeInterface
        TypeInterface -> [AttrOp TypeInterface 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set TypeInterface
o [AttrOp TypeInterface tag]
[AttrOp TypeInterface 'AttrSet]
attrs
        TypeInterface -> m TypeInterface
forall (m :: * -> *) a. Monad m => a -> m a
return TypeInterface
o


-- | A convenience alias for `Nothing` :: `Maybe` `TypeInterface`.
noTypeInterface :: Maybe TypeInterface
noTypeInterface :: Maybe TypeInterface
noTypeInterface = Maybe TypeInterface
forall a. Maybe a
Nothing


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

-- method TypeInterface::peek_parent
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "g_iface"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "TypeInterface" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTypeInterface structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GObject" , name = "TypeInterface" })
-- throws : False
-- Skip return : False

foreign import ccall "g_type_interface_peek_parent" g_type_interface_peek_parent :: 
    Ptr TypeInterface ->                    -- g_iface : TInterface (Name {namespace = "GObject", name = "TypeInterface"})
    IO (Ptr TypeInterface)

-- | Returns the corresponding t'GI.GObject.Structs.TypeInterface.TypeInterface' structure of the parent type
-- of the instance type to which /@gIface@/ belongs. This is useful when
-- deriving the implementation of an interface from the parent type and
-- then possibly overriding some methods.
typeInterfacePeekParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TypeInterface
    -- ^ /@gIface@/: a t'GI.GObject.Structs.TypeInterface.TypeInterface' structure
    -> m TypeInterface
    -- ^ __Returns:__ the
    --     corresponding t'GI.GObject.Structs.TypeInterface.TypeInterface' structure of the parent type of the
    --     instance type to which /@gIface@/ belongs, or 'P.Nothing' if the parent
    --     type doesn\'t conform to the interface
typeInterfacePeekParent :: TypeInterface -> m TypeInterface
typeInterfacePeekParent gIface :: TypeInterface
gIface = IO TypeInterface -> m TypeInterface
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TypeInterface -> m TypeInterface)
-> IO TypeInterface -> m TypeInterface
forall a b. (a -> b) -> a -> b
$ do
    Ptr TypeInterface
gIface' <- TypeInterface -> IO (Ptr TypeInterface)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TypeInterface
gIface
    Ptr TypeInterface
result <- Ptr TypeInterface -> IO (Ptr TypeInterface)
g_type_interface_peek_parent Ptr TypeInterface
gIface'
    Text -> Ptr TypeInterface -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "typeInterfacePeekParent" Ptr TypeInterface
result
    TypeInterface
result' <- ((ManagedPtr TypeInterface -> TypeInterface)
-> Ptr TypeInterface -> IO TypeInterface
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr TypeInterface -> TypeInterface
TypeInterface) Ptr TypeInterface
result
    TypeInterface -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TypeInterface
gIface
    TypeInterface -> IO TypeInterface
forall (m :: * -> *) a. Monad m => a -> m a
return TypeInterface
result'

#if defined(ENABLE_OVERLOADING)
data TypeInterfacePeekParentMethodInfo
instance (signature ~ (m TypeInterface), MonadIO m) => O.MethodInfo TypeInterfacePeekParentMethodInfo TypeInterface signature where
    overloadedMethod = typeInterfacePeekParent

#endif

-- method TypeInterface::add_prerequisite
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "interface_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GType value of an interface type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "prerequisite_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GType value of an interface or instantiatable type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_type_interface_add_prerequisite" g_type_interface_add_prerequisite :: 
    CGType ->                               -- interface_type : TBasicType TGType
    CGType ->                               -- prerequisite_type : TBasicType TGType
    IO ()

-- | Adds /@prerequisiteType@/ to the list of prerequisites of /@interfaceType@/.
-- This means that any type implementing /@interfaceType@/ must also implement
-- /@prerequisiteType@/. Prerequisites can be thought of as an alternative to
-- interface derivation (which GType doesn\'t support). An interface can have
-- at most one instantiatable prerequisite type.
typeInterfaceAddPrerequisite ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@interfaceType@/: t'GType' value of an interface type
    -> GType
    -- ^ /@prerequisiteType@/: t'GType' value of an interface or instantiatable type
    -> m ()
typeInterfaceAddPrerequisite :: GType -> GType -> m ()
typeInterfaceAddPrerequisite interfaceType :: GType
interfaceType prerequisiteType :: GType
prerequisiteType = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let interfaceType' :: CGType
interfaceType' = GType -> CGType
gtypeToCGType GType
interfaceType
    let prerequisiteType' :: CGType
prerequisiteType' = GType -> CGType
gtypeToCGType GType
prerequisiteType
    CGType -> CGType -> IO ()
g_type_interface_add_prerequisite CGType
interfaceType' CGType
prerequisiteType'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method TypeInterface::get_plugin
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "instance_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GType of an instantiatable type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interface_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GType of an interface type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GObject" , name = "TypePlugin" })
-- throws : False
-- Skip return : False

foreign import ccall "g_type_interface_get_plugin" g_type_interface_get_plugin :: 
    CGType ->                               -- instance_type : TBasicType TGType
    CGType ->                               -- interface_type : TBasicType TGType
    IO (Ptr GObject.TypePlugin.TypePlugin)

-- | Returns the t'GI.GObject.Interfaces.TypePlugin.TypePlugin' structure for the dynamic interface
-- /@interfaceType@/ which has been added to /@instanceType@/, or 'P.Nothing'
-- if /@interfaceType@/ has not been added to /@instanceType@/ or does
-- not have a t'GI.GObject.Interfaces.TypePlugin.TypePlugin' structure. See 'GI.GObject.Functions.typeAddInterfaceDynamic'.
typeInterfaceGetPlugin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@instanceType@/: t'GType' of an instantiatable type
    -> GType
    -- ^ /@interfaceType@/: t'GType' of an interface type
    -> m GObject.TypePlugin.TypePlugin
    -- ^ __Returns:__ the t'GI.GObject.Interfaces.TypePlugin.TypePlugin' for the dynamic
    --     interface /@interfaceType@/ of /@instanceType@/
typeInterfaceGetPlugin :: GType -> GType -> m TypePlugin
typeInterfaceGetPlugin instanceType :: GType
instanceType interfaceType :: GType
interfaceType = IO TypePlugin -> m TypePlugin
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TypePlugin -> m TypePlugin) -> IO TypePlugin -> m TypePlugin
forall a b. (a -> b) -> a -> b
$ do
    let instanceType' :: CGType
instanceType' = GType -> CGType
gtypeToCGType GType
instanceType
    let interfaceType' :: CGType
interfaceType' = GType -> CGType
gtypeToCGType GType
interfaceType
    Ptr TypePlugin
result <- CGType -> CGType -> IO (Ptr TypePlugin)
g_type_interface_get_plugin CGType
instanceType' CGType
interfaceType'
    Text -> Ptr TypePlugin -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "typeInterfaceGetPlugin" Ptr TypePlugin
result
    TypePlugin
result' <- ((ManagedPtr TypePlugin -> TypePlugin)
-> Ptr TypePlugin -> IO TypePlugin
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr TypePlugin -> TypePlugin
GObject.TypePlugin.TypePlugin) Ptr TypePlugin
result
    TypePlugin -> IO TypePlugin
forall (m :: * -> *) a. Monad m => a -> m a
return TypePlugin
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method TypeInterface::peek
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "instance_class"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "TypeClass" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTypeClass structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "iface_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an interface ID which this class conforms to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GObject" , name = "TypeInterface" })
-- throws : False
-- Skip return : False

foreign import ccall "g_type_interface_peek" g_type_interface_peek :: 
    Ptr GObject.TypeClass.TypeClass ->      -- instance_class : TInterface (Name {namespace = "GObject", name = "TypeClass"})
    CGType ->                               -- iface_type : TBasicType TGType
    IO (Ptr TypeInterface)

-- | Returns the t'GI.GObject.Structs.TypeInterface.TypeInterface' structure of an interface to which the
-- passed in class conforms.
typeInterfacePeek ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GObject.TypeClass.TypeClass
    -- ^ /@instanceClass@/: a t'GI.GObject.Structs.TypeClass.TypeClass' structure
    -> GType
    -- ^ /@ifaceType@/: an interface ID which this class conforms to
    -> m TypeInterface
    -- ^ __Returns:__ the t'GI.GObject.Structs.TypeInterface.TypeInterface'
    --     structure of /@ifaceType@/ if implemented by /@instanceClass@/, 'P.Nothing'
    --     otherwise
typeInterfacePeek :: TypeClass -> GType -> m TypeInterface
typeInterfacePeek instanceClass :: TypeClass
instanceClass ifaceType :: GType
ifaceType = IO TypeInterface -> m TypeInterface
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TypeInterface -> m TypeInterface)
-> IO TypeInterface -> m TypeInterface
forall a b. (a -> b) -> a -> b
$ do
    Ptr TypeClass
instanceClass' <- TypeClass -> IO (Ptr TypeClass)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TypeClass
instanceClass
    let ifaceType' :: CGType
ifaceType' = GType -> CGType
gtypeToCGType GType
ifaceType
    Ptr TypeInterface
result <- Ptr TypeClass -> CGType -> IO (Ptr TypeInterface)
g_type_interface_peek Ptr TypeClass
instanceClass' CGType
ifaceType'
    Text -> Ptr TypeInterface -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "typeInterfacePeek" Ptr TypeInterface
result
    TypeInterface
result' <- ((ManagedPtr TypeInterface -> TypeInterface)
-> Ptr TypeInterface -> IO TypeInterface
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr TypeInterface -> TypeInterface
TypeInterface) Ptr TypeInterface
result
    TypeClass -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TypeClass
instanceClass
    TypeInterface -> IO TypeInterface
forall (m :: * -> *) a. Monad m => a -> m a
return TypeInterface
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method TypeInterface::prerequisites
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "interface_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an interface type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n_prerequisites"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "location to return the number\n    of prerequisites, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_prerequisites"
--              , argType = TBasicType TUInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "location to return the number\n    of prerequisites, or %NULL"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TGType))
-- throws : False
-- Skip return : False

foreign import ccall "g_type_interface_prerequisites" g_type_interface_prerequisites :: 
    CGType ->                               -- interface_type : TBasicType TGType
    Ptr Word32 ->                           -- n_prerequisites : TBasicType TUInt
    IO (Ptr CGType)

-- | Returns the prerequisites of an interfaces type.
-- 
-- /Since: 2.2/
typeInterfacePrerequisites ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@interfaceType@/: an interface type
    -> m [GType]
    -- ^ __Returns:__ a
    --     newly-allocated zero-terminated array of t'GType' containing
    --     the prerequisites of /@interfaceType@/
typeInterfacePrerequisites :: GType -> m [GType]
typeInterfacePrerequisites interfaceType :: GType
interfaceType = 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
    let interfaceType' :: CGType
interfaceType' = GType -> CGType
gtypeToCGType GType
interfaceType
    Ptr Word32
nPrerequisites <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr CGType
result <- CGType -> Ptr Word32 -> IO (Ptr CGType)
g_type_interface_prerequisites CGType
interfaceType' Ptr Word32
nPrerequisites
    Word32
nPrerequisites' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
nPrerequisites
    Text -> Ptr CGType -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "typeInterfacePrerequisites" Ptr CGType
result
    [GType]
result' <- ((CGType -> GType) -> Word32 -> Ptr CGType -> IO [GType]
forall a b c.
(Integral a, Storable b) =>
(b -> c) -> a -> Ptr b -> IO [c]
unpackMapStorableArrayWithLength CGType -> GType
GType Word32
nPrerequisites') Ptr CGType
result
    Ptr CGType -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CGType
result
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
nPrerequisites
    [GType] -> IO [GType]
forall (m :: * -> *) a. Monad m => a -> m a
return [GType]
result'

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveTypeInterfaceMethod (t :: Symbol) (o :: *) :: * where
    ResolveTypeInterfaceMethod "peekParent" o = TypeInterfacePeekParentMethodInfo
    ResolveTypeInterfaceMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveTypeInterfaceMethod t TypeInterface, O.MethodInfo info TypeInterface p) => OL.IsLabel t (TypeInterface -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif