{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.UnixInputStream
(
UnixInputStream(..) ,
IsUnixInputStream ,
toUnixInputStream ,
noUnixInputStream ,
#if defined(ENABLE_OVERLOADING)
ResolveUnixInputStreamMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
UnixInputStreamGetCloseFdMethodInfo ,
#endif
unixInputStreamGetCloseFd ,
#if defined(ENABLE_OVERLOADING)
UnixInputStreamGetFdMethodInfo ,
#endif
unixInputStreamGetFd ,
unixInputStreamNew ,
#if defined(ENABLE_OVERLOADING)
UnixInputStreamSetCloseFdMethodInfo ,
#endif
unixInputStreamSetCloseFd ,
#if defined(ENABLE_OVERLOADING)
UnixInputStreamCloseFdPropertyInfo ,
#endif
constructUnixInputStreamCloseFd ,
getUnixInputStreamCloseFd ,
setUnixInputStreamCloseFd ,
#if defined(ENABLE_OVERLOADING)
unixInputStreamCloseFd ,
#endif
#if defined(ENABLE_OVERLOADING)
UnixInputStreamFdPropertyInfo ,
#endif
constructUnixInputStreamFd ,
getUnixInputStreamFd ,
#if defined(ENABLE_OVERLOADING)
unixInputStreamFd ,
#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.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 qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.FileDescriptorBased as Gio.FileDescriptorBased
import {-# SOURCE #-} qualified GI.Gio.Interfaces.PollableInputStream as Gio.PollableInputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
newtype UnixInputStream = UnixInputStream (ManagedPtr UnixInputStream)
deriving (Eq)
foreign import ccall "g_unix_input_stream_get_type"
c_g_unix_input_stream_get_type :: IO GType
instance GObject UnixInputStream where
gobjectType = c_g_unix_input_stream_get_type
instance B.GValue.IsGValue UnixInputStream where
toGValue o = do
gtype <- c_g_unix_input_stream_get_type
B.ManagedPtr.withManagedPtr o (B.GValue.buildGValue gtype B.GValue.set_object)
fromGValue gv = do
ptr <- B.GValue.get_object gv :: IO (Ptr UnixInputStream)
B.ManagedPtr.newObject UnixInputStream ptr
class (GObject o, O.IsDescendantOf UnixInputStream o) => IsUnixInputStream o
instance (GObject o, O.IsDescendantOf UnixInputStream o) => IsUnixInputStream o
instance O.HasParentTypes UnixInputStream
type instance O.ParentTypes UnixInputStream = '[Gio.InputStream.InputStream, GObject.Object.Object, Gio.FileDescriptorBased.FileDescriptorBased, Gio.PollableInputStream.PollableInputStream]
toUnixInputStream :: (MonadIO m, IsUnixInputStream o) => o -> m UnixInputStream
toUnixInputStream = liftIO . unsafeCastTo UnixInputStream
noUnixInputStream :: Maybe UnixInputStream
noUnixInputStream = Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveUnixInputStreamMethod (t :: Symbol) (o :: *) :: * where
ResolveUnixInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveUnixInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveUnixInputStreamMethod "canPoll" o = Gio.PollableInputStream.PollableInputStreamCanPollMethodInfo
ResolveUnixInputStreamMethod "clearPending" o = Gio.InputStream.InputStreamClearPendingMethodInfo
ResolveUnixInputStreamMethod "close" o = Gio.InputStream.InputStreamCloseMethodInfo
ResolveUnixInputStreamMethod "closeAsync" o = Gio.InputStream.InputStreamCloseAsyncMethodInfo
ResolveUnixInputStreamMethod "closeFinish" o = Gio.InputStream.InputStreamCloseFinishMethodInfo
ResolveUnixInputStreamMethod "createSource" o = Gio.PollableInputStream.PollableInputStreamCreateSourceMethodInfo
ResolveUnixInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveUnixInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveUnixInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveUnixInputStreamMethod "hasPending" o = Gio.InputStream.InputStreamHasPendingMethodInfo
ResolveUnixInputStreamMethod "isClosed" o = Gio.InputStream.InputStreamIsClosedMethodInfo
ResolveUnixInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveUnixInputStreamMethod "isReadable" o = Gio.PollableInputStream.PollableInputStreamIsReadableMethodInfo
ResolveUnixInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveUnixInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveUnixInputStreamMethod "read" o = Gio.InputStream.InputStreamReadMethodInfo
ResolveUnixInputStreamMethod "readAll" o = Gio.InputStream.InputStreamReadAllMethodInfo
ResolveUnixInputStreamMethod "readAllAsync" o = Gio.InputStream.InputStreamReadAllAsyncMethodInfo
ResolveUnixInputStreamMethod "readAllFinish" o = Gio.InputStream.InputStreamReadAllFinishMethodInfo
ResolveUnixInputStreamMethod "readAsync" o = Gio.InputStream.InputStreamReadAsyncMethodInfo
ResolveUnixInputStreamMethod "readBytes" o = Gio.InputStream.InputStreamReadBytesMethodInfo
ResolveUnixInputStreamMethod "readBytesAsync" o = Gio.InputStream.InputStreamReadBytesAsyncMethodInfo
ResolveUnixInputStreamMethod "readBytesFinish" o = Gio.InputStream.InputStreamReadBytesFinishMethodInfo
ResolveUnixInputStreamMethod "readFinish" o = Gio.InputStream.InputStreamReadFinishMethodInfo
ResolveUnixInputStreamMethod "readNonblocking" o = Gio.PollableInputStream.PollableInputStreamReadNonblockingMethodInfo
ResolveUnixInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveUnixInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveUnixInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveUnixInputStreamMethod "skip" o = Gio.InputStream.InputStreamSkipMethodInfo
ResolveUnixInputStreamMethod "skipAsync" o = Gio.InputStream.InputStreamSkipAsyncMethodInfo
ResolveUnixInputStreamMethod "skipFinish" o = Gio.InputStream.InputStreamSkipFinishMethodInfo
ResolveUnixInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveUnixInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveUnixInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveUnixInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveUnixInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveUnixInputStreamMethod "getCloseFd" o = UnixInputStreamGetCloseFdMethodInfo
ResolveUnixInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveUnixInputStreamMethod "getFd" o = UnixInputStreamGetFdMethodInfo
ResolveUnixInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveUnixInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveUnixInputStreamMethod "setCloseFd" o = UnixInputStreamSetCloseFdMethodInfo
ResolveUnixInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveUnixInputStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveUnixInputStreamMethod "setPending" o = Gio.InputStream.InputStreamSetPendingMethodInfo
ResolveUnixInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveUnixInputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveUnixInputStreamMethod t UnixInputStream, O.MethodInfo info UnixInputStream p) => OL.IsLabel t (UnixInputStream -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
getUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> m Bool
getUnixInputStreamCloseFd obj = liftIO $ B.Properties.getObjectPropertyBool obj "close-fd"
setUnixInputStreamCloseFd :: (MonadIO m, IsUnixInputStream o) => o -> Bool -> m ()
setUnixInputStreamCloseFd obj val = liftIO $ B.Properties.setObjectPropertyBool obj "close-fd" val
constructUnixInputStreamCloseFd :: (IsUnixInputStream o) => Bool -> IO (GValueConstruct o)
constructUnixInputStreamCloseFd val = B.Properties.constructObjectPropertyBool "close-fd" val
#if defined(ENABLE_OVERLOADING)
data UnixInputStreamCloseFdPropertyInfo
instance AttrInfo UnixInputStreamCloseFdPropertyInfo where
type AttrAllowedOps UnixInputStreamCloseFdPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint UnixInputStreamCloseFdPropertyInfo = IsUnixInputStream
type AttrSetTypeConstraint UnixInputStreamCloseFdPropertyInfo = (~) Bool
type AttrTransferTypeConstraint UnixInputStreamCloseFdPropertyInfo = (~) Bool
type AttrTransferType UnixInputStreamCloseFdPropertyInfo = Bool
type AttrGetType UnixInputStreamCloseFdPropertyInfo = Bool
type AttrLabel UnixInputStreamCloseFdPropertyInfo = "close-fd"
type AttrOrigin UnixInputStreamCloseFdPropertyInfo = UnixInputStream
attrGet = getUnixInputStreamCloseFd
attrSet = setUnixInputStreamCloseFd
attrTransfer _ v = do
return v
attrConstruct = constructUnixInputStreamCloseFd
attrClear = undefined
#endif
getUnixInputStreamFd :: (MonadIO m, IsUnixInputStream o) => o -> m Int32
getUnixInputStreamFd obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "fd"
constructUnixInputStreamFd :: (IsUnixInputStream o) => Int32 -> IO (GValueConstruct o)
constructUnixInputStreamFd val = B.Properties.constructObjectPropertyInt32 "fd" val
#if defined(ENABLE_OVERLOADING)
data UnixInputStreamFdPropertyInfo
instance AttrInfo UnixInputStreamFdPropertyInfo where
type AttrAllowedOps UnixInputStreamFdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint UnixInputStreamFdPropertyInfo = IsUnixInputStream
type AttrSetTypeConstraint UnixInputStreamFdPropertyInfo = (~) Int32
type AttrTransferTypeConstraint UnixInputStreamFdPropertyInfo = (~) Int32
type AttrTransferType UnixInputStreamFdPropertyInfo = Int32
type AttrGetType UnixInputStreamFdPropertyInfo = Int32
type AttrLabel UnixInputStreamFdPropertyInfo = "fd"
type AttrOrigin UnixInputStreamFdPropertyInfo = UnixInputStream
attrGet = getUnixInputStreamFd
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructUnixInputStreamFd
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList UnixInputStream
type instance O.AttributeList UnixInputStream = UnixInputStreamAttributeList
type UnixInputStreamAttributeList = ('[ '("closeFd", UnixInputStreamCloseFdPropertyInfo), '("fd", UnixInputStreamFdPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
unixInputStreamCloseFd :: AttrLabelProxy "closeFd"
unixInputStreamCloseFd = AttrLabelProxy
unixInputStreamFd :: AttrLabelProxy "fd"
unixInputStreamFd = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList UnixInputStream = UnixInputStreamSignalList
type UnixInputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_unix_input_stream_new" g_unix_input_stream_new ::
Int32 ->
CInt ->
IO (Ptr UnixInputStream)
unixInputStreamNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> Bool
-> m UnixInputStream
unixInputStreamNew fd closeFd = liftIO $ do
let closeFd' = (fromIntegral . fromEnum) closeFd
result <- g_unix_input_stream_new fd closeFd'
checkUnexpectedReturnNULL "unixInputStreamNew" result
result' <- (wrapObject UnixInputStream) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_unix_input_stream_get_close_fd" g_unix_input_stream_get_close_fd ::
Ptr UnixInputStream ->
IO CInt
unixInputStreamGetCloseFd ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixInputStream a) =>
a
-> m Bool
unixInputStreamGetCloseFd stream = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result <- g_unix_input_stream_get_close_fd stream'
let result' = (/= 0) result
touchManagedPtr stream
return result'
#if defined(ENABLE_OVERLOADING)
data UnixInputStreamGetCloseFdMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsUnixInputStream a) => O.MethodInfo UnixInputStreamGetCloseFdMethodInfo a signature where
overloadedMethod = unixInputStreamGetCloseFd
#endif
foreign import ccall "g_unix_input_stream_get_fd" g_unix_input_stream_get_fd ::
Ptr UnixInputStream ->
IO Int32
unixInputStreamGetFd ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixInputStream a) =>
a
-> m Int32
unixInputStreamGetFd stream = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result <- g_unix_input_stream_get_fd stream'
touchManagedPtr stream
return result
#if defined(ENABLE_OVERLOADING)
data UnixInputStreamGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsUnixInputStream a) => O.MethodInfo UnixInputStreamGetFdMethodInfo a signature where
overloadedMethod = unixInputStreamGetFd
#endif
foreign import ccall "g_unix_input_stream_set_close_fd" g_unix_input_stream_set_close_fd ::
Ptr UnixInputStream ->
CInt ->
IO ()
unixInputStreamSetCloseFd ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixInputStream a) =>
a
-> Bool
-> m ()
unixInputStreamSetCloseFd stream closeFd = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
let closeFd' = (fromIntegral . fromEnum) closeFd
g_unix_input_stream_set_close_fd stream' closeFd'
touchManagedPtr stream
return ()
#if defined(ENABLE_OVERLOADING)
data UnixInputStreamSetCloseFdMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsUnixInputStream a) => O.MethodInfo UnixInputStreamSetCloseFdMethodInfo a signature where
overloadedMethod = unixInputStreamSetCloseFd
#endif