gi-gio-0.2.44.12: GI/Gio/Objects/FileOutputStream.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gio.Objects.FileOutputStream
(
-- * Exported types
FileOutputStream(..) ,
FileOutputStreamK ,
toFileOutputStream ,
noFileOutputStream ,
-- * Methods
-- ** fileOutputStreamGetEtag
fileOutputStreamGetEtag ,
-- ** fileOutputStreamQueryInfo
fileOutputStreamQueryInfo ,
-- ** fileOutputStreamQueryInfoAsync
fileOutputStreamQueryInfoAsync ,
-- ** fileOutputStreamQueryInfoFinish
fileOutputStreamQueryInfoFinish ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject
newtype FileOutputStream = FileOutputStream (ForeignPtr FileOutputStream)
foreign import ccall "g_file_output_stream_get_type"
c_g_file_output_stream_get_type :: IO GType
type instance ParentTypes FileOutputStream = FileOutputStreamParentTypes
type FileOutputStreamParentTypes = '[OutputStream, GObject.Object, Seekable]
instance GObject FileOutputStream where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_file_output_stream_get_type
class GObject o => FileOutputStreamK o
instance (GObject o, IsDescendantOf FileOutputStream o) => FileOutputStreamK o
toFileOutputStream :: FileOutputStreamK o => o -> IO FileOutputStream
toFileOutputStream = unsafeCastTo FileOutputStream
noFileOutputStream :: Maybe FileOutputStream
noFileOutputStream = Nothing
type instance AttributeList FileOutputStream = FileOutputStreamAttributeList
type FileOutputStreamAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList FileOutputStream = FileOutputStreamSignalList
type FileOutputStreamSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method FileOutputStream::get_etag
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_file_output_stream_get_etag" g_file_output_stream_get_etag ::
Ptr FileOutputStream -> -- _obj : TInterface "Gio" "FileOutputStream"
IO CString
fileOutputStreamGetEtag ::
(MonadIO m, FileOutputStreamK a) =>
a -> -- _obj
m T.Text
fileOutputStreamGetEtag _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_file_output_stream_get_etag _obj'
checkUnexpectedReturnNULL "g_file_output_stream_get_etag" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'
-- method FileOutputStream::query_info
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "FileInfo"
-- throws : True
-- Skip return : False
foreign import ccall "g_file_output_stream_query_info" g_file_output_stream_query_info ::
Ptr FileOutputStream -> -- _obj : TInterface "Gio" "FileOutputStream"
CString -> -- attributes : TBasicType TUTF8
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
Ptr (Ptr GError) -> -- error
IO (Ptr FileInfo)
fileOutputStreamQueryInfo ::
(MonadIO m, FileOutputStreamK a, CancellableK b) =>
a -> -- _obj
T.Text -> -- attributes
Maybe (b) -> -- cancellable
m FileInfo
fileOutputStreamQueryInfo _obj attributes cancellable = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_file_output_stream_query_info _obj' attributes' maybeCancellable
checkUnexpectedReturnNULL "g_file_output_stream_query_info" result
result' <- (wrapObject FileInfo) result
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
freeMem attributes'
return result'
) (do
freeMem attributes'
)
-- method FileOutputStream::query_info_async
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "io_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attributes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "io_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_file_output_stream_query_info_async" g_file_output_stream_query_info_async ::
Ptr FileOutputStream -> -- _obj : TInterface "Gio" "FileOutputStream"
CString -> -- attributes : TBasicType TUTF8
Int32 -> -- io_priority : TBasicType TInt32
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
fileOutputStreamQueryInfoAsync ::
(MonadIO m, FileOutputStreamK a, CancellableK b) =>
a -> -- _obj
T.Text -> -- attributes
Int32 -> -- io_priority
Maybe (b) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
fileOutputStreamQueryInfoAsync _obj attributes io_priority cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
attributes' <- textToCString attributes
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_file_output_stream_query_info_async _obj' attributes' io_priority maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
-- method FileOutputStream::query_info_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "FileInfo"
-- throws : True
-- Skip return : False
foreign import ccall "g_file_output_stream_query_info_finish" g_file_output_stream_query_info_finish ::
Ptr FileOutputStream -> -- _obj : TInterface "Gio" "FileOutputStream"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO (Ptr FileInfo)
fileOutputStreamQueryInfoFinish ::
(MonadIO m, FileOutputStreamK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m FileInfo
fileOutputStreamQueryInfoFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_file_output_stream_query_info_finish _obj' result_'
checkUnexpectedReturnNULL "g_file_output_stream_query_info_finish" result
result' <- (wrapObject FileInfo) result
touchManagedPtr _obj
touchManagedPtr result_
return result'
) (do
return ()
)