{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.FileDescriptorBased
(
FileDescriptorBased(..) ,
IsFileDescriptorBased ,
toFileDescriptorBased ,
#if defined(ENABLE_OVERLOADING)
ResolveFileDescriptorBasedMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FileDescriptorBasedGetFdMethodInfo ,
#endif
fileDescriptorBasedGetFd ,
) 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.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 Control.Monad.IO.Class as MIO
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 qualified GI.GObject.Objects.Object as GObject.Object
newtype FileDescriptorBased = FileDescriptorBased (SP.ManagedPtr FileDescriptorBased)
deriving (FileDescriptorBased -> FileDescriptorBased -> Bool
(FileDescriptorBased -> FileDescriptorBased -> Bool)
-> (FileDescriptorBased -> FileDescriptorBased -> Bool)
-> Eq FileDescriptorBased
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileDescriptorBased -> FileDescriptorBased -> Bool
$c/= :: FileDescriptorBased -> FileDescriptorBased -> Bool
== :: FileDescriptorBased -> FileDescriptorBased -> Bool
$c== :: FileDescriptorBased -> FileDescriptorBased -> Bool
Eq)
instance SP.ManagedPtrNewtype FileDescriptorBased where
toManagedPtr :: FileDescriptorBased -> ManagedPtr FileDescriptorBased
toManagedPtr (FileDescriptorBased ManagedPtr FileDescriptorBased
p) = ManagedPtr FileDescriptorBased
p
foreign import ccall "g_file_descriptor_based_get_type"
c_g_file_descriptor_based_get_type :: IO B.Types.GType
instance B.Types.TypedObject FileDescriptorBased where
glibType :: IO GType
glibType = IO GType
c_g_file_descriptor_based_get_type
instance B.Types.GObject FileDescriptorBased
instance B.GValue.IsGValue FileDescriptorBased where
toGValue :: FileDescriptorBased -> IO GValue
toGValue FileDescriptorBased
o = do
GType
gtype <- IO GType
c_g_file_descriptor_based_get_type
FileDescriptorBased
-> (Ptr FileDescriptorBased -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FileDescriptorBased
o (GType
-> (GValue -> Ptr FileDescriptorBased -> IO ())
-> Ptr FileDescriptorBased
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr FileDescriptorBased -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO FileDescriptorBased
fromGValue GValue
gv = do
Ptr FileDescriptorBased
ptr <- GValue -> IO (Ptr FileDescriptorBased)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr FileDescriptorBased)
(ManagedPtr FileDescriptorBased -> FileDescriptorBased)
-> Ptr FileDescriptorBased -> IO FileDescriptorBased
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FileDescriptorBased -> FileDescriptorBased
FileDescriptorBased Ptr FileDescriptorBased
ptr
class (SP.GObject o, O.IsDescendantOf FileDescriptorBased o) => IsFileDescriptorBased o
instance (SP.GObject o, O.IsDescendantOf FileDescriptorBased o) => IsFileDescriptorBased o
instance O.HasParentTypes FileDescriptorBased
type instance O.ParentTypes FileDescriptorBased = '[GObject.Object.Object]
toFileDescriptorBased :: (MonadIO m, IsFileDescriptorBased o) => o -> m FileDescriptorBased
toFileDescriptorBased :: o -> m FileDescriptorBased
toFileDescriptorBased = IO FileDescriptorBased -> m FileDescriptorBased
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileDescriptorBased -> m FileDescriptorBased)
-> (o -> IO FileDescriptorBased) -> o -> m FileDescriptorBased
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FileDescriptorBased -> FileDescriptorBased)
-> o -> IO FileDescriptorBased
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr FileDescriptorBased -> FileDescriptorBased
FileDescriptorBased
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FileDescriptorBased
type instance O.AttributeList FileDescriptorBased = FileDescriptorBasedAttributeList
type FileDescriptorBasedAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveFileDescriptorBasedMethod (t :: Symbol) (o :: *) :: * where
ResolveFileDescriptorBasedMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileDescriptorBasedMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileDescriptorBasedMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileDescriptorBasedMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileDescriptorBasedMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileDescriptorBasedMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileDescriptorBasedMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileDescriptorBasedMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileDescriptorBasedMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileDescriptorBasedMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileDescriptorBasedMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileDescriptorBasedMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileDescriptorBasedMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileDescriptorBasedMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileDescriptorBasedMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileDescriptorBasedMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileDescriptorBasedMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileDescriptorBasedMethod "getFd" o = FileDescriptorBasedGetFdMethodInfo
ResolveFileDescriptorBasedMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileDescriptorBasedMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileDescriptorBasedMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileDescriptorBasedMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileDescriptorBasedMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileDescriptorBasedMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileDescriptorBasedMethod t FileDescriptorBased, O.MethodInfo info FileDescriptorBased p) => OL.IsLabel t (FileDescriptorBased -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
foreign import ccall "g_file_descriptor_based_get_fd" g_file_descriptor_based_get_fd ::
Ptr FileDescriptorBased ->
IO Int32
fileDescriptorBasedGetFd ::
(B.CallStack.HasCallStack, MonadIO m, IsFileDescriptorBased a) =>
a
-> m Int32
fileDescriptorBasedGetFd :: a -> m Int32
fileDescriptorBasedGetFd a
fdBased = IO Int32 -> m Int32
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
Ptr FileDescriptorBased
fdBased' <- a -> IO (Ptr FileDescriptorBased)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
fdBased
Int32
result <- Ptr FileDescriptorBased -> IO Int32
g_file_descriptor_based_get_fd Ptr FileDescriptorBased
fdBased'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
fdBased
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data FileDescriptorBasedGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsFileDescriptorBased a) => O.MethodInfo FileDescriptorBasedGetFdMethodInfo a signature where
overloadedMethod = fileDescriptorBasedGetFd
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FileDescriptorBased = FileDescriptorBasedSignalList
type FileDescriptorBasedSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif