{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.HarfBuzz.Unions.VarNumT
    ( 

-- * Exported types
    VarNumT(..)                             ,
    newZeroVarNumT                          ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveVarNumTMethod                    ,
#endif



 -- * Properties


-- ** f #attr:f#
-- | /No description available in the introspection data./

    getVarNumTF                             ,
    setVarNumTF                             ,
#if defined(ENABLE_OVERLOADING)
    varNumT_f                               ,
#endif


-- ** i32 #attr:i32#
-- | /No description available in the introspection data./

    getVarNumTI32                           ,
    setVarNumTI32                           ,
#if defined(ENABLE_OVERLOADING)
    varNumT_i32                             ,
#endif


-- ** u32 #attr:u32#
-- | /No description available in the introspection data./

    getVarNumTU32                           ,
    setVarNumTU32                           ,
#if defined(ENABLE_OVERLOADING)
    varNumT_u32                             ,
#endif




    ) 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.GHashTable as B.GHT
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.Kind as DK
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 VarNumT = VarNumT (SP.ManagedPtr VarNumT)
    deriving (VarNumT -> VarNumT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VarNumT -> VarNumT -> Bool
$c/= :: VarNumT -> VarNumT -> Bool
== :: VarNumT -> VarNumT -> Bool
$c== :: VarNumT -> VarNumT -> Bool
Eq)

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

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


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

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


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

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

#if defined(ENABLE_OVERLOADING)
data VarNumTFFieldInfo
instance AttrInfo VarNumTFFieldInfo where
    type AttrBaseTypeConstraint VarNumTFFieldInfo = (~) VarNumT
    type AttrAllowedOps VarNumTFFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VarNumTFFieldInfo = (~) Float
    type AttrTransferTypeConstraint VarNumTFFieldInfo = (~)Float
    type AttrTransferType VarNumTFFieldInfo = Float
    type AttrGetType VarNumTFFieldInfo = Float
    type AttrLabel VarNumTFFieldInfo = "f"
    type AttrOrigin VarNumTFFieldInfo = VarNumT
    attrGet = getVarNumTF
    attrSet = setVarNumTF
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.HarfBuzz.Unions.VarNumT.f"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-harfbuzz-0.0.7/docs/GI-HarfBuzz-Unions-VarNumT.html#g:attr:f"
        })

varNumT_f :: AttrLabelProxy "f"
varNumT_f = AttrLabelProxy

#endif


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

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

#if defined(ENABLE_OVERLOADING)
data VarNumTU32FieldInfo
instance AttrInfo VarNumTU32FieldInfo where
    type AttrBaseTypeConstraint VarNumTU32FieldInfo = (~) VarNumT
    type AttrAllowedOps VarNumTU32FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VarNumTU32FieldInfo = (~) Word32
    type AttrTransferTypeConstraint VarNumTU32FieldInfo = (~)Word32
    type AttrTransferType VarNumTU32FieldInfo = Word32
    type AttrGetType VarNumTU32FieldInfo = Word32
    type AttrLabel VarNumTU32FieldInfo = "u32"
    type AttrOrigin VarNumTU32FieldInfo = VarNumT
    attrGet = getVarNumTU32
    attrSet = setVarNumTU32
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.HarfBuzz.Unions.VarNumT.u32"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-harfbuzz-0.0.7/docs/GI-HarfBuzz-Unions-VarNumT.html#g:attr:u32"
        })

varNumT_u32 :: AttrLabelProxy "u32"
varNumT_u32 = AttrLabelProxy

#endif


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

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

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

varNumT_i32 :: AttrLabelProxy "i32"
varNumT_i32 = AttrLabelProxy

#endif


-- XXX Skipped attribute for "VarNumT:u16"
-- Not implemented: Don't know how to unpack C array of type TCArray False 2 (-1) (TBasicType TUInt16)
-- XXX Skipped attribute for "VarNumT:i16"
-- Not implemented: Don't know how to unpack C array of type TCArray False 2 (-1) (TBasicType TInt16)
-- XXX Skipped attribute for "VarNumT:u8"
-- Not implemented: Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt8)
-- XXX Skipped attribute for "VarNumT:i8"
-- Not implemented: Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TInt8)

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList VarNumT
type instance O.AttributeList VarNumT = VarNumTAttributeList
type VarNumTAttributeList = ('[ '("f", VarNumTFFieldInfo), '("u32", VarNumTU32FieldInfo), '("i32", VarNumTI32FieldInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveVarNumTMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveVarNumTMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif