{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Structs.TimeCoord
(
TimeCoord(..) ,
newZeroTimeCoord ,
#if defined(ENABLE_OVERLOADING)
ResolveTimeCoordMethod ,
#endif
getTimeCoordTime ,
setTimeCoordTime ,
#if defined(ENABLE_OVERLOADING)
timeCoord_time ,
#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.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
newtype TimeCoord = TimeCoord (SP.ManagedPtr TimeCoord)
deriving (TimeCoord -> TimeCoord -> Bool
(TimeCoord -> TimeCoord -> Bool)
-> (TimeCoord -> TimeCoord -> Bool) -> Eq TimeCoord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeCoord -> TimeCoord -> Bool
$c/= :: TimeCoord -> TimeCoord -> Bool
== :: TimeCoord -> TimeCoord -> Bool
$c== :: TimeCoord -> TimeCoord -> Bool
Eq)
instance SP.ManagedPtrNewtype TimeCoord where
toManagedPtr :: TimeCoord -> ManagedPtr TimeCoord
toManagedPtr (TimeCoord ManagedPtr TimeCoord
p) = ManagedPtr TimeCoord
p
instance BoxedPtr TimeCoord where
boxedPtrCopy :: TimeCoord -> IO TimeCoord
boxedPtrCopy = \TimeCoord
p -> TimeCoord -> (Ptr TimeCoord -> IO TimeCoord) -> IO TimeCoord
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr TimeCoord
p (Int -> Ptr TimeCoord -> IO (Ptr TimeCoord)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
1032 (Ptr TimeCoord -> IO (Ptr TimeCoord))
-> (Ptr TimeCoord -> IO TimeCoord) -> Ptr TimeCoord -> IO TimeCoord
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr TimeCoord -> TimeCoord)
-> Ptr TimeCoord -> IO TimeCoord
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr TimeCoord -> TimeCoord
TimeCoord)
boxedPtrFree :: TimeCoord -> IO ()
boxedPtrFree = \TimeCoord
x -> TimeCoord -> (Ptr TimeCoord -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr TimeCoord
x Ptr TimeCoord -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr TimeCoord where
boxedPtrCalloc :: IO (Ptr TimeCoord)
boxedPtrCalloc = Int -> IO (Ptr TimeCoord)
forall a. Int -> IO (Ptr a)
callocBytes Int
1032
newZeroTimeCoord :: MonadIO m => m TimeCoord
newZeroTimeCoord :: forall (m :: * -> *). MonadIO m => m TimeCoord
newZeroTimeCoord = IO TimeCoord -> m TimeCoord
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TimeCoord -> m TimeCoord) -> IO TimeCoord -> m TimeCoord
forall a b. (a -> b) -> a -> b
$ IO (Ptr TimeCoord)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr TimeCoord)
-> (Ptr TimeCoord -> IO TimeCoord) -> IO TimeCoord
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr TimeCoord -> TimeCoord)
-> Ptr TimeCoord -> IO TimeCoord
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TimeCoord -> TimeCoord
TimeCoord
instance tag ~ 'AttrSet => Constructible TimeCoord tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr TimeCoord -> TimeCoord)
-> [AttrOp TimeCoord tag] -> m TimeCoord
new ManagedPtr TimeCoord -> TimeCoord
_ [AttrOp TimeCoord tag]
attrs = do
TimeCoord
o <- m TimeCoord
forall (m :: * -> *). MonadIO m => m TimeCoord
newZeroTimeCoord
TimeCoord -> [AttrOp TimeCoord 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set TimeCoord
o [AttrOp TimeCoord tag]
[AttrOp TimeCoord 'AttrSet]
attrs
TimeCoord -> m TimeCoord
forall (m :: * -> *) a. Monad m => a -> m a
return TimeCoord
o
getTimeCoordTime :: MonadIO m => TimeCoord -> m Word32
getTimeCoordTime :: forall (m :: * -> *). MonadIO m => TimeCoord -> m Word32
getTimeCoordTime TimeCoord
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
$ TimeCoord -> (Ptr TimeCoord -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimeCoord
s ((Ptr TimeCoord -> IO Word32) -> IO Word32)
-> (Ptr TimeCoord -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr TimeCoord
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr TimeCoord
ptr Ptr TimeCoord -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setTimeCoordTime :: MonadIO m => TimeCoord -> Word32 -> m ()
setTimeCoordTime :: forall (m :: * -> *). MonadIO m => TimeCoord -> Word32 -> m ()
setTimeCoordTime TimeCoord
s 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
$ TimeCoord -> (Ptr TimeCoord -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TimeCoord
s ((Ptr TimeCoord -> IO ()) -> IO ())
-> (Ptr TimeCoord -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TimeCoord
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TimeCoord
ptr Ptr TimeCoord -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data TimeCoordTimeFieldInfo
instance AttrInfo TimeCoordTimeFieldInfo where
type AttrBaseTypeConstraint TimeCoordTimeFieldInfo = (~) TimeCoord
type AttrAllowedOps TimeCoordTimeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TimeCoordTimeFieldInfo = (~) Word32
type AttrTransferTypeConstraint TimeCoordTimeFieldInfo = (~)Word32
type AttrTransferType TimeCoordTimeFieldInfo = Word32
type AttrGetType TimeCoordTimeFieldInfo = Word32
type AttrLabel TimeCoordTimeFieldInfo = "time"
type AttrOrigin TimeCoordTimeFieldInfo = TimeCoord
attrGet = getTimeCoordTime
attrSet = setTimeCoordTime
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.TimeCoord.time"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-3.0.25/docs/GI-Gdk-Structs-TimeCoord.html#g:attr:time"
})
timeCoord_time :: AttrLabelProxy "time"
timeCoord_time = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TimeCoord
type instance O.AttributeList TimeCoord = TimeCoordAttributeList
type TimeCoordAttributeList = ('[ '("time", TimeCoordTimeFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveTimeCoordMethod (t :: Symbol) (o :: *) :: * where
ResolveTimeCoordMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTimeCoordMethod t TimeCoord, O.OverloadedMethod info TimeCoord p) => OL.IsLabel t (TimeCoord -> 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 ~ ResolveTimeCoordMethod t TimeCoord, O.OverloadedMethod info TimeCoord p, R.HasField t TimeCoord p) => R.HasField t TimeCoord p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveTimeCoordMethod t TimeCoord, O.OverloadedMethodInfo info TimeCoord) => OL.IsLabel t (O.MethodProxy info TimeCoord) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif