mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
girepository: Add type-checking cast macros
These follow GObject conventions, using `G_TYPE_CHECK_INSTANCE_CAST` to cast to the given type, and potentially performing some runtime checks of the type instance’s `GType` too. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Fixes: #3216
This commit is contained in:
@@ -34,6 +34,20 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GI_TYPE_ENUM_INFO (gi_enum_info_get_type ())
|
||||
|
||||
/**
|
||||
* GI_ENUM_INFO:
|
||||
* @info: Info object which is subject to casting.
|
||||
*
|
||||
* Casts a [type@GIRepository.EnumInfo] or derived pointer into a
|
||||
* `(GIEnumInfo*)` pointer.
|
||||
*
|
||||
* Depending on the current debugging level, this function may invoke
|
||||
* certain runtime checks to identify invalid casts.
|
||||
*
|
||||
* Since: 2.80
|
||||
*/
|
||||
#define GI_ENUM_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_ENUM_INFO, GIEnumInfo))
|
||||
|
||||
/**
|
||||
* GI_IS_ENUM_INFO:
|
||||
* @info: an info structure
|
||||
|
Reference in New Issue
Block a user