    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- The t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT' is the structure that holds information about the
    -- glyphs and their relation to input text.

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.HarfBuzz.Structs.GlyphInfoT
        (

    -- * Exported types
        GlyphInfoT(..)                          ,
        newZeroGlyphInfoT                       ,

     -- * Methods
    -- ** Overloaded methods #method:Overloaded methods#

    #if defined(ENABLE_OVERLOADING)
        ResolveGlyphInfoTMethod                 ,
    #endif

     -- * Properties
    -- ** cluster #attr:cluster#
    -- | the index of the character in the original text that corresponds
    --           to this t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT', or whatever the client passes to
    --           'GI.HarfBuzz.Functions.bufferAdd'. More than one t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT' can have the same
    --           /@cluster@/ value, if they resulted from the same character (e.g. one
    --           to many glyph substitution), and when more than one character gets
    --           merged in the same glyph (e.g. many to one glyph substitution) the
    --           t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT' will have the smallest cluster value of them.
    --           By default some characters are merged into the same cluster
    --           (e.g. combining marks have the same cluster as their bases)
    --           even if they are separate glyphs, 'GI.HarfBuzz.Functions.bufferSetClusterLevel'
    --           allow selecting more fine-grained cluster handling.

        getGlyphInfoTCluster                    ,
    #if defined(ENABLE_OVERLOADING)
        glyphInfoT_cluster                      ,
    #endif
        setGlyphInfoTCluster                    ,

    -- ** codepoint #attr:codepoint#
    -- | either a Unicode code point (before shaping) or a glyph index
    --             (after shaping).

        getGlyphInfoTCodepoint                  ,
    #if defined(ENABLE_OVERLOADING)
        glyphInfoT_codepoint                    ,
    #endif
        setGlyphInfoTCodepoint                  ,

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

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

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

    foreign import ccall "hb_gobject_glyph_info_get_type" c_hb_gobject_glyph_info_get_type ::
        IO GType

    type instance O.ParentTypes GlyphInfoT = '[]
    instance O.HasParentTypes GlyphInfoT

    instance B.Types.TypedObject GlyphInfoT where
        glibType :: IO GType
    glibType = IO GType
    c_hb_gobject_glyph_info_get_type

    instance B.Types.GBoxed GlyphInfoT

    -- | Convert 'GlyphInfoT' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue GlyphInfoT where
        toGValue :: GlyphInfoT -> IO GValue
    toGValue o :: GlyphInfoT
    o = do
            GType
    gtype <- IO GType
    c_hb_gobject_glyph_info_get_type
            GlyphInfoT -> (Ptr GlyphInfoT -> IO GValue) -> IO GValue
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr GlyphInfoT
    o (GType
    -> (GValue -> Ptr GlyphInfoT -> IO ())
    -> Ptr GlyphInfoT
    -> IO GValue
    forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
    B.GValue.buildGValue GType
    gtype GValue -> Ptr GlyphInfoT -> IO ()
    forall a. GValue -> Ptr a -> IO ()
    B.GValue.set_boxed)

        fromGValue :: GValue -> IO GlyphInfoT
    fromGValue gv :: GValue
    gv = do
            Ptr GlyphInfoT
    ptr <- GValue -> IO (Ptr GlyphInfoT)
    forall b. GValue -> IO (Ptr b)
    B.GValue.get_boxed GValue
    gv :: IO (Ptr GlyphInfoT)
            (ManagedPtr GlyphInfoT -> GlyphInfoT)
    -> Ptr GlyphInfoT -> IO GlyphInfoT
    forall a.
    (HasCallStack, GBoxed a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    B.ManagedPtr.newBoxed ManagedPtr GlyphInfoT -> GlyphInfoT
    GlyphInfoT Ptr GlyphInfoT
    ptr

    -- | Construct a `GlyphInfoT` struct initialized to zero.
    newZeroGlyphInfoT :: MonadIO m => m GlyphInfoT
    newZeroGlyphInfoT :: m GlyphInfoT
    newZeroGlyphInfoT = IO GlyphInfoT -> m GlyphInfoT
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO GlyphInfoT -> m GlyphInfoT) -> IO GlyphInfoT -> m GlyphInfoT
    forall a b. (a -> b) -> a -> b
    $ Int -> IO (Ptr GlyphInfoT)
    forall a. GBoxed a => Int -> IO (Ptr a)
    callocBoxedBytes 20 IO (Ptr GlyphInfoT)
    -> (Ptr GlyphInfoT -> IO GlyphInfoT) -> IO GlyphInfoT
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (ManagedPtr GlyphInfoT -> GlyphInfoT)
    -> Ptr GlyphInfoT -> IO GlyphInfoT
    forall a.
    (HasCallStack, GBoxed a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    wrapBoxed ManagedPtr GlyphInfoT -> GlyphInfoT
    GlyphInfoT

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

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

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

    #if defined(ENABLE_OVERLOADING)
    data GlyphInfoTCodepointFieldInfo
    instance AttrInfo GlyphInfoTCodepointFieldInfo where
        type AttrBaseTypeConstraint GlyphInfoTCodepointFieldInfo = (~) GlyphInfoT
        type AttrAllowedOps GlyphInfoTCodepointFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint GlyphInfoTCodepointFieldInfo = (~) Word32
        type AttrTransferTypeConstraint GlyphInfoTCodepointFieldInfo = (~)Word32
        type AttrTransferType GlyphInfoTCodepointFieldInfo = Word32
        type AttrGetType GlyphInfoTCodepointFieldInfo = Word32
        type AttrLabel GlyphInfoTCodepointFieldInfo = "codepoint"
        type AttrOrigin GlyphInfoTCodepointFieldInfo = GlyphInfoT
        attrGet = getGlyphInfoTCodepoint
        attrSet = setGlyphInfoTCodepoint
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v

    glyphInfoT_codepoint :: AttrLabelProxy "codepoint"
    glyphInfoT_codepoint = AttrLabelProxy

    #endif

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

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

    #if defined(ENABLE_OVERLOADING)
    data GlyphInfoTClusterFieldInfo
    instance AttrInfo GlyphInfoTClusterFieldInfo where
        type AttrBaseTypeConstraint GlyphInfoTClusterFieldInfo = (~) GlyphInfoT
        type AttrAllowedOps GlyphInfoTClusterFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint GlyphInfoTClusterFieldInfo = (~) Word32
        type AttrTransferTypeConstraint GlyphInfoTClusterFieldInfo = (~)Word32
        type AttrTransferType GlyphInfoTClusterFieldInfo = Word32
        type AttrGetType GlyphInfoTClusterFieldInfo = Word32
        type AttrLabel GlyphInfoTClusterFieldInfo = "cluster"
        type AttrOrigin GlyphInfoTClusterFieldInfo = GlyphInfoT
        attrGet = getGlyphInfoTCluster
        attrSet = setGlyphInfoTCluster
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v

    glyphInfoT_cluster :: AttrLabelProxy "cluster"
    glyphInfoT_cluster = AttrLabelProxy

    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList GlyphInfoT
    type instance O.AttributeList GlyphInfoT = GlyphInfoTAttributeList
    type GlyphInfoTAttributeList = ('[ '("codepoint", GlyphInfoTCodepointFieldInfo), '("cluster", GlyphInfoTClusterFieldInfo)] :: [(Symbol, *)])
    #endif

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

    instance (info ~ ResolveGlyphInfoTMethod t GlyphInfoT, O.MethodInfo info GlyphInfoT p) => OL.IsLabel t (GlyphInfoT -> p) where
    #if MIN_VERSION_base(4,10,0)
        fromLabel = O.overloadedMethod @info
    #else
        fromLabel _ = O.overloadedMethod @info
    #endif

    #endif