mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 04:56:14 +01:00
girepository: Rework IS_(type) macros to use G_TYPE_CHECK_INSTANCE_TYPE
This means they’re now using the `GType` type system rather than the old `GIInfoType` type system. Given the preceding few commits, these two systems should now be equivalent. This makes the type handling more conventional and hence a bit simpler for people to use if they have experience with GObject. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3216
This commit is contained in:
parent
a99a35ab39
commit
5423bf4df7
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user