{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.IOExtension
(
IOExtension(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveIOExtensionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
IOExtensionGetNameMethodInfo ,
#endif
iOExtensionGetName ,
#if defined(ENABLE_OVERLOADING)
IOExtensionGetPriorityMethodInfo ,
#endif
iOExtensionGetPriority ,
#if defined(ENABLE_OVERLOADING)
IOExtensionGetTypeMethodInfo ,
#endif
iOExtensionGetType ,
) 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 IOExtension = IOExtension (SP.ManagedPtr IOExtension)
deriving (IOExtension -> IOExtension -> Bool
(IOExtension -> IOExtension -> Bool)
-> (IOExtension -> IOExtension -> Bool) -> Eq IOExtension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IOExtension -> IOExtension -> Bool
== :: IOExtension -> IOExtension -> Bool
$c/= :: IOExtension -> IOExtension -> Bool
/= :: IOExtension -> IOExtension -> Bool
Eq)
instance SP.ManagedPtrNewtype IOExtension where
toManagedPtr :: IOExtension -> ManagedPtr IOExtension
toManagedPtr (IOExtension ManagedPtr IOExtension
p) = ManagedPtr IOExtension
p
instance BoxedPtr IOExtension where
boxedPtrCopy :: IOExtension -> IO IOExtension
boxedPtrCopy = IOExtension -> IO IOExtension
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: IOExtension -> IO ()
boxedPtrFree = \IOExtension
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IOExtension
type instance O.AttributeList IOExtension = IOExtensionAttributeList
type IOExtensionAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_io_extension_get_name" g_io_extension_get_name ::
Ptr IOExtension ->
IO CString
iOExtensionGetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOExtension
-> m T.Text
iOExtensionGetName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOExtension -> m Text
iOExtensionGetName IOExtension
extension = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
extension' <- IOExtension -> IO (Ptr IOExtension)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtension
extension
result <- g_io_extension_get_name extension'
checkUnexpectedReturnNULL "iOExtensionGetName" result
result' <- cstringToText result
touchManagedPtr extension
return result'
#if defined(ENABLE_OVERLOADING)
data IOExtensionGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod IOExtensionGetNameMethodInfo IOExtension signature where
overloadedMethod = iOExtensionGetName
instance O.OverloadedMethodInfo IOExtensionGetNameMethodInfo IOExtension where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.IOExtension.iOExtensionGetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-IOExtension.html#v:iOExtensionGetName"
})
#endif
foreign import ccall "g_io_extension_get_priority" g_io_extension_get_priority ::
Ptr IOExtension ->
IO Int32
iOExtensionGetPriority ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOExtension
-> m Int32
iOExtensionGetPriority :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOExtension -> m Int32
iOExtensionGetPriority IOExtension
extension = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
extension' <- IOExtension -> IO (Ptr IOExtension)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtension
extension
result <- g_io_extension_get_priority extension'
touchManagedPtr extension
return result
#if defined(ENABLE_OVERLOADING)
data IOExtensionGetPriorityMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod IOExtensionGetPriorityMethodInfo IOExtension signature where
overloadedMethod = iOExtensionGetPriority
instance O.OverloadedMethodInfo IOExtensionGetPriorityMethodInfo IOExtension where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.IOExtension.iOExtensionGetPriority",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-IOExtension.html#v:iOExtensionGetPriority"
})
#endif
foreign import ccall "g_io_extension_get_type" g_io_extension_get_type ::
Ptr IOExtension ->
IO CGType
iOExtensionGetType ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOExtension
-> m GType
iOExtensionGetType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOExtension -> m GType
iOExtensionGetType IOExtension
extension = IO GType -> m GType
forall a. IO a -> m a
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
extension' <- IOExtension -> IO (Ptr IOExtension)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOExtension
extension
result <- g_io_extension_get_type extension'
let result' = CGType -> GType
GType CGType
result
touchManagedPtr extension
return result'
#if defined(ENABLE_OVERLOADING)
data IOExtensionGetTypeMethodInfo
instance (signature ~ (m GType), MonadIO m) => O.OverloadedMethod IOExtensionGetTypeMethodInfo IOExtension signature where
overloadedMethod = iOExtensionGetType
instance O.OverloadedMethodInfo IOExtensionGetTypeMethodInfo IOExtension where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Structs.IOExtension.iOExtensionGetType",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Structs-IOExtension.html#v:iOExtensionGetType"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveIOExtensionMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveIOExtensionMethod "getName" o = IOExtensionGetNameMethodInfo
ResolveIOExtensionMethod "getPriority" o = IOExtensionGetPriorityMethodInfo
ResolveIOExtensionMethod "getType" o = IOExtensionGetTypeMethodInfo
ResolveIOExtensionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveIOExtensionMethod t IOExtension, O.OverloadedMethod info IOExtension p) => OL.IsLabel t (IOExtension -> 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 ~ ResolveIOExtensionMethod t IOExtension, O.OverloadedMethod info IOExtension p, R.HasField t IOExtension p) => R.HasField t IOExtension p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveIOExtensionMethod t IOExtension, O.OverloadedMethodInfo info IOExtension) => OL.IsLabel t (O.MethodProxy info IOExtension) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif