{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.FileOutputStream
(
FileOutputStream(..) ,
IsFileOutputStream ,
toFileOutputStream ,
#if defined(ENABLE_OVERLOADING)
ResolveFileOutputStreamMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FileOutputStreamGetEtagMethodInfo ,
#endif
fileOutputStreamGetEtag ,
#if defined(ENABLE_OVERLOADING)
FileOutputStreamQueryInfoMethodInfo ,
#endif
fileOutputStreamQueryInfo ,
#if defined(ENABLE_OVERLOADING)
FileOutputStreamQueryInfoAsyncMethodInfo,
#endif
fileOutputStreamQueryInfoAsync ,
#if defined(ENABLE_OVERLOADING)
FileOutputStreamQueryInfoFinishMethodInfo,
#endif
fileOutputStreamQueryInfoFinish ,
) 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.DateTime as GLib.DateTime
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GLib.Structs.TimeVal as GLib.TimeVal
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.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
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.FileInfo as Gio.FileInfo
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeMatcher as Gio.FileAttributeMatcher
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
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.FileInfo as Gio.FileInfo
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
#endif
newtype FileOutputStream = FileOutputStream (SP.ManagedPtr FileOutputStream)
deriving (FileOutputStream -> FileOutputStream -> Bool
(FileOutputStream -> FileOutputStream -> Bool)
-> (FileOutputStream -> FileOutputStream -> Bool)
-> Eq FileOutputStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FileOutputStream -> FileOutputStream -> Bool
== :: FileOutputStream -> FileOutputStream -> Bool
$c/= :: FileOutputStream -> FileOutputStream -> Bool
/= :: FileOutputStream -> FileOutputStream -> Bool
Eq)
instance SP.ManagedPtrNewtype FileOutputStream where
toManagedPtr :: FileOutputStream -> ManagedPtr FileOutputStream
toManagedPtr (FileOutputStream ManagedPtr FileOutputStream
p) = ManagedPtr FileOutputStream
p
foreign import ccall "g_file_output_stream_get_type"
c_g_file_output_stream_get_type :: IO B.Types.GType
instance B.Types.TypedObject FileOutputStream where
glibType :: IO GType
glibType = IO GType
c_g_file_output_stream_get_type
instance B.Types.GObject FileOutputStream
class (SP.GObject o, O.IsDescendantOf FileOutputStream o) => IsFileOutputStream o
instance (SP.GObject o, O.IsDescendantOf FileOutputStream o) => IsFileOutputStream o
instance O.HasParentTypes FileOutputStream
type instance O.ParentTypes FileOutputStream = '[Gio.OutputStream.OutputStream, GObject.Object.Object, Gio.Seekable.Seekable]
toFileOutputStream :: (MIO.MonadIO m, IsFileOutputStream o) => o -> m FileOutputStream
toFileOutputStream :: forall (m :: * -> *) o.
(MonadIO m, IsFileOutputStream o) =>
o -> m FileOutputStream
toFileOutputStream = IO FileOutputStream -> m FileOutputStream
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO FileOutputStream -> m FileOutputStream)
-> (o -> IO FileOutputStream) -> o -> m FileOutputStream
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FileOutputStream -> FileOutputStream)
-> o -> IO FileOutputStream
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr FileOutputStream -> FileOutputStream
FileOutputStream
instance B.GValue.IsGValue (Maybe FileOutputStream) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_file_output_stream_get_type
gvalueSet_ :: Ptr GValue -> Maybe FileOutputStream -> IO ()
gvalueSet_ Ptr GValue
gv Maybe FileOutputStream
P.Nothing = Ptr GValue -> Ptr FileOutputStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr FileOutputStream
forall a. Ptr a
FP.nullPtr :: FP.Ptr FileOutputStream)
gvalueSet_ Ptr GValue
gv (P.Just FileOutputStream
obj) = FileOutputStream -> (Ptr FileOutputStream -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FileOutputStream
obj (Ptr GValue -> Ptr FileOutputStream -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe FileOutputStream)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr FileOutputStream)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr FileOutputStream)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject FileOutputStream ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveFileOutputStreamMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveFileOutputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileOutputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileOutputStreamMethod "canSeek" o = Gio.Seekable.SeekableCanSeekMethodInfo
ResolveFileOutputStreamMethod "canTruncate" o = Gio.Seekable.SeekableCanTruncateMethodInfo
ResolveFileOutputStreamMethod "clearPending" o = Gio.OutputStream.OutputStreamClearPendingMethodInfo
ResolveFileOutputStreamMethod "close" o = Gio.OutputStream.OutputStreamCloseMethodInfo
ResolveFileOutputStreamMethod "closeAsync" o = Gio.OutputStream.OutputStreamCloseAsyncMethodInfo
ResolveFileOutputStreamMethod "closeFinish" o = Gio.OutputStream.OutputStreamCloseFinishMethodInfo
ResolveFileOutputStreamMethod "flush" o = Gio.OutputStream.OutputStreamFlushMethodInfo
ResolveFileOutputStreamMethod "flushAsync" o = Gio.OutputStream.OutputStreamFlushAsyncMethodInfo
ResolveFileOutputStreamMethod "flushFinish" o = Gio.OutputStream.OutputStreamFlushFinishMethodInfo
ResolveFileOutputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileOutputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileOutputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileOutputStreamMethod "hasPending" o = Gio.OutputStream.OutputStreamHasPendingMethodInfo
ResolveFileOutputStreamMethod "isClosed" o = Gio.OutputStream.OutputStreamIsClosedMethodInfo
ResolveFileOutputStreamMethod "isClosing" o = Gio.OutputStream.OutputStreamIsClosingMethodInfo
ResolveFileOutputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileOutputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileOutputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileOutputStreamMethod "queryInfo" o = FileOutputStreamQueryInfoMethodInfo
ResolveFileOutputStreamMethod "queryInfoAsync" o = FileOutputStreamQueryInfoAsyncMethodInfo
ResolveFileOutputStreamMethod "queryInfoFinish" o = FileOutputStreamQueryInfoFinishMethodInfo
ResolveFileOutputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileOutputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileOutputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileOutputStreamMethod "seek" o = Gio.Seekable.SeekableSeekMethodInfo
ResolveFileOutputStreamMethod "splice" o = Gio.OutputStream.OutputStreamSpliceMethodInfo
ResolveFileOutputStreamMethod "spliceAsync" o = Gio.OutputStream.OutputStreamSpliceAsyncMethodInfo
ResolveFileOutputStreamMethod "spliceFinish" o = Gio.OutputStream.OutputStreamSpliceFinishMethodInfo
ResolveFileOutputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileOutputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileOutputStreamMethod "tell" o = Gio.Seekable.SeekableTellMethodInfo
ResolveFileOutputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileOutputStreamMethod "truncate" o = Gio.Seekable.SeekableTruncateMethodInfo
ResolveFileOutputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileOutputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileOutputStreamMethod "write" o = Gio.OutputStream.OutputStreamWriteMethodInfo
ResolveFileOutputStreamMethod "writeAll" o = Gio.OutputStream.OutputStreamWriteAllMethodInfo
ResolveFileOutputStreamMethod "writeAllAsync" o = Gio.OutputStream.OutputStreamWriteAllAsyncMethodInfo
ResolveFileOutputStreamMethod "writeAllFinish" o = Gio.OutputStream.OutputStreamWriteAllFinishMethodInfo
ResolveFileOutputStreamMethod "writeAsync" o = Gio.OutputStream.OutputStreamWriteAsyncMethodInfo
ResolveFileOutputStreamMethod "writeBytes" o = Gio.OutputStream.OutputStreamWriteBytesMethodInfo
ResolveFileOutputStreamMethod "writeBytesAsync" o = Gio.OutputStream.OutputStreamWriteBytesAsyncMethodInfo
ResolveFileOutputStreamMethod "writeBytesFinish" o = Gio.OutputStream.OutputStreamWriteBytesFinishMethodInfo
ResolveFileOutputStreamMethod "writeFinish" o = Gio.OutputStream.OutputStreamWriteFinishMethodInfo
ResolveFileOutputStreamMethod "writev" o = Gio.OutputStream.OutputStreamWritevMethodInfo
ResolveFileOutputStreamMethod "writevAll" o = Gio.OutputStream.OutputStreamWritevAllMethodInfo
ResolveFileOutputStreamMethod "writevAllAsync" o = Gio.OutputStream.OutputStreamWritevAllAsyncMethodInfo
ResolveFileOutputStreamMethod "writevAllFinish" o = Gio.OutputStream.OutputStreamWritevAllFinishMethodInfo
ResolveFileOutputStreamMethod "writevAsync" o = Gio.OutputStream.OutputStreamWritevAsyncMethodInfo
ResolveFileOutputStreamMethod "writevFinish" o = Gio.OutputStream.OutputStreamWritevFinishMethodInfo
ResolveFileOutputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileOutputStreamMethod "getEtag" o = FileOutputStreamGetEtagMethodInfo
ResolveFileOutputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileOutputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileOutputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileOutputStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileOutputStreamMethod "setPending" o = Gio.OutputStream.OutputStreamSetPendingMethodInfo
ResolveFileOutputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileOutputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileOutputStreamMethod t FileOutputStream, O.OverloadedMethod info FileOutputStream p) => OL.IsLabel t (FileOutputStream -> 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 ~ ResolveFileOutputStreamMethod t FileOutputStream, O.OverloadedMethod info FileOutputStream p, R.HasField t FileOutputStream p) => R.HasField t FileOutputStream p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFileOutputStreamMethod t FileOutputStream, O.OverloadedMethodInfo info FileOutputStream) => OL.IsLabel t (O.MethodProxy info FileOutputStream) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FileOutputStream
type instance O.AttributeList FileOutputStream = FileOutputStreamAttributeList
type FileOutputStreamAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FileOutputStream = FileOutputStreamSignalList
type FileOutputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_file_output_stream_get_etag" g_file_output_stream_get_etag ::
Ptr FileOutputStream ->
IO CString
fileOutputStreamGetEtag ::
(B.CallStack.HasCallStack, MonadIO m, IsFileOutputStream a) =>
a
-> m (Maybe T.Text)
fileOutputStreamGetEtag :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFileOutputStream a) =>
a -> m (Maybe Text)
fileOutputStreamGetEtag a
stream = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr FileOutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result <- g_file_output_stream_get_etag stream'
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
freeMem result'
return result''
touchManagedPtr stream
return maybeResult
#if defined(ENABLE_OVERLOADING)
data FileOutputStreamGetEtagMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsFileOutputStream a) => O.OverloadedMethod FileOutputStreamGetEtagMethodInfo a signature where
overloadedMethod = fileOutputStreamGetEtag
instance O.OverloadedMethodInfo FileOutputStreamGetEtagMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileOutputStream.fileOutputStreamGetEtag",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-FileOutputStream.html#v:fileOutputStreamGetEtag"
})
#endif
foreign import ccall "g_file_output_stream_query_info" g_file_output_stream_query_info ::
Ptr FileOutputStream ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileOutputStreamQueryInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFileOutputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m Gio.FileInfo.FileInfo
fileOutputStreamQueryInfo :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFileOutputStream a, IsCancellable b) =>
a -> Text -> Maybe b -> m FileInfo
fileOutputStreamQueryInfo a
stream Text
attributes Maybe b
cancellable = IO FileInfo -> m FileInfo
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr FileOutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_file_output_stream_query_info stream' attributes' maybeCancellable
checkUnexpectedReturnNULL "fileOutputStreamQueryInfo" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return result'
) (do
freeMem attributes'
)
#if defined(ENABLE_OVERLOADING)
data FileOutputStreamQueryInfoMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileOutputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod FileOutputStreamQueryInfoMethodInfo a signature where
overloadedMethod = fileOutputStreamQueryInfo
instance O.OverloadedMethodInfo FileOutputStreamQueryInfoMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileOutputStream.fileOutputStreamQueryInfo",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-FileOutputStream.html#v:fileOutputStreamQueryInfo"
})
#endif
foreign import ccall "g_file_output_stream_query_info_async" g_file_output_stream_query_info_async ::
Ptr FileOutputStream ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileOutputStreamQueryInfoAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFileOutputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileOutputStreamQueryInfoAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFileOutputStream a, IsCancellable b) =>
a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileOutputStreamQueryInfoAsync a
stream Text
attributes Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr FileOutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_file_output_stream_query_info_async stream' attributes' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
#if defined(ENABLE_OVERLOADING)
data FileOutputStreamQueryInfoAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileOutputStream a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod FileOutputStreamQueryInfoAsyncMethodInfo a signature where
overloadedMethod = fileOutputStreamQueryInfoAsync
instance O.OverloadedMethodInfo FileOutputStreamQueryInfoAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileOutputStream.fileOutputStreamQueryInfoAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-FileOutputStream.html#v:fileOutputStreamQueryInfoAsync"
})
#endif
foreign import ccall "g_file_output_stream_query_info_finish" g_file_output_stream_query_info_finish ::
Ptr FileOutputStream ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileOutputStreamQueryInfoFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFileOutputStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInfo.FileInfo
fileOutputStreamQueryInfoFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFileOutputStream a, IsAsyncResult b) =>
a -> b -> m FileInfo
fileOutputStreamQueryInfoFinish a
stream b
result_ = IO FileInfo -> m FileInfo
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileInfo -> m FileInfo) -> IO FileInfo -> m FileInfo
forall a b. (a -> b) -> a -> b
$ do
stream' <- a -> IO (Ptr FileOutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_file_output_stream_query_info_finish stream' result_'
checkUnexpectedReturnNULL "fileOutputStreamQueryInfoFinish" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
touchManagedPtr result_
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileOutputStreamQueryInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileOutputStream a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod FileOutputStreamQueryInfoFinishMethodInfo a signature where
overloadedMethod = fileOutputStreamQueryInfoFinish
instance O.OverloadedMethodInfo FileOutputStreamQueryInfoFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileOutputStream.fileOutputStreamQueryInfoFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-FileOutputStream.html#v:fileOutputStreamQueryInfoFinish"
})
#endif