#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.FileInputStream
(
FileInputStream(..) ,
IsFileInputStream ,
toFileInputStream ,
noFileInputStream ,
#if ENABLE_OVERLOADING
FileInputStreamQueryInfoMethodInfo ,
#endif
fileInputStreamQueryInfo ,
#if ENABLE_OVERLOADING
FileInputStreamQueryInfoAsyncMethodInfo ,
#endif
fileInputStreamQueryInfoAsync ,
#if ENABLE_OVERLOADING
FileInputStreamQueryInfoFinishMethodInfo,
#endif
fileInputStreamQueryInfoFinish ,
) 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.InputStream as Gio.InputStream
newtype FileInputStream = FileInputStream (ManagedPtr FileInputStream)
foreign import ccall "g_file_input_stream_get_type"
c_g_file_input_stream_get_type :: IO GType
instance GObject FileInputStream where
gobjectType _ = c_g_file_input_stream_get_type
class GObject o => IsFileInputStream o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError FileInputStream a) =>
IsFileInputStream a
#endif
instance IsFileInputStream FileInputStream
instance Gio.InputStream.IsInputStream FileInputStream
instance GObject.Object.IsObject FileInputStream
instance Gio.Seekable.IsSeekable FileInputStream
toFileInputStream :: (MonadIO m, IsFileInputStream o) => o -> m FileInputStream
toFileInputStream = liftIO . unsafeCastTo FileInputStream
noFileInputStream :: Maybe FileInputStream
noFileInputStream = Nothing
#if ENABLE_OVERLOADING
type family ResolveFileInputStreamMethod (t :: Symbol) (o :: *) :: * where
ResolveFileInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileInputStreamMethod "canSeek" o = Gio.Seekable.SeekableCanSeekMethodInfo
ResolveFileInputStreamMethod "canTruncate" o = Gio.Seekable.SeekableCanTruncateMethodInfo
ResolveFileInputStreamMethod "clearPending" o = Gio.InputStream.InputStreamClearPendingMethodInfo
ResolveFileInputStreamMethod "close" o = Gio.InputStream.InputStreamCloseMethodInfo
ResolveFileInputStreamMethod "closeAsync" o = Gio.InputStream.InputStreamCloseAsyncMethodInfo
ResolveFileInputStreamMethod "closeFinish" o = Gio.InputStream.InputStreamCloseFinishMethodInfo
ResolveFileInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileInputStreamMethod "hasPending" o = Gio.InputStream.InputStreamHasPendingMethodInfo
ResolveFileInputStreamMethod "isClosed" o = Gio.InputStream.InputStreamIsClosedMethodInfo
ResolveFileInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileInputStreamMethod "queryInfo" o = FileInputStreamQueryInfoMethodInfo
ResolveFileInputStreamMethod "queryInfoAsync" o = FileInputStreamQueryInfoAsyncMethodInfo
ResolveFileInputStreamMethod "queryInfoFinish" o = FileInputStreamQueryInfoFinishMethodInfo
ResolveFileInputStreamMethod "read" o = Gio.InputStream.InputStreamReadMethodInfo
ResolveFileInputStreamMethod "readAll" o = Gio.InputStream.InputStreamReadAllMethodInfo
ResolveFileInputStreamMethod "readAllAsync" o = Gio.InputStream.InputStreamReadAllAsyncMethodInfo
ResolveFileInputStreamMethod "readAllFinish" o = Gio.InputStream.InputStreamReadAllFinishMethodInfo
ResolveFileInputStreamMethod "readAsync" o = Gio.InputStream.InputStreamReadAsyncMethodInfo
ResolveFileInputStreamMethod "readBytes" o = Gio.InputStream.InputStreamReadBytesMethodInfo
ResolveFileInputStreamMethod "readBytesAsync" o = Gio.InputStream.InputStreamReadBytesAsyncMethodInfo
ResolveFileInputStreamMethod "readBytesFinish" o = Gio.InputStream.InputStreamReadBytesFinishMethodInfo
ResolveFileInputStreamMethod "readFinish" o = Gio.InputStream.InputStreamReadFinishMethodInfo
ResolveFileInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileInputStreamMethod "seek" o = Gio.Seekable.SeekableSeekMethodInfo
ResolveFileInputStreamMethod "skip" o = Gio.InputStream.InputStreamSkipMethodInfo
ResolveFileInputStreamMethod "skipAsync" o = Gio.InputStream.InputStreamSkipAsyncMethodInfo
ResolveFileInputStreamMethod "skipFinish" o = Gio.InputStream.InputStreamSkipFinishMethodInfo
ResolveFileInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileInputStreamMethod "tell" o = Gio.Seekable.SeekableTellMethodInfo
ResolveFileInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileInputStreamMethod "truncate" o = Gio.Seekable.SeekableTruncateMethodInfo
ResolveFileInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileInputStreamMethod "setPending" o = Gio.InputStream.InputStreamSetPendingMethodInfo
ResolveFileInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileInputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileInputStreamMethod t FileInputStream, O.MethodInfo info FileInputStream p) => O.IsLabelProxy t (FileInputStream -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveFileInputStreamMethod t FileInputStream, O.MethodInfo info FileInputStream p) => O.IsLabel t (FileInputStream -> 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 FileInputStream
type instance O.AttributeList FileInputStream = FileInputStreamAttributeList
type FileInputStreamAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList FileInputStream = FileInputStreamSignalList
type FileInputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_file_input_stream_query_info" g_file_input_stream_query_info ::
Ptr FileInputStream ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileInputStreamQueryInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFileInputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m Gio.FileInfo.FileInfo
fileInputStreamQueryInfo 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_input_stream_query_info stream' attributes' maybeCancellable
checkUnexpectedReturnNULL "fileInputStreamQueryInfo" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return result'
) (do
freeMem attributes'
)
#if ENABLE_OVERLOADING
data FileInputStreamQueryInfoMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileInputStreamQueryInfoMethodInfo a signature where
overloadedMethod _ = fileInputStreamQueryInfo
#endif
foreign import ccall "g_file_input_stream_query_info_async" g_file_input_stream_query_info_async ::
Ptr FileInputStream ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileInputStreamQueryInfoAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFileInputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileInputStreamQueryInfoAsync 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_input_stream_query_info_async stream' attributes' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
#if ENABLE_OVERLOADING
data FileInputStreamQueryInfoAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileInputStreamQueryInfoAsyncMethodInfo a signature where
overloadedMethod _ = fileInputStreamQueryInfoAsync
#endif
foreign import ccall "g_file_input_stream_query_info_finish" g_file_input_stream_query_info_finish ::
Ptr FileInputStream ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileInputStreamQueryInfoFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFileInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInfo.FileInfo
fileInputStreamQueryInfoFinish stream result_ = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_file_input_stream_query_info_finish stream' result_'
checkUnexpectedReturnNULL "fileInputStreamQueryInfoFinish" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
touchManagedPtr result_
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
data FileInputStreamQueryInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileInputStreamQueryInfoFinishMethodInfo a signature where
overloadedMethod _ = fileInputStreamQueryInfoFinish
#endif