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