packages feed

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

This structure is used to provide the type system with the information
required to initialize and destruct (finalize) a parameter's class and
instances thereof.
The initialized structure is passed to the g_param_type_register_static()
The type system will perform a deep copy of this structure, so its memory
does not need to be persistent across invocation of
g_param_type_register_static().
-}

module GI.GObject.Structs.ParamSpecTypeInfo
    ( 

-- * Exported types
    ParamSpecTypeInfo(..)                   ,
    newZeroParamSpecTypeInfo                ,
    noParamSpecTypeInfo                     ,


 -- * Properties
-- ** InstanceSize
    paramSpecTypeInfoReadInstanceSize       ,


-- ** NPreallocs
    paramSpecTypeInfoReadNPreallocs         ,


-- ** ValueType
    paramSpecTypeInfoReadValueType          ,




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

noParamSpecTypeInfo :: Maybe ParamSpecTypeInfo
noParamSpecTypeInfo = Nothing

paramSpecTypeInfoReadInstanceSize :: ParamSpecTypeInfo -> IO Word16
paramSpecTypeInfoReadInstanceSize s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Word16
    return val

paramSpecTypeInfoReadNPreallocs :: ParamSpecTypeInfo -> IO Word16
paramSpecTypeInfoReadNPreallocs s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 2) :: IO Word16
    return val

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

paramSpecTypeInfoReadValueType :: ParamSpecTypeInfo -> IO GType
paramSpecTypeInfoReadValueType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CGType
    let val' = GType val
    return val'

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

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

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

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

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

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

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