{-# 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 ,
noAttrFontFeatures ,
#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.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.Attribute as Pango.Attribute
newtype AttrFontFeatures = AttrFontFeatures (ManagedPtr AttrFontFeatures)
deriving (AttrFontFeatures -> AttrFontFeatures -> Bool
(AttrFontFeatures -> AttrFontFeatures -> Bool)
-> (AttrFontFeatures -> AttrFontFeatures -> Bool)
-> Eq AttrFontFeatures
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 WrappedPtr AttrFontFeatures where
wrappedPtrCalloc :: IO (Ptr AttrFontFeatures)
wrappedPtrCalloc = Int -> IO (Ptr AttrFontFeatures)
forall a. Int -> IO (Ptr a)
callocBytes 24
wrappedPtrCopy :: AttrFontFeatures -> IO AttrFontFeatures
wrappedPtrCopy = \p :: AttrFontFeatures
p -> AttrFontFeatures
-> (Ptr AttrFontFeatures -> IO AttrFontFeatures)
-> IO AttrFontFeatures
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
p (Int -> Ptr AttrFontFeatures -> IO (Ptr AttrFontFeatures)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 24 (Ptr AttrFontFeatures -> IO (Ptr AttrFontFeatures))
-> (Ptr AttrFontFeatures -> IO AttrFontFeatures)
-> Ptr AttrFontFeatures
-> IO AttrFontFeatures
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr AttrFontFeatures -> AttrFontFeatures)
-> Ptr AttrFontFeatures -> IO AttrFontFeatures
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrFontFeatures -> AttrFontFeatures
AttrFontFeatures)
wrappedPtrFree :: Maybe (GDestroyNotify AttrFontFeatures)
wrappedPtrFree = GDestroyNotify AttrFontFeatures
-> Maybe (GDestroyNotify AttrFontFeatures)
forall a. a -> Maybe a
Just GDestroyNotify AttrFontFeatures
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroAttrFontFeatures :: MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures :: m AttrFontFeatures
newZeroAttrFontFeatures = IO AttrFontFeatures -> m AttrFontFeatures
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AttrFontFeatures -> m AttrFontFeatures)
-> IO AttrFontFeatures -> m AttrFontFeatures
forall a b. (a -> b) -> a -> b
$ IO (Ptr AttrFontFeatures)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr AttrFontFeatures)
-> (Ptr AttrFontFeatures -> IO AttrFontFeatures)
-> IO AttrFontFeatures
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr AttrFontFeatures -> AttrFontFeatures)
-> Ptr AttrFontFeatures -> IO AttrFontFeatures
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrFontFeatures -> AttrFontFeatures
AttrFontFeatures
instance tag ~ 'AttrSet => Constructible AttrFontFeatures tag where
new :: (ManagedPtr AttrFontFeatures -> AttrFontFeatures)
-> [AttrOp AttrFontFeatures tag] -> m AttrFontFeatures
new _ attrs :: [AttrOp AttrFontFeatures tag]
attrs = do
AttrFontFeatures
o <- m AttrFontFeatures
forall (m :: * -> *). MonadIO m => m AttrFontFeatures
newZeroAttrFontFeatures
AttrFontFeatures -> [AttrOp AttrFontFeatures 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set AttrFontFeatures
o [AttrOp AttrFontFeatures tag]
[AttrOp AttrFontFeatures 'AttrSet]
attrs
AttrFontFeatures -> m AttrFontFeatures
forall (m :: * -> *) a. Monad m => a -> m a
return AttrFontFeatures
o
noAttrFontFeatures :: Maybe AttrFontFeatures
noAttrFontFeatures :: Maybe AttrFontFeatures
noAttrFontFeatures = Maybe AttrFontFeatures
forall a. Maybe a
Nothing
getAttrFontFeaturesAttr :: MonadIO m => AttrFontFeatures -> m Pango.Attribute.Attribute
getAttrFontFeaturesAttr :: AttrFontFeatures -> m Attribute
getAttrFontFeaturesAttr s :: AttrFontFeatures
s = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ AttrFontFeatures
-> (Ptr AttrFontFeatures -> IO Attribute) -> IO Attribute
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s ((Ptr AttrFontFeatures -> IO Attribute) -> IO Attribute)
-> (Ptr AttrFontFeatures -> IO Attribute) -> IO Attribute
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrFontFeatures
ptr -> do
let val :: Ptr Attribute
val = Ptr AttrFontFeatures
ptr Ptr AttrFontFeatures -> Int -> Ptr Attribute
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: (Ptr Pango.Attribute.Attribute)
Attribute
val' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
val
Attribute -> IO Attribute
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
attrFontFeatures_attr :: AttrLabelProxy "attr"
attrFontFeatures_attr = AttrLabelProxy
#endif
getAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m (Maybe T.Text)
getAttrFontFeaturesFeatures :: AttrFontFeatures -> m (Maybe Text)
getAttrFontFeaturesFeatures s :: AttrFontFeatures
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
$ AttrFontFeatures
-> (Ptr AttrFontFeatures -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s ((Ptr AttrFontFeatures -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr AttrFontFeatures -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrFontFeatures
ptr -> do
CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr AttrFontFeatures
ptr Ptr AttrFontFeatures -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) :: 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
setAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> CString -> m ()
setAttrFontFeaturesFeatures :: AttrFontFeatures -> CString -> m ()
setAttrFontFeaturesFeatures s :: AttrFontFeatures
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
$ AttrFontFeatures -> (Ptr AttrFontFeatures -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s ((Ptr AttrFontFeatures -> IO ()) -> IO ())
-> (Ptr AttrFontFeatures -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrFontFeatures
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrFontFeatures
ptr Ptr AttrFontFeatures -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (CString
val :: CString)
clearAttrFontFeaturesFeatures :: MonadIO m => AttrFontFeatures -> m ()
clearAttrFontFeaturesFeatures :: AttrFontFeatures -> m ()
clearAttrFontFeaturesFeatures s :: AttrFontFeatures
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AttrFontFeatures -> (Ptr AttrFontFeatures -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrFontFeatures
s ((Ptr AttrFontFeatures -> IO ()) -> IO ())
-> (Ptr AttrFontFeatures -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrFontFeatures
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrFontFeatures
ptr Ptr AttrFontFeatures -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (CString
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
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, *)])
#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 :: Text -> m Attribute
attrFontFeaturesNew features :: Text
features = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
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'
Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "attrFontFeaturesNew" Ptr Attribute
result
Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
features'
Attribute -> IO Attribute
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 :: *) :: * 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 @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif