{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.EngineScriptInfo
(
EngineScriptInfo(..) ,
newZeroEngineScriptInfo ,
noEngineScriptInfo ,
#if defined(ENABLE_OVERLOADING)
ResolveEngineScriptInfoMethod ,
#endif
clearEngineScriptInfoLangs ,
#if defined(ENABLE_OVERLOADING)
engineScriptInfo_langs ,
#endif
getEngineScriptInfoLangs ,
setEngineScriptInfoLangs ,
#if defined(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.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.Enums as Pango.Enums
newtype EngineScriptInfo = EngineScriptInfo (ManagedPtr EngineScriptInfo)
deriving (EngineScriptInfo -> EngineScriptInfo -> Bool
(EngineScriptInfo -> EngineScriptInfo -> Bool)
-> (EngineScriptInfo -> EngineScriptInfo -> Bool)
-> Eq EngineScriptInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EngineScriptInfo -> EngineScriptInfo -> Bool
$c/= :: EngineScriptInfo -> EngineScriptInfo -> Bool
== :: EngineScriptInfo -> EngineScriptInfo -> Bool
$c== :: EngineScriptInfo -> EngineScriptInfo -> Bool
Eq)
instance WrappedPtr EngineScriptInfo where
wrappedPtrCalloc :: IO (Ptr EngineScriptInfo)
wrappedPtrCalloc = Int -> IO (Ptr EngineScriptInfo)
forall a. Int -> IO (Ptr a)
callocBytes 16
wrappedPtrCopy :: EngineScriptInfo -> IO EngineScriptInfo
wrappedPtrCopy = \p :: EngineScriptInfo
p -> EngineScriptInfo
-> (Ptr EngineScriptInfo -> IO EngineScriptInfo)
-> IO EngineScriptInfo
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
p (Int -> Ptr EngineScriptInfo -> IO (Ptr EngineScriptInfo)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 16 (Ptr EngineScriptInfo -> IO (Ptr EngineScriptInfo))
-> (Ptr EngineScriptInfo -> IO EngineScriptInfo)
-> Ptr EngineScriptInfo
-> IO EngineScriptInfo
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr EngineScriptInfo -> EngineScriptInfo)
-> Ptr EngineScriptInfo -> IO EngineScriptInfo
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr EngineScriptInfo -> EngineScriptInfo
EngineScriptInfo)
wrappedPtrFree :: Maybe (GDestroyNotify EngineScriptInfo)
wrappedPtrFree = GDestroyNotify EngineScriptInfo
-> Maybe (GDestroyNotify EngineScriptInfo)
forall a. a -> Maybe a
Just GDestroyNotify EngineScriptInfo
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroEngineScriptInfo :: MonadIO m => m EngineScriptInfo
newZeroEngineScriptInfo :: m EngineScriptInfo
newZeroEngineScriptInfo = IO EngineScriptInfo -> m EngineScriptInfo
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EngineScriptInfo -> m EngineScriptInfo)
-> IO EngineScriptInfo -> m EngineScriptInfo
forall a b. (a -> b) -> a -> b
$ IO (Ptr EngineScriptInfo)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr EngineScriptInfo)
-> (Ptr EngineScriptInfo -> IO EngineScriptInfo)
-> IO EngineScriptInfo
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr EngineScriptInfo -> EngineScriptInfo)
-> Ptr EngineScriptInfo -> IO EngineScriptInfo
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr EngineScriptInfo -> EngineScriptInfo
EngineScriptInfo
instance tag ~ 'AttrSet => Constructible EngineScriptInfo tag where
new :: (ManagedPtr EngineScriptInfo -> EngineScriptInfo)
-> [AttrOp EngineScriptInfo tag] -> m EngineScriptInfo
new _ attrs :: [AttrOp EngineScriptInfo tag]
attrs = do
EngineScriptInfo
o <- m EngineScriptInfo
forall (m :: * -> *). MonadIO m => m EngineScriptInfo
newZeroEngineScriptInfo
EngineScriptInfo -> [AttrOp EngineScriptInfo 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set EngineScriptInfo
o [AttrOp EngineScriptInfo tag]
[AttrOp EngineScriptInfo 'AttrSet]
attrs
EngineScriptInfo -> m EngineScriptInfo
forall (m :: * -> *) a. Monad m => a -> m a
return EngineScriptInfo
o
noEngineScriptInfo :: Maybe EngineScriptInfo
noEngineScriptInfo :: Maybe EngineScriptInfo
noEngineScriptInfo = Maybe EngineScriptInfo
forall a. Maybe a
Nothing
getEngineScriptInfoScript :: MonadIO m => EngineScriptInfo -> m Pango.Enums.Script
getEngineScriptInfoScript :: EngineScriptInfo -> m Script
getEngineScriptInfoScript s :: EngineScriptInfo
s = IO Script -> m Script
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Script -> m Script) -> IO Script -> m Script
forall a b. (a -> b) -> a -> b
$ EngineScriptInfo
-> (Ptr EngineScriptInfo -> IO Script) -> IO Script
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
s ((Ptr EngineScriptInfo -> IO Script) -> IO Script)
-> (Ptr EngineScriptInfo -> IO Script) -> IO Script
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr EngineScriptInfo
ptr -> do
CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr EngineScriptInfo
ptr Ptr EngineScriptInfo -> Int -> Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO CInt
let val' :: Script
val' = (Int -> Script
forall a. Enum a => Int -> a
toEnum (Int -> Script) -> (CInt -> Int) -> CInt -> Script
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
val
Script -> IO Script
forall (m :: * -> *) a. Monad m => a -> m a
return Script
val'
setEngineScriptInfoScript :: MonadIO m => EngineScriptInfo -> Pango.Enums.Script -> m ()
setEngineScriptInfoScript :: EngineScriptInfo -> Script -> m ()
setEngineScriptInfoScript s :: EngineScriptInfo
s val :: Script
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EngineScriptInfo -> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
s ((Ptr EngineScriptInfo -> IO ()) -> IO ())
-> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr EngineScriptInfo
ptr -> do
let val' :: CInt
val' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Script -> Int) -> Script -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Script -> Int
forall a. Enum a => a -> Int
fromEnum) Script
val
Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EngineScriptInfo
ptr Ptr EngineScriptInfo -> Int -> Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (CInt
val' :: CInt)
#if defined(ENABLE_OVERLOADING)
data EngineScriptInfoScriptFieldInfo
instance AttrInfo EngineScriptInfoScriptFieldInfo where
type AttrBaseTypeConstraint EngineScriptInfoScriptFieldInfo = (~) EngineScriptInfo
type AttrAllowedOps EngineScriptInfoScriptFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EngineScriptInfoScriptFieldInfo = (~) Pango.Enums.Script
type AttrTransferTypeConstraint EngineScriptInfoScriptFieldInfo = (~)Pango.Enums.Script
type AttrTransferType EngineScriptInfoScriptFieldInfo = Pango.Enums.Script
type AttrGetType EngineScriptInfoScriptFieldInfo = Pango.Enums.Script
type AttrLabel EngineScriptInfoScriptFieldInfo = "script"
type AttrOrigin EngineScriptInfoScriptFieldInfo = EngineScriptInfo
attrGet = getEngineScriptInfoScript
attrSet = setEngineScriptInfoScript
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
engineScriptInfo_script :: AttrLabelProxy "script"
engineScriptInfo_script = AttrLabelProxy
#endif
getEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> m (Maybe T.Text)
getEngineScriptInfoLangs :: EngineScriptInfo -> m (Maybe Text)
getEngineScriptInfoLangs s :: EngineScriptInfo
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ EngineScriptInfo
-> (Ptr EngineScriptInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
s ((Ptr EngineScriptInfo -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr EngineScriptInfo -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr EngineScriptInfo
ptr -> do
CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr EngineScriptInfo
ptr Ptr EngineScriptInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO CString
Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \val' :: CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> CString -> m ()
setEngineScriptInfoLangs :: EngineScriptInfo -> CString -> m ()
setEngineScriptInfoLangs s :: EngineScriptInfo
s val :: CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EngineScriptInfo -> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
s ((Ptr EngineScriptInfo -> IO ()) -> IO ())
-> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr EngineScriptInfo
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EngineScriptInfo
ptr Ptr EngineScriptInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
val :: CString)
clearEngineScriptInfoLangs :: MonadIO m => EngineScriptInfo -> m ()
clearEngineScriptInfoLangs :: EngineScriptInfo -> m ()
clearEngineScriptInfoLangs s :: EngineScriptInfo
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EngineScriptInfo -> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EngineScriptInfo
s ((Ptr EngineScriptInfo -> IO ()) -> IO ())
-> (Ptr EngineScriptInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr EngineScriptInfo
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EngineScriptInfo
ptr Ptr EngineScriptInfo -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data EngineScriptInfoLangsFieldInfo
instance AttrInfo EngineScriptInfoLangsFieldInfo where
type AttrBaseTypeConstraint EngineScriptInfoLangsFieldInfo = (~) EngineScriptInfo
type AttrAllowedOps EngineScriptInfoLangsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint EngineScriptInfoLangsFieldInfo = (~) CString
type AttrTransferTypeConstraint EngineScriptInfoLangsFieldInfo = (~)CString
type AttrTransferType EngineScriptInfoLangsFieldInfo = CString
type AttrGetType EngineScriptInfoLangsFieldInfo = Maybe T.Text
type AttrLabel EngineScriptInfoLangsFieldInfo = "langs"
type AttrOrigin EngineScriptInfoLangsFieldInfo = EngineScriptInfo
attrGet = getEngineScriptInfoLangs
attrSet = setEngineScriptInfoLangs
attrConstruct = undefined
attrClear = clearEngineScriptInfoLangs
attrTransfer _ v = do
return v
engineScriptInfo_langs :: AttrLabelProxy "langs"
engineScriptInfo_langs = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList EngineScriptInfo
type instance O.AttributeList EngineScriptInfo = EngineScriptInfoAttributeList
type EngineScriptInfoAttributeList = ('[ '("script", EngineScriptInfoScriptFieldInfo), '("langs", EngineScriptInfoLangsFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(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 @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif