{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.IOChannel
(
IOChannel(..) ,
newZeroIOChannel ,
#if defined(ENABLE_OVERLOADING)
ResolveIOChannelMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
IOChannelCloseMethodInfo ,
#endif
iOChannelClose ,
iOChannelErrorFromErrno ,
iOChannelErrorQuark ,
#if defined(ENABLE_OVERLOADING)
IOChannelFlushMethodInfo ,
#endif
iOChannelFlush ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetBufferConditionMethodInfo ,
#endif
iOChannelGetBufferCondition ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetBufferSizeMethodInfo ,
#endif
iOChannelGetBufferSize ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetBufferedMethodInfo ,
#endif
iOChannelGetBuffered ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetCloseOnUnrefMethodInfo ,
#endif
iOChannelGetCloseOnUnref ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetEncodingMethodInfo ,
#endif
iOChannelGetEncoding ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetFlagsMethodInfo ,
#endif
iOChannelGetFlags ,
#if defined(ENABLE_OVERLOADING)
IOChannelGetLineTermMethodInfo ,
#endif
iOChannelGetLineTerm ,
#if defined(ENABLE_OVERLOADING)
IOChannelInitMethodInfo ,
#endif
iOChannelInit ,
iOChannelNewFile ,
#if defined(ENABLE_OVERLOADING)
IOChannelReadMethodInfo ,
#endif
iOChannelRead ,
#if defined(ENABLE_OVERLOADING)
IOChannelReadCharsMethodInfo ,
#endif
iOChannelReadChars ,
#if defined(ENABLE_OVERLOADING)
IOChannelReadLineMethodInfo ,
#endif
iOChannelReadLine ,
#if defined(ENABLE_OVERLOADING)
IOChannelReadToEndMethodInfo ,
#endif
iOChannelReadToEnd ,
#if defined(ENABLE_OVERLOADING)
IOChannelReadUnicharMethodInfo ,
#endif
iOChannelReadUnichar ,
#if defined(ENABLE_OVERLOADING)
IOChannelRefMethodInfo ,
#endif
iOChannelRef ,
#if defined(ENABLE_OVERLOADING)
IOChannelSeekMethodInfo ,
#endif
iOChannelSeek ,
#if defined(ENABLE_OVERLOADING)
IOChannelSeekPositionMethodInfo ,
#endif
iOChannelSeekPosition ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetBufferSizeMethodInfo ,
#endif
iOChannelSetBufferSize ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetBufferedMethodInfo ,
#endif
iOChannelSetBuffered ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetCloseOnUnrefMethodInfo ,
#endif
iOChannelSetCloseOnUnref ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetEncodingMethodInfo ,
#endif
iOChannelSetEncoding ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetFlagsMethodInfo ,
#endif
iOChannelSetFlags ,
#if defined(ENABLE_OVERLOADING)
IOChannelSetLineTermMethodInfo ,
#endif
iOChannelSetLineTerm ,
#if defined(ENABLE_OVERLOADING)
IOChannelShutdownMethodInfo ,
#endif
iOChannelShutdown ,
#if defined(ENABLE_OVERLOADING)
IOChannelUnixGetFdMethodInfo ,
#endif
iOChannelUnixGetFd ,
iOChannelUnixNew ,
#if defined(ENABLE_OVERLOADING)
IOChannelUnrefMethodInfo ,
#endif
iOChannelUnref ,
#if defined(ENABLE_OVERLOADING)
IOChannelWriteMethodInfo ,
#endif
iOChannelWrite ,
#if defined(ENABLE_OVERLOADING)
IOChannelWriteCharsMethodInfo ,
#endif
iOChannelWriteChars ,
#if defined(ENABLE_OVERLOADING)
IOChannelWriteUnicharMethodInfo ,
#endif
iOChannelWriteUnichar ,
) 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.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.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 {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
newtype IOChannel = IOChannel (SP.ManagedPtr IOChannel)
deriving (IOChannel -> IOChannel -> Bool
(IOChannel -> IOChannel -> Bool)
-> (IOChannel -> IOChannel -> Bool) -> Eq IOChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IOChannel -> IOChannel -> Bool
$c/= :: IOChannel -> IOChannel -> Bool
== :: IOChannel -> IOChannel -> Bool
$c== :: IOChannel -> IOChannel -> Bool
Eq)
instance SP.ManagedPtrNewtype IOChannel where
toManagedPtr :: IOChannel -> ManagedPtr IOChannel
toManagedPtr (IOChannel ManagedPtr IOChannel
p) = ManagedPtr IOChannel
p
foreign import ccall "g_io_channel_get_type" c_g_io_channel_get_type ::
IO GType
type instance O.ParentTypes IOChannel = '[]
instance O.HasParentTypes IOChannel
instance B.Types.TypedObject IOChannel where
glibType :: IO GType
glibType = IO GType
c_g_io_channel_get_type
instance B.Types.GBoxed IOChannel
instance B.GValue.IsGValue (Maybe IOChannel) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_io_channel_get_type
gvalueSet_ :: Ptr GValue -> Maybe IOChannel -> IO ()
gvalueSet_ Ptr GValue
gv Maybe IOChannel
P.Nothing = Ptr GValue -> Ptr IOChannel -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr IOChannel
forall a. Ptr a
FP.nullPtr :: FP.Ptr IOChannel)
gvalueSet_ Ptr GValue
gv (P.Just IOChannel
obj) = IOChannel -> (Ptr IOChannel -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr IOChannel
obj (Ptr GValue -> Ptr IOChannel -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe IOChannel)
gvalueGet_ Ptr GValue
gv = do
Ptr IOChannel
ptr <- Ptr GValue -> IO (Ptr IOChannel)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr IOChannel)
if Ptr IOChannel
ptr Ptr IOChannel -> Ptr IOChannel -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr IOChannel
forall a. Ptr a
FP.nullPtr
then IOChannel -> Maybe IOChannel
forall a. a -> Maybe a
P.Just (IOChannel -> Maybe IOChannel)
-> IO IOChannel -> IO (Maybe IOChannel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr IOChannel -> IOChannel)
-> Ptr IOChannel -> IO IOChannel
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr IOChannel -> IOChannel
IOChannel Ptr IOChannel
ptr
else Maybe IOChannel -> IO (Maybe IOChannel)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe IOChannel
forall a. Maybe a
P.Nothing
newZeroIOChannel :: MonadIO m => m IOChannel
newZeroIOChannel :: forall (m :: * -> *). MonadIO m => m IOChannel
newZeroIOChannel = IO IOChannel -> m IOChannel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOChannel -> m IOChannel) -> IO IOChannel -> m IOChannel
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr IOChannel)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
136 IO (Ptr IOChannel)
-> (Ptr IOChannel -> IO IOChannel) -> IO IOChannel
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr IOChannel -> IOChannel)
-> Ptr IOChannel -> IO IOChannel
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr IOChannel -> IOChannel
IOChannel
instance tag ~ 'AttrSet => Constructible IOChannel tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr IOChannel -> IOChannel)
-> [AttrOp IOChannel tag] -> m IOChannel
new ManagedPtr IOChannel -> IOChannel
_ [AttrOp IOChannel tag]
attrs = do
IOChannel
o <- m IOChannel
forall (m :: * -> *). MonadIO m => m IOChannel
newZeroIOChannel
IOChannel -> [AttrOp IOChannel 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set IOChannel
o [AttrOp IOChannel tag]
[AttrOp IOChannel 'AttrSet]
attrs
IOChannel -> m IOChannel
forall (m :: * -> *) a. Monad m => a -> m a
return IOChannel
o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IOChannel
type instance O.AttributeList IOChannel = IOChannelAttributeList
type IOChannelAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_io_channel_new_file" g_io_channel_new_file ::
CString ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr IOChannel)
iOChannelNewFile ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> T.Text
-> m IOChannel
iOChannelNewFile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Char] -> Text -> m IOChannel
iOChannelNewFile [Char]
filename Text
mode = IO IOChannel -> m IOChannel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOChannel -> m IOChannel) -> IO IOChannel -> m IOChannel
forall a b. (a -> b) -> a -> b
$ do
CString
filename' <- [Char] -> IO CString
stringToCString [Char]
filename
CString
mode' <- Text -> IO CString
textToCString Text
mode
IO IOChannel -> IO () -> IO IOChannel
forall a b. IO a -> IO b -> IO a
onException (do
Ptr IOChannel
result <- (Ptr (Ptr GError) -> IO (Ptr IOChannel)) -> IO (Ptr IOChannel)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr IOChannel)) -> IO (Ptr IOChannel))
-> (Ptr (Ptr GError) -> IO (Ptr IOChannel)) -> IO (Ptr IOChannel)
forall a b. (a -> b) -> a -> b
$ CString -> CString -> Ptr (Ptr GError) -> IO (Ptr IOChannel)
g_io_channel_new_file CString
filename' CString
mode'
Text -> Ptr IOChannel -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"iOChannelNewFile" Ptr IOChannel
result
IOChannel
result' <- ((ManagedPtr IOChannel -> IOChannel)
-> Ptr IOChannel -> IO IOChannel
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr IOChannel -> IOChannel
IOChannel) Ptr IOChannel
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mode'
IOChannel -> IO IOChannel
forall (m :: * -> *) a. Monad m => a -> m a
return IOChannel
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mode'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_io_channel_unix_new" g_io_channel_unix_new ::
Int32 ->
IO (Ptr IOChannel)
iOChannelUnixNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m IOChannel
iOChannelUnixNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m IOChannel
iOChannelUnixNew Int32
fd = IO IOChannel -> m IOChannel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOChannel -> m IOChannel) -> IO IOChannel -> m IOChannel
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
result <- Int32 -> IO (Ptr IOChannel)
g_io_channel_unix_new Int32
fd
Text -> Ptr IOChannel -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"iOChannelUnixNew" Ptr IOChannel
result
IOChannel
result' <- ((ManagedPtr IOChannel -> IOChannel)
-> Ptr IOChannel -> IO IOChannel
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr IOChannel -> IOChannel
IOChannel) Ptr IOChannel
result
IOChannel -> IO IOChannel
forall (m :: * -> *) a. Monad m => a -> m a
return IOChannel
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_io_channel_close" g_io_channel_close ::
Ptr IOChannel ->
IO ()
{-# DEPRECATED iOChannelClose ["(Since version 2.2)","Use 'GI.GLib.Structs.IOChannel.iOChannelShutdown' instead."] #-}
iOChannelClose ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ()
iOChannelClose :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m ()
iOChannelClose IOChannel
channel = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr IOChannel -> IO ()
g_io_channel_close Ptr IOChannel
channel'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelCloseMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod IOChannelCloseMethodInfo IOChannel signature where
overloadedMethod = iOChannelClose
instance O.OverloadedMethodInfo IOChannelCloseMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelClose",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelClose"
})
#endif
foreign import ccall "g_io_channel_flush" g_io_channel_flush ::
Ptr IOChannel ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelFlush ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m GLib.Enums.IOStatus
iOChannelFlush :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m IOStatus
iOChannelFlush IOChannel
channel = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_flush Ptr IOChannel
channel'
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOChannelFlushMethodInfo
instance (signature ~ (m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelFlushMethodInfo IOChannel signature where
overloadedMethod = iOChannelFlush
instance O.OverloadedMethodInfo IOChannelFlushMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelFlush",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelFlush"
})
#endif
foreign import ccall "g_io_channel_get_buffer_condition" g_io_channel_get_buffer_condition ::
Ptr IOChannel ->
IO CUInt
iOChannelGetBufferCondition ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m [GLib.Flags.IOCondition]
iOChannelGetBufferCondition :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m [IOCondition]
iOChannelGetBufferCondition IOChannel
channel = IO [IOCondition] -> m [IOCondition]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [IOCondition] -> m [IOCondition])
-> IO [IOCondition] -> m [IOCondition]
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CUInt
result <- Ptr IOChannel -> IO CUInt
g_io_channel_get_buffer_condition Ptr IOChannel
channel'
let result' :: [IOCondition]
result' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
[IOCondition] -> IO [IOCondition]
forall (m :: * -> *) a. Monad m => a -> m a
return [IOCondition]
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetBufferConditionMethodInfo
instance (signature ~ (m [GLib.Flags.IOCondition]), MonadIO m) => O.OverloadedMethod IOChannelGetBufferConditionMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetBufferCondition
instance O.OverloadedMethodInfo IOChannelGetBufferConditionMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetBufferCondition",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetBufferCondition"
})
#endif
foreign import ccall "g_io_channel_get_buffer_size" g_io_channel_get_buffer_size ::
Ptr IOChannel ->
IO Word64
iOChannelGetBufferSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m Word64
iOChannelGetBufferSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m Word64
iOChannelGetBufferSize IOChannel
channel = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Word64
result <- Ptr IOChannel -> IO Word64
g_io_channel_get_buffer_size Ptr IOChannel
channel'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result
#if defined(ENABLE_OVERLOADING)
data IOChannelGetBufferSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.OverloadedMethod IOChannelGetBufferSizeMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetBufferSize
instance O.OverloadedMethodInfo IOChannelGetBufferSizeMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetBufferSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetBufferSize"
})
#endif
foreign import ccall "g_io_channel_get_buffered" g_io_channel_get_buffered ::
Ptr IOChannel ->
IO CInt
iOChannelGetBuffered ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m Bool
iOChannelGetBuffered :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m Bool
iOChannelGetBuffered IOChannel
channel = IO Bool -> m Bool
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
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CInt
result <- Ptr IOChannel -> IO CInt
g_io_channel_get_buffered Ptr IOChannel
channel'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetBufferedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod IOChannelGetBufferedMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetBuffered
instance O.OverloadedMethodInfo IOChannelGetBufferedMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetBuffered",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetBuffered"
})
#endif
foreign import ccall "g_io_channel_get_close_on_unref" g_io_channel_get_close_on_unref ::
Ptr IOChannel ->
IO CInt
iOChannelGetCloseOnUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m Bool
iOChannelGetCloseOnUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m Bool
iOChannelGetCloseOnUnref IOChannel
channel = IO Bool -> m Bool
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
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CInt
result <- Ptr IOChannel -> IO CInt
g_io_channel_get_close_on_unref Ptr IOChannel
channel'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetCloseOnUnrefMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod IOChannelGetCloseOnUnrefMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetCloseOnUnref
instance O.OverloadedMethodInfo IOChannelGetCloseOnUnrefMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetCloseOnUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetCloseOnUnref"
})
#endif
foreign import ccall "g_io_channel_get_encoding" g_io_channel_get_encoding ::
Ptr IOChannel ->
IO CString
iOChannelGetEncoding ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m T.Text
iOChannelGetEncoding :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m Text
iOChannelGetEncoding IOChannel
channel = IO Text -> m Text
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
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
result <- Ptr IOChannel -> IO CString
g_io_channel_get_encoding Ptr IOChannel
channel'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"iOChannelGetEncoding" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetEncodingMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod IOChannelGetEncodingMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetEncoding
instance O.OverloadedMethodInfo IOChannelGetEncodingMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetEncoding",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetEncoding"
})
#endif
foreign import ccall "g_io_channel_get_flags" g_io_channel_get_flags ::
Ptr IOChannel ->
IO CUInt
iOChannelGetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m [GLib.Flags.IOFlags]
iOChannelGetFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m [IOFlags]
iOChannelGetFlags IOChannel
channel = IO [IOFlags] -> m [IOFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [IOFlags] -> m [IOFlags]) -> IO [IOFlags] -> m [IOFlags]
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CUInt
result <- Ptr IOChannel -> IO CUInt
g_io_channel_get_flags Ptr IOChannel
channel'
let result' :: [IOFlags]
result' = CUInt -> [IOFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
[IOFlags] -> IO [IOFlags]
forall (m :: * -> *) a. Monad m => a -> m a
return [IOFlags]
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetFlagsMethodInfo
instance (signature ~ (m [GLib.Flags.IOFlags]), MonadIO m) => O.OverloadedMethod IOChannelGetFlagsMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetFlags
instance O.OverloadedMethodInfo IOChannelGetFlagsMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetFlags",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetFlags"
})
#endif
foreign import ccall "g_io_channel_get_line_term" g_io_channel_get_line_term ::
Ptr IOChannel ->
Int32 ->
IO CString
iOChannelGetLineTerm ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Int32
-> m T.Text
iOChannelGetLineTerm :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Int32 -> m Text
iOChannelGetLineTerm IOChannel
channel Int32
length_ = IO Text -> m Text
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
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
result <- Ptr IOChannel -> Int32 -> IO CString
g_io_channel_get_line_term Ptr IOChannel
channel' Int32
length_
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"iOChannelGetLineTerm" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelGetLineTermMethodInfo
instance (signature ~ (Int32 -> m T.Text), MonadIO m) => O.OverloadedMethod IOChannelGetLineTermMethodInfo IOChannel signature where
overloadedMethod = iOChannelGetLineTerm
instance O.OverloadedMethodInfo IOChannelGetLineTermMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelGetLineTerm",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelGetLineTerm"
})
#endif
foreign import ccall "g_io_channel_init" g_io_channel_init ::
Ptr IOChannel ->
IO ()
iOChannelInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ()
iOChannelInit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m ()
iOChannelInit IOChannel
channel = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr IOChannel -> IO ()
g_io_channel_init Ptr IOChannel
channel'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelInitMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod IOChannelInitMethodInfo IOChannel signature where
overloadedMethod = iOChannelInit
instance O.OverloadedMethodInfo IOChannelInitMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelInit",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelInit"
})
#endif
foreign import ccall "g_io_channel_read" g_io_channel_read ::
Ptr IOChannel ->
CString ->
Word64 ->
Word64 ->
IO CUInt
{-# DEPRECATED iOChannelRead ["(Since version 2.2)","Use 'GI.GLib.Structs.IOChannel.iOChannelReadChars' instead."] #-}
iOChannelRead ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> T.Text
-> Word64
-> Word64
-> m GLib.Enums.IOError
iOChannelRead :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Text -> Word64 -> Word64 -> m IOError
iOChannelRead IOChannel
channel Text
buf Word64
count Word64
bytesRead = IO IOError -> m IOError
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOError -> m IOError) -> IO IOError -> m IOError
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
buf' <- Text -> IO CString
textToCString Text
buf
CUInt
result <- Ptr IOChannel -> CString -> Word64 -> Word64 -> IO CUInt
g_io_channel_read Ptr IOChannel
channel' CString
buf' Word64
count Word64
bytesRead
let result' :: IOError
result' = (Int -> IOError
forall a. Enum a => Int -> a
toEnum (Int -> IOError) -> (CUInt -> Int) -> CUInt -> IOError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buf'
IOError -> IO IOError
forall (m :: * -> *) a. Monad m => a -> m a
return IOError
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelReadMethodInfo
instance (signature ~ (T.Text -> Word64 -> Word64 -> m GLib.Enums.IOError), MonadIO m) => O.OverloadedMethod IOChannelReadMethodInfo IOChannel signature where
overloadedMethod = iOChannelRead
instance O.OverloadedMethodInfo IOChannelReadMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelRead",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelRead"
})
#endif
foreign import ccall "g_io_channel_read_chars" g_io_channel_read_chars ::
Ptr IOChannel ->
Ptr Word8 ->
Word64 ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelReadChars ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> ByteString
-> m ((GLib.Enums.IOStatus, ByteString, Word64))
iOChannelReadChars :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> ByteString -> m (IOStatus, ByteString, Word64)
iOChannelReadChars IOChannel
channel ByteString
buf = IO (IOStatus, ByteString, Word64)
-> m (IOStatus, ByteString, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStatus, ByteString, Word64)
-> m (IOStatus, ByteString, Word64))
-> IO (IOStatus, ByteString, Word64)
-> m (IOStatus, ByteString, Word64)
forall a b. (a -> b) -> a -> b
$ do
let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buf
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr Word8
buf' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buf
Ptr Word64
bytesRead <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
IO (IOStatus, ByteString, Word64)
-> IO () -> IO (IOStatus, ByteString, Word64)
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel
-> Ptr Word8
-> Word64
-> Ptr Word64
-> Ptr (Ptr GError)
-> IO CUInt
g_io_channel_read_chars Ptr IOChannel
channel' Ptr Word8
buf' Word64
count Ptr Word64
bytesRead
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
ByteString
buf'' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
count) Ptr Word8
buf'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
Word64
bytesRead' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
bytesRead
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesRead
(IOStatus, ByteString, Word64) -> IO (IOStatus, ByteString, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStatus
result', ByteString
buf'', Word64
bytesRead')
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesRead
)
#if defined(ENABLE_OVERLOADING)
data IOChannelReadCharsMethodInfo
instance (signature ~ (ByteString -> m ((GLib.Enums.IOStatus, ByteString, Word64))), MonadIO m) => O.OverloadedMethod IOChannelReadCharsMethodInfo IOChannel signature where
overloadedMethod = iOChannelReadChars
instance O.OverloadedMethodInfo IOChannelReadCharsMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelReadChars",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelReadChars"
})
#endif
foreign import ccall "g_io_channel_read_line" g_io_channel_read_line ::
Ptr IOChannel ->
Ptr CString ->
Ptr Word64 ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelReadLine ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ((GLib.Enums.IOStatus, T.Text, Word64, Word64))
iOChannelReadLine :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m (IOStatus, Text, Word64, Word64)
iOChannelReadLine IOChannel
channel = IO (IOStatus, Text, Word64, Word64)
-> m (IOStatus, Text, Word64, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStatus, Text, Word64, Word64)
-> m (IOStatus, Text, Word64, Word64))
-> IO (IOStatus, Text, Word64, Word64)
-> m (IOStatus, Text, Word64, Word64)
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr CString
strReturn <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr Word64
terminatorPos <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
IO (IOStatus, Text, Word64, Word64)
-> IO () -> IO (IOStatus, Text, Word64, Word64)
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel
-> Ptr CString
-> Ptr Word64
-> Ptr Word64
-> Ptr (Ptr GError)
-> IO CUInt
g_io_channel_read_line Ptr IOChannel
channel' Ptr CString
strReturn Ptr Word64
length_ Ptr Word64
terminatorPos
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
CString
strReturn' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
strReturn
Text
strReturn'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
strReturn'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
strReturn'
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
Word64
terminatorPos' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
terminatorPos
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
strReturn
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
terminatorPos
(IOStatus, Text, Word64, Word64)
-> IO (IOStatus, Text, Word64, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStatus
result', Text
strReturn'', Word64
length_', Word64
terminatorPos')
) (do
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
strReturn
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
terminatorPos
)
#if defined(ENABLE_OVERLOADING)
data IOChannelReadLineMethodInfo
instance (signature ~ (m ((GLib.Enums.IOStatus, T.Text, Word64, Word64))), MonadIO m) => O.OverloadedMethod IOChannelReadLineMethodInfo IOChannel signature where
overloadedMethod = iOChannelReadLine
instance O.OverloadedMethodInfo IOChannelReadLineMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelReadLine",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelReadLine"
})
#endif
foreign import ccall "g_io_channel_read_to_end" g_io_channel_read_to_end ::
Ptr IOChannel ->
Ptr (Ptr Word8) ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelReadToEnd ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ((GLib.Enums.IOStatus, ByteString))
iOChannelReadToEnd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m (IOStatus, ByteString)
iOChannelReadToEnd IOChannel
channel = IO (IOStatus, ByteString) -> m (IOStatus, ByteString)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStatus, ByteString) -> m (IOStatus, ByteString))
-> IO (IOStatus, ByteString) -> m (IOStatus, ByteString)
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr (Ptr Word8)
strReturn <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
IO (IOStatus, ByteString) -> IO () -> IO (IOStatus, ByteString)
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel
-> Ptr (Ptr Word8) -> Ptr Word64 -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_read_to_end Ptr IOChannel
channel' Ptr (Ptr Word8)
strReturn Ptr Word64
length_
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
Ptr Word8
strReturn' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
strReturn
ByteString
strReturn'' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
strReturn'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
strReturn'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
strReturn
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
(IOStatus, ByteString) -> IO (IOStatus, ByteString)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStatus
result', ByteString
strReturn'')
) (do
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
strReturn
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
)
#if defined(ENABLE_OVERLOADING)
data IOChannelReadToEndMethodInfo
instance (signature ~ (m ((GLib.Enums.IOStatus, ByteString))), MonadIO m) => O.OverloadedMethod IOChannelReadToEndMethodInfo IOChannel signature where
overloadedMethod = iOChannelReadToEnd
instance O.OverloadedMethodInfo IOChannelReadToEndMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelReadToEnd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelReadToEnd"
})
#endif
foreign import ccall "g_io_channel_read_unichar" g_io_channel_read_unichar ::
Ptr IOChannel ->
Ptr CInt ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelReadUnichar ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ((GLib.Enums.IOStatus, Char))
iOChannelReadUnichar :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m (IOStatus, Char)
iOChannelReadUnichar IOChannel
channel = IO (IOStatus, Char) -> m (IOStatus, Char)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStatus, Char) -> m (IOStatus, Char))
-> IO (IOStatus, Char) -> m (IOStatus, Char)
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr CInt
thechar <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CInt)
IO (IOStatus, Char) -> IO () -> IO (IOStatus, Char)
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> Ptr CInt -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_read_unichar Ptr IOChannel
channel' Ptr CInt
thechar
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
CInt
thechar' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
thechar
let thechar'' :: Char
thechar'' = (Int -> Char
chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
thechar'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
thechar
(IOStatus, Char) -> IO (IOStatus, Char)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStatus
result', Char
thechar'')
) (do
Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
thechar
)
#if defined(ENABLE_OVERLOADING)
data IOChannelReadUnicharMethodInfo
instance (signature ~ (m ((GLib.Enums.IOStatus, Char))), MonadIO m) => O.OverloadedMethod IOChannelReadUnicharMethodInfo IOChannel signature where
overloadedMethod = iOChannelReadUnichar
instance O.OverloadedMethodInfo IOChannelReadUnicharMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelReadUnichar",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelReadUnichar"
})
#endif
foreign import ccall "g_io_channel_ref" g_io_channel_ref ::
Ptr IOChannel ->
IO (Ptr IOChannel)
iOChannelRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m IOChannel
iOChannelRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m IOChannel
iOChannelRef IOChannel
channel = IO IOChannel -> m IOChannel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOChannel -> m IOChannel) -> IO IOChannel -> m IOChannel
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr IOChannel
result <- Ptr IOChannel -> IO (Ptr IOChannel)
g_io_channel_ref Ptr IOChannel
channel'
Text -> Ptr IOChannel -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"iOChannelRef" Ptr IOChannel
result
IOChannel
result' <- ((ManagedPtr IOChannel -> IOChannel)
-> Ptr IOChannel -> IO IOChannel
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr IOChannel -> IOChannel
IOChannel) Ptr IOChannel
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOChannel -> IO IOChannel
forall (m :: * -> *) a. Monad m => a -> m a
return IOChannel
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelRefMethodInfo
instance (signature ~ (m IOChannel), MonadIO m) => O.OverloadedMethod IOChannelRefMethodInfo IOChannel signature where
overloadedMethod = iOChannelRef
instance O.OverloadedMethodInfo IOChannelRefMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelRef",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelRef"
})
#endif
foreign import ccall "g_io_channel_seek" g_io_channel_seek ::
Ptr IOChannel ->
Int64 ->
CUInt ->
IO CUInt
{-# DEPRECATED iOChannelSeek ["(Since version 2.2)","Use 'GI.GLib.Structs.IOChannel.iOChannelSeekPosition' instead."] #-}
iOChannelSeek ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Int64
-> GLib.Enums.SeekType
-> m GLib.Enums.IOError
iOChannelSeek :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Int64 -> SeekType -> m IOError
iOChannelSeek IOChannel
channel Int64
offset SeekType
type_ = IO IOError -> m IOError
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOError -> m IOError) -> IO IOError -> m IOError
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SeekType -> Int) -> SeekType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SeekType -> Int
forall a. Enum a => a -> Int
fromEnum) SeekType
type_
CUInt
result <- Ptr IOChannel -> Int64 -> CUInt -> IO CUInt
g_io_channel_seek Ptr IOChannel
channel' Int64
offset CUInt
type_'
let result' :: IOError
result' = (Int -> IOError
forall a. Enum a => Int -> a
toEnum (Int -> IOError) -> (CUInt -> Int) -> CUInt -> IOError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOError -> IO IOError
forall (m :: * -> *) a. Monad m => a -> m a
return IOError
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelSeekMethodInfo
instance (signature ~ (Int64 -> GLib.Enums.SeekType -> m GLib.Enums.IOError), MonadIO m) => O.OverloadedMethod IOChannelSeekMethodInfo IOChannel signature where
overloadedMethod = iOChannelSeek
instance O.OverloadedMethodInfo IOChannelSeekMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSeek",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSeek"
})
#endif
foreign import ccall "g_io_channel_seek_position" g_io_channel_seek_position ::
Ptr IOChannel ->
Int64 ->
CUInt ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelSeekPosition ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Int64
-> GLib.Enums.SeekType
-> m GLib.Enums.IOStatus
iOChannelSeekPosition :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Int64 -> SeekType -> m IOStatus
iOChannelSeekPosition IOChannel
channel Int64
offset SeekType
type_ = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SeekType -> Int) -> SeekType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SeekType -> Int
forall a. Enum a => a -> Int
fromEnum) SeekType
type_
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> Int64 -> CUInt -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_seek_position Ptr IOChannel
channel' Int64
offset CUInt
type_'
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOChannelSeekPositionMethodInfo
instance (signature ~ (Int64 -> GLib.Enums.SeekType -> m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelSeekPositionMethodInfo IOChannel signature where
overloadedMethod = iOChannelSeekPosition
instance O.OverloadedMethodInfo IOChannelSeekPositionMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSeekPosition",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSeekPosition"
})
#endif
foreign import ccall "g_io_channel_set_buffer_size" g_io_channel_set_buffer_size ::
Ptr IOChannel ->
Word64 ->
IO ()
iOChannelSetBufferSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Word64
-> m ()
iOChannelSetBufferSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Word64 -> m ()
iOChannelSetBufferSize IOChannel
channel Word64
size = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr IOChannel -> Word64 -> IO ()
g_io_channel_set_buffer_size Ptr IOChannel
channel' Word64
size
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelSetBufferSizeMethodInfo
instance (signature ~ (Word64 -> m ()), MonadIO m) => O.OverloadedMethod IOChannelSetBufferSizeMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetBufferSize
instance O.OverloadedMethodInfo IOChannelSetBufferSizeMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetBufferSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetBufferSize"
})
#endif
foreign import ccall "g_io_channel_set_buffered" g_io_channel_set_buffered ::
Ptr IOChannel ->
CInt ->
IO ()
iOChannelSetBuffered ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Bool
-> m ()
iOChannelSetBuffered :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Bool -> m ()
iOChannelSetBuffered IOChannel
channel Bool
buffered = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let buffered' :: CInt
buffered' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
buffered
Ptr IOChannel -> CInt -> IO ()
g_io_channel_set_buffered Ptr IOChannel
channel' CInt
buffered'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelSetBufferedMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.OverloadedMethod IOChannelSetBufferedMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetBuffered
instance O.OverloadedMethodInfo IOChannelSetBufferedMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetBuffered",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetBuffered"
})
#endif
foreign import ccall "g_io_channel_set_close_on_unref" g_io_channel_set_close_on_unref ::
Ptr IOChannel ->
CInt ->
IO ()
iOChannelSetCloseOnUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Bool
-> m ()
iOChannelSetCloseOnUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Bool -> m ()
iOChannelSetCloseOnUnref IOChannel
channel Bool
doClose = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let doClose' :: CInt
doClose' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
doClose
Ptr IOChannel -> CInt -> IO ()
g_io_channel_set_close_on_unref Ptr IOChannel
channel' CInt
doClose'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelSetCloseOnUnrefMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.OverloadedMethod IOChannelSetCloseOnUnrefMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetCloseOnUnref
instance O.OverloadedMethodInfo IOChannelSetCloseOnUnrefMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetCloseOnUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetCloseOnUnref"
})
#endif
foreign import ccall "g_io_channel_set_encoding" g_io_channel_set_encoding ::
Ptr IOChannel ->
CString ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelSetEncoding ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Maybe (T.Text)
-> m GLib.Enums.IOStatus
iOChannelSetEncoding :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Maybe Text -> m IOStatus
iOChannelSetEncoding IOChannel
channel Maybe Text
encoding = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
maybeEncoding <- case Maybe Text
encoding of
Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jEncoding -> do
CString
jEncoding' <- Text -> IO CString
textToCString Text
jEncoding
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jEncoding'
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> CString -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_set_encoding Ptr IOChannel
channel' CString
maybeEncoding
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEncoding
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeEncoding
)
#if defined(ENABLE_OVERLOADING)
data IOChannelSetEncodingMethodInfo
instance (signature ~ (Maybe (T.Text) -> m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelSetEncodingMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetEncoding
instance O.OverloadedMethodInfo IOChannelSetEncodingMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetEncoding",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetEncoding"
})
#endif
foreign import ccall "g_io_channel_set_flags" g_io_channel_set_flags ::
Ptr IOChannel ->
CUInt ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelSetFlags ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> [GLib.Flags.IOFlags]
-> m GLib.Enums.IOStatus
iOChannelSetFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> [IOFlags] -> m IOStatus
iOChannelSetFlags IOChannel
channel [IOFlags]
flags = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let flags' :: CUInt
flags' = [IOFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOFlags]
flags
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> CUInt -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_set_flags Ptr IOChannel
channel' CUInt
flags'
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOChannelSetFlagsMethodInfo
instance (signature ~ ([GLib.Flags.IOFlags] -> m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelSetFlagsMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetFlags
instance O.OverloadedMethodInfo IOChannelSetFlagsMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetFlags",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetFlags"
})
#endif
foreign import ccall "g_io_channel_set_line_term" g_io_channel_set_line_term ::
Ptr IOChannel ->
CString ->
Int32 ->
IO ()
iOChannelSetLineTerm ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Maybe (T.Text)
-> Int32
-> m ()
iOChannelSetLineTerm :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Maybe Text -> Int32 -> m ()
iOChannelSetLineTerm IOChannel
channel Maybe Text
lineTerm Int32
length_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
maybeLineTerm <- case Maybe Text
lineTerm of
Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just Text
jLineTerm -> do
CString
jLineTerm' <- Text -> IO CString
textToCString Text
jLineTerm
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jLineTerm'
Ptr IOChannel -> CString -> Int32 -> IO ()
g_io_channel_set_line_term Ptr IOChannel
channel' CString
maybeLineTerm Int32
length_
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeLineTerm
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelSetLineTermMethodInfo
instance (signature ~ (Maybe (T.Text) -> Int32 -> m ()), MonadIO m) => O.OverloadedMethod IOChannelSetLineTermMethodInfo IOChannel signature where
overloadedMethod = iOChannelSetLineTerm
instance O.OverloadedMethodInfo IOChannelSetLineTermMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelSetLineTerm",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelSetLineTerm"
})
#endif
foreign import ccall "g_io_channel_shutdown" g_io_channel_shutdown ::
Ptr IOChannel ->
CInt ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelShutdown ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Bool
-> m GLib.Enums.IOStatus
iOChannelShutdown :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Bool -> m IOStatus
iOChannelShutdown IOChannel
channel Bool
flush = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let flush' :: CInt
flush' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
flush
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> CInt -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_shutdown Ptr IOChannel
channel' CInt
flush'
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOChannelShutdownMethodInfo
instance (signature ~ (Bool -> m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelShutdownMethodInfo IOChannel signature where
overloadedMethod = iOChannelShutdown
instance O.OverloadedMethodInfo IOChannelShutdownMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelShutdown",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelShutdown"
})
#endif
foreign import ccall "g_io_channel_unix_get_fd" g_io_channel_unix_get_fd ::
Ptr IOChannel ->
IO Int32
iOChannelUnixGetFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m Int32
iOChannelUnixGetFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m Int32
iOChannelUnixGetFd IOChannel
channel = 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 IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Int32
result <- Ptr IOChannel -> IO Int32
g_io_channel_unix_get_fd Ptr IOChannel
channel'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data IOChannelUnixGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod IOChannelUnixGetFdMethodInfo IOChannel signature where
overloadedMethod = iOChannelUnixGetFd
instance O.OverloadedMethodInfo IOChannelUnixGetFdMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelUnixGetFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelUnixGetFd"
})
#endif
foreign import ccall "g_io_channel_unref" g_io_channel_unref ::
Ptr IOChannel ->
IO ()
iOChannelUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> m ()
iOChannelUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> m ()
iOChannelUnref IOChannel
channel = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr IOChannel -> IO ()
g_io_channel_unref Ptr IOChannel
channel'
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOChannelUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod IOChannelUnrefMethodInfo IOChannel signature where
overloadedMethod = iOChannelUnref
instance O.OverloadedMethodInfo IOChannelUnrefMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelUnref"
})
#endif
foreign import ccall "g_io_channel_write" g_io_channel_write ::
Ptr IOChannel ->
CString ->
Word64 ->
Word64 ->
IO CUInt
{-# DEPRECATED iOChannelWrite ["(Since version 2.2)","Use 'GI.GLib.Structs.IOChannel.iOChannelWriteChars' instead."] #-}
iOChannelWrite ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> T.Text
-> Word64
-> Word64
-> m GLib.Enums.IOError
iOChannelWrite :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Text -> Word64 -> Word64 -> m IOError
iOChannelWrite IOChannel
channel Text
buf Word64
count Word64
bytesWritten = IO IOError -> m IOError
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOError -> m IOError) -> IO IOError -> m IOError
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
CString
buf' <- Text -> IO CString
textToCString Text
buf
CUInt
result <- Ptr IOChannel -> CString -> Word64 -> Word64 -> IO CUInt
g_io_channel_write Ptr IOChannel
channel' CString
buf' Word64
count Word64
bytesWritten
let result' :: IOError
result' = (Int -> IOError
forall a. Enum a => Int -> a
toEnum (Int -> IOError) -> (CUInt -> Int) -> CUInt -> IOError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buf'
IOError -> IO IOError
forall (m :: * -> *) a. Monad m => a -> m a
return IOError
result'
#if defined(ENABLE_OVERLOADING)
data IOChannelWriteMethodInfo
instance (signature ~ (T.Text -> Word64 -> Word64 -> m GLib.Enums.IOError), MonadIO m) => O.OverloadedMethod IOChannelWriteMethodInfo IOChannel signature where
overloadedMethod = iOChannelWrite
instance O.OverloadedMethodInfo IOChannelWriteMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelWrite",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelWrite"
})
#endif
foreign import ccall "g_io_channel_write_chars" g_io_channel_write_chars ::
Ptr IOChannel ->
Ptr Word8 ->
Int64 ->
Ptr Word64 ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelWriteChars ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Ptr Word8
-> Int64
-> m ((GLib.Enums.IOStatus, Word64))
iOChannelWriteChars :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Ptr Word8 -> Int64 -> m (IOStatus, Word64)
iOChannelWriteChars IOChannel
channel Ptr Word8
buf Int64
count = IO (IOStatus, Word64) -> m (IOStatus, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStatus, Word64) -> m (IOStatus, Word64))
-> IO (IOStatus, Word64) -> m (IOStatus, Word64)
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
Ptr Word64
bytesWritten <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
IO (IOStatus, Word64) -> IO () -> IO (IOStatus, Word64)
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel
-> Ptr Word8 -> Int64 -> Ptr Word64 -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_write_chars Ptr IOChannel
channel' Ptr Word8
buf Int64
count Ptr Word64
bytesWritten
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
Word64
bytesWritten' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
bytesWritten
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesWritten
(IOStatus, Word64) -> IO (IOStatus, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStatus
result', Word64
bytesWritten')
) (do
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesWritten
)
#if defined(ENABLE_OVERLOADING)
data IOChannelWriteCharsMethodInfo
instance (signature ~ (Ptr Word8 -> Int64 -> m ((GLib.Enums.IOStatus, Word64))), MonadIO m) => O.OverloadedMethod IOChannelWriteCharsMethodInfo IOChannel signature where
overloadedMethod = iOChannelWriteChars
instance O.OverloadedMethodInfo IOChannelWriteCharsMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelWriteChars",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelWriteChars"
})
#endif
foreign import ccall "g_io_channel_write_unichar" g_io_channel_write_unichar ::
Ptr IOChannel ->
CInt ->
Ptr (Ptr GError) ->
IO CUInt
iOChannelWriteUnichar ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOChannel
-> Char
-> m GLib.Enums.IOStatus
iOChannelWriteUnichar :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
IOChannel -> Char -> m IOStatus
iOChannelWriteUnichar IOChannel
channel Char
thechar = IO IOStatus -> m IOStatus
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStatus -> m IOStatus) -> IO IOStatus -> m IOStatus
forall a b. (a -> b) -> a -> b
$ do
Ptr IOChannel
channel' <- IOChannel -> IO (Ptr IOChannel)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOChannel
channel
let thechar' :: CInt
thechar' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
thechar
IO IOStatus -> IO () -> IO IOStatus
forall a b. IO a -> IO b -> IO a
onException (do
CUInt
result <- (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CUInt) -> IO CUInt)
-> (Ptr (Ptr GError) -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr IOChannel -> CInt -> Ptr (Ptr GError) -> IO CUInt
g_io_channel_write_unichar Ptr IOChannel
channel' CInt
thechar'
let result' :: IOStatus
result' = (Int -> IOStatus
forall a. Enum a => Int -> a
toEnum (Int -> IOStatus) -> (CUInt -> Int) -> CUInt -> IOStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannel -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOChannel
channel
IOStatus -> IO IOStatus
forall (m :: * -> *) a. Monad m => a -> m a
return IOStatus
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data IOChannelWriteUnicharMethodInfo
instance (signature ~ (Char -> m GLib.Enums.IOStatus), MonadIO m) => O.OverloadedMethod IOChannelWriteUnicharMethodInfo IOChannel signature where
overloadedMethod = iOChannelWriteUnichar
instance O.OverloadedMethodInfo IOChannelWriteUnicharMethodInfo IOChannel where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.IOChannel.iOChannelWriteUnichar",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-IOChannel.html#v:iOChannelWriteUnichar"
})
#endif
foreign import ccall "g_io_channel_error_from_errno" g_io_channel_error_from_errno ::
Int32 ->
IO CUInt
iOChannelErrorFromErrno ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m GLib.Enums.IOChannelError
iOChannelErrorFromErrno :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m IOChannelError
iOChannelErrorFromErrno Int32
en = IO IOChannelError -> m IOChannelError
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOChannelError -> m IOChannelError)
-> IO IOChannelError -> m IOChannelError
forall a b. (a -> b) -> a -> b
$ do
CUInt
result <- Int32 -> IO CUInt
g_io_channel_error_from_errno Int32
en
let result' :: IOChannelError
result' = (Int -> IOChannelError
forall a. Enum a => Int -> a
toEnum (Int -> IOChannelError)
-> (CUInt -> Int) -> CUInt -> IOChannelError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
IOChannelError -> IO IOChannelError
forall (m :: * -> *) a. Monad m => a -> m a
return IOChannelError
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_io_channel_error_quark" g_io_channel_error_quark ::
IO Word32
iOChannelErrorQuark ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Word32
iOChannelErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
iOChannelErrorQuark = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Word32
result <- IO Word32
g_io_channel_error_quark
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveIOChannelMethod (t :: Symbol) (o :: *) :: * where
ResolveIOChannelMethod "close" o = IOChannelCloseMethodInfo
ResolveIOChannelMethod "flush" o = IOChannelFlushMethodInfo
ResolveIOChannelMethod "init" o = IOChannelInitMethodInfo
ResolveIOChannelMethod "read" o = IOChannelReadMethodInfo
ResolveIOChannelMethod "readChars" o = IOChannelReadCharsMethodInfo
ResolveIOChannelMethod "readLine" o = IOChannelReadLineMethodInfo
ResolveIOChannelMethod "readToEnd" o = IOChannelReadToEndMethodInfo
ResolveIOChannelMethod "readUnichar" o = IOChannelReadUnicharMethodInfo
ResolveIOChannelMethod "ref" o = IOChannelRefMethodInfo
ResolveIOChannelMethod "seek" o = IOChannelSeekMethodInfo
ResolveIOChannelMethod "seekPosition" o = IOChannelSeekPositionMethodInfo
ResolveIOChannelMethod "shutdown" o = IOChannelShutdownMethodInfo
ResolveIOChannelMethod "unixGetFd" o = IOChannelUnixGetFdMethodInfo
ResolveIOChannelMethod "unref" o = IOChannelUnrefMethodInfo
ResolveIOChannelMethod "write" o = IOChannelWriteMethodInfo
ResolveIOChannelMethod "writeChars" o = IOChannelWriteCharsMethodInfo
ResolveIOChannelMethod "writeUnichar" o = IOChannelWriteUnicharMethodInfo
ResolveIOChannelMethod "getBufferCondition" o = IOChannelGetBufferConditionMethodInfo
ResolveIOChannelMethod "getBufferSize" o = IOChannelGetBufferSizeMethodInfo
ResolveIOChannelMethod "getBuffered" o = IOChannelGetBufferedMethodInfo
ResolveIOChannelMethod "getCloseOnUnref" o = IOChannelGetCloseOnUnrefMethodInfo
ResolveIOChannelMethod "getEncoding" o = IOChannelGetEncodingMethodInfo
ResolveIOChannelMethod "getFlags" o = IOChannelGetFlagsMethodInfo
ResolveIOChannelMethod "getLineTerm" o = IOChannelGetLineTermMethodInfo
ResolveIOChannelMethod "setBufferSize" o = IOChannelSetBufferSizeMethodInfo
ResolveIOChannelMethod "setBuffered" o = IOChannelSetBufferedMethodInfo
ResolveIOChannelMethod "setCloseOnUnref" o = IOChannelSetCloseOnUnrefMethodInfo
ResolveIOChannelMethod "setEncoding" o = IOChannelSetEncodingMethodInfo
ResolveIOChannelMethod "setFlags" o = IOChannelSetFlagsMethodInfo
ResolveIOChannelMethod "setLineTerm" o = IOChannelSetLineTermMethodInfo
ResolveIOChannelMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveIOChannelMethod t IOChannel, O.OverloadedMethod info IOChannel p) => OL.IsLabel t (IOChannel -> 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 ~ ResolveIOChannelMethod t IOChannel, O.OverloadedMethod info IOChannel p, R.HasField t IOChannel p) => R.HasField t IOChannel p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveIOChannelMethod t IOChannel, O.OverloadedMethodInfo info IOChannel) => OL.IsLabel t (O.MethodProxy info IOChannel) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif