packages feed

gi-gobject-0.2.46.13: GI/GObject/Structs/TypeValueTable.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)

The #GTypeValueTable provides the functions required by the #GValue
implementation, to serve as a container for values of a type.
-}

module GI.GObject.Structs.TypeValueTable
    ( 

-- * Exported types
    TypeValueTable(..)                      ,
    newZeroTypeValueTable                   ,
    noTypeValueTable                        ,


 -- * Properties
-- ** CollectFormat
    typeValueTableReadCollectFormat         ,


-- ** LcopyFormat
    typeValueTableReadLcopyFormat           ,




    ) 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 TypeValueTable = TypeValueTable (ForeignPtr TypeValueTable)
-- | Construct a `TypeValueTable` struct initialized to zero.
newZeroTypeValueTable :: MonadIO m => m TypeValueTable
newZeroTypeValueTable = liftIO $ callocBytes 64 >>= wrapPtr TypeValueTable

noTypeValueTable :: Maybe TypeValueTable
noTypeValueTable = Nothing

-- XXX Skipped getter for "TypeValueTable:value_init" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

-- XXX Skipped getter for "TypeValueTable:value_free" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

-- XXX Skipped getter for "TypeValueTable:value_copy" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

typeValueTableReadCollectFormat :: TypeValueTable -> IO T.Text
typeValueTableReadCollectFormat s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO CString
    val' <- cstringToText val
    return val'

-- XXX Skipped getter for "TypeValueTable:collect_value" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

typeValueTableReadLcopyFormat :: TypeValueTable -> IO T.Text
typeValueTableReadLcopyFormat s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 48) :: IO CString
    val' <- cstringToText val
    return val'

-- XXX Skipped getter for "TypeValueTable:lcopy_value" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

type family ResolveTypeValueTableMethod (t :: Symbol) (o :: *) :: * where
    ResolveTypeValueTableMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveTypeValueTableMethod t TypeValueTable, MethodInfo info TypeValueTable p) => IsLabelProxy t (TypeValueTable -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTypeValueTableMethod t TypeValueTable, MethodInfo info TypeValueTable p) => IsLabel t (TypeValueTable -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif