diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c index e3c5db016..3427a17b5 100644 --- a/girepository/gibaseinfo.c +++ b/girepository/gibaseinfo.c @@ -257,6 +257,7 @@ GI_DEFINE_BASE_INFO_TYPE (gi_enum_info, GI_INFO_TYPE_ENUM) GI_DEFINE_BASE_INFO_TYPE (gi_flags_info, GI_INFO_TYPE_FLAGS) GI_DEFINE_BASE_INFO_TYPE (gi_object_info, GI_INFO_TYPE_OBJECT) GI_DEFINE_BASE_INFO_TYPE (gi_interface_info, GI_INFO_TYPE_INTERFACE) +GI_DEFINE_BASE_INFO_TYPE (gi_boxed_info, GI_INFO_TYPE_BOXED) GI_DEFINE_BASE_INFO_TYPE (gi_constant_info, GI_INFO_TYPE_CONSTANT) GI_DEFINE_BASE_INFO_TYPE (gi_value_info, GI_INFO_TYPE_VALUE) GI_DEFINE_BASE_INFO_TYPE (gi_signal_info, GI_INFO_TYPE_SIGNAL) @@ -295,6 +296,7 @@ gi_base_info_init_types (void) { GI_INFO_TYPE_FLAGS, "GIFlagsInfo", sizeof (GIFlagsInfo), gi_flags_info_class_init, GI_INFO_TYPE_ENUM, G_TYPE_FLAG_NONE }, { GI_INFO_TYPE_OBJECT, "GIObjectInfo", sizeof (GIObjectInfo), gi_object_info_class_init, 0, G_TYPE_FLAG_NONE }, { GI_INFO_TYPE_INTERFACE, "GIInterfaceInfo", sizeof (GIInterfaceInfo), gi_interface_info_class_init, 0, G_TYPE_FLAG_NONE }, + { GI_INFO_TYPE_BOXED, "GIBoxedInfo", sizeof (GIBoxedInfo), gi_boxed_info_class_init, 0, G_TYPE_FLAG_NONE }, { GI_INFO_TYPE_CONSTANT, "GIConstantInfo", sizeof (GIConstantInfo), gi_constant_info_class_init, 0, G_TYPE_FLAG_NONE }, { GI_INFO_TYPE_VALUE, "GIValueInfo", sizeof (GIValueInfo), gi_value_info_class_init, 0, G_TYPE_FLAG_NONE }, { GI_INFO_TYPE_SIGNAL, "GISignalInfo", sizeof (GISignalInfo), gi_signal_info_class_init, GI_INFO_TYPE_CALLABLE, G_TYPE_FLAG_NONE }, diff --git a/girepository/giboxedinfo.c b/girepository/giboxedinfo.c new file mode 100644 index 000000000..36921e31a --- /dev/null +++ b/girepository/giboxedinfo.c @@ -0,0 +1,52 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Boxed type implementation + * + * Copyright 2024 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include +#include "gibaseinfo-private.h" +#include "girepository-private.h" +#include "gitypelib-internal.h" +#include "giboxedinfo.h" + +/** + * GIBoxedInfo: + * + * A `GIBoxedInfo` represents a boxed type. + * + * There isn’t much you can do with a boxed type; `GIBoxedInfo` exists mainly to + * tag the type. + * + * Since: 2.80 + */ + +void +gi_boxed_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_BOXED; +} diff --git a/girepository/giboxedinfo.h b/girepository/giboxedinfo.h new file mode 100644 index 000000000..0136b065e --- /dev/null +++ b/girepository/giboxedinfo.h @@ -0,0 +1,46 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Boxed types + * + * Copyright 2024 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#pragma once + +#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +#define GI_TYPE_BOXED_INFO (gi_boxed_info_get_type ()) + +/** + * GI_IS_BOXED_INFO: + * @info: an info structure + * + * Checks if @info is a [class@GIRepository.BoxedInfo] (or a derived type). + * + * Since: 2.80 + */ +#define GI_IS_BOXED_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_BOXED_INFO)) + +G_END_DECLS diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h index 5c7c1fb3f..7fe8211dd 100644 --- a/girepository/girepository-private.h +++ b/girepository/girepository-private.h @@ -132,12 +132,20 @@ void gi_object_info_class_init (gpointer g_class, struct _GIInterfaceInfo { - GIBaseInfo parent; + GIRegisteredTypeInfo parent; }; void gi_interface_info_class_init (gpointer g_class, gpointer class_data); +struct _GIBoxedInfo +{ + GIBaseInfo parent; +}; + +void gi_boxed_info_class_init (gpointer g_class, + gpointer class_data); + struct _GIConstantInfo { GIBaseInfo parent; diff --git a/girepository/girepository.h b/girepository/girepository.h index 4588ca981..f430e95aa 100644 --- a/girepository/girepository.h +++ b/girepository/girepository.h @@ -33,6 +33,7 @@ #include #include +#include #include #include #include diff --git a/girepository/gitypes.h b/girepository/gitypes.h index 7ddd1a906..587b8ec7f 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -81,6 +81,10 @@ GI_AVAILABLE_IN_ALL GType gi_object_info_get_type (void); typedef struct _GIInterfaceInfo GIInterfaceInfo; GI_AVAILABLE_IN_ALL GType gi_interface_info_get_type (void); +/* Documented in giboxedinfo.c */ +typedef struct _GIBoxedInfo GIBoxedInfo; +GI_AVAILABLE_IN_ALL GType gi_boxed_info_get_type (void); + /* Documented in giconstantinfo.c */ typedef struct _GIConstantInfo GIConstantInfo; GI_AVAILABLE_IN_ALL GType gi_constant_info_get_type (void); diff --git a/girepository/meson.build b/girepository/meson.build index 3f03a8c03..f6086305a 100644 --- a/girepository/meson.build +++ b/girepository/meson.build @@ -44,6 +44,7 @@ gi_visibility_h = custom_target( girepo_headers = files( 'giarginfo.h', 'gibaseinfo.h', + 'giboxedinfo.h', 'gicallableinfo.h', 'gicallbackinfo.h', 'giconstantinfo.h', @@ -145,6 +146,7 @@ girepo_sources = files( 'gdump.c', 'giarginfo.c', 'gibaseinfo.c', + 'giboxedinfo.c', 'gicallableinfo.c', 'gicallbackinfo.c', 'giconstantinfo.c',