gi-pango-0.1.36.12: GI/Pango/Structs/Coverage.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
The #PangoCoverage structure represents a map from Unicode characters
to #PangoCoverageLevel. It is an opaque structure with no public fields.
-}
module GI.Pango.Structs.Coverage
(
-- * Exported types
Coverage(..) ,
noCoverage ,
-- * Methods
-- ** coverageGet
coverageGet ,
-- ** coverageMax
coverageMax ,
-- ** coverageSet
coverageSet ,
-- ** coverageToBytes
coverageToBytes ,
-- ** coverageUnref
coverageUnref ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Pango.Types
import GI.Pango.Callbacks
newtype Coverage = Coverage (ForeignPtr Coverage)
noCoverage :: Maybe Coverage
noCoverage = Nothing
-- method Coverage::get
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "CoverageLevel"
-- throws : False
-- Skip return : False
foreign import ccall "pango_coverage_get" pango_coverage_get ::
Ptr Coverage -> -- _obj : TInterface "Pango" "Coverage"
Int32 -> -- index_ : TBasicType TInt32
IO CUInt
coverageGet ::
(MonadIO m) =>
Coverage -> -- _obj
Int32 -> -- index_
m CoverageLevel
coverageGet _obj index_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- pango_coverage_get _obj' index_
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method Coverage::max
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "other", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "other", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_coverage_max" pango_coverage_max ::
Ptr Coverage -> -- _obj : TInterface "Pango" "Coverage"
Ptr Coverage -> -- other : TInterface "Pango" "Coverage"
IO ()
coverageMax ::
(MonadIO m) =>
Coverage -> -- _obj
Coverage -> -- other
m ()
coverageMax _obj other = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let other' = unsafeManagedPtrGetPtr other
pango_coverage_max _obj' other'
touchManagedPtr _obj
touchManagedPtr other
return ()
-- method Coverage::set
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "level", argType = TInterface "Pango" "CoverageLevel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "level", argType = TInterface "Pango" "CoverageLevel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_coverage_set" pango_coverage_set ::
Ptr Coverage -> -- _obj : TInterface "Pango" "Coverage"
Int32 -> -- index_ : TBasicType TInt32
CUInt -> -- level : TInterface "Pango" "CoverageLevel"
IO ()
coverageSet ::
(MonadIO m) =>
Coverage -> -- _obj
Int32 -> -- index_
CoverageLevel -> -- level
m ()
coverageSet _obj index_ level = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let level' = (fromIntegral . fromEnum) level
pango_coverage_set _obj' index_ level'
touchManagedPtr _obj
return ()
-- method Coverage::to_bytes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "bytes", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "n_bytes", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_bytes", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_coverage_to_bytes" pango_coverage_to_bytes ::
Ptr Coverage -> -- _obj : TInterface "Pango" "Coverage"
Ptr (Ptr Word8) -> -- bytes : TCArray False (-1) 2 (TBasicType TUInt8)
Ptr Int32 -> -- n_bytes : TBasicType TInt32
IO ()
coverageToBytes ::
(MonadIO m) =>
Coverage -> -- _obj
m (ByteString)
coverageToBytes _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
bytes <- allocMem :: IO (Ptr (Ptr Word8))
n_bytes <- allocMem :: IO (Ptr Int32)
pango_coverage_to_bytes _obj' bytes n_bytes
n_bytes' <- peek n_bytes
bytes' <- peek bytes
bytes'' <- (unpackByteStringWithLength n_bytes') bytes'
freeMem bytes'
touchManagedPtr _obj
freeMem bytes
freeMem n_bytes
return bytes''
-- method Coverage::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Coverage", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_coverage_unref" pango_coverage_unref ::
Ptr Coverage -> -- _obj : TInterface "Pango" "Coverage"
IO ()
coverageUnref ::
(MonadIO m) =>
Coverage -> -- _obj
m ()
coverageUnref _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
pango_coverage_unref _obj'
touchManagedPtr _obj
return ()