#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.FileIOStream
(
FileIOStream(..) ,
IsFileIOStream ,
toFileIOStream ,
noFileIOStream ,
#if ENABLE_OVERLOADING
FileIOStreamGetEtagMethodInfo ,
#endif
fileIOStreamGetEtag ,
#if ENABLE_OVERLOADING
FileIOStreamQueryInfoMethodInfo ,
#endif
fileIOStreamQueryInfo ,
#if ENABLE_OVERLOADING
FileIOStreamQueryInfoAsyncMethodInfo ,
#endif
fileIOStreamQueryInfoAsync ,
#if ENABLE_OVERLOADING
FileIOStreamQueryInfoFinishMethodInfo ,
#endif
fileIOStreamQueryInfoFinish ,
) 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.GClosure as B.GClosure
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.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL
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.IOStream as Gio.IOStream
newtype FileIOStream = FileIOStream (ManagedPtr FileIOStream)
foreign import ccall "g_file_io_stream_get_type"
c_g_file_io_stream_get_type :: IO GType
instance GObject FileIOStream where
gobjectType = c_g_file_io_stream_get_type
class (GObject o, O.IsDescendantOf FileIOStream o) => IsFileIOStream o
instance (GObject o, O.IsDescendantOf FileIOStream o) => IsFileIOStream o
instance O.HasParentTypes FileIOStream
type instance O.ParentTypes FileIOStream = '[Gio.IOStream.IOStream, GObject.Object.Object, Gio.Seekable.Seekable]
toFileIOStream :: (MonadIO m, IsFileIOStream o) => o -> m FileIOStream
toFileIOStream = liftIO . unsafeCastTo FileIOStream
noFileIOStream :: Maybe FileIOStream
noFileIOStream = Nothing
#if ENABLE_OVERLOADING
type family ResolveFileIOStreamMethod (t :: Symbol) (o :: *) :: * where
ResolveFileIOStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileIOStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileIOStreamMethod "canSeek" o = Gio.Seekable.SeekableCanSeekMethodInfo
ResolveFileIOStreamMethod "canTruncate" o = Gio.Seekable.SeekableCanTruncateMethodInfo
ResolveFileIOStreamMethod "clearPending" o = Gio.IOStream.IOStreamClearPendingMethodInfo
ResolveFileIOStreamMethod "close" o = Gio.IOStream.IOStreamCloseMethodInfo
ResolveFileIOStreamMethod "closeAsync" o = Gio.IOStream.IOStreamCloseAsyncMethodInfo
ResolveFileIOStreamMethod "closeFinish" o = Gio.IOStream.IOStreamCloseFinishMethodInfo
ResolveFileIOStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileIOStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileIOStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileIOStreamMethod "hasPending" o = Gio.IOStream.IOStreamHasPendingMethodInfo
ResolveFileIOStreamMethod "isClosed" o = Gio.IOStream.IOStreamIsClosedMethodInfo
ResolveFileIOStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileIOStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileIOStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileIOStreamMethod "queryInfo" o = FileIOStreamQueryInfoMethodInfo
ResolveFileIOStreamMethod "queryInfoAsync" o = FileIOStreamQueryInfoAsyncMethodInfo
ResolveFileIOStreamMethod "queryInfoFinish" o = FileIOStreamQueryInfoFinishMethodInfo
ResolveFileIOStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileIOStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileIOStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileIOStreamMethod "seek" o = Gio.Seekable.SeekableSeekMethodInfo
ResolveFileIOStreamMethod "spliceAsync" o = Gio.IOStream.IOStreamSpliceAsyncMethodInfo
ResolveFileIOStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileIOStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileIOStreamMethod "tell" o = Gio.Seekable.SeekableTellMethodInfo
ResolveFileIOStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileIOStreamMethod "truncate" o = Gio.Seekable.SeekableTruncateMethodInfo
ResolveFileIOStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileIOStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileIOStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileIOStreamMethod "getEtag" o = FileIOStreamGetEtagMethodInfo
ResolveFileIOStreamMethod "getInputStream" o = Gio.IOStream.IOStreamGetInputStreamMethodInfo
ResolveFileIOStreamMethod "getOutputStream" o = Gio.IOStream.IOStreamGetOutputStreamMethodInfo
ResolveFileIOStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileIOStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileIOStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileIOStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileIOStreamMethod "setPending" o = Gio.IOStream.IOStreamSetPendingMethodInfo
ResolveFileIOStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileIOStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileIOStreamMethod t FileIOStream, O.MethodInfo info FileIOStream p) => OL.IsLabel t (FileIOStream -> 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
#if ENABLE_OVERLOADING
instance O.HasAttributeList FileIOStream
type instance O.AttributeList FileIOStream = FileIOStreamAttributeList
type FileIOStreamAttributeList = ('[ '("closed", Gio.IOStream.IOStreamClosedPropertyInfo), '("inputStream", Gio.IOStream.IOStreamInputStreamPropertyInfo), '("outputStream", Gio.IOStream.IOStreamOutputStreamPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList FileIOStream = FileIOStreamSignalList
type FileIOStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_file_io_stream_get_etag" g_file_io_stream_get_etag ::
Ptr FileIOStream ->
IO CString
fileIOStreamGetEtag ::
(B.CallStack.HasCallStack, MonadIO m, IsFileIOStream a) =>
a
-> m T.Text
fileIOStreamGetEtag stream = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result <- g_file_io_stream_get_etag stream'
checkUnexpectedReturnNULL "fileIOStreamGetEtag" result
result' <- cstringToText result
freeMem result
touchManagedPtr stream
return result'
#if ENABLE_OVERLOADING
data FileIOStreamGetEtagMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFileIOStream a) => O.MethodInfo FileIOStreamGetEtagMethodInfo a signature where
overloadedMethod _ = fileIOStreamGetEtag
#endif
foreign import ccall "g_file_io_stream_query_info" g_file_io_stream_query_info ::
Ptr FileIOStream ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileIOStreamQueryInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsFileIOStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m Gio.FileInfo.FileInfo
fileIOStreamQueryInfo 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_io_stream_query_info stream' attributes' maybeCancellable
checkUnexpectedReturnNULL "fileIOStreamQueryInfo" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return result'
) (do
freeMem attributes'
)
#if ENABLE_OVERLOADING
data FileIOStreamQueryInfoMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileIOStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileIOStreamQueryInfoMethodInfo a signature where
overloadedMethod _ = fileIOStreamQueryInfo
#endif
foreign import ccall "g_file_io_stream_query_info_async" g_file_io_stream_query_info_async ::
Ptr FileIOStream ->
CString ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileIOStreamQueryInfoAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFileIOStream a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileIOStreamQueryInfoAsync 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_io_stream_query_info_async stream' attributes' ioPriority maybeCancellable maybeCallback userData
touchManagedPtr stream
whenJust cancellable touchManagedPtr
freeMem attributes'
return ()
#if ENABLE_OVERLOADING
data FileIOStreamQueryInfoAsyncMethodInfo
instance (signature ~ (T.Text -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileIOStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileIOStreamQueryInfoAsyncMethodInfo a signature where
overloadedMethod _ = fileIOStreamQueryInfoAsync
#endif
foreign import ccall "g_file_io_stream_query_info_finish" g_file_io_stream_query_info_finish ::
Ptr FileIOStream ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileIOStreamQueryInfoFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFileIOStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.FileInfo.FileInfo
fileIOStreamQueryInfoFinish stream result_ = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_file_io_stream_query_info_finish stream' result_'
checkUnexpectedReturnNULL "fileIOStreamQueryInfoFinish" result
result' <- (wrapObject Gio.FileInfo.FileInfo) result
touchManagedPtr stream
touchManagedPtr result_
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
data FileIOStreamQueryInfoFinishMethodInfo
instance (signature ~ (b -> m Gio.FileInfo.FileInfo), MonadIO m, IsFileIOStream a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileIOStreamQueryInfoFinishMethodInfo a signature where
overloadedMethod _ = fileIOStreamQueryInfoFinish
#endif