    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream' is a class for using arbitrary
    -- memory chunks as output for GIO streaming output operations.
    --
    -- As of GLib 2.34, t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream' trivially implements
    -- t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream': it always polls as ready.

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gio.Objects.MemoryOutputStream
        (

    -- * Exported types
        MemoryOutputStream(..)                  ,
        IsMemoryOutputStream                    ,
        toMemoryOutputStream                    ,

     -- * Methods
    -- ** Overloaded methods #method:Overloaded methods#

    #if defined(ENABLE_OVERLOADING)
        ResolveMemoryOutputStreamMethod         ,
    #endif

    -- ** getData #method:getData#

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamGetDataMethodInfo     ,
    #endif
        memoryOutputStreamGetData               ,

    -- ** getDataSize #method:getDataSize#

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamGetDataSizeMethodInfo ,
    #endif
        memoryOutputStreamGetDataSize           ,

    -- ** getSize #method:getSize#

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamGetSizeMethodInfo     ,
    #endif
        memoryOutputStreamGetSize               ,

    -- ** newResizable #method:newResizable#

        memoryOutputStreamNewResizable          ,

    -- ** stealAsBytes #method:stealAsBytes#

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamStealAsBytesMethodInfo,
    #endif
        memoryOutputStreamStealAsBytes          ,

    -- ** stealData #method:stealData#

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamStealDataMethodInfo   ,
    #endif
        memoryOutputStreamStealData             ,

     -- * Properties
    -- ** data #attr:data#
    -- | Pointer to buffer where data will be written.
    --
    -- /Since: 2.24/

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamDataPropertyInfo      ,
    #endif
        constructMemoryOutputStreamData         ,
        getMemoryOutputStreamData               ,
    #if defined(ENABLE_OVERLOADING)
        memoryOutputStreamData                  ,
    #endif

    -- ** dataSize #attr:dataSize#
    -- | Size of data written to the buffer.
    --
    -- /Since: 2.24/

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamDataSizePropertyInfo  ,
    #endif
        getMemoryOutputStreamDataSize           ,
    #if defined(ENABLE_OVERLOADING)
        memoryOutputStreamDataSize              ,
    #endif

    -- ** size #attr:size#
    -- | Current size of the data buffer.
    --
    -- /Since: 2.24/

    #if defined(ENABLE_OVERLOADING)
        MemoryOutputStreamSizePropertyInfo      ,
    #endif
        constructMemoryOutputStreamSize         ,
        getMemoryOutputStreamSize               ,
    #if defined(ENABLE_OVERLOADING)
        memoryOutputStreamSize                  ,
    #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.BasicTypes as B.Types
    import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
    import qualified Data.GI.Base.GArray as B.GArray
    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.GI.Base.Signals as B.Signals
    import qualified Control.Monad.IO.Class as MIO
    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.GLib.Structs.Bytes as GLib.Bytes
    import qualified GI.GObject.Objects.Object as GObject.Object
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.PollableOutputStream as Gio.PollableOutputStream
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.Seekable as Gio.Seekable
    import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream

    -- | Memory-managed wrapper type.
    newtype MemoryOutputStream = MemoryOutputStream (SP.ManagedPtr MemoryOutputStream)
        deriving (MemoryOutputStream -> MemoryOutputStream -> Bool
    (MemoryOutputStream -> MemoryOutputStream -> Bool)
    -> (MemoryOutputStream -> MemoryOutputStream -> Bool)
    -> Eq MemoryOutputStream
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: MemoryOutputStream -> MemoryOutputStream -> Bool
    $c/= :: MemoryOutputStream -> MemoryOutputStream -> Bool
    == :: MemoryOutputStream -> MemoryOutputStream -> Bool
    $c== :: MemoryOutputStream -> MemoryOutputStream -> Bool
    Eq)

    instance SP.ManagedPtrNewtype MemoryOutputStream where
        toManagedPtr :: MemoryOutputStream -> ManagedPtr MemoryOutputStream
    toManagedPtr (MemoryOutputStream p :: ManagedPtr MemoryOutputStream
    p) = ManagedPtr MemoryOutputStream
    p

    foreign import ccall "g_memory_output_stream_get_type"
        c_g_memory_output_stream_get_type :: IO B.Types.GType

    instance B.Types.TypedObject MemoryOutputStream where
        glibType :: IO GType
    glibType = IO GType
    c_g_memory_output_stream_get_type

    instance B.Types.GObject MemoryOutputStream

    -- | Convert 'MemoryOutputStream' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue MemoryOutputStream where
        toGValue :: MemoryOutputStream -> IO GValue
    toGValue o :: MemoryOutputStream
    o = do
            GType
    gtype <- IO GType
    c_g_memory_output_stream_get_type
            MemoryOutputStream
    -> (Ptr MemoryOutputStream -> IO GValue) -> IO GValue
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr MemoryOutputStream
    o (GType
    -> (GValue -> Ptr MemoryOutputStream -> IO ())
    -> Ptr MemoryOutputStream
    -> IO GValue
    forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
    B.GValue.buildGValue GType
    gtype GValue -> Ptr MemoryOutputStream -> IO ()
    forall a. GObject a => GValue -> Ptr a -> IO ()
    B.GValue.set_object)

        fromGValue :: GValue -> IO MemoryOutputStream
    fromGValue gv :: GValue
    gv = do
            Ptr MemoryOutputStream
    ptr <- GValue -> IO (Ptr MemoryOutputStream)
    forall b. GObject b => GValue -> IO (Ptr b)
    B.GValue.get_object GValue
    gv :: IO (Ptr MemoryOutputStream)
            (ManagedPtr MemoryOutputStream -> MemoryOutputStream)
    -> Ptr MemoryOutputStream -> IO MemoryOutputStream
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    B.ManagedPtr.newObject ManagedPtr MemoryOutputStream -> MemoryOutputStream
    MemoryOutputStream Ptr MemoryOutputStream
    ptr

    -- | Type class for types which can be safely cast to `MemoryOutputStream`, for instance with `toMemoryOutputStream`.
    class (SP.GObject o, O.IsDescendantOf MemoryOutputStream o) => IsMemoryOutputStream o
    instance (SP.GObject o, O.IsDescendantOf MemoryOutputStream o) => IsMemoryOutputStream o

    instance O.HasParentTypes MemoryOutputStream
    type instance O.ParentTypes MemoryOutputStream = '[Gio.OutputStream.OutputStream, GObject.Object.Object, Gio.PollableOutputStream.PollableOutputStream, Gio.Seekable.Seekable]

    -- | Cast to `MemoryOutputStream`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
    toMemoryOutputStream :: (MonadIO m, IsMemoryOutputStream o) => o -> m MemoryOutputStream
    toMemoryOutputStream :: o -> m MemoryOutputStream
    toMemoryOutputStream = IO MemoryOutputStream -> m MemoryOutputStream
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO MemoryOutputStream -> m MemoryOutputStream)
    -> (o -> IO MemoryOutputStream) -> o -> m MemoryOutputStream
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ManagedPtr MemoryOutputStream -> MemoryOutputStream)
    -> o -> IO MemoryOutputStream
    forall o o'.
    (HasCallStack, ManagedPtrNewtype o, TypedObject o,
     ManagedPtrNewtype o', TypedObject o') =>
    (ManagedPtr o' -> o') -> o -> IO o'
    unsafeCastTo ManagedPtr MemoryOutputStream -> MemoryOutputStream
    MemoryOutputStream

    #if defined(ENABLE_OVERLOADING)
    type family ResolveMemoryOutputStreamMethod (t :: Symbol) (o :: *) :: * where
        ResolveMemoryOutputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveMemoryOutputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveMemoryOutputStreamMethod "canPoll" o = Gio.PollableOutputStream.PollableOutputStreamCanPollMethodInfo
        ResolveMemoryOutputStreamMethod "canSeek" o = Gio.Seekable.SeekableCanSeekMethodInfo
        ResolveMemoryOutputStreamMethod "canTruncate" o = Gio.Seekable.SeekableCanTruncateMethodInfo
        ResolveMemoryOutputStreamMethod "clearPending" o = Gio.OutputStream.OutputStreamClearPendingMethodInfo
        ResolveMemoryOutputStreamMethod "close" o = Gio.OutputStream.OutputStreamCloseMethodInfo
        ResolveMemoryOutputStreamMethod "closeAsync" o = Gio.OutputStream.OutputStreamCloseAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "closeFinish" o = Gio.OutputStream.OutputStreamCloseFinishMethodInfo
        ResolveMemoryOutputStreamMethod "createSource" o = Gio.PollableOutputStream.PollableOutputStreamCreateSourceMethodInfo
        ResolveMemoryOutputStreamMethod "flush" o = Gio.OutputStream.OutputStreamFlushMethodInfo
        ResolveMemoryOutputStreamMethod "flushAsync" o = Gio.OutputStream.OutputStreamFlushAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "flushFinish" o = Gio.OutputStream.OutputStreamFlushFinishMethodInfo
        ResolveMemoryOutputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveMemoryOutputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveMemoryOutputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveMemoryOutputStreamMethod "hasPending" o = Gio.OutputStream.OutputStreamHasPendingMethodInfo
        ResolveMemoryOutputStreamMethod "isClosed" o = Gio.OutputStream.OutputStreamIsClosedMethodInfo
        ResolveMemoryOutputStreamMethod "isClosing" o = Gio.OutputStream.OutputStreamIsClosingMethodInfo
        ResolveMemoryOutputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveMemoryOutputStreamMethod "isWritable" o = Gio.PollableOutputStream.PollableOutputStreamIsWritableMethodInfo
        ResolveMemoryOutputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveMemoryOutputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveMemoryOutputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveMemoryOutputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveMemoryOutputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveMemoryOutputStreamMethod "seek" o = Gio.Seekable.SeekableSeekMethodInfo
        ResolveMemoryOutputStreamMethod "splice" o = Gio.OutputStream.OutputStreamSpliceMethodInfo
        ResolveMemoryOutputStreamMethod "spliceAsync" o = Gio.OutputStream.OutputStreamSpliceAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "spliceFinish" o = Gio.OutputStream.OutputStreamSpliceFinishMethodInfo
        ResolveMemoryOutputStreamMethod "stealAsBytes" o = MemoryOutputStreamStealAsBytesMethodInfo
        ResolveMemoryOutputStreamMethod "stealData" o = MemoryOutputStreamStealDataMethodInfo
        ResolveMemoryOutputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveMemoryOutputStreamMethod "tell" o = Gio.Seekable.SeekableTellMethodInfo
        ResolveMemoryOutputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveMemoryOutputStreamMethod "truncate" o = Gio.Seekable.SeekableTruncateMethodInfo
        ResolveMemoryOutputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveMemoryOutputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveMemoryOutputStreamMethod "write" o = Gio.OutputStream.OutputStreamWriteMethodInfo
        ResolveMemoryOutputStreamMethod "writeAll" o = Gio.OutputStream.OutputStreamWriteAllMethodInfo
        ResolveMemoryOutputStreamMethod "writeAllAsync" o = Gio.OutputStream.OutputStreamWriteAllAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "writeAllFinish" o = Gio.OutputStream.OutputStreamWriteAllFinishMethodInfo
        ResolveMemoryOutputStreamMethod "writeAsync" o = Gio.OutputStream.OutputStreamWriteAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "writeBytes" o = Gio.OutputStream.OutputStreamWriteBytesMethodInfo
        ResolveMemoryOutputStreamMethod "writeBytesAsync" o = Gio.OutputStream.OutputStreamWriteBytesAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "writeBytesFinish" o = Gio.OutputStream.OutputStreamWriteBytesFinishMethodInfo
        ResolveMemoryOutputStreamMethod "writeFinish" o = Gio.OutputStream.OutputStreamWriteFinishMethodInfo
        ResolveMemoryOutputStreamMethod "writeNonblocking" o = Gio.PollableOutputStream.PollableOutputStreamWriteNonblockingMethodInfo
        ResolveMemoryOutputStreamMethod "writev" o = Gio.OutputStream.OutputStreamWritevMethodInfo
        ResolveMemoryOutputStreamMethod "writevAll" o = Gio.OutputStream.OutputStreamWritevAllMethodInfo
        ResolveMemoryOutputStreamMethod "writevAllAsync" o = Gio.OutputStream.OutputStreamWritevAllAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "writevAllFinish" o = Gio.OutputStream.OutputStreamWritevAllFinishMethodInfo
        ResolveMemoryOutputStreamMethod "writevAsync" o = Gio.OutputStream.OutputStreamWritevAsyncMethodInfo
        ResolveMemoryOutputStreamMethod "writevFinish" o = Gio.OutputStream.OutputStreamWritevFinishMethodInfo
        ResolveMemoryOutputStreamMethod "writevNonblocking" o = Gio.PollableOutputStream.PollableOutputStreamWritevNonblockingMethodInfo
        ResolveMemoryOutputStreamMethod "getData" o = MemoryOutputStreamGetDataMethodInfo
        ResolveMemoryOutputStreamMethod "getDataSize" o = MemoryOutputStreamGetDataSizeMethodInfo
        ResolveMemoryOutputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveMemoryOutputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveMemoryOutputStreamMethod "getSize" o = MemoryOutputStreamGetSizeMethodInfo
        ResolveMemoryOutputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveMemoryOutputStreamMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
        ResolveMemoryOutputStreamMethod "setPending" o = Gio.OutputStream.OutputStreamSetPendingMethodInfo
        ResolveMemoryOutputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveMemoryOutputStreamMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveMemoryOutputStreamMethod t MemoryOutputStream, O.MethodInfo info MemoryOutputStream p) => OL.IsLabel t (MemoryOutputStream -> p) where
    #if MIN_VERSION_base(4,10,0)
        fromLabel = O.overloadedMethod @info
    #else
        fromLabel _ = O.overloadedMethod @info
    #endif

    #endif

    -- VVV Prop "data"
       -- Type: TBasicType TPtr
       -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
       -- Nullable: (Just True,Nothing)

    -- | Get the value of the “@data@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' memoryOutputStream #data
    -- @
    getMemoryOutputStreamData :: (MonadIO m, IsMemoryOutputStream o) => o -> m (Ptr ())
    getMemoryOutputStreamData :: o -> m (Ptr ())
    getMemoryOutputStreamData obj :: o
    obj = IO (Ptr ()) -> m (Ptr ())
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
    forall a b. (a -> b) -> a -> b
    $ o -> String -> IO (Ptr ())
    forall a b. GObject a => a -> String -> IO (Ptr b)
    B.Properties.getObjectPropertyPtr o
    obj "data"

    -- | Construct a `GValueConstruct` with valid value for the “@data@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    constructMemoryOutputStreamData :: (IsMemoryOutputStream o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
    constructMemoryOutputStreamData :: Ptr () -> m (GValueConstruct o)
    constructMemoryOutputStreamData val :: Ptr ()
    val = IO (GValueConstruct o) -> m (GValueConstruct o)
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
    -> IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ String -> Ptr () -> IO (GValueConstruct o)
    forall b o. String -> Ptr b -> IO (GValueConstruct o)
    B.Properties.constructObjectPropertyPtr "data" Ptr ()
    val

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamDataPropertyInfo
    instance AttrInfo MemoryOutputStreamDataPropertyInfo where
        type AttrAllowedOps MemoryOutputStreamDataPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
        type AttrBaseTypeConstraint MemoryOutputStreamDataPropertyInfo = IsMemoryOutputStream
        type AttrSetTypeConstraint MemoryOutputStreamDataPropertyInfo = (~) (Ptr ())
        type AttrTransferTypeConstraint MemoryOutputStreamDataPropertyInfo = (~) (Ptr ())
        type AttrTransferType MemoryOutputStreamDataPropertyInfo = Ptr ()
        type AttrGetType MemoryOutputStreamDataPropertyInfo = (Ptr ())
        type AttrLabel MemoryOutputStreamDataPropertyInfo = "data"
        type AttrOrigin MemoryOutputStreamDataPropertyInfo = MemoryOutputStream
        attrGet = getMemoryOutputStreamData
        attrSet = undefined
        attrTransfer _ v = do
            return v
        attrConstruct = constructMemoryOutputStreamData
        attrClear = undefined
    #endif

    -- VVV Prop "data-size"
       -- Type: TBasicType TULong
       -- Flags: [PropertyReadable]
       -- Nullable: (Nothing,Nothing)

    -- | Get the value of the “@data-size@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' memoryOutputStream #dataSize
    -- @
    getMemoryOutputStreamDataSize :: (MonadIO m, IsMemoryOutputStream o) => o -> m CULong
    getMemoryOutputStreamDataSize :: o -> m CULong
    getMemoryOutputStreamDataSize obj :: o
    obj = IO CULong -> m CULong
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
    forall a b. (a -> b) -> a -> b
    $ o -> String -> IO CULong
    forall a. GObject a => a -> String -> IO CULong
    B.Properties.getObjectPropertyULong o
    obj "data-size"

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamDataSizePropertyInfo
    instance AttrInfo MemoryOutputStreamDataSizePropertyInfo where
        type AttrAllowedOps MemoryOutputStreamDataSizePropertyInfo = '[ 'AttrGet]
        type AttrBaseTypeConstraint MemoryOutputStreamDataSizePropertyInfo = IsMemoryOutputStream
        type AttrSetTypeConstraint MemoryOutputStreamDataSizePropertyInfo = (~) ()
        type AttrTransferTypeConstraint MemoryOutputStreamDataSizePropertyInfo = (~) ()
        type AttrTransferType MemoryOutputStreamDataSizePropertyInfo = ()
        type AttrGetType MemoryOutputStreamDataSizePropertyInfo = CULong
        type AttrLabel MemoryOutputStreamDataSizePropertyInfo = "data-size"
        type AttrOrigin MemoryOutputStreamDataSizePropertyInfo = MemoryOutputStream
        attrGet = getMemoryOutputStreamDataSize
        attrSet = undefined
        attrTransfer _ = undefined
        attrConstruct = undefined
        attrClear = undefined
    #endif

    -- VVV Prop "size"
       -- Type: TBasicType TULong
       -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
       -- Nullable: (Nothing,Nothing)

    -- | Get the value of the “@size@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' memoryOutputStream #size
    -- @
    getMemoryOutputStreamSize :: (MonadIO m, IsMemoryOutputStream o) => o -> m CULong
    getMemoryOutputStreamSize :: o -> m CULong
    getMemoryOutputStreamSize obj :: o
    obj = IO CULong -> m CULong
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
    forall a b. (a -> b) -> a -> b
    $ o -> String -> IO CULong
    forall a. GObject a => a -> String -> IO CULong
    B.Properties.getObjectPropertyULong o
    obj "size"

    -- | Construct a `GValueConstruct` with valid value for the “@size@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    constructMemoryOutputStreamSize :: (IsMemoryOutputStream o, MIO.MonadIO m) => CULong -> m (GValueConstruct o)
    constructMemoryOutputStreamSize :: CULong -> m (GValueConstruct o)
    constructMemoryOutputStreamSize val :: CULong
    val = IO (GValueConstruct o) -> m (GValueConstruct o)
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
    -> IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ String -> CULong -> IO (GValueConstruct o)
    forall o. String -> CULong -> IO (GValueConstruct o)
    B.Properties.constructObjectPropertyULong "size" CULong
    val

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamSizePropertyInfo
    instance AttrInfo MemoryOutputStreamSizePropertyInfo where
        type AttrAllowedOps MemoryOutputStreamSizePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
        type AttrBaseTypeConstraint MemoryOutputStreamSizePropertyInfo = IsMemoryOutputStream
        type AttrSetTypeConstraint MemoryOutputStreamSizePropertyInfo = (~) CULong
        type AttrTransferTypeConstraint MemoryOutputStreamSizePropertyInfo = (~) CULong
        type AttrTransferType MemoryOutputStreamSizePropertyInfo = CULong
        type AttrGetType MemoryOutputStreamSizePropertyInfo = CULong
        type AttrLabel MemoryOutputStreamSizePropertyInfo = "size"
        type AttrOrigin MemoryOutputStreamSizePropertyInfo = MemoryOutputStream
        attrGet = getMemoryOutputStreamSize
        attrSet = undefined
        attrTransfer _ v = do
            return v
        attrConstruct = constructMemoryOutputStreamSize
        attrClear = undefined
    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList MemoryOutputStream
    type instance O.AttributeList MemoryOutputStream = MemoryOutputStreamAttributeList
    type MemoryOutputStreamAttributeList = ('[ '("data", MemoryOutputStreamDataPropertyInfo), '("dataSize", MemoryOutputStreamDataSizePropertyInfo), '("size", MemoryOutputStreamSizePropertyInfo)] :: [(Symbol, *)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    memoryOutputStreamData :: AttrLabelProxy "data"
    memoryOutputStreamData = AttrLabelProxy

    memoryOutputStreamDataSize :: AttrLabelProxy "dataSize"
    memoryOutputStreamDataSize = AttrLabelProxy

    memoryOutputStreamSize :: AttrLabelProxy "size"
    memoryOutputStreamSize = AttrLabelProxy

    #endif

    #if defined(ENABLE_OVERLOADING)
    type instance O.SignalList MemoryOutputStream = MemoryOutputStreamSignalList
    type MemoryOutputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

    #endif

    -- method MemoryOutputStream::new_resizable
    -- method type : Constructor
    -- Args: []
    -- Lengths: []
    -- returnType: Just
    --               (TInterface
    --                  Name { namespace = "Gio" , name = "MemoryOutputStream" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_new_resizable" g_memory_output_stream_new_resizable ::
        IO (Ptr MemoryOutputStream)

    -- | Creates a new t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream', using 'GI.GLib.Functions.realloc' and 'GI.GLib.Functions.free'
    -- for memory allocation.
    --
    -- /Since: 2.36/
    memoryOutputStreamNewResizable ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        m MemoryOutputStream
    memoryOutputStreamNewResizable :: m MemoryOutputStream
    memoryOutputStreamNewResizable  = IO MemoryOutputStream -> m MemoryOutputStream
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO MemoryOutputStream -> m MemoryOutputStream)
    -> IO MemoryOutputStream -> m MemoryOutputStream
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    result <- IO (Ptr MemoryOutputStream)
    g_memory_output_stream_new_resizable
        Text -> Ptr MemoryOutputStream -> IO ()
    forall a. HasCallStack => Text -> Ptr a -> IO ()
    checkUnexpectedReturnNULL "memoryOutputStreamNewResizable" Ptr MemoryOutputStream
    result
        MemoryOutputStream
    result' <- ((ManagedPtr MemoryOutputStream -> MemoryOutputStream)
    -> Ptr MemoryOutputStream -> IO MemoryOutputStream
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    wrapObject ManagedPtr MemoryOutputStream -> MemoryOutputStream
    MemoryOutputStream) Ptr MemoryOutputStream
    result
        MemoryOutputStream -> IO MemoryOutputStream
    forall (m :: * -> *) a. Monad m => a -> m a
    return MemoryOutputStream
    result'

    #if defined(ENABLE_OVERLOADING)
    #endif

    -- method MemoryOutputStream::get_data
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "ostream"
    --           , argType =
    --               TInterface Name { namespace = "Gio" , name = "MemoryOutputStream" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GMemoryOutputStream"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TPtr)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_get_data" g_memory_output_stream_get_data ::
        Ptr MemoryOutputStream ->               -- ostream : TInterface (Name {namespace = "Gio", name = "MemoryOutputStream"})
        IO (Ptr ())

    -- | Gets any loaded data from the /@ostream@/.
    --
    -- Note that the returned pointer may become invalid on the next
    -- write or truncate operation on the stream.
    memoryOutputStreamGetData ::
        (B.CallStack.HasCallStack, MonadIO m, IsMemoryOutputStream a) =>
        a
        -- ^ /@ostream@/: a t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream'
        -> m (Ptr ())
        -- ^ __Returns:__ pointer to the stream\'s data, or 'P.Nothing' if the data
        --    has been stolen
    memoryOutputStreamGetData :: a -> m (Ptr ())
    memoryOutputStreamGetData ostream :: a
    ostream = IO (Ptr ()) -> m (Ptr ())
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    ostream' <- a -> IO (Ptr MemoryOutputStream)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    ostream
        Ptr ()
    result <- Ptr MemoryOutputStream -> IO (Ptr ())
    g_memory_output_stream_get_data Ptr MemoryOutputStream
    ostream'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    ostream
        Ptr () -> IO (Ptr ())
    forall (m :: * -> *) a. Monad m => a -> m a
    return Ptr ()
    result

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamGetDataMethodInfo
    instance (signature ~ (m (Ptr ())), MonadIO m, IsMemoryOutputStream a) => O.MethodInfo MemoryOutputStreamGetDataMethodInfo a signature where
        overloadedMethod = memoryOutputStreamGetData

    #endif

    -- method MemoryOutputStream::get_data_size
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "ostream"
    --           , argType =
    --               TInterface Name { namespace = "Gio" , name = "MemoryOutputStream" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GMemoryOutputStream"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TUInt64)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_get_data_size" g_memory_output_stream_get_data_size ::
        Ptr MemoryOutputStream ->               -- ostream : TInterface (Name {namespace = "Gio", name = "MemoryOutputStream"})
        IO Word64

    -- | Returns the number of bytes from the start up to including the last
    -- byte written in the stream that has not been truncated away.
    --
    -- /Since: 2.18/
    memoryOutputStreamGetDataSize ::
        (B.CallStack.HasCallStack, MonadIO m, IsMemoryOutputStream a) =>
        a
        -- ^ /@ostream@/: a t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream'
        -> m Word64
        -- ^ __Returns:__ the number of bytes written to the stream
    memoryOutputStreamGetDataSize :: a -> m Word64
    memoryOutputStreamGetDataSize ostream :: a
    ostream = IO Word64 -> m Word64
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    ostream' <- a -> IO (Ptr MemoryOutputStream)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    ostream
        Word64
    result <- Ptr MemoryOutputStream -> IO Word64
    g_memory_output_stream_get_data_size Ptr MemoryOutputStream
    ostream'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    ostream
        Word64 -> IO Word64
    forall (m :: * -> *) a. Monad m => a -> m a
    return Word64
    result

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamGetDataSizeMethodInfo
    instance (signature ~ (m Word64), MonadIO m, IsMemoryOutputStream a) => O.MethodInfo MemoryOutputStreamGetDataSizeMethodInfo a signature where
        overloadedMethod = memoryOutputStreamGetDataSize

    #endif

    -- method MemoryOutputStream::get_size
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "ostream"
    --           , argType =
    --               TInterface Name { namespace = "Gio" , name = "MemoryOutputStream" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GMemoryOutputStream"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TUInt64)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_get_size" g_memory_output_stream_get_size ::
        Ptr MemoryOutputStream ->               -- ostream : TInterface (Name {namespace = "Gio", name = "MemoryOutputStream"})
        IO Word64

    -- | Gets the size of the currently allocated data area (available from
    -- 'GI.Gio.Objects.MemoryOutputStream.memoryOutputStreamGetData').
    --
    -- You probably don\'t want to use this function on resizable streams.
    -- See 'GI.Gio.Objects.MemoryOutputStream.memoryOutputStreamGetDataSize' instead.  For resizable
    -- streams the size returned by this function is an implementation
    -- detail and may be change at any time in response to operations on the
    -- stream.
    --
    -- If the stream is fixed-sized (ie: no realloc was passed to
    -- @/g_memory_output_stream_new()/@) then this is the maximum size of the
    -- stream and further writes will return 'GI.Gio.Enums.IOErrorEnumNoSpace'.
    --
    -- In any case, if you want the number of bytes currently written to the
    -- stream, use 'GI.Gio.Objects.MemoryOutputStream.memoryOutputStreamGetDataSize'.
    memoryOutputStreamGetSize ::
        (B.CallStack.HasCallStack, MonadIO m, IsMemoryOutputStream a) =>
        a
        -- ^ /@ostream@/: a t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream'
        -> m Word64
        -- ^ __Returns:__ the number of bytes allocated for the data buffer
    memoryOutputStreamGetSize :: a -> m Word64
    memoryOutputStreamGetSize ostream :: a
    ostream = IO Word64 -> m Word64
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    ostream' <- a -> IO (Ptr MemoryOutputStream)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    ostream
        Word64
    result <- Ptr MemoryOutputStream -> IO Word64
    g_memory_output_stream_get_size Ptr MemoryOutputStream
    ostream'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    ostream
        Word64 -> IO Word64
    forall (m :: * -> *) a. Monad m => a -> m a
    return Word64
    result

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamGetSizeMethodInfo
    instance (signature ~ (m Word64), MonadIO m, IsMemoryOutputStream a) => O.MethodInfo MemoryOutputStreamGetSizeMethodInfo a signature where
        overloadedMethod = memoryOutputStreamGetSize

    #endif

    -- method MemoryOutputStream::steal_as_bytes
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "ostream"
    --           , argType =
    --               TInterface Name { namespace = "Gio" , name = "MemoryOutputStream" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GMemoryOutputStream"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_steal_as_bytes" g_memory_output_stream_steal_as_bytes ::
        Ptr MemoryOutputStream ->               -- ostream : TInterface (Name {namespace = "Gio", name = "MemoryOutputStream"})
        IO (Ptr GLib.Bytes.Bytes)

    -- | Returns data from the /@ostream@/ as a t'GI.GLib.Structs.Bytes.Bytes'. /@ostream@/ must be
    -- closed before calling this function.
    --
    -- /Since: 2.34/
    memoryOutputStreamStealAsBytes ::
        (B.CallStack.HasCallStack, MonadIO m, IsMemoryOutputStream a) =>
        a
        -- ^ /@ostream@/: a t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream'
        -> m GLib.Bytes.Bytes
        -- ^ __Returns:__ the stream\'s data
    memoryOutputStreamStealAsBytes :: a -> m Bytes
    memoryOutputStreamStealAsBytes ostream :: a
    ostream = IO Bytes -> m Bytes
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    ostream' <- a -> IO (Ptr MemoryOutputStream)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    ostream
        Ptr Bytes
    result <- Ptr MemoryOutputStream -> IO (Ptr Bytes)
    g_memory_output_stream_steal_as_bytes Ptr MemoryOutputStream
    ostream'
        Text -> Ptr Bytes -> IO ()
    forall a. HasCallStack => Text -> Ptr a -> IO ()
    checkUnexpectedReturnNULL "memoryOutputStreamStealAsBytes" Ptr Bytes
    result
        Bytes
    result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
    forall a.
    (HasCallStack, GBoxed a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    wrapBoxed ManagedPtr Bytes -> Bytes
    GLib.Bytes.Bytes) Ptr Bytes
    result
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    ostream
        Bytes -> IO Bytes
    forall (m :: * -> *) a. Monad m => a -> m a
    return Bytes
    result'

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamStealAsBytesMethodInfo
    instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsMemoryOutputStream a) => O.MethodInfo MemoryOutputStreamStealAsBytesMethodInfo a signature where
        overloadedMethod = memoryOutputStreamStealAsBytes

    #endif

    -- method MemoryOutputStream::steal_data
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "ostream"
    --           , argType =
    --               TInterface Name { namespace = "Gio" , name = "MemoryOutputStream" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GMemoryOutputStream"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TPtr)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_memory_output_stream_steal_data" g_memory_output_stream_steal_data ::
        Ptr MemoryOutputStream ->               -- ostream : TInterface (Name {namespace = "Gio", name = "MemoryOutputStream"})
        IO (Ptr ())

    -- | Gets any loaded data from the /@ostream@/. Ownership of the data
    -- is transferred to the caller; when no longer needed it must be
    -- freed using the free function set in /@ostream@/\'s
    -- t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream':@/destroy-function/@ property.
    --
    -- /@ostream@/ must be closed before calling this function.
    --
    -- /Since: 2.26/
    memoryOutputStreamStealData ::
        (B.CallStack.HasCallStack, MonadIO m, IsMemoryOutputStream a) =>
        a
        -- ^ /@ostream@/: a t'GI.Gio.Objects.MemoryOutputStream.MemoryOutputStream'
        -> m (Ptr ())
        -- ^ __Returns:__ the stream\'s data, or 'P.Nothing' if it has previously
        --    been stolen
    memoryOutputStreamStealData :: a -> m (Ptr ())
    memoryOutputStreamStealData ostream :: a
    ostream = IO (Ptr ()) -> m (Ptr ())
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr MemoryOutputStream
    ostream' <- a -> IO (Ptr MemoryOutputStream)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    ostream
        Ptr ()
    result <- Ptr MemoryOutputStream -> IO (Ptr ())
    g_memory_output_stream_steal_data Ptr MemoryOutputStream
    ostream'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    ostream
        Ptr () -> IO (Ptr ())
    forall (m :: * -> *) a. Monad m => a -> m a
    return Ptr ()
    result

    #if defined(ENABLE_OVERLOADING)
    data MemoryOutputStreamStealDataMethodInfo
    instance (signature ~ (m (Ptr ())), MonadIO m, IsMemoryOutputStream a) => O.MethodInfo MemoryOutputStreamStealDataMethodInfo a signature where
        overloadedMethod = memoryOutputStreamStealData

    #endif