{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Unions.DoubleIEEE754
(
DoubleIEEE754(..) ,
newZeroDoubleIEEE754 ,
noDoubleIEEE754 ,
#if defined(ENABLE_OVERLOADING)
ResolveDoubleIEEE754Method ,
#endif
#if defined(ENABLE_OVERLOADING)
doubleIEEE754_vDouble ,
#endif
getDoubleIEEE754VDouble ,
setDoubleIEEE754VDouble ,
) 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
newtype DoubleIEEE754 = DoubleIEEE754 (ManagedPtr DoubleIEEE754)
deriving (DoubleIEEE754 -> DoubleIEEE754 -> Bool
(DoubleIEEE754 -> DoubleIEEE754 -> Bool)
-> (DoubleIEEE754 -> DoubleIEEE754 -> Bool) -> Eq DoubleIEEE754
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DoubleIEEE754 -> DoubleIEEE754 -> Bool
$c/= :: DoubleIEEE754 -> DoubleIEEE754 -> Bool
== :: DoubleIEEE754 -> DoubleIEEE754 -> Bool
$c== :: DoubleIEEE754 -> DoubleIEEE754 -> Bool
Eq)
instance WrappedPtr DoubleIEEE754 where
wrappedPtrCalloc :: IO (Ptr DoubleIEEE754)
wrappedPtrCalloc = Int -> IO (Ptr DoubleIEEE754)
forall a. Int -> IO (Ptr a)
callocBytes 8
wrappedPtrCopy :: DoubleIEEE754 -> IO DoubleIEEE754
wrappedPtrCopy = \p :: DoubleIEEE754
p -> DoubleIEEE754
-> (Ptr DoubleIEEE754 -> IO DoubleIEEE754) -> IO DoubleIEEE754
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DoubleIEEE754
p (Int -> Ptr DoubleIEEE754 -> IO (Ptr DoubleIEEE754)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 8 (Ptr DoubleIEEE754 -> IO (Ptr DoubleIEEE754))
-> (Ptr DoubleIEEE754 -> IO DoubleIEEE754)
-> Ptr DoubleIEEE754
-> IO DoubleIEEE754
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr DoubleIEEE754 -> DoubleIEEE754)
-> Ptr DoubleIEEE754 -> IO DoubleIEEE754
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DoubleIEEE754 -> DoubleIEEE754
DoubleIEEE754)
wrappedPtrFree :: Maybe (GDestroyNotify DoubleIEEE754)
wrappedPtrFree = GDestroyNotify DoubleIEEE754
-> Maybe (GDestroyNotify DoubleIEEE754)
forall a. a -> Maybe a
Just GDestroyNotify DoubleIEEE754
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroDoubleIEEE754 :: MonadIO m => m DoubleIEEE754
newZeroDoubleIEEE754 :: m DoubleIEEE754
newZeroDoubleIEEE754 = IO DoubleIEEE754 -> m DoubleIEEE754
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DoubleIEEE754 -> m DoubleIEEE754)
-> IO DoubleIEEE754 -> m DoubleIEEE754
forall a b. (a -> b) -> a -> b
$ IO (Ptr DoubleIEEE754)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr DoubleIEEE754)
-> (Ptr DoubleIEEE754 -> IO DoubleIEEE754) -> IO DoubleIEEE754
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr DoubleIEEE754 -> DoubleIEEE754)
-> Ptr DoubleIEEE754 -> IO DoubleIEEE754
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr DoubleIEEE754 -> DoubleIEEE754
DoubleIEEE754
instance tag ~ 'AttrSet => Constructible DoubleIEEE754 tag where
new :: (ManagedPtr DoubleIEEE754 -> DoubleIEEE754)
-> [AttrOp DoubleIEEE754 tag] -> m DoubleIEEE754
new _ attrs :: [AttrOp DoubleIEEE754 tag]
attrs = do
DoubleIEEE754
o <- m DoubleIEEE754
forall (m :: * -> *). MonadIO m => m DoubleIEEE754
newZeroDoubleIEEE754
DoubleIEEE754 -> [AttrOp DoubleIEEE754 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set DoubleIEEE754
o [AttrOp DoubleIEEE754 tag]
[AttrOp DoubleIEEE754 'AttrSet]
attrs
DoubleIEEE754 -> m DoubleIEEE754
forall (m :: * -> *) a. Monad m => a -> m a
return DoubleIEEE754
o
noDoubleIEEE754 :: Maybe DoubleIEEE754
noDoubleIEEE754 :: Maybe DoubleIEEE754
noDoubleIEEE754 = Maybe DoubleIEEE754
forall a. Maybe a
Nothing
getDoubleIEEE754VDouble :: MonadIO m => DoubleIEEE754 -> m Double
getDoubleIEEE754VDouble :: DoubleIEEE754 -> m Double
getDoubleIEEE754VDouble s :: DoubleIEEE754
s = IO Double -> m Double
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
$ DoubleIEEE754 -> (Ptr DoubleIEEE754 -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DoubleIEEE754
s ((Ptr DoubleIEEE754 -> IO Double) -> IO Double)
-> (Ptr DoubleIEEE754 -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DoubleIEEE754
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr DoubleIEEE754
ptr Ptr DoubleIEEE754 -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setDoubleIEEE754VDouble :: MonadIO m => DoubleIEEE754 -> Double -> m ()
setDoubleIEEE754VDouble :: DoubleIEEE754 -> Double -> m ()
setDoubleIEEE754VDouble s :: DoubleIEEE754
s val :: Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DoubleIEEE754 -> (Ptr DoubleIEEE754 -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr DoubleIEEE754
s ((Ptr DoubleIEEE754 -> IO ()) -> IO ())
-> (Ptr DoubleIEEE754 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr DoubleIEEE754
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 DoubleIEEE754
ptr Ptr DoubleIEEE754 -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data DoubleIEEE754VDoubleFieldInfo
instance AttrInfo DoubleIEEE754VDoubleFieldInfo where
type AttrBaseTypeConstraint DoubleIEEE754VDoubleFieldInfo = (~) DoubleIEEE754
type AttrAllowedOps DoubleIEEE754VDoubleFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint DoubleIEEE754VDoubleFieldInfo = (~) Double
type AttrTransferTypeConstraint DoubleIEEE754VDoubleFieldInfo = (~)Double
type AttrTransferType DoubleIEEE754VDoubleFieldInfo = Double
type AttrGetType DoubleIEEE754VDoubleFieldInfo = Double
type AttrLabel DoubleIEEE754VDoubleFieldInfo = "v_double"
type AttrOrigin DoubleIEEE754VDoubleFieldInfo = DoubleIEEE754
attrGet = getDoubleIEEE754VDouble
attrSet = setDoubleIEEE754VDouble
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
doubleIEEE754_vDouble :: AttrLabelProxy "vDouble"
doubleIEEE754_vDouble = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DoubleIEEE754
type instance O.AttributeList DoubleIEEE754 = DoubleIEEE754AttributeList
type DoubleIEEE754AttributeList = ('[ '("vDouble", DoubleIEEE754VDoubleFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveDoubleIEEE754Method (t :: Symbol) (o :: *) :: * where
ResolveDoubleIEEE754Method l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDoubleIEEE754Method t DoubleIEEE754, O.MethodInfo info DoubleIEEE754 p) => OL.IsLabel t (DoubleIEEE754 -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif