gi-poppler-0.0.34.13: GI/Poppler/Structs/ActionUri.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)
-}
module GI.Poppler.Structs.ActionUri
(
-- * Exported types
ActionUri(..) ,
newZeroActionUri ,
noActionUri ,
-- * Properties
-- ** Title
actionUriReadTitle ,
-- ** Type
actionUriReadType ,
-- ** Uri
actionUriReadUri ,
) 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 ActionUri = ActionUri (ForeignPtr ActionUri)
-- | Construct a `ActionUri` struct initialized to zero.
newZeroActionUri :: MonadIO m => m ActionUri
newZeroActionUri = liftIO $ callocBytes 24 >>= wrapPtr ActionUri
noActionUri :: Maybe ActionUri
noActionUri = Nothing
actionUriReadType :: ActionUri -> IO ActionType
actionUriReadType s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
actionUriReadTitle :: ActionUri -> IO T.Text
actionUriReadTitle s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
actionUriReadUri :: ActionUri -> IO T.Text
actionUriReadUri s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'
type family ResolveActionUriMethod (t :: Symbol) (o :: *) :: * where
ResolveActionUriMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveActionUriMethod t ActionUri, MethodInfo info ActionUri p) => IsLabelProxy t (ActionUri -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionUriMethod t ActionUri, MethodInfo info ActionUri p) => IsLabel t (ActionUri -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif