#define ENABLE_OVERLOADING \
(!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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
newtype TypeQuery = TypeQuery (ManagedPtr TypeQuery)
instance WrappedPtr TypeQuery where
wrappedPtrCalloc :: IO (Ptr TypeQuery)
wrappedPtrCalloc = Int -> IO (Ptr TypeQuery)
forall a. Int -> IO (Ptr a)
callocBytes 24
wrappedPtrCopy :: TypeQuery -> IO TypeQuery
wrappedPtrCopy = \p :: TypeQuery
p -> TypeQuery -> (Ptr TypeQuery -> IO TypeQuery) -> IO TypeQuery
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
p (Int -> Ptr TypeQuery -> IO (Ptr TypeQuery)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 24 (Ptr TypeQuery -> IO (Ptr TypeQuery))
-> (Ptr TypeQuery -> IO TypeQuery) -> Ptr TypeQuery -> IO TypeQuery
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr TypeQuery -> TypeQuery)
-> Ptr TypeQuery -> IO TypeQuery
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TypeQuery -> TypeQuery
TypeQuery)
wrappedPtrFree :: Maybe (FunPtr (Ptr TypeQuery -> IO ()))
wrappedPtrFree = FunPtr (Ptr TypeQuery -> IO ())
-> Maybe (FunPtr (Ptr TypeQuery -> IO ()))
forall a. a -> Maybe a
Just FunPtr (Ptr TypeQuery -> IO ())
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroTypeQuery :: MonadIO m => m TypeQuery
newZeroTypeQuery :: m TypeQuery
newZeroTypeQuery = IO TypeQuery -> m TypeQuery
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TypeQuery -> m TypeQuery) -> IO TypeQuery -> m TypeQuery
forall a b. (a -> b) -> a -> b
$ IO (Ptr TypeQuery)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr TypeQuery)
-> (Ptr TypeQuery -> IO TypeQuery) -> IO TypeQuery
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr TypeQuery -> TypeQuery)
-> Ptr TypeQuery -> IO TypeQuery
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TypeQuery -> TypeQuery
TypeQuery
instance tag ~ 'AttrSet => Constructible TypeQuery tag where
new :: (ManagedPtr TypeQuery -> TypeQuery)
-> [AttrOp TypeQuery tag] -> m TypeQuery
new _ attrs :: [AttrOp TypeQuery tag]
attrs = do
TypeQuery
o <- m TypeQuery
forall (m :: * -> *). MonadIO m => m TypeQuery
newZeroTypeQuery
TypeQuery -> [AttrOp TypeQuery 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set TypeQuery
o [AttrOp TypeQuery tag]
[AttrOp TypeQuery 'AttrSet]
attrs
TypeQuery -> m TypeQuery
forall (m :: * -> *) a. Monad m => a -> m a
return TypeQuery
o
noTypeQuery :: Maybe TypeQuery
noTypeQuery :: Maybe TypeQuery
noTypeQuery = Maybe TypeQuery
forall a. Maybe a
Nothing
getTypeQueryType :: MonadIO m => TypeQuery -> m GType
getTypeQueryType :: TypeQuery -> m GType
getTypeQueryType s :: TypeQuery
s = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO GType) -> IO GType
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO GType) -> IO GType)
-> (Ptr TypeQuery -> IO GType) -> IO GType
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
CGType
val <- Ptr CGType -> IO CGType
forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr CGType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO CGType
let val' :: GType
val' = CGType -> GType
GType CGType
val
GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
val'
setTypeQueryType :: MonadIO m => TypeQuery -> GType -> m ()
setTypeQueryType :: TypeQuery -> GType -> m ()
setTypeQueryType s :: TypeQuery
s val :: GType
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO ()) -> IO ())
-> (Ptr TypeQuery -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
let val' :: CGType
val' = GType -> CGType
gtypeToCGType GType
val
Ptr CGType -> CGType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr CGType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (CGType
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 :: TypeQuery -> m (Maybe Text)
getTypeQueryTypeName s :: TypeQuery
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr TypeQuery -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO CString
Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \val' :: CString
val' -> do
Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result
setTypeQueryTypeName :: MonadIO m => TypeQuery -> CString -> m ()
setTypeQueryTypeName :: TypeQuery -> CString -> m ()
setTypeQueryTypeName s :: TypeQuery
s val :: CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO ()) -> IO ())
-> (Ptr TypeQuery -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
val :: CString)
clearTypeQueryTypeName :: MonadIO m => TypeQuery -> m ()
clearTypeQueryTypeName :: TypeQuery -> m ()
clearTypeQueryTypeName s :: TypeQuery
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO ()) -> IO ())
-> (Ptr TypeQuery -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (CString
forall a. Ptr a
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 :: TypeQuery -> m Word32
getTypeQueryClassSize s :: TypeQuery
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO Word32) -> IO Word32)
-> (Ptr TypeQuery -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setTypeQueryClassSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryClassSize :: TypeQuery -> Word32 -> m ()
setTypeQueryClassSize s :: TypeQuery
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO ()) -> IO ())
-> (Ptr TypeQuery -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16) (Word32
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 :: TypeQuery -> m Word32
getTypeQueryInstanceSize s :: TypeQuery
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO Word32) -> IO Word32)
-> (Ptr TypeQuery -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setTypeQueryInstanceSize :: MonadIO m => TypeQuery -> Word32 -> m ()
setTypeQueryInstanceSize :: TypeQuery -> Word32 -> m ()
setTypeQueryInstanceSize s :: TypeQuery
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ TypeQuery -> (Ptr TypeQuery -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr TypeQuery
s ((Ptr TypeQuery -> IO ()) -> IO ())
-> (Ptr TypeQuery -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr TypeQuery
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr TypeQuery
ptr Ptr TypeQuery -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20) (Word32
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) => O.IsLabelProxy t (TypeQuery -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTypeQueryMethod t TypeQuery, O.MethodInfo info TypeQuery p) => O.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
#endif