#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GObject.Structs.TypeQuery
(
TypeQuery(..) ,
newZeroTypeQuery ,
noTypeQuery ,
getTypeQueryClassSize ,
setTypeQueryClassSize ,
#if ENABLE_OVERLOADING
typeQuery_classSize ,
#endif
getTypeQueryInstanceSize ,
setTypeQueryInstanceSize ,
#if ENABLE_OVERLOADING
typeQuery_instanceSize ,
#endif
getTypeQueryType ,
setTypeQueryType ,
#if ENABLE_OVERLOADING
typeQuery_type ,
#endif
clearTypeQueryTypeName ,
getTypeQueryTypeName ,
setTypeQueryTypeName ,
#if ENABLE_OVERLOADING
typeQuery_typeName ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
newtype TypeQuery = TypeQuery (ManagedPtr TypeQuery)
instance WrappedPtr TypeQuery where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr TypeQuery)
wrappedPtrFree = Just ptr_to_g_free
newZeroTypeQuery :: MonadIO m => m TypeQuery
newZeroTypeQuery = liftIO $ wrappedPtrCalloc >>= wrapPtr TypeQuery
instance tag ~ 'AttrSet => Constructible TypeQuery tag where
new _ attrs = do
o <- newZeroTypeQuery
GI.Attributes.set o attrs
return o
noTypeQuery :: Maybe TypeQuery
noTypeQuery = Nothing
getTypeQueryType :: MonadIO m => TypeQuery -> m GType
getTypeQueryType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CGType
let val' = GType val
return val'
setTypeQueryType :: MonadIO m => TypeQuery -> GType -> m ()
setTypeQueryType s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gtypeToCGType val
poke (ptr `plusPtr` 0) (val' :: CGType)
#if ENABLE_OVERLOADING
data TypeQueryTypeFieldInfo
instance AttrInfo TypeQueryTypeFieldInfo where
type AttrAllowedOps TypeQueryTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryTypeFieldInfo = (~) GType
type AttrBaseTypeConstraint TypeQueryTypeFieldInfo = (~) TypeQuery
type AttrGetType TypeQueryTypeFieldInfo = GType
type AttrLabel TypeQueryTypeFieldInfo = "type"
type AttrOrigin TypeQueryTypeFieldInfo = TypeQuery
attrGet _ = getTypeQueryType
attrSet _ = setTypeQueryType
attrConstruct = undefined
attrClear _ = undefined
typeQuery_type :: AttrLabelProxy "type"
typeQuery_type = AttrLabelProxy
#endif
getTypeQueryTypeName :: MonadIO m => TypeQuery -> m (Maybe T.Text)
getTypeQueryTypeName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setTypeQueryTypeName :: MonadIO m => TypeQuery -> CString -> m ()
setTypeQueryTypeName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearTypeQueryTypeName :: MonadIO m => TypeQuery -> m ()
clearTypeQueryTypeName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data TypeQueryTypeNameFieldInfo
instance AttrInfo TypeQueryTypeNameFieldInfo where
type AttrAllowedOps TypeQueryTypeNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TypeQueryTypeNameFieldInfo = (~) CString
type AttrBaseTypeConstraint TypeQueryTypeNameFieldInfo = (~) TypeQuery
type AttrGetType TypeQueryTypeNameFieldInfo = Maybe T.Text
type AttrLabel TypeQueryTypeNameFieldInfo = "type_name"
type AttrOrigin TypeQueryTypeNameFieldInfo = TypeQuery
attrGet _ = getTypeQueryTypeName
attrSet _ = setTypeQueryTypeName
attrConstruct = undefined
attrClear _ = clearTypeQueryTypeName
typeQuery_typeName :: AttrLabelProxy "typeName"
typeQuery_typeName = AttrLabelProxy
#endif
getTypeQueryClassSize :: MonadIO m => TypeQuery -> m Word32
getTypeQueryClassSize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Word32
return val
setTypeQueryClassSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryClassSize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Word32)
#if ENABLE_OVERLOADING
data TypeQueryClassSizeFieldInfo
instance AttrInfo TypeQueryClassSizeFieldInfo where
type AttrAllowedOps TypeQueryClassSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryClassSizeFieldInfo = (~) Word32
type AttrBaseTypeConstraint TypeQueryClassSizeFieldInfo = (~) TypeQuery
type AttrGetType TypeQueryClassSizeFieldInfo = Word32
type AttrLabel TypeQueryClassSizeFieldInfo = "class_size"
type AttrOrigin TypeQueryClassSizeFieldInfo = TypeQuery
attrGet _ = getTypeQueryClassSize
attrSet _ = setTypeQueryClassSize
attrConstruct = undefined
attrClear _ = undefined
typeQuery_classSize :: AttrLabelProxy "classSize"
typeQuery_classSize = AttrLabelProxy
#endif
getTypeQueryInstanceSize :: MonadIO m => TypeQuery -> m Word32
getTypeQueryInstanceSize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Word32
return val
setTypeQueryInstanceSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryInstanceSize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 20) (val :: Word32)
#if ENABLE_OVERLOADING
data TypeQueryInstanceSizeFieldInfo
instance AttrInfo TypeQueryInstanceSizeFieldInfo where
type AttrAllowedOps TypeQueryInstanceSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryInstanceSizeFieldInfo = (~) Word32
type AttrBaseTypeConstraint TypeQueryInstanceSizeFieldInfo = (~) TypeQuery
type AttrGetType TypeQueryInstanceSizeFieldInfo = Word32
type AttrLabel TypeQueryInstanceSizeFieldInfo = "instance_size"
type AttrOrigin TypeQueryInstanceSizeFieldInfo = TypeQuery
attrGet _ = getTypeQueryInstanceSize
attrSet _ = setTypeQueryInstanceSize
attrConstruct = undefined
attrClear _ = undefined
typeQuery_instanceSize :: AttrLabelProxy "instanceSize"
typeQuery_instanceSize = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList TypeQuery
type instance O.AttributeList TypeQuery = TypeQueryAttributeList
type TypeQueryAttributeList = ('[ '("type", TypeQueryTypeFieldInfo), '("typeName", TypeQueryTypeNameFieldInfo), '("classSize", TypeQueryClassSizeFieldInfo), '("instanceSize", TypeQueryInstanceSizeFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveTypeQueryMethod (t :: Symbol) (o :: *) :: * where
ResolveTypeQueryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTypeQueryMethod t TypeQuery, O.MethodInfo info TypeQuery p) => OL.IsLabel t (TypeQuery -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif