{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A union holding one collected value.

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

module GI.GObject.Unions.TypeCValue
    ( 

-- * Exported types
    TypeCValue(..)                          ,
    newZeroTypeCValue                       ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveTypeCValueMethod                 ,
#endif



 -- * Properties


-- ** vDouble #attr:vDouble#
-- | the field for holding floating point values

    getTypeCValueVDouble                    ,
    setTypeCValueVDouble                    ,
#if defined(ENABLE_OVERLOADING)
    typeCValue_vDouble                      ,
#endif


-- ** vInt #attr:vInt#
-- | the field for holding integer values

    getTypeCValueVInt                       ,
    setTypeCValueVInt                       ,
#if defined(ENABLE_OVERLOADING)
    typeCValue_vInt                         ,
#endif


-- ** vInt64 #attr:vInt64#
-- | the field for holding 64 bit integer values

    getTypeCValueVInt64                     ,
    setTypeCValueVInt64                     ,
#if defined(ENABLE_OVERLOADING)
    typeCValue_vInt64                       ,
#endif


-- ** vLong #attr:vLong#
-- | the field for holding long integer values

    getTypeCValueVLong                      ,
    setTypeCValueVLong                      ,
#if defined(ENABLE_OVERLOADING)
    typeCValue_vLong                        ,
#endif


-- ** vPointer #attr:vPointer#
-- | the field for holding pointers

    clearTypeCValueVPointer                 ,
    getTypeCValueVPointer                   ,
    setTypeCValueVPointer                   ,
#if defined(ENABLE_OVERLOADING)
    typeCValue_vPointer                     ,
#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
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified Data.Bits as DB
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)

#else

#endif

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

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

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


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

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


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

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

#if defined(ENABLE_OVERLOADING)
data TypeCValueVIntFieldInfo
instance AttrInfo TypeCValueVIntFieldInfo where
    type AttrBaseTypeConstraint TypeCValueVIntFieldInfo = (~) TypeCValue
    type AttrAllowedOps TypeCValueVIntFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint TypeCValueVIntFieldInfo = (~) Int32
    type AttrTransferTypeConstraint TypeCValueVIntFieldInfo = (~)Int32
    type AttrTransferType TypeCValueVIntFieldInfo = Int32
    type AttrGetType TypeCValueVIntFieldInfo = Int32
    type AttrLabel TypeCValueVIntFieldInfo = "v_int"
    type AttrOrigin TypeCValueVIntFieldInfo = TypeCValue
    attrGet :: forall o.
AttrBaseTypeConstraint TypeCValueVIntFieldInfo o =>
o -> IO (AttrGetType TypeCValueVIntFieldInfo)
attrGet = o -> IO (AttrGetType TypeCValueVIntFieldInfo)
TypeCValue -> IO Int32
forall (m :: * -> *). MonadIO m => TypeCValue -> m Int32
getTypeCValueVInt
    attrSet :: forall o b.
(AttrBaseTypeConstraint TypeCValueVIntFieldInfo o,
 AttrSetTypeConstraint TypeCValueVIntFieldInfo b) =>
o -> b -> IO ()
attrSet = o -> b -> IO ()
TypeCValue -> Int32 -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> Int32 -> m ()
setTypeCValueVInt
    attrConstruct :: forall o b.
(AttrBaseTypeConstraint TypeCValueVIntFieldInfo o,
 AttrSetTypeConstraint TypeCValueVIntFieldInfo b) =>
b -> IO (GValueConstruct o)
attrConstruct = b -> IO (GValueConstruct o)
forall a. HasCallStack => a
undefined
    attrClear :: forall o.
AttrBaseTypeConstraint TypeCValueVIntFieldInfo o =>
o -> IO ()
attrClear = o -> IO ()
forall a. HasCallStack => a
undefined
    attrTransfer :: forall o b.
(AttrBaseTypeConstraint TypeCValueVIntFieldInfo o,
 AttrTransferTypeConstraint TypeCValueVIntFieldInfo b) =>
Proxy o -> b -> IO (AttrTransferType TypeCValueVIntFieldInfo)
attrTransfer Proxy o
_ b
v = do
        b -> IO b
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return b
v
    dbgAttrInfo :: Maybe ResolvedSymbolInfo
dbgAttrInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
        resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GObject.Unions.TypeCValue.vInt"
        , resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-gobject-2.0.32/docs/GI-GObject-Unions-TypeCValue.html#g:attr:vInt"
        })

typeCValue_vInt :: AttrLabelProxy "vInt"
typeCValue_vInt :: AttrLabelProxy "vInt"
typeCValue_vInt = AttrLabelProxy "vInt"
forall (a :: Symbol). AttrLabelProxy a
AttrLabelProxy

#endif


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

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

#if defined(ENABLE_OVERLOADING)
data TypeCValueVLongFieldInfo
instance AttrInfo TypeCValueVLongFieldInfo where
    type AttrBaseTypeConstraint TypeCValueVLongFieldInfo = (~) TypeCValue
    type AttrAllowedOps TypeCValueVLongFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint TypeCValueVLongFieldInfo = (~) FCT.CLong
    type AttrTransferTypeConstraint TypeCValueVLongFieldInfo = (~)FCT.CLong
    type AttrTransferType TypeCValueVLongFieldInfo = FCT.CLong
    type AttrGetType TypeCValueVLongFieldInfo = FCT.CLong
    type AttrLabel TypeCValueVLongFieldInfo = "v_long"
    type AttrOrigin TypeCValueVLongFieldInfo = TypeCValue
    attrGet :: forall o.
AttrBaseTypeConstraint TypeCValueVLongFieldInfo o =>
o -> IO (AttrGetType TypeCValueVLongFieldInfo)
attrGet = o -> IO (AttrGetType TypeCValueVLongFieldInfo)
TypeCValue -> IO CLong
forall (m :: * -> *). MonadIO m => TypeCValue -> m CLong
getTypeCValueVLong
    attrSet :: forall o b.
(AttrBaseTypeConstraint TypeCValueVLongFieldInfo o,
 AttrSetTypeConstraint TypeCValueVLongFieldInfo b) =>
o -> b -> IO ()
attrSet = o -> b -> IO ()
TypeCValue -> CLong -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> CLong -> m ()
setTypeCValueVLong
    attrConstruct :: forall o b.
(AttrBaseTypeConstraint TypeCValueVLongFieldInfo o,
 AttrSetTypeConstraint TypeCValueVLongFieldInfo b) =>
b -> IO (GValueConstruct o)
attrConstruct = b -> IO (GValueConstruct o)
forall a. HasCallStack => a
undefined
    attrClear :: forall o.
AttrBaseTypeConstraint TypeCValueVLongFieldInfo o =>
o -> IO ()
attrClear = o -> IO ()
forall a. HasCallStack => a
undefined
    attrTransfer :: forall o b.
(AttrBaseTypeConstraint TypeCValueVLongFieldInfo o,
 AttrTransferTypeConstraint TypeCValueVLongFieldInfo b) =>
Proxy o -> b -> IO (AttrTransferType TypeCValueVLongFieldInfo)
attrTransfer Proxy o
_ b
v = do
        b -> IO b
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return b
v
    dbgAttrInfo :: Maybe ResolvedSymbolInfo
dbgAttrInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
        resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GObject.Unions.TypeCValue.vLong"
        , resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-gobject-2.0.32/docs/GI-GObject-Unions-TypeCValue.html#g:attr:vLong"
        })

typeCValue_vLong :: AttrLabelProxy "vLong"
typeCValue_vLong :: AttrLabelProxy "vLong"
typeCValue_vLong = AttrLabelProxy "vLong"
forall (a :: Symbol). AttrLabelProxy a
AttrLabelProxy

#endif


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

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

#if defined(ENABLE_OVERLOADING)
data TypeCValueVInt64FieldInfo
instance AttrInfo TypeCValueVInt64FieldInfo where
    type AttrBaseTypeConstraint TypeCValueVInt64FieldInfo = (~) TypeCValue
    type AttrAllowedOps TypeCValueVInt64FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint TypeCValueVInt64FieldInfo = (~) Int64
    type AttrTransferTypeConstraint TypeCValueVInt64FieldInfo = (~)Int64
    type AttrTransferType TypeCValueVInt64FieldInfo = Int64
    type AttrGetType TypeCValueVInt64FieldInfo = Int64
    type AttrLabel TypeCValueVInt64FieldInfo = "v_int64"
    type AttrOrigin TypeCValueVInt64FieldInfo = TypeCValue
    attrGet :: forall o.
AttrBaseTypeConstraint TypeCValueVInt64FieldInfo o =>
o -> IO (AttrGetType TypeCValueVInt64FieldInfo)
attrGet = o -> IO (AttrGetType TypeCValueVInt64FieldInfo)
TypeCValue -> IO Int64
forall (m :: * -> *). MonadIO m => TypeCValue -> m Int64
getTypeCValueVInt64
    attrSet :: forall o b.
(AttrBaseTypeConstraint TypeCValueVInt64FieldInfo o,
 AttrSetTypeConstraint TypeCValueVInt64FieldInfo b) =>
o -> b -> IO ()
attrSet = o -> b -> IO ()
TypeCValue -> Int64 -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> Int64 -> m ()
setTypeCValueVInt64
    attrConstruct :: forall o b.
