#define ENABLE_OVERLOADING \
(!defined(__HADDOCK_VERSION__))
module GI.GObject.Interfaces.TypePlugin
(
TypePlugin(..) ,
noTypePlugin ,
IsTypePlugin ,
#if ENABLE_OVERLOADING
TypePluginCompleteInterfaceInfoMethodInfo,
#endif
typePluginCompleteInterfaceInfo ,
#if ENABLE_OVERLOADING
TypePluginCompleteTypeInfoMethodInfo ,
#endif
typePluginCompleteTypeInfo ,
#if ENABLE_OVERLOADING
TypePluginUnuseMethodInfo ,
#endif
typePluginUnuse ,
#if ENABLE_OVERLOADING
TypePluginUseMethodInfo ,
#endif
typePluginUse ,
) 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.GObject.Structs.InterfaceInfo as GObject.InterfaceInfo
import {-# SOURCE #-} qualified GI.GObject.Structs.TypeInfo as GObject.TypeInfo
import {-# SOURCE #-} qualified GI.GObject.Structs.TypeValueTable as GObject.TypeValueTable
newtype TypePlugin = TypePlugin (ManagedPtr TypePlugin)
noTypePlugin :: Maybe TypePlugin
noTypePlugin :: Maybe TypePlugin
noTypePlugin = Maybe TypePlugin
forall a. Maybe a
Nothing
#if ENABLE_OVERLOADING
type instance O.SignalList TypePlugin = TypePluginSignalList
type TypePluginSignalList = ('[ ] :: [(Symbol, *)])
#endif
class ManagedPtrNewtype a => IsTypePlugin a
instance IsTypePlugin TypePlugin
instance WrappedPtr TypePlugin where
wrappedPtrCalloc :: IO (Ptr TypePlugin)
wrappedPtrCalloc = Ptr TypePlugin -> IO (Ptr TypePlugin)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr TypePlugin
forall a. Ptr a
nullPtr
wrappedPtrCopy :: TypePlugin -> IO TypePlugin
wrappedPtrCopy = TypePlugin -> IO TypePlugin
forall (m :: * -> *) a. Monad m => a -> m a
return
wrappedPtrFree :: Maybe (FunPtr (Ptr TypePlugin -> IO ()))
wrappedPtrFree = Maybe (FunPtr (Ptr TypePlugin -> IO ()))
forall a. Maybe a
Nothing
#if ENABLE_OVERLOADING
type family ResolveTypePluginMethod (t :: Symbol) (o :: *) :: * where
ResolveTypePluginMethod "completeInterfaceInfo" o = TypePluginCompleteInterfaceInfoMethodInfo
ResolveTypePluginMethod "completeTypeInfo" o = TypePluginCompleteTypeInfoMethodInfo
ResolveTypePluginMethod "unuse" o = TypePluginUnuseMethodInfo
ResolveTypePluginMethod "use" o = TypePluginUseMethodInfo
ResolveTypePluginMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTypePluginMethod t TypePlugin, O.MethodInfo info TypePlugin p) => O.IsLabelProxy t (TypePlugin -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTypePluginMethod t TypePlugin, O.MethodInfo info TypePlugin p) => O.IsLabel t (TypePlugin -> 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
foreign import ccall "g_type_plugin_complete_interface_info" g_type_plugin_complete_interface_info ::
Ptr TypePlugin ->
CGType ->
CGType ->
Ptr GObject.InterfaceInfo.InterfaceInfo ->
IO ()
typePluginCompleteInterfaceInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsTypePlugin a) =>
a
-> GType
-> GType
-> GObject.InterfaceInfo.InterfaceInfo
-> m ()
typePluginCompleteInterfaceInfo :: a -> GType -> GType -> InterfaceInfo -> m ()
typePluginCompleteInterfaceInfo plugin :: a
plugin instanceType :: GType
instanceType interfaceType :: GType
interfaceType info :: InterfaceInfo
info = 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 TypePlugin
plugin' <- a -> IO (Ptr TypePlugin)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
plugin
let instanceType' :: CGType
instanceType' = GType -> CGType
gtypeToCGType GType
instanceType
let interfaceType' :: CGType
interfaceType' = GType -> CGType
gtypeToCGType GType
interfaceType
Ptr InterfaceInfo
info' <- InterfaceInfo -> IO (Ptr InterfaceInfo)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr InterfaceInfo
info
Ptr TypePlugin -> CGType -> CGType -> Ptr InterfaceInfo -> IO ()
g_type_plugin_complete_interface_info Ptr TypePlugin
plugin' CGType
instanceType' CGType
interfaceType' Ptr InterfaceInfo
info'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
plugin
InterfaceInfo -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr InterfaceInfo
info
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if ENABLE_OVERLOADING
data TypePluginCompleteInterfaceInfoMethodInfo
instance (signature ~ (GType -> GType -> GObject.InterfaceInfo.InterfaceInfo -> m ()), MonadIO m, IsTypePlugin a) => O.MethodInfo TypePluginCompleteInterfaceInfoMethodInfo a signature where
overloadedMethod _ = typePluginCompleteInterfaceInfo
#endif
foreign import ccall "g_type_plugin_complete_type_info" g_type_plugin_complete_type_info ::
Ptr TypePlugin ->
CGType ->
Ptr GObject.TypeInfo.TypeInfo ->
Ptr GObject.TypeValueTable.TypeValueTable ->
IO ()
typePluginCompleteTypeInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsTypePlugin a) =>
a
-> GType
-> GObject.TypeInfo.TypeInfo
-> GObject.TypeValueTable.TypeValueTable
-> m ()
typePluginCompleteTypeInfo :: a -> GType -> TypeInfo -> TypeValueTable -> m ()
typePluginCompleteTypeInfo plugin :: a
plugin gType :: GType
gType info :: TypeInfo
info valueTable :: TypeValueTable
valueTable = 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 TypePlugin
plugin' <- a -> IO (Ptr TypePlugin)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
plugin
let gType' :: CGType
gType' = GType -> CGType
gtypeToCGType GType
gType
Ptr TypeInfo
info' <- TypeInfo -> IO (Ptr TypeInfo)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TypeInfo
info
Ptr TypeValueTable
valueTable' <- TypeValueTable -> IO (Ptr TypeValueTable)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TypeValueTable
valueTable
Ptr TypePlugin
-> CGType -> Ptr TypeInfo -> Ptr TypeValueTable -> IO ()
g_type_plugin_complete_type_info Ptr TypePlugin
plugin' CGType
gType' Ptr TypeInfo
info' Ptr TypeValueTable
valueTable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
plugin
TypeInfo -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TypeInfo
info
TypeValueTable -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TypeValueTable
valueTable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if ENABLE_OVERLOADING
data TypePluginCompleteTypeInfoMethodInfo
instance (signature ~ (GType -> GObject.TypeInfo.TypeInfo -> GObject.TypeValueTable.TypeValueTable -> m ()), MonadIO m, IsTypePlugin a) => O.MethodInfo TypePluginCompleteTypeInfoMethodInfo a signature where
overloadedMethod _ = typePluginCompleteTypeInfo
#endif
foreign import ccall "g_type_plugin_unuse" g_type_plugin_unuse ::
Ptr TypePlugin ->
IO ()
typePluginUnuse ::
(B.CallStack.HasCallStack, MonadIO m, IsTypePlugin a) =>
a
-> m ()
typePluginUnuse :: a -> m ()
typePluginUnuse plugin :: a
plugin = 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 TypePlugin
plugin' <- a -> IO (Ptr TypePlugin)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
plugin
Ptr TypePlugin -> IO ()
g_type_plugin_unuse Ptr TypePlugin
plugin'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
plugin
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if ENABLE_OVERLOADING
data TypePluginUnuseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsTypePlugin a) => O.MethodInfo TypePluginUnuseMethodInfo a signature where
overloadedMethod _ = typePluginUnuse
#endif
foreign import ccall "g_type_plugin_use" g_type_plugin_use ::
Ptr TypePlugin ->
IO ()
typePluginUse ::
(B.CallStack.HasCallStack, MonadIO m, IsTypePlugin a) =>
a
-> m ()
typePluginUse :: a -> m ()
typePluginUse plugin :: a
plugin = 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 TypePlugin
plugin' <- a -> IO (Ptr TypePlugin)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
plugin
Ptr TypePlugin -> IO ()
g_type_plugin_use Ptr TypePlugin
plugin'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
plugin
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if ENABLE_OVERLOADING
data TypePluginUseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsTypePlugin a) => O.MethodInfo TypePluginUseMethodInfo a signature where
overloadedMethod _ = typePluginUse
#endif