{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Data type to hold math kerning (cut-in) information for a glyph.
-- 
-- /Since: 3.4.0/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.HarfBuzz.Structs.OtMathKernEntryT
    ( 

-- * Exported types
    OtMathKernEntryT(..)                    ,
    newZeroOtMathKernEntryT                 ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveOtMathKernEntryTMethod           ,
#endif



 -- * Properties


-- ** kernValue #attr:kernValue#
-- | The kern value of the entry

    getOtMathKernEntryTKernValue            ,
#if defined(ENABLE_OVERLOADING)
    otMathKernEntryT_kernValue              ,
#endif
    setOtMathKernEntryTKernValue            ,


-- ** maxCorrectionHeight #attr:maxCorrectionHeight#
-- | The maximum height at which this entry should be used

    getOtMathKernEntryTMaxCorrectionHeight  ,
#if defined(ENABLE_OVERLOADING)
    otMathKernEntryT_maxCorrectionHeight    ,
#endif
    setOtMathKernEntryTMaxCorrectionHeight  ,




    ) 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.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.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


-- | Memory-managed wrapper type.
newtype OtMathKernEntryT = OtMathKernEntryT (SP.ManagedPtr OtMathKernEntryT)
    deriving (OtMathKernEntryT -> OtMathKernEntryT -> Bool
(OtMathKernEntryT -> OtMathKernEntryT -> Bool)
-> (OtMathKernEntryT -> OtMathKernEntryT -> Bool)
-> Eq OtMathKernEntryT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OtMathKernEntryT -> OtMathKernEntryT -> Bool
$c/= :: OtMathKernEntryT -> OtMathKernEntryT -> Bool
== :: OtMathKernEntryT -> OtMathKernEntryT -> Bool
$c== :: OtMathKernEntryT -> OtMathKernEntryT -> Bool
Eq)

instance SP.ManagedPtrNewtype OtMathKernEntryT where
    toManagedPtr :: OtMathKernEntryT -> ManagedPtr OtMathKernEntryT
toManagedPtr (OtMathKernEntryT ManagedPtr OtMathKernEntryT
p) = ManagedPtr OtMathKernEntryT
p

instance BoxedPtr OtMathKernEntryT where
    boxedPtrCopy :: OtMathKernEntryT -> IO OtMathKernEntryT
boxedPtrCopy = \OtMathKernEntryT
p -> OtMathKernEntryT
-> (Ptr OtMathKernEntryT -> IO OtMathKernEntryT)
-> IO OtMathKernEntryT
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr OtMathKernEntryT
p (Int -> Ptr OtMathKernEntryT -> IO (Ptr OtMathKernEntryT)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
8 (Ptr OtMathKernEntryT -> IO (Ptr OtMathKernEntryT))
-> (Ptr OtMathKernEntryT -> IO OtMathKernEntryT)
-> Ptr OtMathKernEntryT
-> IO OtMathKernEntryT
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr OtMathKernEntryT -> OtMathKernEntryT)
-> Ptr OtMathKernEntryT -> IO OtMathKernEntryT
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr OtMathKernEntryT -> OtMathKernEntryT
OtMathKernEntryT)
    boxedPtrFree :: OtMathKernEntryT -> IO ()
boxedPtrFree = \OtMathKernEntryT
x -> OtMathKernEntryT -> (Ptr OtMathKernEntryT -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr OtMathKernEntryT
x Ptr OtMathKernEntryT -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr OtMathKernEntryT where
    boxedPtrCalloc :: IO (Ptr OtMathKernEntryT)
boxedPtrCalloc = Int -> IO (Ptr OtMathKernEntryT)
forall a. Int -> IO (Ptr a)
callocBytes Int
8


-- | Construct a `OtMathKernEntryT` struct initialized to zero.
newZeroOtMathKernEntryT :: MonadIO m => m OtMathKernEntryT
newZeroOtMathKernEntryT :: forall (m :: * -> *). MonadIO m => m OtMathKernEntryT
newZeroOtMathKernEntryT = IO OtMathKernEntryT -> m OtMathKernEntryT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO OtMathKernEntryT -> m OtMathKernEntryT)
-> IO OtMathKernEntryT -> m OtMathKernEntryT
forall a b. (a -> b) -> a -> b
$ IO (Ptr OtMathKernEntryT)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr OtMathKernEntryT)
-> (Ptr OtMathKernEntryT -> IO OtMathKernEntryT)
-> IO OtMathKernEntryT
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr OtMathKernEntryT -> OtMathKernEntryT)
-> Ptr OtMathKernEntryT -> IO OtMathKernEntryT
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr OtMathKernEntryT -> OtMathKernEntryT
OtMathKernEntryT

instance tag ~ 'AttrSet => Constructible OtMathKernEntryT tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr OtMathKernEntryT -> OtMathKernEntryT)
-> [AttrOp OtMathKernEntryT tag] -> m OtMathKernEntryT
new ManagedPtr OtMathKernEntryT -> OtMathKernEntryT
_ [AttrOp OtMathKernEntryT tag]
attrs = do
        OtMathKernEntryT
o <- m OtMathKernEntryT
forall (m :: * -> *). MonadIO m => m OtMathKernEntryT
newZeroOtMathKernEntryT
        OtMathKernEntryT -> [AttrOp OtMathKernEntryT 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set OtMathKernEntryT
o [AttrOp OtMathKernEntryT tag]
[AttrOp OtMathKernEntryT 'AttrSet]
attrs
        OtMathKernEntryT -> m OtMathKernEntryT
forall (m :: * -> *) a. Monad m => a -> m a
return OtMathKernEntryT
o


-- | Get the value of the “@max_correction_height@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' otMathKernEntryT #maxCorrectionHeight
-- @
getOtMathKernEntryTMaxCorrectionHeight :: MonadIO m => OtMathKernEntryT -> m Int32
getOtMathKernEntryTMaxCorrectionHeight :: forall (m :: * -> *). MonadIO m => OtMathKernEntryT -> m Int32
getOtMathKernEntryTMaxCorrectionHeight OtMathKernEntryT
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ OtMathKernEntryT -> (Ptr OtMathKernEntryT -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OtMathKernEntryT
s ((Ptr OtMathKernEntryT -> IO Int32) -> IO Int32)
-> (Ptr OtMathKernEntryT -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr OtMathKernEntryT
ptr -> do
    Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr OtMathKernEntryT
ptr Ptr OtMathKernEntryT -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Int32
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val

-- | Set the value of the “@max_correction_height@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' otMathKernEntryT [ #maxCorrectionHeight 'Data.GI.Base.Attributes.:=' value ]
-- @
setOtMathKernEntryTMaxCorrectionHeight :: MonadIO m => OtMathKernEntryT -> Int32 -> m ()
setOtMathKernEntryTMaxCorrectionHeight :: forall (m :: * -> *).
MonadIO m =>
OtMathKernEntryT -> Int32 -> m ()
setOtMathKernEntryTMaxCorrectionHeight OtMathKernEntryT
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ OtMathKernEntryT -> (Ptr OtMathKernEntryT -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OtMathKernEntryT
s ((Ptr OtMathKernEntryT -> IO ()) -> IO ())
-> (Ptr OtMathKernEntryT -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr OtMathKernEntryT
ptr -> do
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr OtMathKernEntryT
ptr Ptr OtMathKernEntryT -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Int32
val :: Int32)

#if defined(ENABLE_OVERLOADING)
data OtMathKernEntryTMaxCorrectionHeightFieldInfo
instance AttrInfo OtMathKernEntryTMaxCorrectionHeightFieldInfo where
    type AttrBaseTypeConstraint OtMathKernEntryTMaxCorrectionHeightFieldInfo = (~) OtMathKernEntryT
    type AttrAllowedOps OtMathKernEntryTMaxCorrectionHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint OtMathKernEntryTMaxCorrectionHeightFieldInfo = (~) Int32
    type AttrTransferTypeConstraint OtMathKernEntryTMaxCorrectionHeightFieldInfo = (~)Int32
    type AttrTransferType OtMathKernEntryTMaxCorrectionHeightFieldInfo = Int32
    type AttrGetType OtMathKernEntryTMaxCorrectionHeightFieldInfo = Int32
    type AttrLabel OtMathKernEntryTMaxCorrectionHeightFieldInfo = "max_correction_height"
    type AttrOrigin OtMathKernEntryTMaxCorrectionHeightFieldInfo = OtMathKernEntryT
    attrGet = getOtMathKernEntryTMaxCorrectionHeight
    attrSet = setOtMathKernEntryTMaxCorrectionHeight
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.HarfBuzz.Structs.OtMathKernEntryT.maxCorrectionHeight"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-harfbuzz-0.0.6/docs/GI-HarfBuzz-Structs-OtMathKernEntryT.html#g:attr:maxCorrectionHeight"
        })

otMathKernEntryT_maxCorrectionHeight :: AttrLabelProxy "maxCorrectionHeight"
otMathKernEntryT_maxCorrectionHeight = AttrLabelProxy

#endif


-- | Get the value of the “@kern_value@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' otMathKernEntryT #kernValue
-- @
getOtMathKernEntryTKernValue :: MonadIO m => OtMathKernEntryT -> m Int32
getOtMathKernEntryTKernValue :: forall (m :: * -> *). MonadIO m => OtMathKernEntryT -> m Int32
getOtMathKernEntryTKernValue OtMathKernEntryT
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ OtMathKernEntryT -> (Ptr OtMathKernEntryT -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OtMathKernEntryT
s ((Ptr OtMathKernEntryT -> IO Int32) -> IO Int32)
-> (Ptr OtMathKernEntryT -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr OtMathKernEntryT
ptr -> do
    Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr OtMathKernEntryT
ptr Ptr OtMathKernEntryT -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO Int32
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val

-- | Set the value of the “@kern_value@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' otMathKernEntryT [ #kernValue 'Data.GI.Base.Attributes.:=' value ]
-- @
setOtMathKernEntryTKernValue :: MonadIO m => OtMathKernEntryT -> Int32 -> m ()
setOtMathKernEntryTKernValue :: forall (m :: * -> *).
MonadIO m =>
OtMathKernEntryT -> Int32 -> m ()
setOtMathKernEntryTKernValue OtMathKernEntryT
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ OtMathKernEntryT -> (Ptr OtMathKernEntryT -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr OtMathKernEntryT
s ((Ptr OtMathKernEntryT -> IO ()) -> IO ())
-> (Ptr OtMathKernEntryT -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr OtMathKernEntryT
ptr -> do
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr OtMathKernEntryT
ptr Ptr OtMathKernEntryT -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Int32
val :: Int32)

#if defined(ENABLE_OVERLOADING)
data OtMathKernEntryTKernValueFieldInfo
instance AttrInfo OtMathKernEntryTKernValueFieldInfo where
    type AttrBaseTypeConstraint OtMathKernEntryTKernValueFieldInfo = (~) OtMathKernEntryT
    type AttrAllowedOps OtMathKernEntryTKernValueFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint OtMathKernEntryTKernValueFieldInfo = (~) Int32
    type AttrTransferTypeConstraint OtMathKernEntryTKernValueFieldInfo = (~)Int32
    type AttrTransferType OtMathKernEntryTKernValueFieldInfo = Int32
    type AttrGetType OtMathKernEntryTKernValueFieldInfo = Int32
    type AttrLabel OtMathKernEntryTKernValueFieldInfo = "kern_value"
    type AttrOrigin OtMathKernEntryTKernValueFieldInfo = OtMathKernEntryT
    attrGet = getOtMathKernEntryTKernValue
    attrSet = setOtMathKernEntryTKernValue
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.HarfBuzz.Structs.OtMathKernEntryT.kernValue"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-harfbuzz-0.0.6/docs/GI-HarfBuzz-Structs-OtMathKernEntryT.html#g:attr:kernValue"
        })

otMathKernEntryT_kernValue :: AttrLabelProxy "kernValue"
otMathKernEntryT_kernValue = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList OtMathKernEntryT
type instance O.AttributeList OtMathKernEntryT = OtMathKernEntryTAttributeList
type OtMathKernEntryTAttributeList = ('[ '("maxCorrectionHeight", OtMathKernEntryTMaxCorrectionHeightFieldInfo), '("kernValue", OtMathKernEntryTKernValueFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveOtMathKernEntryTMethod (t :: Symbol) (o :: *) :: * where
    ResolveOtMathKernEntryTMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveOtMathKernEntryTMethod t OtMathKernEntryT, O.OverloadedMethod info OtMathKernEntryT p) => OL.IsLabel t (OtMathKernEntryT -> 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 ~ ResolveOtMathKernEntryTMethod t OtMathKernEntryT, O.OverloadedMethod info OtMathKernEntryT p, R.HasField t OtMathKernEntryT p) => R.HasField t OtMathKernEntryT p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveOtMathKernEntryTMethod t OtMathKernEntryT, O.OverloadedMethodInfo info OtMathKernEntryT) => OL.IsLabel t (O.MethodProxy info OtMathKernEntryT) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif