#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Structs.EngineScriptInfo
(
EngineScriptInfo(..) ,
newZeroEngineScriptInfo ,
noEngineScriptInfo ,
clearEngineScriptInfoLangs ,
#if ENABLE_OVERLOADING
engineScriptInfo_langs ,
#endif
getEngineScriptInfoLangs ,
setEngineScriptInfoLangs ,
#if ENABLE_OVERLOADING
engineScriptInfo_script ,
#endif
getEngineScriptInfoScript ,
setEngineScriptInfoScript ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
newtype EngineScriptInfo = EngineScriptInfo (ManagedPtr EngineScriptInfo)
instance WrappedPtr EngineScriptInfo where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr EngineScriptInfo)
wrappedPtrFree = Just ptr_to_g_free
newZeroEngineScriptInfo :: MonadIO m => m EngineScriptInfo
newZeroEngineScriptInfo = liftIO $ wrappedPtrCalloc >>= wrapPtr EngineScriptInfo
instance tag ~ 'AttrSet => Constructible EngineScriptInfo tag where
new _ attrs = do
o <- newZeroEngineScriptInfo
GI.Attributes.set o attrs
return o
noEngineScriptInfo :: Maybe EngineScriptInfo
noEngineScriptInfo = Nothing
getEngineScriptInfoScript :: MonadIO m => EngineScriptInfo -> m Pango.Enums.Script
getEngineScriptInfoScript s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CInt
let val' = (toEnum . fromIntegral) val
return val'
setEngineScriptInfoScript :: MonadIO m => EngineScriptInfo -> Pango.Enums.Script -> m ()
setEngineScriptInfoScript s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 0) (val' :: CInt)
#if ENABLE_OVERLOADING
data EngineScriptInfoScriptFieldInfo
instance AttrInfo EngineScriptInfoScriptFieldInfo where
type AttrAllowedOps EngineScriptInfoScriptFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EngineScriptInfoScriptFieldInfo = (~) Pango.Enums.Script
type AttrBaseTypeConstraint EngineScriptInfoScriptFieldInfo = (~) EngineScriptInfo
type AttrGetType EngineScriptInfoScriptFieldInfo = Pango.Enums.Script
type AttrLabel EngineScriptInfoScriptFieldInfo = "script"
type AttrOrigin EngineScriptInfoScriptFieldInfo = EngineScriptInfo
attrGet _ = getEngineScriptInfoScript
attrSet _ = setEngineScriptInfoScript
attrConstruct = undefined
attrClear _ = undefined
engineScriptInfo_script :: AttrLabelProxy "script"
engineScriptInfo_script = AttrLabelProxy
#endif
getEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> m (Maybe T.Text)
getEngineScriptInfoLangs 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
setEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> CString -> m ()
setEngineScriptInfoLangs s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> m ()
clearEngineScriptInfoLangs s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data EngineScriptInfoLangsFieldInfo
instance AttrInfo EngineScriptInfoLangsFieldInfo where
type AttrAllowedOps EngineScriptInfoLangsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint EngineScriptInfoLangsFieldInfo = (~) CString
type AttrBaseTypeConstraint EngineScriptInfoLangsFieldInfo = (~) EngineScriptInfo
type AttrGetType EngineScriptInfoLangsFieldInfo = Maybe T.Text
type AttrLabel EngineScriptInfoLangsFieldInfo = "langs"
type AttrOrigin EngineScriptInfoLangsFieldInfo = EngineScriptInfo
attrGet _ = getEngineScriptInfoLangs
attrSet _ = setEngineScriptInfoLangs
attrConstruct = undefined
attrClear _ = clearEngineScriptInfoLangs
engineScriptInfo_langs :: AttrLabelProxy "langs"
engineScriptInfo_langs = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList EngineScriptInfo
type instance O.AttributeList EngineScriptInfo = EngineScriptInfoAttributeList
type EngineScriptInfoAttributeList = ('[ '("script", EngineScriptInfoScriptFieldInfo), '("langs", EngineScriptInfoLangsFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveEngineScriptInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveEngineScriptInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveEngineScriptInfoMethod t EngineScriptInfo, O.MethodInfo info EngineScriptInfo p) => OL.IsLabel t (EngineScriptInfo -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif