{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Poppler.Structs.LinkMapping
(
LinkMapping(..) ,
newZeroLinkMapping ,
#if defined(ENABLE_OVERLOADING)
ResolveLinkMappingMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
LinkMappingCopyMethodInfo ,
#endif
linkMappingCopy ,
#if defined(ENABLE_OVERLOADING)
LinkMappingFreeMethodInfo ,
#endif
linkMappingFree ,
linkMappingNew ,
clearLinkMappingAction ,
getLinkMappingAction ,
#if defined(ENABLE_OVERLOADING)
linkMapping_action ,
#endif
setLinkMappingAction ,
getLinkMappingArea ,
#if defined(ENABLE_OVERLOADING)
linkMapping_area ,
#endif
) 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 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 {-# SOURCE #-} qualified GI.Poppler.Structs.Rectangle as Poppler.Rectangle
import {-# SOURCE #-} qualified GI.Poppler.Unions.Action as Poppler.Action
newtype LinkMapping = LinkMapping (ManagedPtr LinkMapping)
deriving (LinkMapping -> LinkMapping -> Bool
(LinkMapping -> LinkMapping -> Bool)
-> (LinkMapping -> LinkMapping -> Bool) -> Eq LinkMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinkMapping -> LinkMapping -> Bool
$c/= :: LinkMapping -> LinkMapping -> Bool
== :: LinkMapping -> LinkMapping -> Bool
$c== :: LinkMapping -> LinkMapping -> Bool
Eq)
foreign import ccall "poppler_link_mapping_get_type" c_poppler_link_mapping_get_type ::
IO GType
instance BoxedObject LinkMapping where
boxedType :: LinkMapping -> IO GType
boxedType LinkMapping
_ = IO GType
c_poppler_link_mapping_get_type
instance B.GValue.IsGValue LinkMapping where
toGValue :: LinkMapping -> IO GValue
toGValue LinkMapping
o = do
GType
gtype <- IO GType
c_poppler_link_mapping_get_type
LinkMapping -> (Ptr LinkMapping -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr LinkMapping
o (GType
-> (GValue -> Ptr LinkMapping -> IO ())
-> Ptr LinkMapping
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr LinkMapping -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO LinkMapping
fromGValue GValue
gv = do
Ptr LinkMapping
ptr <- GValue -> IO (Ptr LinkMapping)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr LinkMapping)
(ManagedPtr LinkMapping -> LinkMapping)
-> Ptr LinkMapping -> IO LinkMapping
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr LinkMapping -> LinkMapping
LinkMapping Ptr LinkMapping
ptr
newZeroLinkMapping :: MonadIO m => m LinkMapping
newZeroLinkMapping :: m LinkMapping
newZeroLinkMapping = IO LinkMapping -> m LinkMapping
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO LinkMapping -> m LinkMapping)
-> IO LinkMapping -> m LinkMapping
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr LinkMapping)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes Int
40 IO (Ptr LinkMapping)
-> (Ptr LinkMapping -> IO LinkMapping) -> IO LinkMapping
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr LinkMapping -> LinkMapping)
-> Ptr LinkMapping -> IO LinkMapping
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr LinkMapping -> LinkMapping
LinkMapping
instance tag ~ 'AttrSet => Constructible LinkMapping tag where
new :: (ManagedPtr LinkMapping -> LinkMapping)
-> [AttrOp LinkMapping tag] -> m LinkMapping
new ManagedPtr LinkMapping -> LinkMapping
_ [AttrOp LinkMapping tag]
attrs = do
LinkMapping
o <- m LinkMapping
forall (m :: * -> *). MonadIO m => m LinkMapping
newZeroLinkMapping
LinkMapping -> [AttrOp LinkMapping 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set LinkMapping
o [AttrOp LinkMapping tag]
[AttrOp LinkMapping 'AttrSet]
attrs
LinkMapping -> m LinkMapping
forall (m :: * -> *) a. Monad m => a -> m a
return LinkMapping
o
getLinkMappingArea :: MonadIO m => LinkMapping -> m Poppler.Rectangle.Rectangle
getLinkMappingArea :: LinkMapping -> m Rectangle
getLinkMappingArea LinkMapping
s = IO Rectangle -> m Rectangle
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Rectangle -> m Rectangle) -> IO Rectangle -> m Rectangle
forall a b. (a -> b) -> a -> b
$ LinkMapping -> (Ptr LinkMapping -> IO Rectangle) -> IO Rectangle
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LinkMapping
s ((Ptr LinkMapping -> IO Rectangle) -> IO Rectangle)
-> (Ptr LinkMapping -> IO Rectangle) -> IO Rectangle
forall a b. (a -> b) -> a -> b
$ \Ptr LinkMapping
ptr -> do
let val :: Ptr Rectangle
val = Ptr LinkMapping
ptr Ptr LinkMapping -> Int -> Ptr Rectangle
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: (Ptr Poppler.Rectangle.Rectangle)
Rectangle
val' <- ((ManagedPtr Rectangle -> Rectangle)
-> Ptr Rectangle -> IO Rectangle
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Rectangle -> Rectangle
Poppler.Rectangle.Rectangle) Ptr Rectangle
val
Rectangle -> IO Rectangle
forall (m :: * -> *) a. Monad m => a -> m a
return Rectangle
val'
#if defined(ENABLE_OVERLOADING)
data LinkMappingAreaFieldInfo
instance AttrInfo LinkMappingAreaFieldInfo where
type AttrBaseTypeConstraint LinkMappingAreaFieldInfo = (~) LinkMapping
type AttrAllowedOps LinkMappingAreaFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint LinkMappingAreaFieldInfo = (~) (Ptr Poppler.Rectangle.Rectangle)
type AttrTransferTypeConstraint LinkMappingAreaFieldInfo = (~)(Ptr Poppler.Rectangle.Rectangle)
type AttrTransferType LinkMappingAreaFieldInfo = (Ptr Poppler.Rectangle.Rectangle)
type AttrGetType LinkMappingAreaFieldInfo = Poppler.Rectangle.Rectangle
type AttrLabel LinkMappingAreaFieldInfo = "area"
type AttrOrigin LinkMappingAreaFieldInfo = LinkMapping
attrGet = getLinkMappingArea
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
linkMapping_area :: AttrLabelProxy "area"
linkMapping_area = AttrLabelProxy
#endif
getLinkMappingAction :: MonadIO m => LinkMapping -> m (Maybe Poppler.Action.Action)
getLinkMappingAction :: LinkMapping -> m (Maybe Action)
getLinkMappingAction LinkMapping
s = IO (Maybe Action) -> m (Maybe Action)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Action) -> m (Maybe Action))
-> IO (Maybe Action) -> m (Maybe Action)
forall a b. (a -> b) -> a -> b
$ LinkMapping
-> (Ptr LinkMapping -> IO (Maybe Action)) -> IO (Maybe Action)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LinkMapping
s ((Ptr LinkMapping -> IO (Maybe Action)) -> IO (Maybe Action))
-> (Ptr LinkMapping -> IO (Maybe Action)) -> IO (Maybe Action)
forall a b. (a -> b) -> a -> b
$ \Ptr LinkMapping
ptr -> do
Ptr Action
val <- Ptr (Ptr Action) -> IO (Ptr Action)
forall a. Storable a => Ptr a -> IO a
peek (Ptr LinkMapping
ptr Ptr LinkMapping -> Int -> Ptr (Ptr Action)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32) :: IO (Ptr Poppler.Action.Action)
Maybe Action
result <- Ptr Action -> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr Action
val ((Ptr Action -> IO Action) -> IO (Maybe Action))
-> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. (a -> b) -> a -> b
$ \Ptr Action
val' -> do
Action
val'' <- ((ManagedPtr Action -> Action) -> Ptr Action -> IO Action
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Action -> Action
Poppler.Action.Action) Ptr Action
val'
Action -> IO Action
forall (m :: * -> *) a. Monad m => a -> m a
return Action
val''
Maybe Action -> IO (Maybe Action)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Action
result
setLinkMappingAction :: MonadIO m => LinkMapping -> Ptr Poppler.Action.Action -> m ()
setLinkMappingAction :: LinkMapping -> Ptr Action -> m ()
setLinkMappingAction LinkMapping
s Ptr Action
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ LinkMapping -> (Ptr LinkMapping -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LinkMapping
s ((Ptr LinkMapping -> IO ()) -> IO ())
-> (Ptr LinkMapping -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr LinkMapping
ptr -> do
Ptr (Ptr Action) -> Ptr Action -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr LinkMapping
ptr Ptr LinkMapping -> Int -> Ptr (Ptr Action)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32) (Ptr Action
val :: Ptr Poppler.Action.Action)
clearLinkMappingAction :: MonadIO m => LinkMapping -> m ()
clearLinkMappingAction :: LinkMapping -> m ()
clearLinkMappingAction LinkMapping
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ LinkMapping -> (Ptr LinkMapping -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LinkMapping
s ((Ptr LinkMapping -> IO ()) -> IO ())
-> (Ptr LinkMapping -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr LinkMapping
ptr -> do
Ptr (Ptr Action) -> Ptr Action -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr LinkMapping
ptr Ptr LinkMapping -> Int -> Ptr (Ptr Action)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32) (Ptr Action
forall a. Ptr a
FP.nullPtr :: Ptr Poppler.Action.Action)
#if defined(ENABLE_OVERLOADING)
data LinkMappingActionFieldInfo
instance AttrInfo LinkMappingActionFieldInfo where
type AttrBaseTypeConstraint LinkMappingActionFieldInfo = (~) LinkMapping
type AttrAllowedOps LinkMappingActionFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint LinkMappingActionFieldInfo = (~) (Ptr Poppler.Action.Action)
type AttrTransferTypeConstraint LinkMappingActionFieldInfo = (~)(Ptr Poppler.Action.Action)
type AttrTransferType LinkMappingActionFieldInfo = (Ptr Poppler.Action.Action)
type AttrGetType LinkMappingActionFieldInfo = Maybe Poppler.Action.Action
type AttrLabel LinkMappingActionFieldInfo = "action"
type AttrOrigin LinkMappingActionFieldInfo = LinkMapping
attrGet = getLinkMappingAction
attrSet = setLinkMappingAction
attrConstruct = undefined
attrClear = clearLinkMappingAction
attrTransfer _ v = do
return v
linkMapping_action :: AttrLabelProxy "action"
linkMapping_action = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList LinkMapping
type instance O.AttributeList LinkMapping = LinkMappingAttributeList
type LinkMappingAttributeList = ('[ '("area", LinkMappingAreaFieldInfo), '("action", LinkMappingActionFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "poppler_link_mapping_new" poppler_link_mapping_new ::
IO (Ptr LinkMapping)
linkMappingNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m LinkMapping
linkMappingNew :: m LinkMapping
linkMappingNew = IO LinkMapping -> m LinkMapping
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO LinkMapping -> m LinkMapping)
-> IO LinkMapping -> m LinkMapping
forall a b. (a -> b) -> a -> b
$ do
Ptr LinkMapping
result <- IO (Ptr LinkMapping)
poppler_link_mapping_new
Text -> Ptr LinkMapping -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"linkMappingNew" Ptr LinkMapping
result
LinkMapping
result' <- ((ManagedPtr LinkMapping -> LinkMapping)
-> Ptr LinkMapping -> IO LinkMapping
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr LinkMapping -> LinkMapping
LinkMapping) Ptr LinkMapping
result
LinkMapping -> IO LinkMapping
forall (m :: * -> *) a. Monad m => a -> m a
return LinkMapping
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "poppler_link_mapping_copy" poppler_link_mapping_copy ::
Ptr LinkMapping ->
IO (Ptr LinkMapping)
linkMappingCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
LinkMapping
-> m LinkMapping
linkMappingCopy :: LinkMapping -> m LinkMapping
linkMappingCopy LinkMapping
mapping = IO LinkMapping -> m LinkMapping
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO LinkMapping -> m LinkMapping)
-> IO LinkMapping -> m LinkMapping
forall a b. (a -> b) -> a -> b
$ do
Ptr LinkMapping
mapping' <- LinkMapping -> IO (Ptr LinkMapping)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr LinkMapping
mapping
Ptr LinkMapping
result <- Ptr LinkMapping -> IO (Ptr LinkMapping)
poppler_link_mapping_copy Ptr LinkMapping
mapping'
Text -> Ptr LinkMapping -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"linkMappingCopy" Ptr LinkMapping
result
LinkMapping
result' <- ((ManagedPtr LinkMapping -> LinkMapping)
-> Ptr LinkMapping -> IO LinkMapping
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr LinkMapping -> LinkMapping
LinkMapping) Ptr LinkMapping
result
LinkMapping -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr LinkMapping
mapping
LinkMapping -> IO LinkMapping
forall (m :: * -> *) a. Monad m => a -> m a
return LinkMapping
result'
#if defined(ENABLE_OVERLOADING)
data LinkMappingCopyMethodInfo
instance (signature ~ (m LinkMapping), MonadIO m) => O.MethodInfo LinkMappingCopyMethodInfo LinkMapping signature where
overloadedMethod = linkMappingCopy
#endif
foreign import ccall "poppler_link_mapping_free" poppler_link_mapping_free ::
Ptr LinkMapping ->
IO ()
linkMappingFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
LinkMapping
-> m ()
linkMappingFree :: LinkMapping -> m ()
linkMappingFree LinkMapping
mapping = 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 LinkMapping
mapping' <- LinkMapping -> IO (Ptr LinkMapping)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr LinkMapping
mapping
Ptr LinkMapping -> IO ()
poppler_link_mapping_free Ptr LinkMapping
mapping'
LinkMapping -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr LinkMapping
mapping
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data LinkMappingFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo LinkMappingFreeMethodInfo LinkMapping signature where
overloadedMethod = linkMappingFree
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveLinkMappingMethod (t :: Symbol) (o :: *) :: * where
ResolveLinkMappingMethod "copy" o = LinkMappingCopyMethodInfo
ResolveLinkMappingMethod "free" o = LinkMappingFreeMethodInfo
ResolveLinkMappingMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveLinkMappingMethod t LinkMapping, O.MethodInfo info LinkMapping p) => OL.IsLabel t (LinkMapping -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif