{- |
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.DataOutputStream
    ( 

-- * Exported types
    DataOutputStream(..)                    ,
    DataOutputStreamK                       ,
    toDataOutputStream                      ,
    noDataOutputStream                      ,


 -- * Methods
-- ** dataOutputStreamGetByteOrder
    dataOutputStreamGetByteOrder            ,


-- ** dataOutputStreamNew
    dataOutputStreamNew                     ,


-- ** dataOutputStreamPutByte
    dataOutputStreamPutByte                 ,


-- ** dataOutputStreamPutInt16
    dataOutputStreamPutInt16                ,


-- ** dataOutputStreamPutInt32
    dataOutputStreamPutInt32                ,


-- ** dataOutputStreamPutInt64
    dataOutputStreamPutInt64                ,


-- ** dataOutputStreamPutString
    dataOutputStreamPutString               ,


-- ** dataOutputStreamPutUint16
    dataOutputStreamPutUint16               ,


-- ** dataOutputStreamPutUint32
    dataOutputStreamPutUint32               ,


-- ** dataOutputStreamPutUint64
    dataOutputStreamPutUint64               ,


-- ** dataOutputStreamSetByteOrder
    dataOutputStreamSetByteOrder            ,




 -- * Properties
-- ** ByteOrder
    DataOutputStreamByteOrderPropertyInfo   ,
    constructDataOutputStreamByteOrder      ,
    getDataOutputStreamByteOrder            ,
    setDataOutputStreamByteOrder            ,




    ) 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 DataOutputStream = DataOutputStream (ForeignPtr DataOutputStream)
foreign import ccall "g_data_output_stream_get_type"
    c_g_data_output_stream_get_type :: IO GType

type instance ParentTypes DataOutputStream = DataOutputStreamParentTypes
type DataOutputStreamParentTypes = '[FilterOutputStream, OutputStream, GObject.Object, Seekable]

instance GObject DataOutputStream where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_data_output_stream_get_type
    

class GObject o => DataOutputStreamK o
instance (GObject o, IsDescendantOf DataOutputStream o) => DataOutputStreamK o

toDataOutputStream :: DataOutputStreamK o => o -> IO DataOutputStream
toDataOutputStream = unsafeCastTo DataOutputStream

noDataOutputStream :: Maybe DataOutputStream
noDataOutputStream = Nothing

-- VVV Prop "byte-order"
   -- Type: TInterface "Gio" "DataStreamByteOrder"
   -- Flags: [PropertyReadable,PropertyWritable]

getDataOutputStreamByteOrder :: (MonadIO m, DataOutputStreamK o) => o -> m DataStreamByteOrder
getDataOutputStreamByteOrder obj = liftIO $ getObjectPropertyEnum obj "byte-order"

setDataOutputStreamByteOrder :: (MonadIO m, DataOutputStreamK o) => o -> DataStreamByteOrder -> m ()
setDataOutputStreamByteOrder obj val = liftIO $ setObjectPropertyEnum obj "byte-order" val

constructDataOutputStreamByteOrder :: DataStreamByteOrder -> IO ([Char], GValue)
constructDataOutputStreamByteOrder val = constructObjectPropertyEnum "byte-order" val

data DataOutputStreamByteOrderPropertyInfo
instance AttrInfo DataOutputStreamByteOrderPropertyInfo where
    type AttrAllowedOps DataOutputStreamByteOrderPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DataOutputStreamByteOrderPropertyInfo = (~) DataStreamByteOrder
    type AttrBaseTypeConstraint DataOutputStreamByteOrderPropertyInfo = DataOutputStreamK
    type AttrGetType DataOutputStreamByteOrderPropertyInfo = DataStreamByteOrder
    type AttrLabel DataOutputStreamByteOrderPropertyInfo = "DataOutputStream::byte-order"
    attrGet _ = getDataOutputStreamByteOrder
    attrSet _ = setDataOutputStreamByteOrder
    attrConstruct _ = constructDataOutputStreamByteOrder

type instance AttributeList DataOutputStream = DataOutputStreamAttributeList
type DataOutputStreamAttributeList = ('[ '("base-stream", FilterOutputStreamBaseStreamPropertyInfo), '("byte-order", DataOutputStreamByteOrderPropertyInfo), '("close-base-stream", FilterOutputStreamCloseBaseStreamPropertyInfo)] :: [(Symbol, *)])

type instance SignalList DataOutputStream = DataOutputStreamSignalList
type DataOutputStreamSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DataOutputStream::new
-- method type : Constructor
-- Args : [Arg {argName = "base_stream", argType = TInterface "Gio" "OutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "base_stream", argType = TInterface "Gio" "OutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DataOutputStream"
-- throws : False
-- Skip return : False

foreign import ccall "g_data_output_stream_new" g_data_output_stream_new :: 
    Ptr OutputStream ->                     -- base_stream : TInterface "Gio" "OutputStream"
    IO (Ptr DataOutputStream)


dataOutputStreamNew ::
    (MonadIO m, OutputStreamK a) =>
    a ->                                    -- base_stream
    m DataOutputStream
dataOutputStreamNew base_stream = liftIO $ do
    let base_stream' = unsafeManagedPtrCastPtr base_stream
    result <- g_data_output_stream_new base_stream'
    checkUnexpectedReturnNULL "g_data_output_stream_new" result
    result' <- (wrapObject DataOutputStream) result
    touchManagedPtr base_stream
    return result'

-- method DataOutputStream::get_byte_order
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DataStreamByteOrder"
-- throws : False
-- Skip return : False

foreign import ccall "g_data_output_stream_get_byte_order" g_data_output_stream_get_byte_order :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    IO CUInt


dataOutputStreamGetByteOrder ::
    (MonadIO m, DataOutputStreamK a) =>
    a ->                                    -- _obj
    m DataStreamByteOrder
dataOutputStreamGetByteOrder _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_data_output_stream_get_byte_order _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method DataOutputStream::put_byte
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt8, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt8, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_byte" g_data_output_stream_put_byte :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Word8 ->                                -- data : TBasicType TUInt8
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutByte ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Word8 ->                                -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutByte _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_byte _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_int16
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TInt16, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TInt16, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_int16" g_data_output_stream_put_int16 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Int16 ->                                -- data : TBasicType TInt16
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutInt16 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Int16 ->                                -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutInt16 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_int16 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_int32
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", 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}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", 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}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_int32" g_data_output_stream_put_int32 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Int32 ->                                -- data : TBasicType TInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutInt32 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Int32 ->                                -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutInt32 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_int32 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_int64
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TInt64, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TInt64, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_int64" g_data_output_stream_put_int64 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Int64 ->                                -- data : TBasicType TInt64
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutInt64 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Int64 ->                                -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutInt64 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_int64 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_string" g_data_output_stream_put_string :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    CString ->                              -- str : TBasicType TUTF8
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutString ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- str
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutString _obj str cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    str' <- textToCString str
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_string _obj' str' maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        freeMem str'
        return ()
     ) (do
        freeMem str'
     )

-- method DataOutputStream::put_uint16
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt16, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt16, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_uint16" g_data_output_stream_put_uint16 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Word16 ->                               -- data : TBasicType TUInt16
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutUint16 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Word16 ->                               -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutUint16 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_uint16 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_uint32
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt32, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt32, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_uint32" g_data_output_stream_put_uint32 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Word32 ->                               -- data : TBasicType TUInt32
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutUint32 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Word32 ->                               -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutUint32 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_uint32 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::put_uint64
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt64, 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" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TUInt64, 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 : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "g_data_output_stream_put_uint64" g_data_output_stream_put_uint64 :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    Word64 ->                               -- data : TBasicType TUInt64
    Ptr Cancellable ->                      -- cancellable : TInterface "Gio" "Cancellable"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


dataOutputStreamPutUint64 ::
    (MonadIO m, DataOutputStreamK a, CancellableK b) =>
    a ->                                    -- _obj
    Word64 ->                               -- data
    Maybe (b) ->                            -- cancellable
    m ()
dataOutputStreamPutUint64 _obj data_ cancellable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            let jCancellable' = unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ g_data_output_stream_put_uint64 _obj' data_ maybeCancellable
        touchManagedPtr _obj
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

-- method DataOutputStream::set_byte_order
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "order", argType = TInterface "Gio" "DataStreamByteOrder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "DataOutputStream", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "order", argType = TInterface "Gio" "DataStreamByteOrder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_data_output_stream_set_byte_order" g_data_output_stream_set_byte_order :: 
    Ptr DataOutputStream ->                 -- _obj : TInterface "Gio" "DataOutputStream"
    CUInt ->                                -- order : TInterface "Gio" "DataStreamByteOrder"
    IO ()


dataOutputStreamSetByteOrder ::
    (MonadIO m, DataOutputStreamK a) =>
    a ->                                    -- _obj
    DataStreamByteOrder ->                  -- order
    m ()
dataOutputStreamSetByteOrder _obj order = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let order' = (fromIntegral . fromEnum) order
    g_data_output_stream_set_byte_order _obj' order'
    touchManagedPtr _obj
    return ()