gi-gobject-0.2.44.12: GI/GObject/Structs/EnumValue.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 structure which contains a single enum value, its name, and its
nickname.
-}
module GI.GObject.Structs.EnumValue
(
-- * Exported types
EnumValue(..) ,
noEnumValue ,
-- * Properties
-- ** Value
enumValueReadValue ,
-- ** ValueName
enumValueReadValueName ,
-- ** ValueNick
enumValueReadValueNick ,
) 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.GObject.Types
import GI.GObject.Callbacks
newtype EnumValue = EnumValue (ForeignPtr EnumValue)
noEnumValue :: Maybe EnumValue
noEnumValue = Nothing
enumValueReadValue :: EnumValue -> IO Int32
enumValueReadValue s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Int32
return val
enumValueReadValueName :: EnumValue -> IO T.Text
enumValueReadValueName s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
enumValueReadValueNick :: EnumValue -> IO T.Text
enumValueReadValueNick s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'