(AttrBaseTypeConstraint TypeCValueVInt64FieldInfo o,
 AttrSetTypeConstraint TypeCValueVInt64FieldInfo b) =>
b -> IO (GValueConstruct o)
attrConstruct = b -> IO (GValueConstruct o)
forall a. HasCallStack => a
undefined
    attrClear :: forall o.
AttrBaseTypeConstraint TypeCValueVInt64FieldInfo o =>
o -> IO ()
attrClear = o -> IO ()
forall a. HasCallStack => a
undefined
    attrTransfer :: forall o b.
(AttrBaseTypeConstraint TypeCValueVInt64FieldInfo o,
 AttrTransferTypeConstraint TypeCValueVInt64FieldInfo b) =>
Proxy o -> b -> IO (AttrTransferType TypeCValueVInt64FieldInfo)
attrTransfer Proxy o
_ b
v = do
        b -> IO b
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return b
v
    dbgAttrInfo :: Maybe ResolvedSymbolInfo
dbgAttrInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
        resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GObject.Unions.TypeCValue.vInt64"
        , resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-gobject-2.0.32/docs/GI-GObject-Unions-TypeCValue.html#g:attr:vInt64"
        })

typeCValue_vInt64 :: AttrLabelProxy "vInt64"
typeCValue_vInt64 :: AttrLabelProxy "vInt64"
typeCValue_vInt64 = AttrLabelProxy "vInt64"
forall (a :: Symbol). AttrLabelProxy a
AttrLabelProxy

#endif


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

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

#if defined(ENABLE_OVERLOADING)
data TypeCValueVDoubleFieldInfo
instance AttrInfo TypeCValueVDoubleFieldInfo where
    type AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo = (~) TypeCValue
    type AttrAllowedOps TypeCValueVDoubleFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint TypeCValueVDoubleFieldInfo = (~) Double
    type AttrTransferTypeConstraint TypeCValueVDoubleFieldInfo = (~)Double
    type AttrTransferType TypeCValueVDoubleFieldInfo = Double
    type AttrGetType TypeCValueVDoubleFieldInfo = Double
    type AttrLabel TypeCValueVDoubleFieldInfo = "v_double"
    type AttrOrigin TypeCValueVDoubleFieldInfo = TypeCValue
    attrGet :: forall o.
AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo o =>
o -> IO (AttrGetType TypeCValueVDoubleFieldInfo)
attrGet = o -> IO (AttrGetType TypeCValueVDoubleFieldInfo)
TypeCValue -> IO Double
forall (m :: * -> *). MonadIO m => TypeCValue -> m Double
getTypeCValueVDouble
    attrSet :: forall o b.
(AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo o,
 AttrSetTypeConstraint TypeCValueVDoubleFieldInfo b) =>
o -> b -> IO ()
attrSet = o -> b -> IO ()
TypeCValue -> Double -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> Double -> m ()
setTypeCValueVDouble
    attrConstruct :: forall o b.
(AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo o,
 AttrSetTypeConstraint TypeCValueVDoubleFieldInfo b) =>
b -> IO (GValueConstruct o)
attrConstruct = b -> IO (GValueConstruct o)
forall a. HasCallStack => a
undefined
    attrClear :: forall o.
AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo o =>
o -> IO ()
attrClear = o -> IO ()
forall a. HasCallStack => a
undefined
    attrTransfer :: forall o b.
(AttrBaseTypeConstraint TypeCValueVDoubleFieldInfo o,
 AttrTransferTypeConstraint TypeCValueVDoubleFieldInfo b) =>
Proxy o -> b -> IO (AttrTransferType TypeCValueVDoubleFieldInfo)
attrTransfer Proxy o
_ b
v = do
        b -> IO b
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return b
v
    dbgAttrInfo :: Maybe ResolvedSymbolInfo
dbgAttrInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
        resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GObject.Unions.TypeCValue.vDouble"
        , resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-gobject-2.0.32/docs/GI-GObject-Unions-TypeCValue.html#g:attr:vDouble"
        })

typeCValue_vDouble :: AttrLabelProxy "vDouble"
typeCValue_vDouble :: AttrLabelProxy "vDouble"
typeCValue_vDouble = AttrLabelProxy "vDouble"
forall (a :: Symbol). AttrLabelProxy a
AttrLabelProxy

#endif


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

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

-- | Set the value of the “@v_pointer@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #vPointer
-- @
clearTypeCValueVPointer :: MonadIO m => TypeCValue -> m ()
clearTypeCValueVPointer :: forall (m :: * -> *). MonadIO m => TypeCValue -> m ()
clearTypeCValueVPointer TypeCValue
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeCValue -> (Ptr TypeCValue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeCValue
s ((Ptr TypeCValue -> IO ()) -> IO ())
-> (Ptr TypeCValue -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TypeCValue
ptr -> do
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeCValue
ptr Ptr TypeCValue -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
forall a. Ptr a
FP.nullPtr :: Ptr ())

#if defined(ENABLE_OVERLOADING)
data TypeCValueVPointerFieldInfo
instance AttrInfo TypeCValueVPointerFieldInfo where
    type AttrBaseTypeConstraint TypeCValueVPointerFieldInfo = (~) TypeCValue
    type AttrAllowedOps TypeCValueVPointerFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint TypeCValueVPointerFieldInfo = (~) (Ptr ())
    type AttrTransferTypeConstraint TypeCValueVPointerFieldInfo = (~)(Ptr ())
    type AttrTransferType TypeCValueVPointerFieldInfo = (Ptr ())
    type AttrGetType TypeCValueVPointerFieldInfo = Ptr ()
    type AttrLabel TypeCValueVPointerFieldInfo = "v_pointer"
    type AttrOrigin TypeCValueVPointerFieldInfo = TypeCValue
    attrGet :: forall o.
AttrBaseTypeConstraint TypeCValueVPointerFieldInfo o =>
o -> IO (AttrGetType TypeCValueVPointerFieldInfo)
attrGet = o -> IO (AttrGetType TypeCValueVPointerFieldInfo)
TypeCValue -> IO (Ptr ())
forall (m :: * -> *). MonadIO m => TypeCValue -> m (Ptr ())
getTypeCValueVPointer
    attrSet :: forall o b.
(AttrBaseTypeConstraint TypeCValueVPointerFieldInfo o,
 AttrSetTypeConstraint TypeCValueVPointerFieldInfo b) =>
o -> b -> IO ()
attrSet = o -> b -> IO ()
TypeCValue -> Ptr () -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> Ptr () -> m ()
setTypeCValueVPointer
    attrConstruct :: forall o b.
(AttrBaseTypeConstraint TypeCValueVPointerFieldInfo o,
 AttrSetTypeConstraint TypeCValueVPointerFieldInfo b) =>
b -> IO (GValueConstruct o)
attrConstruct = b -> IO (GValueConstruct o)
forall a. HasCallStack => a
undefined
    attrClear :: forall o.
AttrBaseTypeConstraint TypeCValueVPointerFieldInfo o =>
o -> IO ()
attrClear = o -> IO ()
TypeCValue -> IO ()
forall (m :: * -> *). MonadIO m => TypeCValue -> m ()
clearTypeCValueVPointer
    attrTransfer :: forall o b.
(AttrBaseTypeConstraint TypeCValueVPointerFieldInfo o,
 AttrTransferTypeConstraint TypeCValueVPointerFieldInfo b) =>
Proxy o -> b -> IO (AttrTransferType TypeCValueVPointerFieldInfo)
attrTransfer Proxy o
_ b
v = do
        b -> IO b
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return b
v
    dbgAttrInfo :: Maybe ResolvedSymbolInfo
dbgAttrInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
        resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GObject.Unions.TypeCValue.vPointer"
        , resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-gobject-2.0.32/docs/GI-GObject-Unions-TypeCValue.html#g:attr:vPointer"
        })

typeCValue_vPointer :: AttrLabelProxy "vPointer"
typeCValue_vPointer :: AttrLabelProxy "vPointer"
typeCValue_vPointer = AttrLabelProxy "vPointer"
forall (a :: Symbol). AttrLabelProxy a
AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TypeCValue
type instance O.AttributeList TypeCValue = TypeCValueAttributeList
type TypeCValueAttributeList = ('[ '("vInt", TypeCValueVIntFieldInfo), '("vLong", TypeCValueVLongFieldInfo), '("vInt64", TypeCValueVInt64FieldInfo), '("vDouble", TypeCValueVDoubleFieldInfo), '("vPointer", TypeCValueVPointerFieldInfo)] :: [(Symbol, DK.Type)])
#endif

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

instance (info ~ ResolveTypeCValueMethod t TypeCValue, O.OverloadedMethod info TypeCValue p) => OL.IsLabel t (TypeCValue -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel :: TypeCValue -> p
fromLabel = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveTypeCValueMethod t TypeCValue, O.OverloadedMethod info TypeCValue p, R.HasField t TypeCValue p) => R.HasField t TypeCValue p where
    getField :: TypeCValue -> p
getField = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
O.overloadedMethod @info

#endif

instance (info ~ ResolveTypeCValueMethod t TypeCValue, O.OverloadedMethodInfo info TypeCValue) => OL.IsLabel t (O.MethodProxy info TypeCValue) where
#if MIN_VERSION_base(4,10,0)
    fromLabel :: MethodProxy info TypeCValue
fromLabel = MethodProxy info TypeCValue
forall info obj. MethodProxy info obj
O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif