{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Pango.Structs.EngineInfo.EngineInfo' structure contains information about a particular
-- engine. It contains the following fields:

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Pango.Structs.EngineInfo
    (

-- * Exported types
    EngineInfo(..)                          ,
    newZeroEngineInfo                       ,
    noEngineInfo                            ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveEngineInfoMethod                 ,
#endif




 -- * Properties
-- ** engineType #attr:engineType#
-- | a string identifying the engine type.

    clearEngineInfoEngineType               ,
#if defined(ENABLE_OVERLOADING)
    engineInfo_engineType                   ,
#endif
    getEngineInfoEngineType                 ,
    setEngineInfoEngineType                 ,


-- ** id #attr:id#
-- | a unique string ID for the engine.

    clearEngineInfoId                       ,
#if defined(ENABLE_OVERLOADING)
    engineInfo_id                           ,
#endif
    getEngineInfoId                         ,
    setEngineInfoId                         ,


-- ** nScripts #attr:nScripts#
-- | number of items in /@scripts@/.

#if defined(ENABLE_OVERLOADING)
    engineInfo_nScripts                     ,
#endif
    getEngineInfoNScripts                   ,
    setEngineInfoNScripts                   ,


-- ** renderType #attr:renderType#
-- | a string identifying the render type.

    clearEngineInfoRenderType               ,
#if defined(ENABLE_OVERLOADING)
    engineInfo_renderType                   ,
#endif
    getEngineInfoRenderType                 ,
    setEngineInfoRenderType                 ,


-- ** scripts #attr:scripts#
-- | array of scripts this engine supports.

    clearEngineInfoScripts                  ,
#if defined(ENABLE_OVERLOADING)
    engineInfo_scripts                      ,
#endif
    getEngineInfoScripts                    ,
    setEngineInfoScripts                    ,




    ) 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.GI.Base.Signals as B.Signals
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 {-# SOURCE #-} qualified GI.Pango.Structs.EngineScriptInfo as Pango.EngineScriptInfo

-- | Memory-managed wrapper type.
newtype EngineInfo = EngineInfo (ManagedPtr EngineInfo)
    deriving (Eq)
instance WrappedPtr EngineInfo where
    wrappedPtrCalloc = callocBytes 20
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 20 >=> wrapPtr EngineInfo)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `EngineInfo` struct initialized to zero.
newZeroEngineInfo :: MonadIO m => m EngineInfo
newZeroEngineInfo = liftIO $ wrappedPtrCalloc >>= wrapPtr EngineInfo

instance tag ~ 'AttrSet => Constructible EngineInfo tag where
    new _ attrs = do
        o <- newZeroEngineInfo
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `EngineInfo`.
noEngineInfo :: Maybe EngineInfo
noEngineInfo = Nothing

-- | Get the value of the “@id@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' engineInfo #id
-- @
getEngineInfoId :: MonadIO m => EngineInfo -> m (Maybe T.Text)
getEngineInfoId s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

-- | Set the value of the “@id@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' engineInfo [ #id 'Data.GI.Base.Attributes.:=' value ]
-- @
setEngineInfoId :: MonadIO m => EngineInfo -> CString -> m ()
setEngineInfoId s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: CString)

-- | Set the value of the “@id@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #id
-- @
clearEngineInfoId :: MonadIO m => EngineInfo -> m ()
clearEngineInfoId s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data EngineInfoIdFieldInfo
instance AttrInfo EngineInfoIdFieldInfo where
    type AttrBaseTypeConstraint EngineInfoIdFieldInfo = (~) EngineInfo
    type AttrAllowedOps EngineInfoIdFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EngineInfoIdFieldInfo = (~) CString
    type AttrTransferTypeConstraint EngineInfoIdFieldInfo = (~)CString
    type AttrTransferType EngineInfoIdFieldInfo = CString
    type AttrGetType EngineInfoIdFieldInfo = Maybe T.Text
    type AttrLabel EngineInfoIdFieldInfo = "id"
    type AttrOrigin EngineInfoIdFieldInfo = EngineInfo
    attrGet = getEngineInfoId
    attrSet = setEngineInfoId
    attrConstruct = undefined
    attrClear = clearEngineInfoId
    attrTransfer _ v = do
        return v

engineInfo_id :: AttrLabelProxy "id"
engineInfo_id = AttrLabelProxy

#endif


-- | Get the value of the “@engine_type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' engineInfo #engineType
-- @
getEngineInfoEngineType :: MonadIO m => EngineInfo -> m (Maybe T.Text)
getEngineInfoEngineType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

-- | Set the value of the “@engine_type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' engineInfo [ #engineType 'Data.GI.Base.Attributes.:=' value ]
-- @
setEngineInfoEngineType :: MonadIO m => EngineInfo -> CString -> m ()
setEngineInfoEngineType s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (val :: CString)

-- | Set the value of the “@engine_type@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #engineType
-- @
clearEngineInfoEngineType :: MonadIO m => EngineInfo -> m ()
clearEngineInfoEngineType s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data EngineInfoEngineTypeFieldInfo
instance AttrInfo EngineInfoEngineTypeFieldInfo where
    type AttrBaseTypeConstraint EngineInfoEngineTypeFieldInfo = (~) EngineInfo
    type AttrAllowedOps EngineInfoEngineTypeFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EngineInfoEngineTypeFieldInfo = (~) CString
    type AttrTransferTypeConstraint EngineInfoEngineTypeFieldInfo = (~)CString
    type AttrTransferType EngineInfoEngineTypeFieldInfo = CString
    type AttrGetType EngineInfoEngineTypeFieldInfo = Maybe T.Text
    type AttrLabel EngineInfoEngineTypeFieldInfo = "engine_type"
    type AttrOrigin EngineInfoEngineTypeFieldInfo = EngineInfo
    attrGet = getEngineInfoEngineType
    attrSet = setEngineInfoEngineType
    attrConstruct = undefined
    attrClear = clearEngineInfoEngineType
    attrTransfer _ v = do
        return v

engineInfo_engineType :: AttrLabelProxy "engineType"
engineInfo_engineType = AttrLabelProxy

#endif


-- | Get the value of the “@render_type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' engineInfo #renderType
-- @
getEngineInfoRenderType :: MonadIO m => EngineInfo -> m (Maybe T.Text)
getEngineInfoRenderType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

-- | Set the value of the “@render_type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' engineInfo [ #renderType 'Data.GI.Base.Attributes.:=' value ]
-- @
setEngineInfoRenderType :: MonadIO m => EngineInfo -> CString -> m ()
setEngineInfoRenderType s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: CString)

-- | Set the value of the “@render_type@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #renderType
-- @
clearEngineInfoRenderType :: MonadIO m => EngineInfo -> m ()
clearEngineInfoRenderType s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data EngineInfoRenderTypeFieldInfo
instance AttrInfo EngineInfoRenderTypeFieldInfo where
    type AttrBaseTypeConstraint EngineInfoRenderTypeFieldInfo = (~) EngineInfo
    type AttrAllowedOps EngineInfoRenderTypeFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EngineInfoRenderTypeFieldInfo = (~) CString
    type AttrTransferTypeConstraint EngineInfoRenderTypeFieldInfo = (~)CString
    type AttrTransferType EngineInfoRenderTypeFieldInfo = CString
    type AttrGetType EngineInfoRenderTypeFieldInfo = Maybe T.Text
    type AttrLabel EngineInfoRenderTypeFieldInfo = "render_type"
    type AttrOrigin EngineInfoRenderTypeFieldInfo = EngineInfo
    attrGet = getEngineInfoRenderType
    attrSet = setEngineInfoRenderType
    attrConstruct = undefined
    attrClear = clearEngineInfoRenderType
    attrTransfer _ v = do
        return v

engineInfo_renderType :: AttrLabelProxy "renderType"
engineInfo_renderType = AttrLabelProxy

#endif


-- | Get the value of the “@scripts@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' engineInfo #scripts
-- @
getEngineInfoScripts :: MonadIO m => EngineInfo -> m (Maybe Pango.EngineScriptInfo.EngineScriptInfo)
getEngineInfoScripts s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO (Ptr Pango.EngineScriptInfo.EngineScriptInfo)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newPtr Pango.EngineScriptInfo.EngineScriptInfo) val'
        return val''
    return result

