{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.AttrLanguage
(
AttrLanguage(..) ,
newZeroAttrLanguage ,
noAttrLanguage ,
#if defined(ENABLE_OVERLOADING)
ResolveAttrLanguageMethod ,
#endif
attrLanguageNew ,
#if defined(ENABLE_OVERLOADING)
attrLanguage_attr ,
#endif
getAttrLanguageAttr ,
#if defined(ENABLE_OVERLOADING)
attrLanguage_value ,
#endif
clearAttrLanguageValue ,
getAttrLanguageValue ,
setAttrLanguageValue ,
) 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
import {-# SOURCE #-} qualified GI.Pango.Structs.Language as Pango.Language
newtype AttrLanguage = AttrLanguage (ManagedPtr AttrLanguage)
deriving (AttrLanguage -> AttrLanguage -> Bool
(AttrLanguage -> AttrLanguage -> Bool)
-> (AttrLanguage -> AttrLanguage -> Bool) -> Eq AttrLanguage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttrLanguage -> AttrLanguage -> Bool
$c/= :: AttrLanguage -> AttrLanguage -> Bool
== :: AttrLanguage -> AttrLanguage -> Bool
$c== :: AttrLanguage -> AttrLanguage -> Bool
Eq)
instance WrappedPtr AttrLanguage where
wrappedPtrCalloc :: IO (Ptr AttrLanguage)
wrappedPtrCalloc = Int -> IO (Ptr AttrLanguage)
forall a. Int -> IO (Ptr a)
callocBytes 24
wrappedPtrCopy :: AttrLanguage -> IO AttrLanguage
wrappedPtrCopy = \p :: AttrLanguage
p -> AttrLanguage
-> (Ptr AttrLanguage -> IO AttrLanguage) -> IO AttrLanguage
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrLanguage
p (Int -> Ptr AttrLanguage -> IO (Ptr AttrLanguage)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 24 (Ptr AttrLanguage -> IO (Ptr AttrLanguage))
-> (Ptr AttrLanguage -> IO AttrLanguage)
-> Ptr AttrLanguage
-> IO AttrLanguage
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr AttrLanguage -> AttrLanguage)
-> Ptr AttrLanguage -> IO AttrLanguage
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrLanguage -> AttrLanguage
AttrLanguage)
wrappedPtrFree :: Maybe (GDestroyNotify AttrLanguage)
wrappedPtrFree = GDestroyNotify AttrLanguage -> Maybe (GDestroyNotify AttrLanguage)
forall a. a -> Maybe a
Just GDestroyNotify AttrLanguage
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroAttrLanguage :: MonadIO m => m AttrLanguage
newZeroAttrLanguage :: m AttrLanguage
newZeroAttrLanguage = IO AttrLanguage -> m AttrLanguage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AttrLanguage -> m AttrLanguage)
-> IO AttrLanguage -> m AttrLanguage
forall a b. (a -> b) -> a -> b
$ IO (Ptr AttrLanguage)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr AttrLanguage)
-> (Ptr AttrLanguage -> IO AttrLanguage) -> IO AttrLanguage
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr AttrLanguage -> AttrLanguage)
-> Ptr AttrLanguage -> IO AttrLanguage
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrLanguage -> AttrLanguage
AttrLanguage
instance tag ~ 'AttrSet => Constructible AttrLanguage tag where
new :: (ManagedPtr AttrLanguage -> AttrLanguage)
-> [AttrOp AttrLanguage tag] -> m AttrLanguage
new _ attrs :: [AttrOp AttrLanguage tag]
attrs = do
AttrLanguage
o <- m AttrLanguage
forall (m :: * -> *). MonadIO m => m AttrLanguage
newZeroAttrLanguage
AttrLanguage -> [AttrOp AttrLanguage 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set AttrLanguage
o [AttrOp AttrLanguage tag]
[AttrOp AttrLanguage 'AttrSet]
attrs
AttrLanguage -> m AttrLanguage
forall (m :: * -> *) a. Monad m => a -> m a
return AttrLanguage
o
noAttrLanguage :: Maybe AttrLanguage
noAttrLanguage :: Maybe AttrLanguage
noAttrLanguage = Maybe AttrLanguage
forall a. Maybe a
Nothing
getAttrLanguageAttr :: MonadIO m => AttrLanguage -> m Pango.Attribute.Attribute
getAttrLanguageAttr :: AttrLanguage -> m Attribute
getAttrLanguageAttr s :: AttrLanguage
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
$ AttrLanguage -> (Ptr AttrLanguage -> IO Attribute) -> IO Attribute
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrLanguage
s ((Ptr AttrLanguage -> IO Attribute) -> IO Attribute)
-> (Ptr AttrLanguage -> IO Attribute) -> IO Attribute
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrLanguage
ptr -> do
let val :: Ptr Attribute
val = Ptr AttrLanguage
ptr Ptr AttrLanguage -> 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 AttrLanguageAttrFieldInfo
instance AttrInfo AttrLanguageAttrFieldInfo where
type AttrBaseTypeConstraint AttrLanguageAttrFieldInfo = (~) AttrLanguage
type AttrAllowedOps AttrLanguageAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrLanguageAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrTransferTypeConstraint AttrLanguageAttrFieldInfo = (~)(Ptr Pango.Attribute.Attribute)
type AttrTransferType AttrLanguageAttrFieldInfo = (Ptr Pango.Attribute.Attribute)
type AttrGetType AttrLanguageAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrLanguageAttrFieldInfo = "attr"
type AttrOrigin AttrLanguageAttrFieldInfo = AttrLanguage
attrGet = getAttrLanguageAttr
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
attrLanguage_attr :: AttrLabelProxy "attr"
attrLanguage_attr = AttrLabelProxy
#endif
getAttrLanguageValue :: MonadIO m => AttrLanguage -> m (Maybe Pango.Language.Language)
getAttrLanguageValue :: AttrLanguage -> m (Maybe Language)
getAttrLanguageValue s :: AttrLanguage
s = IO (Maybe Language) -> m (Maybe Language)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Language) -> m (Maybe Language))
-> IO (Maybe Language) -> m (Maybe Language)
forall a b. (a -> b) -> a -> b
$ AttrLanguage
-> (Ptr AttrLanguage -> IO (Maybe Language)) -> IO (Maybe Language)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrLanguage
s ((Ptr AttrLanguage -> IO (Maybe Language)) -> IO (Maybe Language))
-> (Ptr AttrLanguage -> IO (Maybe Language)) -> IO (Maybe Language)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrLanguage
ptr -> do
Ptr Language
val <- Ptr (Ptr Language) -> IO (Ptr Language)
forall a. Storable a => Ptr a -> IO a
peek (Ptr AttrLanguage
ptr Ptr AttrLanguage -> Int -> Ptr (Ptr Language)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) :: IO (Ptr Pango.Language.Language)
Maybe Language
result <- Ptr Language
-> (Ptr Language -> IO Language) -> IO (Maybe Language)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr Language
val ((Ptr Language -> IO Language) -> IO (Maybe Language))
-> (Ptr Language -> IO Language) -> IO (Maybe Language)
forall a b. (a -> b) -> a -> b
$ \val' :: Ptr Language
val' -> do
Language
val'' <- ((ManagedPtr Language -> Language) -> Ptr Language -> IO Language
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Language -> Language
Pango.Language.Language) Ptr Language
val'
Language -> IO Language
forall (m :: * -> *) a. Monad m => a -> m a
return Language
val''
Maybe Language -> IO (Maybe Language)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Language
result
setAttrLanguageValue :: MonadIO m => AttrLanguage -> Ptr Pango.Language.Language -> m ()
setAttrLanguageValue :: AttrLanguage -> Ptr Language -> m ()
setAttrLanguageValue s :: AttrLanguage
s val :: Ptr Language
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AttrLanguage -> (Ptr AttrLanguage -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrLanguage
s ((Ptr AttrLanguage -> IO ()) -> IO ())
-> (Ptr AttrLanguage -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrLanguage
ptr -> do
Ptr (Ptr Language) -> Ptr Language -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrLanguage
ptr Ptr AttrLanguage -> Int -> Ptr (Ptr Language)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (Ptr Language
val :: Ptr Pango.Language.Language)
clearAttrLanguageValue :: MonadIO m => AttrLanguage -> m ()
clearAttrLanguageValue :: AttrLanguage -> m ()
clearAttrLanguageValue s :: AttrLanguage
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AttrLanguage -> (Ptr AttrLanguage -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrLanguage
s ((Ptr AttrLanguage -> IO ()) -> IO ())
-> (Ptr AttrLanguage -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr AttrLanguage
ptr -> do
Ptr (Ptr Language) -> Ptr Language -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrLanguage
ptr Ptr AttrLanguage -> Int -> Ptr (Ptr Language)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (Ptr Language
forall a. Ptr a
FP.nullPtr :: Ptr Pango.Language.Language)
#if defined(ENABLE_OVERLOADING)
data AttrLanguageValueFieldInfo
instance AttrInfo AttrLanguageValueFieldInfo where
type AttrBaseTypeConstraint AttrLanguageValueFieldInfo = (~) AttrLanguage
type AttrAllowedOps AttrLanguageValueFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AttrLanguageValueFieldInfo = (~) (Ptr Pango.Language.Language)
type AttrTransferTypeConstraint AttrLanguageValueFieldInfo = (~)(Ptr Pango.Language.Language)
type AttrTransferType AttrLanguageValueFieldInfo = (Ptr Pango.Language.Language)
type AttrGetType AttrLanguageValueFieldInfo = Maybe Pango.Language.Language
type AttrLabel AttrLanguageValueFieldInfo = "value"
type AttrOrigin AttrLanguageValueFieldInfo = AttrLanguage
attrGet = getAttrLanguageValue
attrSet = setAttrLanguageValue
attrConstruct = undefined
attrClear = clearAttrLanguageValue
attrTransfer _ v = do
return v
attrLanguage_value :: AttrLabelProxy "value"
attrLanguage_value = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AttrLanguage
type instance O.AttributeList AttrLanguage = AttrLanguageAttributeList
type AttrLanguageAttributeList = ('[ '("attr", AttrLanguageAttrFieldInfo), '("value", AttrLanguageValueFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "pango_attr_language_new" pango_attr_language_new ::
Ptr Pango.Language.Language ->
IO (Ptr Pango.Attribute.Attribute)
attrLanguageNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Pango.Language.Language
-> m Pango.Attribute.Attribute
attrLanguageNew :: Language -> m Attribute
attrLanguageNew language :: Language
language = 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
Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
Ptr Attribute
result <- Ptr Language -> IO (Ptr Attribute)
pango_attr_language_new Ptr Language
language'
Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "attrLanguageNew" 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
Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
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 ResolveAttrLanguageMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrLanguageMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrLanguageMethod t AttrLanguage, O.MethodInfo info AttrLanguage p) => OL.IsLabel t (AttrLanguage -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif