{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.UnixPipe
(
UnixPipe(..) ,
newZeroUnixPipe ,
#if defined(ENABLE_OVERLOADING)
ResolveUnixPipeMethod ,
#endif
) 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 UnixPipe = UnixPipe (SP.ManagedPtr UnixPipe)
deriving (UnixPipe -> UnixPipe -> Bool
(UnixPipe -> UnixPipe -> Bool)
-> (UnixPipe -> UnixPipe -> Bool) -> Eq UnixPipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnixPipe -> UnixPipe -> Bool
== :: UnixPipe -> UnixPipe -> Bool
$c/= :: UnixPipe -> UnixPipe -> Bool
/= :: UnixPipe -> UnixPipe -> Bool
Eq)
instance SP.ManagedPtrNewtype UnixPipe where
toManagedPtr :: UnixPipe -> ManagedPtr UnixPipe
toManagedPtr (UnixPipe ManagedPtr UnixPipe
p) = ManagedPtr UnixPipe
p
instance BoxedPtr UnixPipe where
boxedPtrCopy :: UnixPipe -> IO UnixPipe
boxedPtrCopy = \UnixPipe
p -> UnixPipe -> (Ptr UnixPipe -> IO UnixPipe) -> IO UnixPipe
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr UnixPipe
p (Int -> Ptr UnixPipe -> IO (Ptr UnixPipe)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
8 (Ptr UnixPipe -> IO (Ptr UnixPipe))
-> (Ptr UnixPipe -> IO UnixPipe) -> Ptr UnixPipe -> IO UnixPipe
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr UnixPipe -> UnixPipe) -> Ptr UnixPipe -> IO UnixPipe
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr UnixPipe -> UnixPipe
UnixPipe)
boxedPtrFree :: UnixPipe -> IO ()
boxedPtrFree = \UnixPipe
x -> UnixPipe -> (Ptr UnixPipe -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr UnixPipe
x Ptr UnixPipe -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr UnixPipe where
boxedPtrCalloc :: IO (Ptr UnixPipe)
boxedPtrCalloc = Int -> IO (Ptr UnixPipe)
forall a. Int -> IO (Ptr a)
callocBytes Int
8
newZeroUnixPipe :: MonadIO m => m UnixPipe
newZeroUnixPipe :: forall (m :: * -> *). MonadIO m => m UnixPipe
newZeroUnixPipe = IO UnixPipe -> m UnixPipe
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixPipe -> m UnixPipe) -> IO UnixPipe -> m UnixPipe
forall a b. (a -> b) -> a -> b
$ IO (Ptr UnixPipe)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr UnixPipe) -> (Ptr UnixPipe -> IO UnixPipe) -> IO UnixPipe
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr UnixPipe -> UnixPipe) -> Ptr UnixPipe -> IO UnixPipe
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr UnixPipe -> UnixPipe
UnixPipe
instance tag ~ 'AttrSet => Constructible UnixPipe tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr UnixPipe -> UnixPipe)
-> [AttrOp UnixPipe tag] -> m UnixPipe
new ManagedPtr UnixPipe -> UnixPipe
_ [AttrOp UnixPipe tag]
attrs = do
UnixPipe
o <- m UnixPipe
forall (m :: * -> *). MonadIO m => m UnixPipe
newZeroUnixPipe
UnixPipe -> [AttrOp UnixPipe 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set UnixPipe
o [AttrOp UnixPipe tag]
[AttrOp UnixPipe 'AttrSet]
attrs
UnixPipe -> m UnixPipe
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return UnixPipe
o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList UnixPipe
type instance O.AttributeList UnixPipe = UnixPipeAttributeList
type UnixPipeAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveUnixPipeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveUnixPipeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveUnixPipeMethod t UnixPipe, O.OverloadedMethod info UnixPipe p) => OL.IsLabel t (UnixPipe -> 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 ~ ResolveUnixPipeMethod t UnixPipe, O.OverloadedMethod info UnixPipe p, R.HasField t UnixPipe p) => R.HasField t UnixPipe p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveUnixPipeMethod t UnixPipe, O.OverloadedMethodInfo info UnixPipe) => OL.IsLabel t (O.MethodProxy info UnixPipe) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif