gi-gio-0.2.44.12: GI/Gio/Objects/FileInputStream.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.FileInputStream
(
-- * Exported types
FileInputStream(..) ,
FileInputStreamK ,
toFileInputStream ,
noFileInputStream ,
-- * Methods
-- ** fileInputStreamQueryInfo
fileInputStreamQueryInfo ,
-- ** fileInputStreamQueryInfoAsync
fileInputStreamQueryInfoAsync ,
-- ** fileInputStreamQueryInfoFinish
fileInputStreamQueryInfoFinish ,
) 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 FileInputStream = FileInputStream (ForeignPtr FileInputStream)
foreign import ccall "g_file_input_stream_get_type"
c_g_file_input_stream_get_type :: IO GType
type instance ParentTypes FileInputStream = FileInputStreamParentTypes
type FileInputStreamParentTypes = '[InputStream, GObject.Object, Seekable]
instance GObject FileInputStream where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_file_input_stream_get_type
class GObject o => FileInputStreamK o
instance (GObject o, IsDescendantOf FileInputStream o) => FileInputStreamK o
toFileInputStream :: FileInputStreamK o => o -> IO FileInputStream
toFileInputStream = unsafeCastTo FileInputStream
noFileInputStream :: Maybe FileInputStream
noFileInputStream = Nothing
type instance AttributeList FileInputStream = FileInputStreamAttributeList
type FileInputStreamAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList FileInputStream = FileInputStreamSignalList
type FileInputStreamSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method FileInputStream::query_info
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileInputStream", 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" "FileInputStream", 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_input_stream_query_info" g_file_input_stream_query_info ::
Ptr FileInputStream -> -- _obj : TInterface "Gio" "FileInputStream"
CString -> -- attributes : TBasicType TUTF8
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
Ptr (Ptr GError) -> -- error
IO (Ptr FileInfo)
fileInputStreamQueryInfo ::
(MonadIO m, FileInputStreamK a, CancellableK b) =>
a -> -- _obj
T.Text -> -- attributes
Maybe (b) -> -- cancellable
m FileInfo
fileInputStreamQueryInfo _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_input_stream_query_info _obj' attributes' maybeCancellable
checkUnexpectedReturnNULL "g_file_input_stream_query_info" result
result' <- (wrapObject FileInfo) result
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
freeMem attributes'
return result'
) (do
freeMem attributes'
)
-- method FileInputStream::query_info_async
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileInputStream", 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" "FileInputStream", 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_input_stream_query_info_async" g_file_input_stream_query_info_async ::
Ptr FileInputStream -> -- _obj : TInterface "Gio" "FileInputStream"
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 ()
fileInputStreamQueryInfoAsync ::
(MonadIO m, FileInputStreamK a, CancellableK b) =>
a -> -- _obj
T.Text -> -- attributes
Int32 -> -- io_priority
Maybe (b) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
fileInputStreamQueryInfoAsync _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_input_stream_query_info_async _obj' attributes' io_priority maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
-- method FileInputStream::query_info_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileInputStream", 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" "FileInputStream", 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_input_stream_query_info_finish" g_file_input_stream_query_info_finish ::
Ptr FileInputStream -> -- _obj : TInterface "Gio" "FileInputStream"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO (Ptr FileInfo)
fileInputStreamQueryInfoFinish ::
(MonadIO m, FileInputStreamK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m FileInfo
fileInputStreamQueryInfoFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_file_input_stream_query_info_finish _obj' result_'
checkUnexpectedReturnNULL "g_file_input_stream_query_info_finish" result
result' <- (wrapObject FileInfo) result
touchManagedPtr _obj
touchManagedPtr result_
return result'
) (do
return ()
)