#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Structs.AttrFontFeatures
(
AttrFontFeatures(..) ,
newZeroAttrFontFeatures ,
noAttrFontFeatures ,
attrFontFeaturesNew ,
#if ENABLE_OVERLOADING
attrFontFeatures_attr ,
#endif
getAttrFontFeaturesAttr ,
#if 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.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.Structs.Attribute as Pango.Attribute
newtype AttrFontFeatures = AttrFontFeatures (ManagedPtr AttrFontFeatures)
instance WrappedPtr AttrFontFeatures where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr AttrFontFeatures)
wrappedPtrFree = Just ptr_to_g_free
newZeroAttrFontFeatures :: MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures = liftIO $ wrappedPtrCalloc >>= wrapPtr AttrFontFeatures
instance tag ~ 'AttrSet => Constructible AttrFontFeatures tag where
new _ attrs = do
o <- newZeroAttrFontFeatures
GI.Attributes.set o attrs
return o
noAttrFontFeatures :: Maybe AttrFontFeatures
noAttrFontFeatures = Nothing
getAttrFontFeaturesAttr :: MonadIO m => AttrFontFeatures -> m Pango.Attribute.Attribute
getAttrFontFeaturesAttr s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr Pango.Attribute.Attribute)
val' <- (newPtr Pango.Attribute.Attribute) val
return val'
#if ENABLE_OVERLOADING
data AttrFontFeaturesAttrFieldInfo
instance AttrInfo AttrFontFeaturesAttrFieldInfo where
type AttrAllowedOps AttrFontFeaturesAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrFontFeaturesAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrBaseTypeConstraint AttrFontFeaturesAttrFieldInfo = (~) AttrFontFeatures
type AttrGetType AttrFontFeaturesAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrFontFeaturesAttrFieldInfo = "attr"
type AttrOrigin AttrFontFeaturesAttrFieldInfo = AttrFontFeatures
attrGet _ = getAttrFontFeaturesAttr
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
attrFontFeatures_attr :: AttrLabelProxy "attr"
attrFontFeatures_attr = AttrLabelProxy
#endif
getAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m (Maybe T.Text)
getAttrFontFeaturesFeatures s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> CString -> m ()
setAttrFontFeaturesFeatures s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: CString)
clearAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m ()
clearAttrFontFeaturesFeatures s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data AttrFontFeaturesFeaturesFieldInfo
instance AttrInfo AttrFontFeaturesFeaturesFieldInfo where
type AttrAllowedOps AttrFontFeaturesFeaturesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AttrFontFeaturesFeaturesFieldInfo = (~) CString
type AttrBaseTypeConstraint AttrFontFeaturesFeaturesFieldInfo = (~) AttrFontFeatures
type AttrGetType AttrFontFeaturesFeaturesFieldInfo = Maybe T.Text
type AttrLabel AttrFontFeaturesFeaturesFieldInfo = "features"
type AttrOrigin AttrFontFeaturesFeaturesFieldInfo = AttrFontFeatures
attrGet _ = getAttrFontFeaturesFeatures
attrSet _ = setAttrFontFeaturesFeatures
attrConstruct = undefined
attrClear _ = clearAttrFontFeaturesFeatures
attrFontFeatures_features :: AttrLabelProxy "features"
attrFontFeatures_features = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList AttrFontFeatures
type instance O.AttributeList AttrFontFeatures = AttrFontFeaturesAttributeList
type AttrFontFeaturesAttributeList = ('[ '("attr", AttrFontFeaturesAttrFieldInfo), '("features", AttrFontFeaturesFeaturesFieldInfo)] :: [(Symbol, *)])
#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 features = liftIO $ do
features' <- textToCString features
result <- pango_attr_font_features_new features'
checkUnexpectedReturnNULL "attrFontFeaturesNew" result
result' <- (wrapPtr Pango.Attribute.Attribute) result
freeMem features'
return result'
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveAttrFontFeaturesMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrFontFeaturesMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrFontFeaturesMethod t AttrFontFeatures, O.MethodInfo info AttrFontFeatures p) => OL.IsLabel t (AttrFontFeatures -> 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