diff --git a/girepository/giarginfo.h b/girepository/giarginfo.h index 316ad1b84..55d521f67 100644 --- a/girepository/giarginfo.h +++ b/girepository/giarginfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_ARG_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.ArgInfo]. + * Checks if @info is a [class@GIRepository.ArgInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_ARG_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ARG) +#define GI_IS_ARG_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_ARG_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gibaseinfo.h b/girepository/gibaseinfo.h index 25a61d52b..c28fcb7ba 100644 --- a/girepository/gibaseinfo.h +++ b/girepository/gibaseinfo.h @@ -50,6 +50,16 @@ typedef struct { #define GI_TYPE_BASE_INFO (gi_base_info_get_type ()) +/** + * GI_IS_BASE_INFO: + * @info: Instance to check for being a `GI_TYPE_BASE_INFO`. + * + * Checks whether a valid [type@GObject.TypeInstance] pointer is of type + * `GI_TYPE_BASE_INFO` (or a derived type). + * + * Since: 2.80 + */ +#define GI_IS_BASE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_BASE_INFO)) GI_AVAILABLE_IN_ALL GType gi_base_info_get_type (void) G_GNUC_CONST; diff --git a/girepository/gicallableinfo.h b/girepository/gicallableinfo.h index 95717fd44..359655583 100644 --- a/girepository/gicallableinfo.h +++ b/girepository/gicallableinfo.h @@ -42,11 +42,7 @@ G_BEGIN_DECLS * * Since: 2.80 */ -#define GI_IS_CALLABLE_INFO(info) \ - ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VFUNC)) +#define GI_IS_CALLABLE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CALLABLE_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gicallbackinfo.h b/girepository/gicallbackinfo.h index f678d9f20..aebfd3353 100644 --- a/girepository/gicallbackinfo.h +++ b/girepository/gicallbackinfo.h @@ -41,7 +41,6 @@ G_BEGIN_DECLS * * Since: 2.80 */ -#define GI_IS_CALLBACK_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) +#define GI_IS_CALLBACK_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CALLBACK_INFO)) G_END_DECLS diff --git a/girepository/giconstantinfo.h b/girepository/giconstantinfo.h index 5bfbde5a4..43cb7a803 100644 --- a/girepository/giconstantinfo.h +++ b/girepository/giconstantinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_CONSTANT_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.ConstantInfo]. + * Checks if @info is a [class@GIRepository.ConstantInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_CONSTANT_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CONSTANT) +#define GI_IS_CONSTANT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CONSTANT_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gienuminfo.h b/girepository/gienuminfo.h index 8320e3e26..8590e3b1e 100644 --- a/girepository/gienuminfo.h +++ b/girepository/gienuminfo.h @@ -38,13 +38,11 @@ G_BEGIN_DECLS * GI_IS_ENUM_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.EnumInfo]. + * Checks if @info is a [class@GIRepository.EnumInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_ENUM_INFO(info) \ - ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ENUM) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FLAGS)) +#define GI_IS_ENUM_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_ENUM_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gifieldinfo.h b/girepository/gifieldinfo.h index c42a4d221..d8e61c0c4 100644 --- a/girepository/gifieldinfo.h +++ b/girepository/gifieldinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_FIELD_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.FieldInfo]. + * Checks if @info is a [class@GIRepository.FieldInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_FIELD_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FIELD) +#define GI_IS_FIELD_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_FIELD_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gifunctioninfo.h b/girepository/gifunctioninfo.h index 98aec1c82..8bf18f761 100644 --- a/girepository/gifunctioninfo.h +++ b/girepository/gifunctioninfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_FUNCTION_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.FunctionInfo]. + * Checks if @info is a [class@GIRepository.FunctionInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_FUNCTION_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) +#define GI_IS_FUNCTION_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_FUNCTION_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/giinterfaceinfo.h b/girepository/giinterfaceinfo.h index 0d6c7519b..2d44aa816 100644 --- a/girepository/giinterfaceinfo.h +++ b/girepository/giinterfaceinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_INTERFACE_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.InterfaceInfo]. + * Checks if @info is a [class@GIRepository.InterfaceInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_INTERFACE_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_INTERFACE) +#define GI_IS_INTERFACE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_INTERFACE_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/giobjectinfo.h b/girepository/giobjectinfo.h index af85fa9d3..33666ceba 100644 --- a/girepository/giobjectinfo.h +++ b/girepository/giobjectinfo.h @@ -81,12 +81,11 @@ typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value); * GI_IS_OBJECT_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.ObjectInfo]. + * Checks if @info is a [class@GIRepository.ObjectInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_OBJECT_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_OBJECT) +#define GI_IS_OBJECT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_OBJECT_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gipropertyinfo.h b/girepository/gipropertyinfo.h index 34144953e..bff8d1b8f 100644 --- a/girepository/gipropertyinfo.h +++ b/girepository/gipropertyinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_PROPERTY_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.PropertyInfo]. + * Checks if @info is a [class@GIRepository.PropertyInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_PROPERTY_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_PROPERTY) +#define GI_IS_PROPERTY_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_PROPERTY_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/giregisteredtypeinfo.h b/girepository/giregisteredtypeinfo.h index 6a5a2508f..4eee5cf74 100644 --- a/girepository/giregisteredtypeinfo.h +++ b/girepository/giregisteredtypeinfo.h @@ -44,15 +44,7 @@ G_BEGIN_DECLS * * Since: 2.80 */ -#define GI_IS_REGISTERED_TYPE_INFO(info) \ - ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ENUM) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FLAGS) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_INTERFACE) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_OBJECT) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_STRUCT) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION) || \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED)) +#define GI_IS_REGISTERED_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_OBJECT_INFO)) GI_AVAILABLE_IN_ALL const char * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info); diff --git a/girepository/gisignalinfo.h b/girepository/gisignalinfo.h index b07ad303d..48e74cbec 100644 --- a/girepository/gisignalinfo.h +++ b/girepository/gisignalinfo.h @@ -39,12 +39,11 @@ G_BEGIN_DECLS * GI_IS_SIGNAL_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.SignalInfo]. + * Checks if @info is a [class@GIRepository.SignalInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_SIGNAL_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) +#define GI_IS_SIGNAL_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_SIGNAL_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gistructinfo.h b/girepository/gistructinfo.h index 97ccf15f8..35a88ad80 100644 --- a/girepository/gistructinfo.h +++ b/girepository/gistructinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_STRUCT_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.StructInfo]. + * Checks if @info is a [class@GIRepository.StructInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_STRUCT_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_STRUCT) +#define GI_IS_STRUCT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_STRUCT_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h index df249e330..0e29feec5 100644 --- a/girepository/gitypeinfo.h +++ b/girepository/gitypeinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_TYPE_INFO: * @info: an info structure * - * Checks if @info is a [alias@GIRepository.TypeInfo]. + * Checks if @info is a [alias@GIRepository.TypeInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_TYPE_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_TYPE) +#define GI_IS_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_TYPE_INFO)) /** * GI_TYPE_TAG_IS_BASIC: diff --git a/girepository/giunioninfo.h b/girepository/giunioninfo.h index 0341bff21..bbc3b976e 100644 --- a/girepository/giunioninfo.h +++ b/girepository/giunioninfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_UNION_INFO: * @info: an info structure * - * Checks if @info is a [struct@GIRepository.UnionInfo]. + * Checks if @info is a [struct@GIRepository.UnionInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_UNION_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION) +#define GI_IS_UNION_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_UNION_INFO)) GI_AVAILABLE_IN_ALL unsigned int gi_union_info_get_n_fields (GIUnionInfo *info); diff --git a/girepository/giunresolvedinfo.h b/girepository/giunresolvedinfo.h index 29c629f48..e0d7ea8b6 100644 --- a/girepository/giunresolvedinfo.h +++ b/girepository/giunresolvedinfo.h @@ -41,7 +41,6 @@ G_BEGIN_DECLS * * Since: 2.80 */ -#define GI_IS_UNRESOLVED_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED) +#define GI_IS_UNRESOLVED_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_UNRESOLVED_INFO)) G_END_DECLS diff --git a/girepository/givalueinfo.h b/girepository/givalueinfo.h index 7f1ebb275..52bc4c845 100644 --- a/girepository/givalueinfo.h +++ b/girepository/givalueinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_VALUE_INFO: * @info: an info structure * - * Checks if @info is a [class@GIRepository.ValueInfo]. + * Checks if @info is a [class@GIRepository.ValueInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_VALUE_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VALUE) +#define GI_IS_VALUE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_VALUE_INFO)) GI_AVAILABLE_IN_ALL diff --git a/girepository/givfuncinfo.h b/girepository/givfuncinfo.h index 31fea50bf..79f164c4a 100644 --- a/girepository/givfuncinfo.h +++ b/girepository/givfuncinfo.h @@ -38,12 +38,11 @@ G_BEGIN_DECLS * GI_IS_VFUNC_INFO: * @info: an info structure * - * Checks if @info is a [struct@GIRepository.VFuncInfo]. + * Checks if @info is a [struct@GIRepository.VFuncInfo] (or a derived type). * * Since: 2.80 */ -#define GI_IS_VFUNC_INFO(info) \ - (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VFUNC) +#define GI_IS_VFUNC_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_VFUNC_INFO)) GI_AVAILABLE_IN_ALL GIVFuncInfoFlags gi_vfunc_info_get_flags (GIVFuncInfo *info);