{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.Coverage
(
Coverage(..) ,
noCoverage ,
#if defined(ENABLE_OVERLOADING)
ResolveCoverageMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
CoverageGetMethodInfo ,
#endif
coverageGet ,
#if defined(ENABLE_OVERLOADING)
CoverageMaxMethodInfo ,
#endif
coverageMax ,
#if defined(ENABLE_OVERLOADING)
CoverageSetMethodInfo ,
#endif
coverageSet ,
#if defined(ENABLE_OVERLOADING)
CoverageToBytesMethodInfo ,
#endif
coverageToBytes ,
#if defined(ENABLE_OVERLOADING)
CoverageUnrefMethodInfo ,
#endif
coverageUnref ,
) 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
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
newtype Coverage = Coverage (ManagedPtr Coverage)
deriving (Coverage -> Coverage -> Bool
(Coverage -> Coverage -> Bool)
-> (Coverage -> Coverage -> Bool) -> Eq Coverage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Coverage -> Coverage -> Bool
$c/= :: Coverage -> Coverage -> Bool
== :: Coverage -> Coverage -> Bool
$c== :: Coverage -> Coverage -> Bool
Eq)
instance WrappedPtr Coverage where
wrappedPtrCalloc :: IO (Ptr Coverage)
wrappedPtrCalloc = Ptr Coverage -> IO (Ptr Coverage)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Coverage
forall a. Ptr a
nullPtr
wrappedPtrCopy :: Coverage -> IO Coverage
wrappedPtrCopy = Coverage -> IO Coverage
forall (m :: * -> *) a. Monad m => a -> m a
return
wrappedPtrFree :: Maybe (GDestroyNotify Coverage)
wrappedPtrFree = Maybe (GDestroyNotify Coverage)
forall a. Maybe a
Nothing
noCoverage :: Maybe Coverage
noCoverage :: Maybe Coverage
noCoverage = Maybe Coverage
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Coverage
type instance O.AttributeList Coverage = CoverageAttributeList
type CoverageAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "pango_coverage_get" pango_coverage_get ::
Ptr Coverage ->
Int32 ->
IO CUInt
coverageGet ::
(B.CallStack.HasCallStack, MonadIO m) =>
Coverage
-> Int32
-> m Pango.Enums.CoverageLevel
coverageGet :: Coverage -> Int32 -> m CoverageLevel
coverageGet coverage :: Coverage
coverage index_ :: Int32
index_ = IO CoverageLevel -> m CoverageLevel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CoverageLevel -> m CoverageLevel)
-> IO CoverageLevel -> m CoverageLevel
forall a b. (a -> b) -> a -> b
$ do
Ptr Coverage
coverage' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
coverage
CUInt
result <- Ptr Coverage -> Int32 -> IO CUInt
pango_coverage_get Ptr Coverage
coverage' Int32
index_
let result' :: CoverageLevel
result' = (Int -> CoverageLevel
forall a. Enum a => Int -> a
toEnum (Int -> CoverageLevel) -> (CUInt -> Int) -> CUInt -> CoverageLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
coverage
CoverageLevel -> IO CoverageLevel
forall (m :: * -> *) a. Monad m => a -> m a
return CoverageLevel
result'
#if defined(ENABLE_OVERLOADING)
data CoverageGetMethodInfo
instance (signature ~ (Int32 -> m Pango.Enums.CoverageLevel), MonadIO m) => O.MethodInfo CoverageGetMethodInfo Coverage signature where
overloadedMethod = coverageGet
#endif
foreign import ccall "pango_coverage_max" pango_coverage_max ::
Ptr Coverage ->
Ptr Coverage ->
IO ()
coverageMax ::
(B.CallStack.HasCallStack, MonadIO m) =>
Coverage
-> Coverage
-> m ()
coverageMax :: Coverage -> Coverage -> m ()
coverageMax coverage :: Coverage
coverage other :: Coverage
other = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Coverage
coverage' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
coverage
Ptr Coverage
other' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
other
Ptr Coverage -> Ptr Coverage -> IO ()
pango_coverage_max Ptr Coverage
coverage' Ptr Coverage
other'
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
coverage
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
other
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CoverageMaxMethodInfo
instance (signature ~ (Coverage -> m ()), MonadIO m) => O.MethodInfo CoverageMaxMethodInfo Coverage signature where
overloadedMethod = coverageMax
#endif
foreign import ccall "pango_coverage_set" pango_coverage_set ::
Ptr Coverage ->
Int32 ->
CUInt ->
IO ()
coverageSet ::
(B.CallStack.HasCallStack, MonadIO m) =>
Coverage
-> Int32
-> Pango.Enums.CoverageLevel
-> m ()
coverageSet :: Coverage -> Int32 -> CoverageLevel -> m ()
coverageSet coverage :: Coverage
coverage index_ :: Int32
index_ level :: CoverageLevel
level = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Coverage
coverage' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
coverage
let level' :: CUInt
level' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (CoverageLevel -> Int) -> CoverageLevel -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CoverageLevel -> Int
forall a. Enum a => a -> Int
fromEnum) CoverageLevel
level
Ptr Coverage -> Int32 -> CUInt -> IO ()
pango_coverage_set Ptr Coverage
coverage' Int32
index_ CUInt
level'
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
coverage
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CoverageSetMethodInfo
instance (signature ~ (Int32 -> Pango.Enums.CoverageLevel -> m ()), MonadIO m) => O.MethodInfo CoverageSetMethodInfo Coverage signature where
overloadedMethod = coverageSet
#endif
foreign import ccall "pango_coverage_to_bytes" pango_coverage_to_bytes ::
Ptr Coverage ->
Ptr (Ptr Word8) ->
Ptr Int32 ->
IO ()
coverageToBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
Coverage
-> m (ByteString)
coverageToBytes :: Coverage -> m ByteString
coverageToBytes coverage :: Coverage
coverage = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
Ptr Coverage
coverage' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
coverage
Ptr (Ptr Word8)
bytes <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Word8))
Ptr Int32
nBytes <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Coverage -> Ptr (Ptr Word8) -> Ptr Int32 -> IO ()
pango_coverage_to_bytes Ptr Coverage
coverage' Ptr (Ptr Word8)
bytes Ptr Int32
nBytes
Int32
nBytes' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
nBytes
Ptr Word8
bytes' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
bytes
ByteString
bytes'' <- (Int32 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Int32
nBytes') Ptr Word8
bytes'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
bytes'
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
coverage
Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
bytes
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
nBytes
ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
bytes''
#if defined(ENABLE_OVERLOADING)
data CoverageToBytesMethodInfo
instance (signature ~ (m (ByteString)), MonadIO m) => O.MethodInfo CoverageToBytesMethodInfo Coverage signature where
overloadedMethod = coverageToBytes
#endif
foreign import ccall "pango_coverage_unref" pango_coverage_unref ::
Ptr Coverage ->
IO ()
coverageUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Coverage
-> m ()
coverageUnref :: Coverage -> m ()
coverageUnref coverage :: Coverage
coverage = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Coverage
coverage' <- Coverage -> IO (Ptr Coverage)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Coverage
coverage
Ptr Coverage -> IO ()
pango_coverage_unref Ptr Coverage
coverage'
Coverage -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Coverage
coverage
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CoverageUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo CoverageUnrefMethodInfo Coverage signature where
overloadedMethod = coverageUnref
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveCoverageMethod (t :: Symbol) (o :: *) :: * where
ResolveCoverageMethod "get" o = CoverageGetMethodInfo
ResolveCoverageMethod "max" o = CoverageMaxMethodInfo
ResolveCoverageMethod "set" o = CoverageSetMethodInfo
ResolveCoverageMethod "toBytes" o = CoverageToBytesMethodInfo
ResolveCoverageMethod "unref" o = CoverageUnrefMethodInfo
ResolveCoverageMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCoverageMethod t Coverage, O.MethodInfo info Coverage p) => OL.IsLabel t (Coverage -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif