{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.MemoryInputStream
(
MemoryInputStream(..) ,
IsMemoryInputStream ,
toMemoryInputStream ,
#if defined(ENABLE_OVERLOADING)
ResolveMemoryInputStreamMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
MemoryInputStreamAddBytesMethodInfo ,
#endif
memoryInputStreamAddBytes ,
#if defined(ENABLE_OVERLOADING)
MemoryInputStreamAddDataMethodInfo ,
#endif
memoryInputStreamAddData ,
memoryInputStreamNew ,
memoryInputStreamNewFromBytes ,
memoryInputStreamNewFromData ,
) 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.Enums as GLib.Enums
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.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.PollableInputStream as Gio.PollableInputStream
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Seekable as Gio.Seekable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
#else
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.PollableInputStream as Gio.PollableInputStream
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Seekable as Gio.Seekable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
#endif
newtype MemoryInputStream = MemoryInputStream (SP.ManagedPtr MemoryInputStream)
deriving (MemoryInputStream -> MemoryInputStream -> Bool
(MemoryInputStream -> MemoryInputStream -> Bool)
-> (MemoryInputStream -> MemoryInputStream -> Bool)
-> Eq MemoryInputStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MemoryInputStream -> MemoryInputStream -> Bool
== :: MemoryInputStream -> MemoryInputStream -> Bool
$c/= :: MemoryInputStream -> MemoryInputStream -> Bool
/= :: MemoryInputStream -> MemoryInputStream -> Bool
Eq)
instance SP.ManagedPtrNewtype MemoryInputStream where
toManagedPtr :: MemoryInputStream -> ManagedPtr MemoryInputStream
toManagedPtr (MemoryInputStream ManagedPtr MemoryInputStream
p) = ManagedPtr MemoryInputStream
p
foreign import ccall "g_memory_input_stream_get_type"
c_g_memory_input_stream_get_type :: IO B.Types.GType
instance B.Types.TypedObject MemoryInputStream where
glibType :: IO GType
glibType = IO GType
c_g_memory_input_stream_get_type
instance B.Types.GObject MemoryInputStream
class (SP.GObject o, O.IsDescendantOf MemoryInputStream o) => IsMemoryInputStream o
instance (SP.GObject o, O.IsDescendantOf MemoryInputStream o) => IsMemoryInputStream o
instance O.HasParentTypes MemoryInputStream
type instance O.ParentTypes MemoryInputStream = '[Gio.InputStream.InputStream, GObject.Object.Object, Gio.PollableInputStream.PollableInputStream, Gio.Seekable.Seekable]
toMemoryInputStream :: (MIO.MonadIO m, IsMemoryInputStream o) => o -> m MemoryInputStream
toMemoryInputStream :: forall (m :: * -> *) o.
(MonadIO m, IsMemoryInputStream o) =>
o -> m MemoryInputStream
toMemoryInputStream = IO MemoryInputStream -> m MemoryInputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO MemoryInputStream -> m MemoryInputStream)
-> (o -> IO MemoryInputStream) -> o -> m MemoryInputStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr MemoryInputStream -> MemoryInputStream)
-> o -> IO MemoryInputStream
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr MemoryInputStream -> MemoryInputStream
MemoryInputStream
instance B.GValue.IsGValue (Maybe MemoryInputStream) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_memory_input_stream_get_type
gvalueSet_ :: Ptr GValue -> Maybe MemoryInputStream -> IO ()
gvalueSet_ Ptr GValue
gv Maybe MemoryInputStream
P.Nothing = Ptr GValue -> Ptr MemoryInputStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr MemoryInputStream
forall a. Ptr a
FP.nullPtr :: FP.Ptr MemoryInputStream)
gvalueSet_ Ptr GValue
gv (P.Just MemoryInputStream
obj) = MemoryInputStream -> (Ptr MemoryInputStream -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MemoryInputStream
obj (Ptr GValue -> Ptr MemoryInputStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe MemoryInputStream)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr MemoryInputStream)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr MemoryInputStream)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject MemoryInputStream ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveMemoryInputStreamMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveMemoryInputStreamMethod "addBytes" o = MemoryInputStreamAddBytesMethodInfo
ResolveMemoryInputStreamMethod "addData" o = MemoryInputStreamAddDataMethodInfo
ResolveMemoryInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMemoryInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMemoryInputStreamMethod "canPoll" o = Gio.PollableInputStream.PollableInputStreamCanPollMethodInfo
ResolveMemoryInputStreamMethod "canSeek" o = Gio.Seekable.SeekableCanSeekMethodInfo
ResolveMemoryInputStreamMethod "canTruncate" o = Gio.Seekable.SeekableCanTruncateMethodInfo
ResolveMemoryInputStreamMethod "clearPending" o = Gio.InputStream.InputStreamClearPendingMethodInfo
ResolveMemoryInputStreamMethod "close" o = Gio.InputStream.InputStreamCloseMethodInfo
ResolveMemoryInputStreamMethod "closeAsync" o = Gio.InputStream.InputStreamCloseAsyncMethodInfo
ResolveMemoryInputStreamMethod "closeFinish" o = Gio.InputStream.InputStreamCloseFinishMethodInfo
ResolveMemoryInputStreamMethod "createSource" o = Gio.PollableInputStream.PollableInputStreamCreateSourceMethodInfo
ResolveMemoryInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMemoryInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMemoryInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMemoryInputStreamMethod "hasPending" o = Gio.InputStream.InputStreamHasPendingMethodInfo
ResolveMemoryInputStreamMethod "isClosed" o = Gio.InputStream.InputStreamIsClosedMethodInfo
ResolveMemoryInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMemoryInputStreamMethod "isReadable" o = Gio.PollableInputStream.PollableInputStreamIsReadableMethodInfo
ResolveMemoryInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMemoryInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMemoryInputStreamMethod "read" o = Gio.InputStream.InputStreamReadMethodInfo
ResolveMemoryInputStreamMethod "readAll" o = Gio.InputStream.InputStreamReadAllMethodInfo
ResolveMemoryInputStreamMethod "readAllAsync" o = Gio.InputStream.InputStreamReadAllAsyncMethodInfo
ResolveMemoryInputStreamMethod "readAllFinish" o = Gio.InputStream.InputStreamReadAllFinishMethodInfo
ResolveMemoryInputStreamMethod "readAsync" o = Gio.InputStream.InputStreamReadAsyncMethodInfo
ResolveMemoryInputStreamMethod "readBytes" o = Gio.InputStream.InputStreamReadBytesMethodInfo
ResolveMemoryInputStreamMethod "readBytesAsync" o = Gio.InputStream.InputStreamReadBytesAsyncMethodInfo
ResolveMemoryInputStreamMethod "readBytesFinish" o = Gio.InputStream.InputStreamReadBytesFinishMethodInfo
ResolveMemoryInputStreamMethod "readFinish" o = Gio.InputStream.InputStreamReadFinishMethodInfo
ResolveMemoryInputStreamMethod "readNonblocking" o = Gio.PollableInputStream.PollableInputStreamReadNonblockingMethodInfo
ResolveMemoryInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMemoryInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMemoryInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMemoryInputStreamMethod "seek" o = Gio.Seekable.SeekableSeekMethodInfo
ResolveMemoryInputStreamMethod "skip" o = Gio.InputStream.InputStreamSkipMethodInfo
ResolveMemoryInputStreamMethod "skipAsync" o = Gio.InputStream.InputStreamSkipAsyncMethodInfo
ResolveMemoryInputStreamMethod "skipFinish" o = Gio.InputStream.InputStreamSkipFinishMethodInfo
ResolveMemoryInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMemoryInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMemoryInputStreamMethod "tell" o = Gio.Seekable.SeekableTellMethodInfo
ResolveMemoryInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMemoryInputStreamMethod "truncate" o = Gio.Seekable.SeekableTruncateMethodInfo
ResolveMemoryInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMemoryInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMemoryInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMemoryInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMemoryInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMemoryInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMemoryInputStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveMemoryInputStreamMethod "setPending" o = Gio.InputStream.InputStreamSetPendingMethodInfo
ResolveMemoryInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMemoryInputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMemoryInputStreamMethod t MemoryInputStream, O.OverloadedMethod info MemoryInputStream p) => OL.IsLabel t (MemoryInputStream -> 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 ~ ResolveMemoryInputStreamMethod t MemoryInputStream, O.OverloadedMethod info MemoryInputStream p, R.HasField t MemoryInputStream p) => R.HasField t MemoryInputStream p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveMemoryInputStreamMethod t MemoryInputStream, O.OverloadedMethodInfo info MemoryInputStream) => OL.IsLabel t (O.MethodProxy info MemoryInputStream) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList MemoryInputStream
type instance O.AttributeList MemoryInputStream = MemoryInputStreamAttributeList
type MemoryInputStreamAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList MemoryInputStream = MemoryInputStreamSignalList
type MemoryInputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_memory_input_stream_new" g_memory_input_stream_new ::
IO (Ptr MemoryInputStream)
memoryInputStreamNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m MemoryInputStream
memoryInputStreamNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m MemoryInputStream
memoryInputStreamNew = IO MemoryInputStream -> m MemoryInputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryInputStream -> m MemoryInputStream)
-> IO MemoryInputStream -> m MemoryInputStream
forall a b. (a -> b) -> a -> b
$ do
result <- IO (Ptr MemoryInputStream)
g_memory_input_stream_new
checkUnexpectedReturnNULL "memoryInputStreamNew" result
result' <- (wrapObject MemoryInputStream) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_memory_input_stream_new_from_bytes" g_memory_input_stream_new_from_bytes ::
Ptr GLib.Bytes.Bytes ->
IO (Ptr MemoryInputStream)
memoryInputStreamNewFromBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.Bytes.Bytes
-> m MemoryInputStream
memoryInputStreamNewFromBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Bytes -> m MemoryInputStream
memoryInputStreamNewFromBytes Bytes
bytes = IO MemoryInputStream -> m MemoryInputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryInputStream -> m MemoryInputStream)
-> IO MemoryInputStream -> m MemoryInputStream
forall a b. (a -> b) -> a -> b
$ do
bytes' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
bytes
result <- g_memory_input_stream_new_from_bytes bytes'
checkUnexpectedReturnNULL "memoryInputStreamNewFromBytes" result
result' <- (wrapObject MemoryInputStream) result
touchManagedPtr bytes
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_memory_input_stream_new_from_data" g_memory_input_stream_new_from_data ::
Ptr Word8 ->
DI.Int64 ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO (Ptr MemoryInputStream)
memoryInputStreamNewFromData ::
(B.CallStack.HasCallStack, MonadIO m) =>
ByteString
-> Maybe (GLib.Callbacks.DestroyNotify)
-> m MemoryInputStream
memoryInputStreamNewFromData :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> Maybe DestroyNotify -> m MemoryInputStream
memoryInputStreamNewFromData ByteString
data_ Maybe DestroyNotify
destroy = IO MemoryInputStream -> m MemoryInputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryInputStream -> m MemoryInputStream)
-> IO MemoryInputStream -> m MemoryInputStream
forall a b. (a -> b) -> a -> b
$ do
let len :: Int64
len = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> Int -> Int64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
maybeDestroy <- case destroy of
Maybe DestroyNotify
Nothing -> FunPtr DestroyNotify -> IO (FunPtr DestroyNotify)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr DestroyNotify
forall a. FunPtr a
FP.nullFunPtr
Just DestroyNotify
jDestroy -> do
ptrdestroy <- IO (Ptr (FunPtr DestroyNotify))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
jDestroy' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrdestroy) jDestroy)
poke ptrdestroy jDestroy'
return jDestroy'
result <- g_memory_input_stream_new_from_data data_' len maybeDestroy
checkUnexpectedReturnNULL "memoryInputStreamNewFromData" result
result' <- (wrapObject MemoryInputStream) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_memory_input_stream_add_bytes" g_memory_input_stream_add_bytes ::
Ptr MemoryInputStream ->
Ptr GLib.Bytes.Bytes ->
IO ()
memoryInputStreamAddBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsMemoryInputStream a) =>
a
-> GLib.Bytes.Bytes
-> m ()
memoryInputStreamAddBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsMemoryInputStream a) =>
a -> Bytes -> m ()
memoryInputStreamAddBytes a
stream Bytes
bytes = 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 MemoryInputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
bytes' <- unsafeManagedPtrGetPtr bytes
g_memory_input_stream_add_bytes stream' bytes'
touchManagedPtr stream
touchManagedPtr bytes
return ()
#if defined(ENABLE_OVERLOADING)
data MemoryInputStreamAddBytesMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> m ()), MonadIO m, IsMemoryInputStream a) => O.OverloadedMethod MemoryInputStreamAddBytesMethodInfo a signature where
overloadedMethod = memoryInputStreamAddBytes
instance O.OverloadedMethodInfo MemoryInputStreamAddBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.MemoryInputStream.memoryInputStreamAddBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-MemoryInputStream.html#v:memoryInputStreamAddBytes"
})
#endif
foreign import ccall "g_memory_input_stream_add_data" g_memory_input_stream_add_data ::
Ptr MemoryInputStream ->
Ptr Word8 ->
DI.Int64 ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO ()
memoryInputStreamAddData ::
(B.CallStack.HasCallStack, MonadIO m, IsMemoryInputStream a) =>
a
-> ByteString
-> Maybe (GLib.Callbacks.DestroyNotify)
-> m ()
memoryInputStreamAddData :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsMemoryInputStream a) =>
a -> ByteString -> Maybe DestroyNotify -> m ()
memoryInputStreamAddData a
stream ByteString
data_ Maybe DestroyNotify
destroy = 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
let len :: Int64
len = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> Int -> Int64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
stream' <- a -> IO (Ptr MemoryInputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
data_' <- packByteString data_
maybeDestroy <- case destroy of
Maybe DestroyNotify
Nothing -> FunPtr DestroyNotify -> IO (FunPtr DestroyNotify)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr DestroyNotify
forall a. FunPtr a
FP.nullFunPtr
Just DestroyNotify
jDestroy -> do
ptrdestroy <- IO (Ptr (FunPtr DestroyNotify))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
jDestroy' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrdestroy) jDestroy)
poke ptrdestroy jDestroy'
return jDestroy'
g_memory_input_stream_add_data stream' data_' len maybeDestroy
touchManagedPtr stream
return ()
#if defined(ENABLE_OVERLOADING)
data MemoryInputStreamAddDataMethodInfo
instance (signature ~ (ByteString -> Maybe (GLib.Callbacks.DestroyNotify) -> m ()), MonadIO m, IsMemoryInputStream a) => O.OverloadedMethod MemoryInputStreamAddDataMethodInfo a signature where
overloadedMethod = memoryInputStreamAddData
instance O.OverloadedMethodInfo MemoryInputStreamAddDataMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.MemoryInputStream.memoryInputStreamAddData",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-MemoryInputStream.html#v:memoryInputStreamAddData"
})
#endif