mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-28 02:20:04 +01:00
The type system should have never been relegated to libgobject: it's a low level API to register types at run time. Having GType inside libglib allows us to use the type system information everywhere: - generic but type safe storage data types - explicit memory management semantics for all data types - enumeration types for all flags Having the type system inside libglib also allows us to create new and better fundamental types in the future, like sum types, option types, tuples, and generic types. Moved: - gatomicarray - gboxed - genums - gtype - gtypeplugin - gvalue The move is mostly Git surgery, but given the amount of internal API surface, it results in a single commit to avoid breaking bisectability. We need to maintain `gobject/gvaluecollector.h` as a publicly installed header but, to avoid issues in case of excessive inclusions, we make it conflict with `glib/gvaluecollector.h`. See: #2370 See: https://discourse.gnome.org/t/straw-man-moving-the-gtype-api-down-to-libglib-2-0/11169
100 lines
3.5 KiB
C
100 lines
3.5 KiB
C
/* GObject - GLib Type, Object, Parameter and Signal Library
|
|
* Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, 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.1 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef __G_TYPE_PRIVATE_H__
|
|
#define __G_TYPE_PRIVATE_H__
|
|
|
|
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
|
|
#error "Only <glib-object.h> can be included directly."
|
|
#endif
|
|
|
|
#include "../glib/gtype-private.h"
|
|
|
|
#include "gclosure.h"
|
|
#include "gobject.h"
|
|
|
|
/*< private >
|
|
* GOBJECT_IF_DEBUG:
|
|
* @debug_type: Currently only OBJECTS and SIGNALS are supported.
|
|
* @code_block: Custom debug code.
|
|
*
|
|
* A convenience macro for debugging GObject.
|
|
* This macro is only used internally.
|
|
*/
|
|
#ifdef G_ENABLE_DEBUG
|
|
#define GOBJECT_IF_DEBUG(debug_type, code_block) \
|
|
G_STMT_START { \
|
|
if (GLIB_PRIVATE_CALL (g_type_has_debug_flag) (G_TYPE_DEBUG_ ## debug_type)) \
|
|
{ code_block; } \
|
|
} G_STMT_END
|
|
#else /* !G_ENABLE_DEBUG */
|
|
#define GOBJECT_IF_DEBUG(debug_type, code_block)
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef struct _GRealClosure GRealClosure;
|
|
struct _GRealClosure
|
|
{
|
|
GClosureMarshal meta_marshal;
|
|
gpointer meta_marshal_data;
|
|
GVaClosureMarshal va_meta_marshal;
|
|
GVaClosureMarshal va_marshal;
|
|
GClosure closure;
|
|
};
|
|
|
|
#define G_REAL_CLOSURE(_c) \
|
|
((GRealClosure *)G_STRUCT_MEMBER_P ((_c), -G_STRUCT_OFFSET (GRealClosure, closure)))
|
|
|
|
void _g_param_type_init (void); /* sync with gparam.c */
|
|
void _g_object_type_init (void); /* sync with gobject.c */
|
|
void _g_param_spec_types_init (void); /* sync with gparamspecs.c */
|
|
void _g_signal_init (void); /* sync with gsignal.c */
|
|
|
|
gboolean _g_closure_is_void (GClosure *closure,
|
|
gpointer instance);
|
|
gboolean _g_closure_supports_invoke_va (GClosure *closure);
|
|
void _g_closure_set_va_marshal (GClosure *closure,
|
|
GVaClosureMarshal marshal);
|
|
void _g_closure_invoke_va (GClosure *closure,
|
|
GValue /*out*/ *return_value,
|
|
gpointer instance,
|
|
va_list args,
|
|
int n_params,
|
|
GType *param_types);
|
|
|
|
gboolean _g_object_has_signal_handler (GObject *object);
|
|
void _g_object_set_has_signal_handler (GObject *object,
|
|
guint signal_id);
|
|
|
|
/**
|
|
* _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE:
|
|
*
|
|
* See also G_DEFINE_TYPE_EXTENDED(). This macro is generally only
|
|
* necessary as a workaround for classes which have properties of
|
|
* object types that may be initialized in distinct threads. See:
|
|
* https://bugzilla.gnome.org/show_bug.cgi?id=674885
|
|
*
|
|
* Currently private.
|
|
*/
|
|
#define _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE(TN, t_n, T_P, _f_, _P_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE (TN, t_n) {_P_;} _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER (TN, t_n, T_P, _f_){_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __G_TYPE_PRIVATE_H__ */
|