{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Pango.Objects.Coverage.Coverage' structure represents a map from Unicode characters
-- to t'GI.Pango.Enums.CoverageLevel'. It is an opaque structure with no public fields.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Pango.Objects.Coverage
    ( 

-- * Exported types
    Coverage(..)                            ,
    IsCoverage                              ,
    toCoverage                              ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveCoverageMethod                   ,
#endif


-- ** copy #method:copy#

#if defined(ENABLE_OVERLOADING)
    CoverageCopyMethodInfo                  ,
#endif
    coverageCopy                            ,


-- ** fromBytes #method:fromBytes#

    coverageFromBytes                       ,


-- ** get #method:get#

#if defined(ENABLE_OVERLOADING)
    CoverageGetMethodInfo                   ,
#endif
    coverageGet                             ,


-- ** max #method:max#

#if defined(ENABLE_OVERLOADING)
    CoverageMaxMethodInfo                   ,
#endif
    coverageMax                             ,


-- ** new #method:new#

    coverageNew                             ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    CoverageRefMethodInfo                   ,
#endif
    coverageRef                             ,


-- ** set #method:set#

#if defined(ENABLE_OVERLOADING)
    CoverageSetMethodInfo                   ,
#endif
    coverageSet                             ,


-- ** toBytes #method:toBytes#

#if defined(ENABLE_OVERLOADING)
    CoverageToBytesMethodInfo               ,
#endif
    coverageToBytes                         ,


-- ** unref #method:unref#

#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.BasicTypes as B.Types
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 Control.Monad.IO.Class as MIO
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums

-- | Memory-managed wrapper type.
newtype Coverage = Coverage (SP.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 SP.ManagedPtrNewtype Coverage where
    toManagedPtr :: Coverage -> ManagedPtr Coverage
toManagedPtr (Coverage ManagedPtr Coverage
p) = ManagedPtr Coverage
p

foreign import ccall "pango_coverage_get_type"
    c_pango_coverage_get_type :: IO B.Types.GType

instance B.Types.TypedObject Coverage where
    glibType :: IO GType
glibType = IO GType
c_pango_coverage_get_type

instance B.Types.GObject Coverage

-- | Convert 'Coverage' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Coverage where
    toGValue :: Coverage -> IO GValue
toGValue Coverage
o = do
        GType
gtype <- IO GType
c_pango_coverage_get_type
        Coverage -> (Ptr Coverage -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Coverage
o (GType
-> (GValue -> Ptr Coverage -> IO ()) -> Ptr Coverage -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Coverage -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Coverage
fromGValue GValue
gv = do
        Ptr Coverage
ptr <- GValue -> IO (Ptr Coverage)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Coverage)
        (ManagedPtr Coverage -> Coverage) -> Ptr Coverage -> IO Coverage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Coverage -> Coverage
Coverage Ptr Coverage
ptr
        
    

-- | Type class for types which can be safely cast to `Coverage`, for instance with `toCoverage`.
class (SP.GObject o, O.IsDescendantOf Coverage o) => IsCoverage o
instance (SP.GObject o, O.IsDescendantOf Coverage o) => IsCoverage o

instance O.HasParentTypes Coverage
type instance O.ParentTypes Coverage = '[GObject.Object.Object]

-- | Cast to `Coverage`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toCoverage :: (MonadIO m, IsCoverage o) => o -> m Coverage
toCoverage :: o -> m Coverage
toCoverage = IO Coverage -> m Coverage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Coverage -> m Coverage)
-> (o -> IO Coverage) -> o -> m Coverage
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Coverage -> Coverage) -> o -> IO Coverage
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Coverage -> Coverage
Coverage

#if defined(ENABLE_OVERLOADING)
type family ResolveCoverageMethod (t :: Symbol) (o :: *) :: * where
    ResolveCoverageMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCoverageMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCoverageMethod "copy" o = CoverageCopyMethodInfo
    ResolveCoverageMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCoverageMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCoverageMethod "get" o = CoverageGetMethodInfo
    ResolveCoverageMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveCoverageMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCoverageMethod "max" o = CoverageMaxMethodInfo
    ResolveCoverageMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCoverageMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCoverageMethod "ref" o = CoverageRefMethodInfo
    ResolveCoverageMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCoverageMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCoverageMethod "set" o = CoverageSetMethodInfo
    ResolveCoverageMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCoverageMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCoverageMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCoverageMethod "toBytes" o = CoverageToBytesMethodInfo
    ResolveCoverageMethod "unref" o = CoverageUnrefMethodInfo
    ResolveCoverageMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCoverageMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCoverageMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCoverageMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCoverageMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCoverageMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveCoverageMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    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

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Coverage
type instance O.AttributeList Coverage = CoverageAttributeList
type CoverageAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Coverage = CoverageSignalList
type CoverageSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Coverage::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Coverage" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_new" pango_coverage_new :: 
    IO (Ptr Coverage)

-- | Create a new t'GI.Pango.Objects.Coverage.Coverage'
coverageNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Coverage
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Objects.Coverage.Coverage',
    --               initialized to 'GI.Pango.Enums.CoverageLevelNone'
    --               with a reference count of one, which
    --               should be freed with 'GI.Pango.Objects.Coverage.coverageUnref'.
coverageNew :: m Coverage
coverageNew  = IO Coverage -> m Coverage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Coverage -> m Coverage) -> IO Coverage -> m Coverage
forall a b. (a -> b) -> a -> b
$ do
    Ptr Coverage
result <- IO (Ptr Coverage)
pango_coverage_new
    Text -> Ptr Coverage -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"coverageNew" Ptr Coverage
result
    Coverage
result' <- ((ManagedPtr Coverage -> Coverage) -> Ptr Coverage -> IO Coverage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Coverage -> Coverage
Coverage) Ptr Coverage
result
    Coverage -> IO Coverage
forall (m :: * -> *) a. Monad m => a -> m a
return Coverage
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Coverage::copy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Coverage" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_copy" pango_coverage_copy :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    IO (Ptr Coverage)

-- | Copy an existing t'GI.Pango.Objects.Coverage.Coverage'. (This function may now be unnecessary
-- since we refcount the structure. File a bug if you use it.)
coverageCopy ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> m Coverage
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Objects.Coverage.Coverage',
    --               with a reference count of one, which should be freed
    --               with 'GI.Pango.Objects.Coverage.coverageUnref'.
coverageCopy :: a -> m Coverage
coverageCopy a
coverage = IO Coverage -> m Coverage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Coverage -> m Coverage) -> IO Coverage -> m Coverage
forall a b. (a -> b) -> a -> b
$ do
    Ptr Coverage
coverage' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
coverage
    Ptr Coverage
result <- Ptr Coverage -> IO (Ptr Coverage)
pango_coverage_copy Ptr Coverage
coverage'
    Text -> Ptr Coverage -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"coverageCopy" Ptr Coverage
result
    Coverage
result' <- ((ManagedPtr Coverage -> Coverage) -> Ptr Coverage -> IO Coverage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Coverage -> Coverage
Coverage) Ptr Coverage
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
coverage
    Coverage -> IO Coverage
forall (m :: * -> *) a. Monad m => a -> m a
return Coverage
result'

#if defined(ENABLE_OVERLOADING)
data CoverageCopyMethodInfo
instance (signature ~ (m Coverage), MonadIO m, IsCoverage a) => O.MethodInfo CoverageCopyMethodInfo a signature where
    overloadedMethod = coverageCopy

#endif

-- method Coverage::get
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index_"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Pango" , name = "CoverageLevel" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_get" pango_coverage_get :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    Int32 ->                                -- index_ : TBasicType TInt
    IO CUInt

-- | Determine whether a particular index is covered by /@coverage@/
coverageGet ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> Int32
    -- ^ /@index_@/: the index to check
    -> m Pango.Enums.CoverageLevel
    -- ^ __Returns:__ the coverage level of /@coverage@/ for character /@index_@/.
coverageGet :: a -> Int32 -> m CoverageLevel
coverageGet a
coverage 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' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
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
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
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, IsCoverage a) => O.MethodInfo CoverageGetMethodInfo a signature where
    overloadedMethod = coverageGet

#endif

-- method Coverage::max
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "another #PangoCoverage"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_max" pango_coverage_max :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    Ptr Coverage ->                         -- other : TInterface (Name {namespace = "Pango", name = "Coverage"})
    IO ()

{-# DEPRECATED coverageMax ["(Since version 1.44)","This function does nothing"] #-}
-- | Set the coverage for each index in /@coverage@/ to be the max (better)
-- value of the current coverage for the index and the coverage for
-- the corresponding index in /@other@/.
coverageMax ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a, IsCoverage b) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> b
    -- ^ /@other@/: another t'GI.Pango.Objects.Coverage.Coverage'
    -> m ()
coverageMax :: a -> b -> m ()
coverageMax a
coverage b
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' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
coverage
    Ptr Coverage
other' <- b -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
other
    Ptr Coverage -> Ptr Coverage -> IO ()
pango_coverage_max Ptr Coverage
coverage' Ptr Coverage
other'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
coverage
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
other
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data CoverageMaxMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCoverage a, IsCoverage b) => O.MethodInfo CoverageMaxMethodInfo a signature where
    overloadedMethod = coverageMax

#endif

-- method Coverage::ref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Coverage" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_ref" pango_coverage_ref :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    IO (Ptr Coverage)

-- | Increase the reference count on the t'GI.Pango.Objects.Coverage.Coverage' by one
coverageRef ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> m Coverage
    -- ^ __Returns:__ /@coverage@/
coverageRef :: a -> m Coverage
coverageRef a
coverage = IO Coverage -> m Coverage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Coverage -> m Coverage) -> IO Coverage -> m Coverage
forall a b. (a -> b) -> a -> b
$ do
    Ptr Coverage
coverage' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
coverage
    Ptr Coverage
result <- Ptr Coverage -> IO (Ptr Coverage)
pango_coverage_ref Ptr Coverage
coverage'
    Text -> Ptr Coverage -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"coverageRef" Ptr Coverage
result
    Coverage
result' <- ((ManagedPtr Coverage -> Coverage) -> Ptr Coverage -> IO Coverage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Coverage -> Coverage
Coverage) Ptr Coverage
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
coverage
    Coverage -> IO Coverage
forall (m :: * -> *) a. Monad m => a -> m a
return Coverage
result'

#if defined(ENABLE_OVERLOADING)
data CoverageRefMethodInfo
instance (signature ~ (m Coverage), MonadIO m, IsCoverage a) => O.MethodInfo CoverageRefMethodInfo a signature where
    overloadedMethod = coverageRef

#endif

-- method Coverage::set
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index_"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index to modify"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "level"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "CoverageLevel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new level for @index_"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_set" pango_coverage_set :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    Int32 ->                                -- index_ : TBasicType TInt
    CUInt ->                                -- level : TInterface (Name {namespace = "Pango", name = "CoverageLevel"})
    IO ()

-- | Modify a particular index within /@coverage@/
coverageSet ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> Int32
    -- ^ /@index_@/: the index to modify
    -> Pango.Enums.CoverageLevel
    -- ^ /@level@/: the new level for /@index_@/
    -> m ()
coverageSet :: a -> Int32 -> CoverageLevel -> m ()
coverageSet a
coverage Int32
index_ 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' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
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'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
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, IsCoverage a) => O.MethodInfo CoverageSetMethodInfo a signature where
    overloadedMethod = coverageSet

#endif

-- method Coverage::to_bytes
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "\n  location to store result (must be freed with g_free())"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "n_bytes"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "location to store size of result"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_bytes"
--              , argType = TBasicType TInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "location to store size of result"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_to_bytes" pango_coverage_to_bytes :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    Ptr (Ptr Word8) ->                      -- bytes : TCArray False (-1) 2 (TBasicType TUInt8)
    Ptr Int32 ->                            -- n_bytes : TBasicType TInt
    IO ()

{-# DEPRECATED coverageToBytes ["(Since version 1.44)","This returns 'P.Nothing'"] #-}
-- | Convert a t'GI.Pango.Objects.Coverage.Coverage' structure into a flat binary format
coverageToBytes ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> m (ByteString)
coverageToBytes :: a -> m ByteString
coverageToBytes a
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' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
coverage
    Ptr (Ptr Word8)
bytes <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: 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'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
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, IsCoverage a) => O.MethodInfo CoverageToBytesMethodInfo a signature where
    overloadedMethod = coverageToBytes

#endif

-- method Coverage::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "coverage"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Coverage" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoCoverage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_unref" pango_coverage_unref :: 
    Ptr Coverage ->                         -- coverage : TInterface (Name {namespace = "Pango", name = "Coverage"})
    IO ()

-- | Decrease the reference count on the t'GI.Pango.Objects.Coverage.Coverage' by one.
-- If the result is zero, free the coverage and all associated memory.
coverageUnref ::
    (B.CallStack.HasCallStack, MonadIO m, IsCoverage a) =>
    a
    -- ^ /@coverage@/: a t'GI.Pango.Objects.Coverage.Coverage'
    -> m ()
coverageUnref :: a -> m ()
coverageUnref a
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' <- a -> IO (Ptr Coverage)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject a
coverage
    Ptr Coverage -> IO ()
pango_coverage_unref Ptr Coverage
coverage'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
coverage
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data CoverageUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCoverage a) => O.MethodInfo CoverageUnrefMethodInfo a signature where
    overloadedMethod = coverageUnref

#endif

-- method Coverage::from_bytes
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "bytes"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "binary data\n  representing a #PangoCoverage"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n_bytes"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of @bytes in bytes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_bytes"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the size of @bytes in bytes"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Coverage" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_coverage_from_bytes" pango_coverage_from_bytes :: 
    Ptr Word8 ->                            -- bytes : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- n_bytes : TBasicType TInt
    IO (Ptr Coverage)

{-# DEPRECATED coverageFromBytes ["(Since version 1.44)","This returns 'P.Nothing'"] #-}
-- | Convert data generated from 'GI.Pango.Objects.Coverage.coverageToBytes' back
-- to a t'GI.Pango.Objects.Coverage.Coverage'
coverageFromBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@bytes@/: binary data
    --   representing a t'GI.Pango.Objects.Coverage.Coverage'
    -> m (Maybe Coverage)
    -- ^ __Returns:__ a newly allocated
    --               t'GI.Pango.Objects.Coverage.Coverage', or 'P.Nothing' if the data was invalid.
coverageFromBytes :: ByteString -> m (Maybe Coverage)
coverageFromBytes ByteString
bytes = IO (Maybe Coverage) -> m (Maybe Coverage)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Coverage) -> m (Maybe Coverage))
-> IO (Maybe Coverage) -> m (Maybe Coverage)
forall a b. (a -> b) -> a -> b
$ do
    let nBytes :: Int32
nBytes = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
bytes
    Ptr Word8
bytes' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
bytes
    Ptr Coverage
result <- Ptr Word8 -> Int32 -> IO (Ptr Coverage)
pango_coverage_from_bytes Ptr Word8
bytes' Int32
nBytes
    Maybe Coverage
maybeResult <- Ptr Coverage
-> (Ptr Coverage -> IO Coverage) -> IO (Maybe Coverage)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Coverage
result ((Ptr Coverage -> IO Coverage) -> IO (Maybe Coverage))
-> (Ptr Coverage -> IO Coverage) -> IO (Maybe Coverage)
forall a b. (a -> b) -> a -> b
$ \Ptr Coverage
result' -> do
        Coverage
result'' <- ((ManagedPtr Coverage -> Coverage) -> Ptr Coverage -> IO Coverage
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Coverage -> Coverage
Coverage) Ptr Coverage
result'
        Coverage -> IO Coverage
forall (m :: * -> *) a. Monad m => a -> m a
return Coverage
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
bytes'
    Maybe Coverage -> IO (Maybe Coverage)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Coverage
maybeResult

#if defined(ENABLE_OVERLOADING)
#endif