#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Soup.Objects.MultipartInputStream
(
MultipartInputStream(..) ,
IsMultipartInputStream ,
toMultipartInputStream ,
noMultipartInputStream ,
#if ENABLE_OVERLOADING
MultipartInputStreamGetHeadersMethodInfo,
#endif
multipartInputStreamGetHeaders ,
multipartInputStreamNew ,
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartMethodInfo ,
#endif
multipartInputStreamNextPart ,
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartAsyncMethodInfo,
#endif
multipartInputStreamNextPartAsync ,
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartFinishMethodInfo,
#endif
multipartInputStreamNextPartFinish ,
#if ENABLE_OVERLOADING
MultipartInputStreamMessagePropertyInfo ,
#endif
constructMultipartInputStreamMessage ,
getMultipartInputStreamMessage ,
#if ENABLE_OVERLOADING
multipartInputStreamMessage ,
#endif
) 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 qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.PollableInputStream as Gio.PollableInputStream
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.FilterInputStream as Gio.FilterInputStream
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders
newtype MultipartInputStream = MultipartInputStream (ManagedPtr MultipartInputStream)
foreign import ccall "soup_multipart_input_stream_get_type"
c_soup_multipart_input_stream_get_type :: IO GType
instance GObject MultipartInputStream where
gobjectType = c_soup_multipart_input_stream_get_type
class (GObject o, O.IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o
instance (GObject o, O.IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o
instance O.HasParentTypes MultipartInputStream
type instance O.ParentTypes MultipartInputStream = '[Gio.FilterInputStream.FilterInputStream, Gio.InputStream.InputStream, GObject.Object.Object, Gio.PollableInputStream.PollableInputStream]
toMultipartInputStream :: (MonadIO m, IsMultipartInputStream o) => o -> m MultipartInputStream
toMultipartInputStream = liftIO . unsafeCastTo MultipartInputStream
noMultipartInputStream :: Maybe MultipartInputStream
noMultipartInputStream = Nothing
#if ENABLE_OVERLOADING
type family ResolveMultipartInputStreamMethod (t :: Symbol) (o :: *) :: * where
ResolveMultipartInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMultipartInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMultipartInputStreamMethod "canPoll" o = Gio.PollableInputStream.PollableInputStreamCanPollMethodInfo
ResolveMultipartInputStreamMethod "clearPending" o = Gio.InputStream.InputStreamClearPendingMethodInfo
ResolveMultipartInputStreamMethod "close" o = Gio.InputStream.InputStreamCloseMethodInfo
ResolveMultipartInputStreamMethod "closeAsync" o = Gio.InputStream.InputStreamCloseAsyncMethodInfo
ResolveMultipartInputStreamMethod "closeFinish" o = Gio.InputStream.InputStreamCloseFinishMethodInfo
ResolveMultipartInputStreamMethod "createSource" o = Gio.PollableInputStream.PollableInputStreamCreateSourceMethodInfo
ResolveMultipartInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMultipartInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMultipartInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMultipartInputStreamMethod "hasPending" o = Gio.InputStream.InputStreamHasPendingMethodInfo
ResolveMultipartInputStreamMethod "isClosed" o = Gio.InputStream.InputStreamIsClosedMethodInfo
ResolveMultipartInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMultipartInputStreamMethod "isReadable" o = Gio.PollableInputStream.PollableInputStreamIsReadableMethodInfo
ResolveMultipartInputStreamMethod "nextPart" o = MultipartInputStreamNextPartMethodInfo
ResolveMultipartInputStreamMethod "nextPartAsync" o = MultipartInputStreamNextPartAsyncMethodInfo
ResolveMultipartInputStreamMethod "nextPartFinish" o = MultipartInputStreamNextPartFinishMethodInfo
ResolveMultipartInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMultipartInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMultipartInputStreamMethod "read" o = Gio.InputStream.InputStreamReadMethodInfo
ResolveMultipartInputStreamMethod "readAll" o = Gio.InputStream.InputStreamReadAllMethodInfo
ResolveMultipartInputStreamMethod "readAllAsync" o = Gio.InputStream.InputStreamReadAllAsyncMethodInfo
ResolveMultipartInputStreamMethod "readAllFinish" o = Gio.InputStream.InputStreamReadAllFinishMethodInfo
ResolveMultipartInputStreamMethod "readAsync" o = Gio.InputStream.InputStreamReadAsyncMethodInfo
ResolveMultipartInputStreamMethod "readBytes" o = Gio.InputStream.InputStreamReadBytesMethodInfo
ResolveMultipartInputStreamMethod "readBytesAsync" o = Gio.InputStream.InputStreamReadBytesAsyncMethodInfo
ResolveMultipartInputStreamMethod "readBytesFinish" o = Gio.InputStream.InputStreamReadBytesFinishMethodInfo
ResolveMultipartInputStreamMethod "readFinish" o = Gio.InputStream.InputStreamReadFinishMethodInfo
ResolveMultipartInputStreamMethod "readNonblocking" o = Gio.PollableInputStream.PollableInputStreamReadNonblockingMethodInfo
ResolveMultipartInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMultipartInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMultipartInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMultipartInputStreamMethod "skip" o = Gio.InputStream.InputStreamSkipMethodInfo
ResolveMultipartInputStreamMethod "skipAsync" o = Gio.InputStream.InputStreamSkipAsyncMethodInfo
ResolveMultipartInputStreamMethod "skipFinish" o = Gio.InputStream.InputStreamSkipFinishMethodInfo
ResolveMultipartInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMultipartInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMultipartInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMultipartInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMultipartInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMultipartInputStreamMethod "getBaseStream" o = Gio.FilterInputStream.FilterInputStreamGetBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "getCloseBaseStream" o = Gio.FilterInputStream.FilterInputStreamGetCloseBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMultipartInputStreamMethod "getHeaders" o = MultipartInputStreamGetHeadersMethodInfo
ResolveMultipartInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMultipartInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMultipartInputStreamMethod "setCloseBaseStream" o = Gio.FilterInputStream.FilterInputStreamSetCloseBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMultipartInputStreamMethod "setPending" o = Gio.InputStream.InputStreamSetPendingMethodInfo
ResolveMultipartInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMultipartInputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMultipartInputStreamMethod t MultipartInputStream, O.MethodInfo info MultipartInputStream p) => OL.IsLabel t (MultipartInputStream -> 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
getMultipartInputStreamMessage :: (MonadIO m, IsMultipartInputStream o) => o -> m (Maybe Soup.Message.Message)
getMultipartInputStreamMessage obj = liftIO $ B.Properties.getObjectPropertyObject obj "message" Soup.Message.Message
constructMultipartInputStreamMessage :: (IsMultipartInputStream o, Soup.Message.IsMessage a) => a -> IO (GValueConstruct o)
constructMultipartInputStreamMessage val = B.Properties.constructObjectPropertyObject "message" (Just val)
#if ENABLE_OVERLOADING
data MultipartInputStreamMessagePropertyInfo
instance AttrInfo MultipartInputStreamMessagePropertyInfo where
type AttrAllowedOps MultipartInputStreamMessagePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint MultipartInputStreamMessagePropertyInfo = Soup.Message.IsMessage
type AttrBaseTypeConstraint MultipartInputStreamMessagePropertyInfo = IsMultipartInputStream
type AttrGetType MultipartInputStreamMessagePropertyInfo = (Maybe Soup.Message.Message)
type AttrLabel MultipartInputStreamMessagePropertyInfo = "message"
type AttrOrigin MultipartInputStreamMessagePropertyInfo = MultipartInputStream
attrGet _ = getMultipartInputStreamMessage
attrSet _ = undefined
attrConstruct _ = constructMultipartInputStreamMessage
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList MultipartInputStream
type instance O.AttributeList MultipartInputStream = MultipartInputStreamAttributeList
type MultipartInputStreamAttributeList = ('[ '("baseStream", Gio.FilterInputStream.FilterInputStreamBaseStreamPropertyInfo), '("closeBaseStream", Gio.FilterInputStream.FilterInputStreamCloseBaseStreamPropertyInfo), '("message", MultipartInputStreamMessagePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
multipartInputStreamMessage :: AttrLabelProxy "message"
multipartInputStreamMessage = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList MultipartInputStream = MultipartInputStreamSignalList
type MultipartInputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "soup_multipart_input_stream_new" soup_multipart_input_stream_new ::
Ptr Soup.Message.Message ->
Ptr Gio.InputStream.InputStream ->
IO (Ptr MultipartInputStream)
multipartInputStreamNew ::
(B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a, Gio.InputStream.IsInputStream b) =>
a
-> b
-> m MultipartInputStream
multipartInputStreamNew msg baseStream = liftIO $ do
msg' <- unsafeManagedPtrCastPtr msg
baseStream' <- unsafeManagedPtrCastPtr baseStream
result <- soup_multipart_input_stream_new msg' baseStream'
checkUnexpectedReturnNULL "multipartInputStreamNew" result
result' <- (wrapObject MultipartInputStream) result
touchManagedPtr msg
touchManagedPtr baseStream
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "soup_multipart_input_stream_get_headers" soup_multipart_input_stream_get_headers ::
Ptr MultipartInputStream ->
IO (Ptr Soup.MessageHeaders.MessageHeaders)
multipartInputStreamGetHeaders ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a) =>
a
-> m (Maybe Soup.MessageHeaders.MessageHeaders)
multipartInputStreamGetHeaders multipart = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
result <- soup_multipart_input_stream_get_headers multipart'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed Soup.MessageHeaders.MessageHeaders) result'
return result''
touchManagedPtr multipart
return maybeResult
#if ENABLE_OVERLOADING
data MultipartInputStreamGetHeadersMethodInfo
instance (signature ~ (m (Maybe Soup.MessageHeaders.MessageHeaders)), MonadIO m, IsMultipartInputStream a) => O.MethodInfo MultipartInputStreamGetHeadersMethodInfo a signature where
overloadedMethod _ = multipartInputStreamGetHeaders
#endif
foreign import ccall "soup_multipart_input_stream_next_part" soup_multipart_input_stream_next_part ::
Ptr MultipartInputStream ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.InputStream.InputStream)
multipartInputStreamNextPart ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m (Maybe Gio.InputStream.InputStream)
multipartInputStreamNextPart multipart cancellable = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ soup_multipart_input_stream_next_part multipart' maybeCancellable
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.InputStream.InputStream) result'
return result''
touchManagedPtr multipart
whenJust cancellable touchManagedPtr
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartMethodInfo
instance (signature ~ (Maybe (b) -> m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MultipartInputStreamNextPartMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPart
#endif
foreign import ccall "soup_multipart_input_stream_next_part_async" soup_multipart_input_stream_next_part_async ::
Ptr MultipartInputStream ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
multipartInputStreamNextPartAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
multipartInputStreamNextPartAsync multipart ioPriority cancellable callback = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
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 data_ = nullPtr
soup_multipart_input_stream_next_part_async multipart' ioPriority maybeCancellable maybeCallback data_
touchManagedPtr multipart
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MultipartInputStreamNextPartAsyncMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPartAsync
#endif
foreign import ccall "soup_multipart_input_stream_next_part_finish" soup_multipart_input_stream_next_part_finish ::
Ptr MultipartInputStream ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.InputStream.InputStream)
multipartInputStreamNextPartFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m (Maybe Gio.InputStream.InputStream)
multipartInputStreamNextPartFinish multipart result_ = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ soup_multipart_input_stream_next_part_finish multipart' result_'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.InputStream.InputStream) result'
return result''
touchManagedPtr multipart
touchManagedPtr result_
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartFinishMethodInfo
instance (signature ~ (b -> m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsMultipartInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MultipartInputStreamNextPartFinishMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPartFinish
#endif