{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Cogl.Objects.Fixed
(
Fixed(..) ,
IsFixed ,
toFixed ,
#if defined(ENABLE_OVERLOADING)
ResolveFixedMethod ,
#endif
fixedPow ,
#if defined(ENABLE_OVERLOADING)
FixedPow2MethodInfo ,
#endif
fixedPow2 ,
) 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.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 Fixed = Fixed (SP.ManagedPtr Fixed)
deriving (Fixed -> Fixed -> Bool
(Fixed -> Fixed -> Bool) -> (Fixed -> Fixed -> Bool) -> Eq Fixed
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Fixed -> Fixed -> Bool
== :: Fixed -> Fixed -> Bool
$c/= :: Fixed -> Fixed -> Bool
/= :: Fixed -> Fixed -> Bool
Eq)
instance SP.ManagedPtrNewtype Fixed where
toManagedPtr :: Fixed -> ManagedPtr Fixed
toManagedPtr (Fixed ManagedPtr Fixed
p) = ManagedPtr Fixed
p
foreign import ccall "cogl_fixed_get_type"
c_cogl_fixed_get_type :: IO B.Types.GType
instance B.Types.TypedObject Fixed where
glibType :: IO GType
glibType = IO GType
c_cogl_fixed_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Fixed o) => IsFixed o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Fixed o) => IsFixed o
instance O.HasParentTypes Fixed
type instance O.ParentTypes Fixed = '[]
toFixed :: (MIO.MonadIO m, IsFixed o) => o -> m Fixed
toFixed :: forall (m :: * -> *) o. (MonadIO m, IsFixed o) => o -> m Fixed
toFixed = IO Fixed -> m Fixed
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Fixed -> m Fixed) -> (o -> IO Fixed) -> o -> m Fixed
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Fixed -> Fixed) -> o -> IO Fixed
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Fixed -> Fixed
Fixed
#if defined(ENABLE_OVERLOADING)
type family ResolveFixedMethod (t :: Symbol) (o :: *) :: * where
ResolveFixedMethod "pow2" o = FixedPow2MethodInfo
ResolveFixedMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFixedMethod t Fixed, O.OverloadedMethod info Fixed p) => OL.IsLabel t (Fixed -> 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 ~ ResolveFixedMethod t Fixed, O.OverloadedMethod info Fixed p, R.HasField t Fixed p) => R.HasField t Fixed p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFixedMethod t Fixed, O.OverloadedMethodInfo info Fixed) => OL.IsLabel t (O.MethodProxy info Fixed) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
instance BoxedPtr Fixed where
boxedPtrCopy :: Fixed -> IO Fixed
boxedPtrCopy = Fixed -> IO Fixed
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: Fixed -> IO ()
boxedPtrFree = \Fixed
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "cogl_fixed_pow2" cogl_fixed_pow2 ::
Ptr Fixed ->
IO Word32
fixedPow2 ::
(B.CallStack.HasCallStack, MonadIO m, IsFixed a) =>
a
-> m Word32
fixedPow2 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFixed a) =>
a -> m Word32
fixedPow2 a
x = IO Word32 -> m Word32
forall a. IO a -> m a
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
$ do
Ptr Fixed
x' <- a -> IO (Ptr Fixed)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
x
Word32
result <- Ptr Fixed -> IO Word32
cogl_fixed_pow2 Ptr Fixed
x'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
x
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data FixedPow2MethodInfo
instance (signature ~ (m Word32), MonadIO m, IsFixed a) => O.OverloadedMethod FixedPow2MethodInfo a signature where
overloadedMethod = fixedPow2
instance O.OverloadedMethodInfo FixedPow2MethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Cogl.Objects.Fixed.fixedPow2",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-cogl-1.0.3/docs/GI-Cogl-Objects-Fixed.html#v:fixedPow2"
})
#endif
foreign import ccall "cogl_fixed_pow" cogl_fixed_pow ::
Word32 ->
Ptr Fixed ->
IO Word32
fixedPow ::
(B.CallStack.HasCallStack, MonadIO m, IsFixed a) =>
Word32
-> a
-> m Word32
fixedPow :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFixed a) =>
Word32 -> a -> m Word32
fixedPow Word32
x a
y = IO Word32 -> m Word32
forall a. IO a -> m a
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
$ do
Ptr Fixed
y' <- a -> IO (Ptr Fixed)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
y
Word32
result <- Word32 -> Ptr Fixed -> IO Word32
cogl_fixed_pow Word32
x Ptr Fixed
y'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
y
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
#endif