{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.IOStream
(
IOStream(..) ,
IsIOStream ,
toIOStream ,
#if defined(ENABLE_OVERLOADING)
ResolveIOStreamMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
IOStreamClearPendingMethodInfo ,
#endif
iOStreamClearPending ,
#if defined(ENABLE_OVERLOADING)
IOStreamCloseMethodInfo ,
#endif
iOStreamClose ,
#if defined(ENABLE_OVERLOADING)
IOStreamCloseAsyncMethodInfo ,
#endif
iOStreamCloseAsync ,
#if defined(ENABLE_OVERLOADING)
IOStreamCloseFinishMethodInfo ,
#endif
iOStreamCloseFinish ,
#if defined(ENABLE_OVERLOADING)
IOStreamGetInputStreamMethodInfo ,
#endif
iOStreamGetInputStream ,
#if defined(ENABLE_OVERLOADING)
IOStreamGetOutputStreamMethodInfo ,
#endif
iOStreamGetOutputStream ,
#if defined(ENABLE_OVERLOADING)
IOStreamHasPendingMethodInfo ,
#endif
iOStreamHasPending ,
#if defined(ENABLE_OVERLOADING)
IOStreamIsClosedMethodInfo ,
#endif
iOStreamIsClosed ,
#if defined(ENABLE_OVERLOADING)
IOStreamSetPendingMethodInfo ,
#endif
iOStreamSetPending ,
#if defined(ENABLE_OVERLOADING)
IOStreamSpliceAsyncMethodInfo ,
#endif
iOStreamSpliceAsync ,
iOStreamSpliceFinish ,
#if defined(ENABLE_OVERLOADING)
IOStreamClosedPropertyInfo ,
#endif
getIOStreamClosed ,
#if defined(ENABLE_OVERLOADING)
iOStreamClosed ,
#endif
#if defined(ENABLE_OVERLOADING)
IOStreamInputStreamPropertyInfo ,
#endif
getIOStreamInputStream ,
#if defined(ENABLE_OVERLOADING)
iOStreamInputStream ,
#endif
#if defined(ENABLE_OVERLOADING)
IOStreamOutputStreamPropertyInfo ,
#endif
getIOStreamOutputStream ,
#if defined(ENABLE_OVERLOADING)
iOStreamOutputStream ,
#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)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
#endif
newtype IOStream = IOStream (SP.ManagedPtr IOStream)
deriving (IOStream -> IOStream -> Bool
(IOStream -> IOStream -> Bool)
-> (IOStream -> IOStream -> Bool) -> Eq IOStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IOStream -> IOStream -> Bool
== :: IOStream -> IOStream -> Bool
$c/= :: IOStream -> IOStream -> Bool
/= :: IOStream -> IOStream -> Bool
Eq)
instance SP.ManagedPtrNewtype IOStream where
toManagedPtr :: IOStream -> ManagedPtr IOStream
toManagedPtr (IOStream ManagedPtr IOStream
p) = ManagedPtr IOStream
p
foreign import ccall "g_io_stream_get_type"
c_g_io_stream_get_type :: IO B.Types.GType
instance B.Types.TypedObject IOStream where
glibType :: IO GType
glibType = IO GType
c_g_io_stream_get_type
instance B.Types.GObject IOStream
class (SP.GObject o, O.IsDescendantOf IOStream o) => IsIOStream o
instance (SP.GObject o, O.IsDescendantOf IOStream o) => IsIOStream o
instance O.HasParentTypes IOStream
type instance O.ParentTypes IOStream = '[GObject.Object.Object]
toIOStream :: (MIO.MonadIO m, IsIOStream o) => o -> m IOStream
toIOStream :: forall (m :: * -> *) o.
(MonadIO m, IsIOStream o) =>
o -> m IOStream
toIOStream = IO IOStream -> m IOStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO IOStream -> m IOStream)
-> (o -> IO IOStream) -> o -> m IOStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr IOStream -> IOStream) -> o -> IO IOStream
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr IOStream -> IOStream
IOStream
instance B.GValue.IsGValue (Maybe IOStream) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_io_stream_get_type
gvalueSet_ :: Ptr GValue -> Maybe IOStream -> IO ()
gvalueSet_ Ptr GValue
gv Maybe IOStream
P.Nothing = Ptr GValue -> Ptr IOStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr IOStream
forall a. Ptr a
FP.nullPtr :: FP.Ptr IOStream)
gvalueSet_ Ptr GValue
gv (P.Just IOStream
obj) = IOStream -> (Ptr IOStream -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr IOStream
obj (Ptr GValue -> Ptr IOStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe IOStream)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr IOStream)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr IOStream)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject IOStream ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveIOStreamMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveIOStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveIOStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveIOStreamMethod "clearPending" o = IOStreamClearPendingMethodInfo
ResolveIOStreamMethod "close" o = IOStreamCloseMethodInfo
ResolveIOStreamMethod "closeAsync" o = IOStreamCloseAsyncMethodInfo
ResolveIOStreamMethod "closeFinish" o = IOStreamCloseFinishMethodInfo
ResolveIOStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveIOStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveIOStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveIOStreamMethod "hasPending" o = IOStreamHasPendingMethodInfo
ResolveIOStreamMethod "isClosed" o = IOStreamIsClosedMethodInfo
ResolveIOStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveIOStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveIOStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveIOStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveIOStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveIOStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveIOStreamMethod "spliceAsync" o = IOStreamSpliceAsyncMethodInfo
ResolveIOStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveIOStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveIOStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveIOStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveIOStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveIOStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveIOStreamMethod "getInputStream" o = IOStreamGetInputStreamMethodInfo
ResolveIOStreamMethod "getOutputStream" o = IOStreamGetOutputStreamMethodInfo
ResolveIOStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveIOStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveIOStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveIOStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveIOStreamMethod "setPending" o = IOStreamSetPendingMethodInfo
ResolveIOStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveIOStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveIOStreamMethod t IOStream, O.OverloadedMethod info IOStream p) => OL.IsLabel t (IOStream -> 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 ~ ResolveIOStreamMethod t IOStream, O.OverloadedMethod info IOStream p, R.HasField t IOStream p) => R.HasField t IOStream p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveIOStreamMethod t IOStream, O.OverloadedMethodInfo info IOStream) => OL.IsLabel t (O.MethodProxy info IOStream) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getIOStreamClosed :: (MonadIO m, IsIOStream o) => o -> m Bool
getIOStreamClosed :: forall (m :: * -> *) o. (MonadIO m, IsIOStream o) => o -> m Bool
getIOStreamClosed o
obj = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj String
"closed"
#if defined(ENABLE_OVERLOADING)
data IOStreamClosedPropertyInfo
instance AttrInfo IOStreamClosedPropertyInfo where
type AttrAllowedOps IOStreamClosedPropertyInfo = '[ 'AttrGet]
type AttrBaseTypeConstraint IOStreamClosedPropertyInfo = IsIOStream
type AttrSetTypeConstraint IOStreamClosedPropertyInfo = (~) ()
type AttrTransferTypeConstraint IOStreamClosedPropertyInfo = (~) ()
type AttrTransferType IOStreamClosedPropertyInfo = ()
type AttrGetType IOStreamClosedPropertyInfo = Bool
type AttrLabel IOStreamClosedPropertyInfo = "closed"
type AttrOrigin IOStreamClosedPropertyInfo = IOStream
attrGet = getIOStreamClosed
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.closed"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#g:attr:closed"
})
#endif
getIOStreamInputStream :: (MonadIO m, IsIOStream o) => o -> m Gio.InputStream.InputStream
getIOStreamInputStream :: forall (m :: * -> *) o.
(MonadIO m, IsIOStream o) =>
o -> m InputStream
getIOStreamInputStream o
obj = IO InputStream -> m InputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO InputStream -> m InputStream)
-> IO InputStream -> m InputStream
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe InputStream) -> IO InputStream
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getIOStreamInputStream" (IO (Maybe InputStream) -> IO InputStream)
-> IO (Maybe InputStream) -> IO InputStream
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr InputStream -> InputStream)
-> IO (Maybe InputStream)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"input-stream" ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream
#if defined(ENABLE_OVERLOADING)
data IOStreamInputStreamPropertyInfo
instance AttrInfo IOStreamInputStreamPropertyInfo where
type AttrAllowedOps IOStreamInputStreamPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint IOStreamInputStreamPropertyInfo = IsIOStream
type AttrSetTypeConstraint IOStreamInputStreamPropertyInfo = (~) ()
type AttrTransferTypeConstraint IOStreamInputStreamPropertyInfo = (~) ()
type AttrTransferType IOStreamInputStreamPropertyInfo = ()
type AttrGetType IOStreamInputStreamPropertyInfo = Gio.InputStream.InputStream
type AttrLabel IOStreamInputStreamPropertyInfo = "input-stream"
type AttrOrigin IOStreamInputStreamPropertyInfo = IOStream
attrGet = getIOStreamInputStream
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.inputStream"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#g:attr:inputStream"
})
#endif
getIOStreamOutputStream :: (MonadIO m, IsIOStream o) => o -> m Gio.OutputStream.OutputStream
getIOStreamOutputStream :: forall (m :: * -> *) o.
(MonadIO m, IsIOStream o) =>
o -> m OutputStream
getIOStreamOutputStream o
obj = IO OutputStream -> m OutputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO OutputStream -> m OutputStream)
-> IO OutputStream -> m OutputStream
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe OutputStream) -> IO OutputStream
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getIOStreamOutputStream" (IO (Maybe OutputStream) -> IO OutputStream)
-> IO (Maybe OutputStream) -> IO OutputStream
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr OutputStream -> OutputStream)
-> IO (Maybe OutputStream)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"output-stream" ManagedPtr OutputStream -> OutputStream
Gio.OutputStream.OutputStream
#if defined(ENABLE_OVERLOADING)
data IOStreamOutputStreamPropertyInfo
instance AttrInfo IOStreamOutputStreamPropertyInfo where
type AttrAllowedOps IOStreamOutputStreamPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint IOStreamOutputStreamPropertyInfo = IsIOStream
type AttrSetTypeConstraint IOStreamOutputStreamPropertyInfo = (~) ()
type AttrTransferTypeConstraint IOStreamOutputStreamPropertyInfo = (~) ()
type AttrTransferType IOStreamOutputStreamPropertyInfo = ()
type AttrGetType IOStreamOutputStreamPropertyInfo = Gio.OutputStream.OutputStream
type AttrLabel IOStreamOutputStreamPropertyInfo = "output-stream"
type AttrOrigin IOStreamOutputStreamPropertyInfo = IOStream
attrGet = getIOStreamOutputStream
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.outputStream"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#g:attr:outputStream"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IOStream
type instance O.AttributeList IOStream = IOStreamAttributeList
type IOStreamAttributeList = ('[ '("closed", IOStreamClosedPropertyInfo), '("inputStream", IOStreamInputStreamPropertyInfo), '("outputStream", IOStreamOutputStreamPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
iOStreamClosed :: AttrLabelProxy "closed"
iOStreamClosed = AttrLabelProxy
iOStreamInputStream :: AttrLabelProxy "inputStream"
iOStreamInputStream = AttrLabelProxy
iOStreamOutputStream :: AttrLabelProxy "outputStream"
iOStreamOutputStream = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList IOStream = IOStreamSignalList
type IOStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_io_stream_clear_pending" g_io_stream_clear_pending ::
Ptr IOStream ->
IO ()
iOStreamClearPending ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m ()
iOStreamClearPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m ()
iOStreamClearPending a
stream = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
g_io_stream_clear_pending stream'
touchManagedPtr stream
return ()
#if defined(ENABLE_OVERLOADING)
data IOStreamClearPendingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamClearPendingMethodInfo a signature where
overloadedMethod = iOStreamClearPending
instance O.OverloadedMethodInfo IOStreamClearPendingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamClearPending",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamClearPending"
})
#endif
foreign import ccall "g_io_stream_close" g_io_stream_close ::
Ptr IOStream ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
iOStreamClose ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
iOStreamClose :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsIOStream a, IsCancellable b) =>
a -> Maybe b -> m ()
iOStreamClose a
stream Maybe b
cancellable = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_io_stream_close stream' maybeCancellable
touchManagedPtr stream
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOStreamCloseMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsIOStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod IOStreamCloseMethodInfo a signature where
overloadedMethod = iOStreamClose
instance O.OverloadedMethodInfo IOStreamCloseMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamClose",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamClose"
})
#endif
foreign import ccall "g_io_stream_close_async" g_io_stream_close_async ::
Ptr IOStream ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
iOStreamCloseAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
iOStreamCloseAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsIOStream a, IsCancellable b) =>
a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
iOStreamCloseAsync a
stream Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_io_stream_close_async stream' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data IOStreamCloseAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsIOStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod IOStreamCloseAsyncMethodInfo a signature where
overloadedMethod = iOStreamCloseAsync
instance O.OverloadedMethodInfo IOStreamCloseAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamCloseAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamCloseAsync"
})
#endif
foreign import ccall "g_io_stream_close_finish" g_io_stream_close_finish ::
Ptr IOStream ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
iOStreamCloseFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
iOStreamCloseFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsIOStream a, IsAsyncResult b) =>
a -> b -> m ()
iOStreamCloseFinish a
stream b
result_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_io_stream_close_finish stream' result_'
touchManagedPtr stream
touchManagedPtr result_
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOStreamCloseFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsIOStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod IOStreamCloseFinishMethodInfo a signature where
overloadedMethod = iOStreamCloseFinish
instance O.OverloadedMethodInfo IOStreamCloseFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamCloseFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamCloseFinish"
})
#endif
foreign import ccall "g_io_stream_get_input_stream" g_io_stream_get_input_stream ::
Ptr IOStream ->
IO (Ptr Gio.InputStream.InputStream)
iOStreamGetInputStream ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m Gio.InputStream.InputStream
iOStreamGetInputStream :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m InputStream
iOStreamGetInputStream a
stream = IO InputStream -> m InputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InputStream -> m InputStream)
-> IO InputStream -> m InputStream
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result <- g_io_stream_get_input_stream stream'
checkUnexpectedReturnNULL "iOStreamGetInputStream" result
result' <- (newObject Gio.InputStream.InputStream) result
touchManagedPtr stream
return result'
#if defined(ENABLE_OVERLOADING)
data IOStreamGetInputStreamMethodInfo
instance (signature ~ (m Gio.InputStream.InputStream), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamGetInputStreamMethodInfo a signature where
overloadedMethod = iOStreamGetInputStream
instance O.OverloadedMethodInfo IOStreamGetInputStreamMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamGetInputStream",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamGetInputStream"
})
#endif
foreign import ccall "g_io_stream_get_output_stream" g_io_stream_get_output_stream ::
Ptr IOStream ->
IO (Ptr Gio.OutputStream.OutputStream)
iOStreamGetOutputStream ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m Gio.OutputStream.OutputStream
iOStreamGetOutputStream :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m OutputStream
iOStreamGetOutputStream a
stream = IO OutputStream -> m OutputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO OutputStream -> m OutputStream)
-> IO OutputStream -> m OutputStream
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result <- g_io_stream_get_output_stream stream'
checkUnexpectedReturnNULL "iOStreamGetOutputStream" result
result' <- (newObject Gio.OutputStream.OutputStream) result
touchManagedPtr stream
return result'
#if defined(ENABLE_OVERLOADING)
data IOStreamGetOutputStreamMethodInfo
instance (signature ~ (m Gio.OutputStream.OutputStream), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamGetOutputStreamMethodInfo a signature where
overloadedMethod = iOStreamGetOutputStream
instance O.OverloadedMethodInfo IOStreamGetOutputStreamMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamGetOutputStream",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamGetOutputStream"
})
#endif
foreign import ccall "g_io_stream_has_pending" g_io_stream_has_pending ::
Ptr IOStream ->
IO CInt
iOStreamHasPending ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m Bool
iOStreamHasPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m Bool
iOStreamHasPending a
stream = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result <- g_io_stream_has_pending stream'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr stream
return result'
#if defined(ENABLE_OVERLOADING)
data IOStreamHasPendingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamHasPendingMethodInfo a signature where
overloadedMethod = iOStreamHasPending
instance O.OverloadedMethodInfo IOStreamHasPendingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamHasPending",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamHasPending"
})
#endif
foreign import ccall "g_io_stream_is_closed" g_io_stream_is_closed ::
Ptr IOStream ->
IO CInt
iOStreamIsClosed ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m Bool
iOStreamIsClosed :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m Bool
iOStreamIsClosed a
stream = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result <- g_io_stream_is_closed stream'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr stream
return result'
#if defined(ENABLE_OVERLOADING)
data IOStreamIsClosedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamIsClosedMethodInfo a signature where
overloadedMethod = iOStreamIsClosed
instance O.OverloadedMethodInfo IOStreamIsClosedMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamIsClosed",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamIsClosed"
})
#endif
foreign import ccall "g_io_stream_set_pending" g_io_stream_set_pending ::
Ptr IOStream ->
Ptr (Ptr GError) ->
IO CInt
iOStreamSetPending ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a) =>
a
-> m ()
iOStreamSetPending :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIOStream a) =>
a -> m ()
iOStreamSetPending a
stream = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
onException (do
_ <- propagateGError $ g_io_stream_set_pending stream'
touchManagedPtr stream
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOStreamSetPendingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsIOStream a) => O.OverloadedMethod IOStreamSetPendingMethodInfo a signature where
overloadedMethod = iOStreamSetPending
instance O.OverloadedMethodInfo IOStreamSetPendingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamSetPending",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamSetPending"
})
#endif
foreign import ccall "g_io_stream_splice_async" g_io_stream_splice_async ::
Ptr IOStream ->
Ptr IOStream ->
CUInt ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
iOStreamSpliceAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsIOStream a, IsIOStream b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> [Gio.Flags.IOStreamSpliceFlags]
-> Int32
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
iOStreamSpliceAsync :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsIOStream a, IsIOStream b,
IsCancellable c) =>
a
-> b
-> [IOStreamSpliceFlags]
-> Int32
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
iOStreamSpliceAsync a
stream1 b
stream2 [IOStreamSpliceFlags]
flags Int32
ioPriority Maybe c
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream1' <- a -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream1
stream2' <- unsafeManagedPtrCastPtr stream2
let flags' = [IOStreamSpliceFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOStreamSpliceFlags]
flags
maybeCancellable <- case cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just c
jCancellable -> do
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_io_stream_splice_async stream1' stream2' flags' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream1
touchManagedPtr stream2
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data IOStreamSpliceAsyncMethodInfo
instance (signature ~ (b -> [Gio.Flags.IOStreamSpliceFlags] -> Int32 -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsIOStream a, IsIOStream b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod IOStreamSpliceAsyncMethodInfo a signature where
overloadedMethod = iOStreamSpliceAsync
instance O.OverloadedMethodInfo IOStreamSpliceAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.IOStream.iOStreamSpliceAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-IOStream.html#v:iOStreamSpliceAsync"
})
#endif
foreign import ccall "g_io_stream_splice_finish" g_io_stream_splice_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
iOStreamSpliceFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m ()
iOStreamSpliceFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m ()
iOStreamSpliceFinish a
result_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
result_' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
result_
onException (do
_ <- propagateGError $ g_io_stream_splice_finish result_'
touchManagedPtr result_
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif