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

-- * Exported types
    ZlibCompressor(..)                      ,
    ZlibCompressorK                         ,
    toZlibCompressor                        ,
    noZlibCompressor                        ,


 -- * Methods
-- ** zlibCompressorGetFileInfo
    zlibCompressorGetFileInfo               ,


-- ** zlibCompressorNew
    zlibCompressorNew                       ,


-- ** zlibCompressorSetFileInfo
    zlibCompressorSetFileInfo               ,




 -- * Properties
-- ** FileInfo
    ZlibCompressorFileInfoPropertyInfo      ,
    constructZlibCompressorFileInfo         ,
    getZlibCompressorFileInfo               ,
    setZlibCompressorFileInfo               ,


-- ** Format
    ZlibCompressorFormatPropertyInfo        ,
    constructZlibCompressorFormat           ,
    getZlibCompressorFormat                 ,


-- ** Level
    ZlibCompressorLevelPropertyInfo         ,
    constructZlibCompressorLevel            ,
    getZlibCompressorLevel                  ,




    ) 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 ZlibCompressor = ZlibCompressor (ForeignPtr ZlibCompressor)
foreign import ccall "g_zlib_compressor_get_type"
    c_g_zlib_compressor_get_type :: IO GType

type instance ParentTypes ZlibCompressor = ZlibCompressorParentTypes
type ZlibCompressorParentTypes = '[GObject.Object, Converter]

instance GObject ZlibCompressor where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_zlib_compressor_get_type
    

class GObject o => ZlibCompressorK o
instance (GObject o, IsDescendantOf ZlibCompressor o) => ZlibCompressorK o

toZlibCompressor :: ZlibCompressorK o => o -> IO ZlibCompressor
toZlibCompressor = unsafeCastTo ZlibCompressor

noZlibCompressor :: Maybe ZlibCompressor
noZlibCompressor = Nothing

-- VVV Prop "file-info"
   -- Type: TInterface "Gio" "FileInfo"
   -- Flags: [PropertyReadable,PropertyWritable]

getZlibCompressorFileInfo :: (MonadIO m, ZlibCompressorK o) => o -> m FileInfo
getZlibCompressorFileInfo obj = liftIO $ getObjectPropertyObject obj "file-info" FileInfo

setZlibCompressorFileInfo :: (MonadIO m, ZlibCompressorK o, FileInfoK a) => o -> a -> m ()
setZlibCompressorFileInfo obj val = liftIO $ setObjectPropertyObject obj "file-info" val

constructZlibCompressorFileInfo :: (FileInfoK a) => a -> IO ([Char], GValue)
constructZlibCompressorFileInfo val = constructObjectPropertyObject "file-info" val

data ZlibCompressorFileInfoPropertyInfo
instance AttrInfo ZlibCompressorFileInfoPropertyInfo where
    type AttrAllowedOps ZlibCompressorFileInfoPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ZlibCompressorFileInfoPropertyInfo = FileInfoK
    type AttrBaseTypeConstraint ZlibCompressorFileInfoPropertyInfo = ZlibCompressorK
    type AttrGetType ZlibCompressorFileInfoPropertyInfo = FileInfo
    type AttrLabel ZlibCompressorFileInfoPropertyInfo = "ZlibCompressor::file-info"
    attrGet _ = getZlibCompressorFileInfo
    attrSet _ = setZlibCompressorFileInfo
    attrConstruct _ = constructZlibCompressorFileInfo

-- VVV Prop "format"
   -- Type: TInterface "Gio" "ZlibCompressorFormat"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getZlibCompressorFormat :: (MonadIO m, ZlibCompressorK o) => o -> m ZlibCompressorFormat
getZlibCompressorFormat obj = liftIO $ getObjectPropertyEnum obj "format"

constructZlibCompressorFormat :: ZlibCompressorFormat -> IO ([Char], GValue)
constructZlibCompressorFormat val = constructObjectPropertyEnum "format" val

data ZlibCompressorFormatPropertyInfo
instance AttrInfo ZlibCompressorFormatPropertyInfo where
    type AttrAllowedOps ZlibCompressorFormatPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ZlibCompressorFormatPropertyInfo = (~) ZlibCompressorFormat
    type AttrBaseTypeConstraint ZlibCompressorFormatPropertyInfo = ZlibCompressorK
    type AttrGetType ZlibCompressorFormatPropertyInfo = ZlibCompressorFormat
    type AttrLabel ZlibCompressorFormatPropertyInfo = "ZlibCompressor::format"
    attrGet _ = getZlibCompressorFormat
    attrSet _ = undefined
    attrConstruct _ = constructZlibCompressorFormat

-- VVV Prop "level"
   -- Type: TBasicType TInt32
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getZlibCompressorLevel :: (MonadIO m, ZlibCompressorK o) => o -> m Int32
getZlibCompressorLevel obj = liftIO $ getObjectPropertyCInt obj "level"

constructZlibCompressorLevel :: Int32 -> IO ([Char], GValue)
constructZlibCompressorLevel val = constructObjectPropertyCInt "level" val

data ZlibCompressorLevelPropertyInfo
instance AttrInfo ZlibCompressorLevelPropertyInfo where
    type AttrAllowedOps ZlibCompressorLevelPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ZlibCompressorLevelPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint ZlibCompressorLevelPropertyInfo = ZlibCompressorK
    type AttrGetType ZlibCompressorLevelPropertyInfo = Int32
    type AttrLabel ZlibCompressorLevelPropertyInfo = "ZlibCompressor::level"
    attrGet _ = getZlibCompressorLevel
    attrSet _ = undefined
    attrConstruct _ = constructZlibCompressorLevel

type instance AttributeList ZlibCompressor = ZlibCompressorAttributeList
type ZlibCompressorAttributeList = ('[ '("file-info", ZlibCompressorFileInfoPropertyInfo), '("format", ZlibCompressorFormatPropertyInfo), '("level", ZlibCompressorLevelPropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "g_zlib_compressor_new" g_zlib_compressor_new :: 
    CUInt ->                                -- format : TInterface "Gio" "ZlibCompressorFormat"
    Int32 ->                                -- level : TBasicType TInt32
    IO (Ptr ZlibCompressor)


zlibCompressorNew ::
    (MonadIO m) =>
    ZlibCompressorFormat ->                 -- format
    Int32 ->                                -- level
    m ZlibCompressor
zlibCompressorNew format level = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- g_zlib_compressor_new format' level
    checkUnexpectedReturnNULL "g_zlib_compressor_new" result
    result' <- (wrapObject ZlibCompressor) result
    return result'

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

foreign import ccall "g_zlib_compressor_get_file_info" g_zlib_compressor_get_file_info :: 
    Ptr ZlibCompressor ->                   -- _obj : TInterface "Gio" "ZlibCompressor"
    IO (Ptr FileInfo)


zlibCompressorGetFileInfo ::
    (MonadIO m, ZlibCompressorK a) =>
    a ->                                    -- _obj
    m FileInfo
zlibCompressorGetFileInfo _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_zlib_compressor_get_file_info _obj'
    checkUnexpectedReturnNULL "g_zlib_compressor_get_file_info" result
    result' <- (newObject FileInfo) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_zlib_compressor_set_file_info" g_zlib_compressor_set_file_info :: 
    Ptr ZlibCompressor ->                   -- _obj : TInterface "Gio" "ZlibCompressor"
    Ptr FileInfo ->                         -- file_info : TInterface "Gio" "FileInfo"
    IO ()


zlibCompressorSetFileInfo ::
    (MonadIO m, ZlibCompressorK a, FileInfoK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- file_info
    m ()
zlibCompressorSetFileInfo _obj file_info = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeFile_info <- case file_info of
        Nothing -> return nullPtr
        Just jFile_info -> do
            let jFile_info' = unsafeManagedPtrCastPtr jFile_info
            return jFile_info'
    g_zlib_compressor_set_file_info _obj' maybeFile_info
    touchManagedPtr _obj
    whenJust file_info touchManagedPtr
    return ()