mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 08:58:54 +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_STRUCT_INFO (gi_struct_info_get_type ())
|
||||
|
||||
/**
|
||||
* GI_STRUCT_INFO:
|
||||
* @info: Info object which is subject to casting.
|
||||
*
|
||||
* Casts a [type@GIRepository.StructInfo] or derived pointer into a
|
||||
* `(GIStructInfo*)` pointer.
|
||||
*
|
||||
* Depending on the current debugging level, this function may invoke
|
||||
* certain runtime checks to identify invalid casts.
|
||||
*
|
||||
* Since: 2.80
|
||||
*/
|
||||
#define GI_STRUCT_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_STRUCT_INFO, GIStructInfo))
|
||||
|
||||
/**
|
||||
* GI_IS_STRUCT_INFO:
|
||||
* @info: an info structure
|
||||
|
Reference in New Issue
Block a user