-- | Set the value of the “@scripts@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' engineInfo [ #scripts 'Data.GI.Base.Attributes.:=' value ]
-- @
setEngineInfoScripts :: MonadIO m => EngineInfo -> Ptr Pango.EngineScriptInfo.EngineScriptInfo -> m ()
setEngineInfoScripts s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 12) (val :: Ptr Pango.EngineScriptInfo.EngineScriptInfo)

-- | Set the value of the “@scripts@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #scripts
-- @
clearEngineInfoScripts :: MonadIO m => EngineInfo -> m ()
clearEngineInfoScripts s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 12) (FP.nullPtr :: Ptr Pango.EngineScriptInfo.EngineScriptInfo)

#if defined(ENABLE_OVERLOADING)
data EngineInfoScriptsFieldInfo
instance AttrInfo EngineInfoScriptsFieldInfo where
    type AttrBaseTypeConstraint EngineInfoScriptsFieldInfo = (~) EngineInfo
    type AttrAllowedOps EngineInfoScriptsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EngineInfoScriptsFieldInfo = (~) (Ptr Pango.EngineScriptInfo.EngineScriptInfo)
    type AttrTransferTypeConstraint EngineInfoScriptsFieldInfo = (~)(Ptr Pango.EngineScriptInfo.EngineScriptInfo)
    type AttrTransferType EngineInfoScriptsFieldInfo = (Ptr Pango.EngineScriptInfo.EngineScriptInfo)
    type AttrGetType EngineInfoScriptsFieldInfo = Maybe Pango.EngineScriptInfo.EngineScriptInfo
    type AttrLabel EngineInfoScriptsFieldInfo = "scripts"
    type AttrOrigin EngineInfoScriptsFieldInfo = EngineInfo
    attrGet = getEngineInfoScripts
    attrSet = setEngineInfoScripts
    attrConstruct = undefined
    attrClear = clearEngineInfoScripts
    attrTransfer _ v = do
        return v

engineInfo_scripts :: AttrLabelProxy "scripts"
engineInfo_scripts = AttrLabelProxy

#endif


-- | Get the value of the “@n_scripts@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' engineInfo #nScripts
-- @
getEngineInfoNScripts :: MonadIO m => EngineInfo -> m Int32
getEngineInfoNScripts s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Int32
    return val

-- | Set the value of the “@n_scripts@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' engineInfo [ #nScripts 'Data.GI.Base.Attributes.:=' value ]
-- @
setEngineInfoNScripts :: MonadIO m => EngineInfo -> Int32 -> m ()
setEngineInfoNScripts s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Int32)

#if defined(ENABLE_OVERLOADING)
data EngineInfoNScriptsFieldInfo
instance AttrInfo EngineInfoNScriptsFieldInfo where
    type AttrBaseTypeConstraint EngineInfoNScriptsFieldInfo = (~) EngineInfo
    type AttrAllowedOps EngineInfoNScriptsFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint EngineInfoNScriptsFieldInfo = (~) Int32
    type AttrTransferTypeConstraint EngineInfoNScriptsFieldInfo = (~)Int32
    type AttrTransferType EngineInfoNScriptsFieldInfo = Int32
    type AttrGetType EngineInfoNScriptsFieldInfo = Int32
    type AttrLabel EngineInfoNScriptsFieldInfo = "n_scripts"
    type AttrOrigin EngineInfoNScriptsFieldInfo = EngineInfo
    attrGet = getEngineInfoNScripts
    attrSet = setEngineInfoNScripts
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

engineInfo_nScripts :: AttrLabelProxy "nScripts"
engineInfo_nScripts = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList EngineInfo
type instance O.AttributeList EngineInfo = EngineInfoAttributeList
type EngineInfoAttributeList = ('[ '("id", EngineInfoIdFieldInfo), '("engineType", EngineInfoEngineTypeFieldInfo), '("renderType", EngineInfoRenderTypeFieldInfo), '("scripts", EngineInfoScriptsFieldInfo), '("nScripts", EngineInfoNScriptsFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveEngineInfoMethod (t :: Symbol) (o :: *) :: * where
    ResolveEngineInfoMethod l o = O.MethodResolutionFailed l o

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

#endif