{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GObject.Structs.TypeQuery
(
TypeQuery(..) ,
newZeroTypeQuery ,
#if defined(ENABLE_OVERLOADING)
ResolveTypeQueryMethod ,
#endif
getTypeQueryClassSize ,
setTypeQueryClassSize ,
#if defined(ENABLE_OVERLOADING)
typeQuery_classSize ,
#endif
getTypeQueryInstanceSize ,
setTypeQueryInstanceSize ,
#if defined(ENABLE_OVERLOADING)
typeQuery_instanceSize ,
#endif
getTypeQueryType ,
setTypeQueryType ,
#if defined(ENABLE_OVERLOADING)
typeQuery_type ,
#endif
clearTypeQueryTypeName ,
getTypeQueryTypeName ,
setTypeQueryTypeName ,
#if defined(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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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
import qualified GHC.Records as R
newtype TypeQuery = TypeQuery (SP.ManagedPtr TypeQuery)
deriving (TypeQuery -> TypeQuery -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeQuery -> TypeQuery -> Bool
$c/= :: TypeQuery -> TypeQuery -> Bool
== :: TypeQuery -> TypeQuery -> Bool
$c== :: TypeQuery -> TypeQuery -> Bool
Eq)
instance SP.ManagedPtrNewtype TypeQuery where
toManagedPtr :: TypeQuery -> ManagedPtr TypeQuery
toManagedPtr (TypeQuery ManagedPtr TypeQuery
p) = ManagedPtr TypeQuery
p
instance BoxedPtr TypeQuery where
boxedPtrCopy :: TypeQuery -> IO TypeQuery
boxedPtrCopy = \TypeQuery
p -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr TypeQuery
p (forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
16 forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr TypeQuery -> TypeQuery
TypeQuery)
boxedPtrFree :: TypeQuery -> IO ()
boxedPtrFree = \TypeQuery
x -> forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr TypeQuery
x forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr TypeQuery where
boxedPtrCalloc :: IO (Ptr TypeQuery)
boxedPtrCalloc = forall a. Int -> IO (Ptr a)
callocBytes Int
16
newZeroTypeQuery :: MonadIO m => m TypeQuery
newZeroTypeQuery :: forall (m :: * -> *). MonadIO m => m TypeQuery
newZeroTypeQuery = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TypeQuery -> TypeQuery
TypeQuery
instance tag ~ 'AttrSet => Constructible TypeQuery tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr TypeQuery -> TypeQuery)
-> [AttrOp TypeQuery tag] -> m TypeQuery
new ManagedPtr TypeQuery -> TypeQuery
_ [AttrOp TypeQuery tag]
attrs = do
TypeQuery
o <- forall (m :: * -> *). MonadIO m => m TypeQuery
newZeroTypeQuery
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set TypeQuery
o [AttrOp TypeQuery tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return TypeQuery
o
getTypeQueryType :: MonadIO m => TypeQuery -> m GType
getTypeQueryType :: forall (m :: * -> *). MonadIO m => TypeQuery -> m GType
getTypeQueryType TypeQuery
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
CGType
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CGType
let val' :: GType
val' = CGType -> GType
GType CGType
val
forall (m :: * -> *) a. Monad m => a -> m a
return GType
val'
setTypeQueryType :: MonadIO m => TypeQuery -> GType -> m ()
setTypeQueryType :: forall (m :: * -> *). MonadIO m => TypeQuery -> GType -> m ()
setTypeQueryType TypeQuery
s GType
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
let val' :: CGType
val' = GType -> CGType
gtypeToCGType GType
val
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CGType
val' :: CGType)
#if defined(ENABLE_OVERLOADING)
data TypeQueryTypeFieldInfo
instance AttrInfo TypeQueryTypeFieldInfo where
type AttrBaseTypeConstraint TypeQueryTypeFieldInfo = (~) TypeQuery
type AttrAllowedOps TypeQueryTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryTypeFieldInfo = (~) GType
type AttrTransferTypeConstraint TypeQueryTypeFieldInfo = (~)GType
type AttrTransferType TypeQueryTypeFieldInfo = GType
type AttrGetType TypeQueryTypeFieldInfo = GType
type AttrLabel TypeQueryTypeFieldInfo = "type"
type AttrOrigin TypeQueryTypeFieldInfo = TypeQuery
attrGet = getTypeQueryType
attrSet = setTypeQueryType
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.TypeQuery.type"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.28/docs/GI-GObject-Structs-TypeQuery.html#g:attr:type"
})
typeQuery_type :: AttrLabelProxy "type"
typeQuery_type = AttrLabelProxy
#endif
getTypeQueryTypeName :: MonadIO m => TypeQuery -> m (Maybe T.Text)
getTypeQueryTypeName :: forall (m :: * -> *). MonadIO m => TypeQuery -> m (Maybe Text)
getTypeQueryTypeName TypeQuery
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
CString
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO CString
Maybe Text
result <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
cstringToText CString
val'
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setTypeQueryTypeName :: MonadIO m => TypeQuery -> CString -> m ()
setTypeQueryTypeName :: forall (m :: * -> *). MonadIO m => TypeQuery -> CString -> m ()
setTypeQueryTypeName TypeQuery
s CString
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (CString
val :: CString)
clearTypeQueryTypeName :: MonadIO m => TypeQuery -> m ()
clearTypeQueryTypeName :: forall (m :: * -> *). MonadIO m => TypeQuery -> m ()
clearTypeQueryTypeName TypeQuery
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (forall a. Ptr a
FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data TypeQueryTypeNameFieldInfo
instance AttrInfo TypeQueryTypeNameFieldInfo where
type AttrBaseTypeConstraint TypeQueryTypeNameFieldInfo = (~) TypeQuery
type AttrAllowedOps TypeQueryTypeNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TypeQueryTypeNameFieldInfo = (~) CString
type AttrTransferTypeConstraint TypeQueryTypeNameFieldInfo = (~)CString
type AttrTransferType TypeQueryTypeNameFieldInfo = CString
type AttrGetType TypeQueryTypeNameFieldInfo = Maybe T.Text
type AttrLabel TypeQueryTypeNameFieldInfo = "type_name"
type AttrOrigin TypeQueryTypeNameFieldInfo = TypeQuery
attrGet = getTypeQueryTypeName
attrSet = setTypeQueryTypeName
attrConstruct = undefined
attrClear = clearTypeQueryTypeName
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.TypeQuery.typeName"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.28/docs/GI-GObject-Structs-TypeQuery.html#g:attr:typeName"
})
typeQuery_typeName :: AttrLabelProxy "typeName"
typeQuery_typeName = AttrLabelProxy
#endif
getTypeQueryClassSize :: MonadIO m => TypeQuery -> m Word32
getTypeQueryClassSize :: forall (m :: * -> *). MonadIO m => TypeQuery -> m CGType
getTypeQueryClassSize TypeQuery
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
CGType
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return CGType
val
setTypeQueryClassSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryClassSize :: forall (m :: * -> *). MonadIO m => TypeQuery -> CGType -> m ()
setTypeQueryClassSize TypeQuery
s CGType
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CGType
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data TypeQueryClassSizeFieldInfo
instance AttrInfo TypeQueryClassSizeFieldInfo where
type AttrBaseTypeConstraint TypeQueryClassSizeFieldInfo = (~) TypeQuery
type AttrAllowedOps TypeQueryClassSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryClassSizeFieldInfo = (~) Word32
type AttrTransferTypeConstraint TypeQueryClassSizeFieldInfo = (~)Word32
type AttrTransferType TypeQueryClassSizeFieldInfo = Word32
type AttrGetType TypeQueryClassSizeFieldInfo = Word32
type AttrLabel TypeQueryClassSizeFieldInfo = "class_size"
type AttrOrigin TypeQueryClassSizeFieldInfo = TypeQuery
attrGet = getTypeQueryClassSize
attrSet = setTypeQueryClassSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.TypeQuery.classSize"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.28/docs/GI-GObject-Structs-TypeQuery.html#g:attr:classSize"
})
typeQuery_classSize :: AttrLabelProxy "classSize"
typeQuery_classSize = AttrLabelProxy
#endif
getTypeQueryInstanceSize :: MonadIO m => TypeQuery -> m Word32
getTypeQueryInstanceSize :: forall (m :: * -> *). MonadIO m => TypeQuery -> m CGType
getTypeQueryInstanceSize TypeQuery
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
CGType
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) :: IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return CGType
val
setTypeQueryInstanceSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryInstanceSize :: forall (m :: * -> *). MonadIO m => TypeQuery -> CGType -> m ()
setTypeQueryInstanceSize TypeQuery
s CGType
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s forall a b. (a -> b) -> a -> b
$ \Ptr TypeQuery
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) (CGType
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data TypeQueryInstanceSizeFieldInfo
instance AttrInfo TypeQueryInstanceSizeFieldInfo where
type AttrBaseTypeConstraint TypeQueryInstanceSizeFieldInfo = (~) TypeQuery
type AttrAllowedOps TypeQueryInstanceSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TypeQueryInstanceSizeFieldInfo = (~) Word32
type AttrTransferTypeConstraint TypeQueryInstanceSizeFieldInfo = (~)Word32
type AttrTransferType TypeQueryInstanceSizeFieldInfo = Word32
type AttrGetType TypeQueryInstanceSizeFieldInfo = Word32
type AttrLabel TypeQueryInstanceSizeFieldInfo = "instance_size"
type AttrOrigin TypeQueryInstanceSizeFieldInfo = TypeQuery
attrGet = getTypeQueryInstanceSize
attrSet = setTypeQueryInstanceSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GObject.Structs.TypeQuery.instanceSize"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gobject-2.0.28/docs/GI-GObject-Structs-TypeQuery.html#g:attr:instanceSize"
})
typeQuery_instanceSize :: AttrLabelProxy "instanceSize"
typeQuery_instanceSize = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TypeQuery
type instance O.AttributeList TypeQuery = TypeQueryAttributeList
type TypeQueryAttributeList = ('[ '("type", TypeQueryTypeFieldInfo), '("typeName", TypeQueryTypeNameFieldInfo), '("classSize", TypeQueryClassSizeFieldInfo), '("instanceSize", TypeQueryInstanceSizeFieldInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveTypeQueryMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveTypeQueryMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTypeQueryMethod t TypeQuery, O.OverloadedMethod info TypeQuery p) => OL.IsLabel t (TypeQuery -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveTypeQueryMethod t TypeQuery, O.OverloadedMethod info TypeQuery p, R.HasField t TypeQuery p) => R.HasField t TypeQuery p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveTypeQueryMethod t TypeQuery, O.OverloadedMethodInfo info TypeQuery) => OL.IsLabel t (O.MethodProxy info TypeQuery) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif