{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.AttrFontFeatures
(
AttrFontFeatures(..) ,
newZeroAttrFontFeatures ,
#if defined(ENABLE_OVERLOADING)
ResolveAttrFontFeaturesMethod ,
#endif
attrFontFeaturesNew ,
#if defined(ENABLE_OVERLOADING)
attrFontFeatures_attr ,
#endif
getAttrFontFeaturesAttr ,
#if defined(ENABLE_OVERLOADING)
attrFontFeatures_features ,
#endif
clearAttrFontFeaturesFeatures ,
getAttrFontFeaturesFeatures ,
setAttrFontFeaturesFeatures ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 qualified GHC.Records as R
import {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
newtype AttrFontFeatures = AttrFontFeatures (SP.ManagedPtr AttrFontFeatures)
deriving (AttrFontFeatures -> AttrFontFeatures -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttrFontFeatures -> AttrFontFeatures -> Bool
$c/= :: AttrFontFeatures -> AttrFontFeatures -> Bool
== :: AttrFontFeatures -> AttrFontFeatures -> Bool
$c== :: AttrFontFeatures -> AttrFontFeatures -> Bool
Eq)
instance SP.ManagedPtrNewtype AttrFontFeatures where
toManagedPtr :: AttrFontFeatures -> ManagedPtr AttrFontFeatures
toManagedPtr (AttrFontFeatures ManagedPtr AttrFontFeatures
p) = ManagedPtr AttrFontFeatures
p
instance BoxedPtr AttrFontFeatures where
boxedPtrCopy :: AttrFontFeatures -> IO AttrFontFeatures
boxedPtrCopy = \AttrFontFeatures
p -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AttrFontFeatures
p (forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
24 forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr AttrFontFeatures -> AttrFontFeatures
AttrFontFeatures)
boxedPtrFree :: AttrFontFeatures -> IO ()
boxedPtrFree = \AttrFontFeatures
x -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr AttrFontFeatures
x forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr AttrFontFeatures where
boxedPtrCalloc :: IO (Ptr AttrFontFeatures)
boxedPtrCalloc = forall a. Int -> IO (Ptr a)
callocBytes Int
24
newZeroAttrFontFeatures :: MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures :: forall (m :: * -> *). MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrFontFeatures -> AttrFontFeatures
AttrFontFeatures
instance tag ~ 'AttrSet => Constructible AttrFontFeatures tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr AttrFontFeatures -> AttrFontFeatures)
-> [AttrOp AttrFontFeatures tag] -> m AttrFontFeatures
new ManagedPtr AttrFontFeatures -> AttrFontFeatures
_ [AttrOp AttrFontFeatures tag]
attrs = do
AttrFontFeatures
o <- forall (m :: * -> *). MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set AttrFontFeatures
o [AttrOp AttrFontFeatures tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return AttrFontFeatures
o
getAttrFontFeaturesAttr :: MonadIO m => AttrFontFeatures -> m Pango.Attribute.Attribute
getAttrFontFeaturesAttr :: forall (m :: * -> *). MonadIO m => AttrFontFeatures -> m Attribute
getAttrFontFeaturesAttr AttrFontFeatures
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s forall a b. (a -> b) -> a -> b
$ \Ptr AttrFontFeatures
ptr -> do
let val :: Ptr Attribute
val = Ptr AttrFontFeatures
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: (Ptr Pango.Attribute.Attribute)
Attribute
val' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
val
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
val'
#if defined(ENABLE_OVERLOADING)
data AttrFontFeaturesAttrFieldInfo
instance AttrInfo AttrFontFeaturesAttrFieldInfo where
type AttrBaseTypeConstraint AttrFontFeaturesAttrFieldInfo = (~) AttrFontFeatures
type AttrAllowedOps AttrFontFeaturesAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrFontFeaturesAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrTransferTypeConstraint AttrFontFeaturesAttrFieldInfo = (~)(Ptr Pango.Attribute.Attribute)
type AttrTransferType AttrFontFeaturesAttrFieldInfo = (Ptr Pango.Attribute.Attribute)
type AttrGetType AttrFontFeaturesAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrFontFeaturesAttrFieldInfo = "attr"
type AttrOrigin AttrFontFeaturesAttrFieldInfo = AttrFontFeatures
attrGet = getAttrFontFeaturesAttr
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.AttrFontFeatures.attr"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-AttrFontFeatures.html#g:attr:attr"
})
attrFontFeatures_attr :: AttrLabelProxy "attr"
attrFontFeatures_attr = AttrLabelProxy
#endif
getAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m (Maybe T.Text)
getAttrFontFeaturesFeatures :: forall (m :: * -> *).
MonadIO m =>
AttrFontFeatures -> m (Maybe Text)
getAttrFontFeaturesFeatures AttrFontFeatures
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s forall a b. (a -> b) -> a -> b
$ \Ptr AttrFontFeatures
ptr -> do
CString
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr AttrFontFeatures
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO CString
Maybe Text
result <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
cstringToText CString
val'
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> CString -> m ()
setAttrFontFeaturesFeatures :: forall (m :: * -> *).
MonadIO m =>
AttrFontFeatures -> CString -> m ()
setAttrFontFeaturesFeatures AttrFontFeatures
s CString
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s forall a b. (a -> b) -> a -> b
$ \Ptr AttrFontFeatures
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrFontFeatures
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (CString
val :: CString)
clearAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m ()
clearAttrFontFeaturesFeatures :: forall (m :: * -> *). MonadIO m => AttrFontFeatures -> m ()
clearAttrFontFeaturesFeatures AttrFontFeatures
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s forall a b. (a -> b) -> a -> b
$ \Ptr AttrFontFeatures
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrFontFeatures
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data AttrFontFeaturesFeaturesFieldInfo
instance AttrInfo AttrFontFeaturesFeaturesFieldInfo where
type AttrBaseTypeConstraint AttrFontFeaturesFeaturesFieldInfo = (~) AttrFontFeatures
type AttrAllowedOps AttrFontFeaturesFeaturesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AttrFontFeaturesFeaturesFieldInfo = (~) CString
type AttrTransferTypeConstraint AttrFontFeaturesFeaturesFieldInfo = (~)CString
type AttrTransferType AttrFontFeaturesFeaturesFieldInfo = CString
type AttrGetType AttrFontFeaturesFeaturesFieldInfo = Maybe T.Text
type AttrLabel AttrFontFeaturesFeaturesFieldInfo = "features"
type AttrOrigin AttrFontFeaturesFeaturesFieldInfo = AttrFontFeatures
attrGet = getAttrFontFeaturesFeatures
attrSet = setAttrFontFeaturesFeatures
attrConstruct = undefined
attrClear = clearAttrFontFeaturesFeatures
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.AttrFontFeatures.features"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-AttrFontFeatures.html#g:attr:features"
})
attrFontFeatures_features :: AttrLabelProxy "features"
attrFontFeatures_features = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AttrFontFeatures
type instance O.AttributeList AttrFontFeatures = AttrFontFeaturesAttributeList
type AttrFontFeaturesAttributeList = ('[ '("attr", AttrFontFeaturesAttrFieldInfo), '("features", AttrFontFeaturesFeaturesFieldInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "pango_attr_font_features_new" pango_attr_font_features_new ::
CString ->
IO (Ptr Pango.Attribute.Attribute)
attrFontFeaturesNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Pango.Attribute.Attribute
attrFontFeaturesNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m Attribute
attrFontFeaturesNew Text
features = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
CString
features' <- Text -> IO CString
textToCString Text
features
Ptr Attribute
result <- CString -> IO (Ptr Attribute)
pango_attr_font_features_new CString
features'
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrFontFeaturesNew" Ptr Attribute
result
Attribute
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
forall a. Ptr a -> IO ()
freeMem CString
features'
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveAttrFontFeaturesMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveAttrFontFeaturesMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, O.OverloadedMethod info AttrFontFeatures p) => OL.IsLabel t (AttrFontFeatures -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, O.OverloadedMethod info AttrFontFeatures p, R.HasField t AttrFontFeatures p) => R.HasField t AttrFontFeatures p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, O.OverloadedMethodInfo info AttrFontFeatures) => OL.IsLabel t (O.MethodProxy info AttrFontFeatures) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif