gi-poppler-0.0.34.13: GI/Poppler/Structs/AnnotMapping.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)
A #PopplerAnnotMapping structure represents the location
of @annot on the page
-}
module GI.Poppler.Structs.AnnotMapping
(
-- * Exported types
AnnotMapping(..) ,
newZeroAnnotMapping ,
noAnnotMapping ,
-- * Methods
-- ** annotMappingCopy
AnnotMappingCopyMethodInfo ,
annotMappingCopy ,
-- ** annotMappingFree
AnnotMappingFreeMethodInfo ,
annotMappingFree ,
-- ** annotMappingNew
annotMappingNew ,
-- * Properties
-- ** Annot
annotMappingReadAnnot ,
-- ** Area
annotMappingReadArea ,
) 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.Poppler.Types
import GI.Poppler.Callbacks
newtype AnnotMapping = AnnotMapping (ForeignPtr AnnotMapping)
foreign import ccall "poppler_annot_mapping_get_type" c_poppler_annot_mapping_get_type ::
IO GType
instance BoxedObject AnnotMapping where
boxedType _ = c_poppler_annot_mapping_get_type
-- | Construct a `AnnotMapping` struct initialized to zero.
newZeroAnnotMapping :: MonadIO m => m AnnotMapping
newZeroAnnotMapping = liftIO $ callocBoxedBytes 40 >>= wrapBoxed AnnotMapping
noAnnotMapping :: Maybe AnnotMapping
noAnnotMapping = Nothing
annotMappingReadArea :: AnnotMapping -> IO Rectangle
annotMappingReadArea s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Rectangle)
val' <- (newBoxed Rectangle) val
return val'
annotMappingReadAnnot :: AnnotMapping -> IO Annot
annotMappingReadAnnot s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO (Ptr Annot)
val' <- (newObject Annot) val
return val'
-- method AnnotMapping::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : TInterface "Poppler" "AnnotMapping"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_mapping_new" poppler_annot_mapping_new ::
IO (Ptr AnnotMapping)
annotMappingNew ::
(MonadIO m) =>
m AnnotMapping -- result
annotMappingNew = liftIO $ do
result <- poppler_annot_mapping_new
checkUnexpectedReturnNULL "poppler_annot_mapping_new" result
result' <- (wrapBoxed AnnotMapping) result
return result'
-- method AnnotMapping::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Poppler" "AnnotMapping"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_mapping_copy" poppler_annot_mapping_copy ::
Ptr AnnotMapping -> -- _obj : TInterface "Poppler" "AnnotMapping"
IO (Ptr AnnotMapping)
annotMappingCopy ::
(MonadIO m) =>
AnnotMapping -- _obj
-> m AnnotMapping -- result
annotMappingCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- poppler_annot_mapping_copy _obj'
checkUnexpectedReturnNULL "poppler_annot_mapping_copy" result
result' <- (wrapBoxed AnnotMapping) result
touchManagedPtr _obj
return result'
data AnnotMappingCopyMethodInfo
instance (signature ~ (m AnnotMapping), MonadIO m) => MethodInfo AnnotMappingCopyMethodInfo AnnotMapping signature where
overloadedMethod _ = annotMappingCopy
-- method AnnotMapping::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_mapping_free" poppler_annot_mapping_free ::
Ptr AnnotMapping -> -- _obj : TInterface "Poppler" "AnnotMapping"
IO ()
annotMappingFree ::
(MonadIO m) =>
AnnotMapping -- _obj
-> m () -- result
annotMappingFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
poppler_annot_mapping_free _obj'
touchManagedPtr _obj
return ()
data AnnotMappingFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo AnnotMappingFreeMethodInfo AnnotMapping signature where
overloadedMethod _ = annotMappingFree
type family ResolveAnnotMappingMethod (t :: Symbol) (o :: *) :: * where
ResolveAnnotMappingMethod "copy" o = AnnotMappingCopyMethodInfo
ResolveAnnotMappingMethod "free" o = AnnotMappingFreeMethodInfo
ResolveAnnotMappingMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveAnnotMappingMethod t AnnotMapping, MethodInfo info AnnotMapping p) => IsLabelProxy t (AnnotMapping -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAnnotMappingMethod t AnnotMapping, MethodInfo info AnnotMapping p) => IsLabel t (AnnotMapping -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif