#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.FileOutputStream
(
FileOutputStream(..) ,
IsFileOutputStream ,
toFileOutputStream ,
noFileOutputStream ,
#if ENABLE_OVERLOADING
FileOutputStreamGetEtagMethodInfo ,
#endif
fileOutputStreamGetEtag ,
#if ENABLE_OVERLOADING
FileOutputStreamQueryInfoMethodInfo ,
#endif
fileOutputStreamQueryInfo ,
#if ENABLE_OVERLOADING
FileOutputStreamQueryInfoAsyncMethodInfo,
#endif
fileOutputStreamQueryInfoAsync ,
#if 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
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
newtype FileOutputStream = FileOutputStream (ManagedPtr FileOutputStream)
foreign import ccall "g_file_output_stream_get_type"
c_g_file_output_stream_get_type :: IO GType
instance GObject FileOutputStream where
gobjectType _ = c_g_file_output_stream_get_type
class GObject o => IsFileOutputStream o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError FileOutputStream a) =>
IsFileOutputStream a
#endif
instance IsFileOutputStream FileOutputStream
instance Gio.OutputStream.IsOutputStream FileOutputStream
instance GObject.Object.IsObject FileOutputStream
instance Gio.Seekable.IsSeekable FileOutputStream
toFileOutputStream :: (MonadIO m, IsFileOutputStream o) => o -> m FileOutputStream
toFileOutputStream = liftIO . unsafeCastTo FileOutputStream
noFileOutputStream :: Maybe FileOutputStream
noFileOutputStream = Nothing
#if ENABLE_OVERLOADING
type family ResolveFileOutputStreamMethod (t :: Symbol) (o :: *) :: * 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 "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 "setPending" o = Gio.OutputStream.OutputStreamSetPendingMethodInfo
ResolveFileOutputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileOutputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileOutputStreamMethod t FileOutputStream, O.MethodInfo info FileOutputStream p) => O.IsLabelProxy t (FileOutputStream -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveFileOutputStreamMethod t FileOutputStream, O.MethodInfo info FileOutputStream p) => O.IsLabel t (FileOutputStream -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList FileOutputStream
type instance O.AttributeList FileOutputStream = FileOutputStreamAttributeList
type FileOutputStreamAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList FileOutputStream = FileOutputStreamSignalList
type FileOutputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#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 T.Text
fileOutputStreamGetEtag stream = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result <- g_file_output_stream_get_etag stream'
checkUnexpectedReturnNULL "fileOutputStreamGetEtag" result
result' <- cstringToText result
freeMem result
touchManagedPtr stream
return result'
#if ENABLE_OVERLOADING
data FileOutputStreamGetEtagMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFileOutputStream a) => O.MethodInfo FileOutputStreamGetEtagMethodInfo a signature where
overloadedMethod _ = 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 stream attributes cancellable = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr 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 ENABLE_OVERLOADING
data FileOutputStreamQueryInfoMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileOutputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileOutputStreamQueryInfoMethodInfo a signature where
overloadedMethod _ = 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 stream attributes ioPriority cancellable callback = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- 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 = nullPtr
g_file_output_stream_query_info_async stream' attributes' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
#if 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.MethodInfo FileOutputStreamQueryInfoAsyncMethodInfo a signature where
overloadedMethod _ = 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 stream result_ = liftIO $ do
stream' <- unsafeManagedPtrCastPtr 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 ENABLE_OVERLOADING
data FileOutputStreamQueryInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileOutputStream a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileOutputStreamQueryInfoFinishMethodInfo a signature where
overloadedMethod _ = fileOutputStreamQueryInfoFinish
#endif