add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
/* GObject - GLib Type, Object, Parameter and Signal Library
|
changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar 7 09:36:33 2001 Tim Janik <timj@gtk.org>
* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.
* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.
* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.
* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.
* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.
* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.
* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.
* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.
* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.
* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.
* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().
* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
* *.[hc]: many fixes and cleanups.
* many warning improvements.
Tue Feb 27 18:35:15 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.
* gparam.c: fixed G_PARAM_USER_MASK.
* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.
* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.
* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.
* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.
* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).
Wed Mar 7 09:32:06 2001 Tim Janik <timj@gtk.org>
* glib-object.h: add gvaluearray.h.
* gstring.[hc]: fixup naming of g_string_sprint*.
* gtypes.h: fixed GCompareDataFunc naming.
Wed Mar 7 09:33:27 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: shuffled rules to avoid excessive
rebuilds.
* gobject/gobject-sections.txt: updates.
* gobject/tmpl/*: bunch of updates, added another patch
from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 15:46:45 +01:00
|
|
|
|
* Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
*
|
2022-06-01 13:44:23 +02:00
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
*
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
* 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
|
2017-01-05 14:09:06 +01:00
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2014-01-23 12:58:29 +01:00
|
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
*/
|
2012-12-28 05:43:14 +01:00
|
|
|
|
#ifndef __G_TYPE_H__
|
|
|
|
|
#define __G_TYPE_H__
|
|
|
|
|
|
2001-11-18 01:38:48 +01:00
|
|
|
|
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
|
|
|
|
|
#error "Only <glib-object.h> can be included directly."
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-10-03 16:36:04 +02:00
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gobject/gobject-visibility.h>
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2001-03-09 22:39:51 +01:00
|
|
|
|
G_BEGIN_DECLS
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
/* Basic Type Macros
|
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FUNDAMENTAL:
|
|
|
|
|
* @type: A #GType value.
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type which is the ancestor of @type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Fundamental types are types that serve as ultimate bases for the derived types,
|
|
|
|
|
* thus they are the roots of distinct inheritance hierarchies.
|
|
|
|
|
*/
|
2001-11-22 00:48:19 +01:00
|
|
|
|
#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
2023-09-27 12:48:26 +02:00
|
|
|
|
* G_TYPE_FUNDAMENTAL_SHIFT:
|
|
|
|
|
*
|
|
|
|
|
* Shift value used in converting numbers to type IDs.
|
|
|
|
|
*/
|
|
|
|
|
#define G_TYPE_FUNDAMENTAL_SHIFT (2)
|
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FUNDAMENTAL_MAX: (value 1020)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* An integer constant that represents the number of identifiers reserved
|
|
|
|
|
* for types that are assigned at compile-time.
|
|
|
|
|
*/
|
2001-11-22 00:48:19 +01:00
|
|
|
|
#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT)
|
2001-11-25 22:59:53 +01:00
|
|
|
|
|
|
|
|
|
/* Constant fundamental types,
|
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INVALID:
|
|
|
|
|
*
|
|
|
|
|
* An invalid #GType used as error return value in some functions which return
|
|
|
|
|
* a #GType.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_NONE:
|
|
|
|
|
*
|
|
|
|
|
* A fundamental type which is used as a replacement for the C
|
2014-03-03 00:20:37 +01:00
|
|
|
|
* void return type.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INTERFACE:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type from which all interfaces are derived.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHAR:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gchar.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* The type designated by %G_TYPE_CHAR is unconditionally an 8-bit signed integer.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* This may or may not be the same type a the C type "gchar".
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_UCHAR:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #guchar.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_BOOLEAN:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gboolean.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INT:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gint.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_UINT:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #guint.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_LONG:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #glong.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_ULONG:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gulong.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INT64:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gint64.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_UINT64:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #guint64.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_ENUM:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type from which all enumeration types are derived.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FLAGS:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type from which all flags types are derived.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FLOAT:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gfloat.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_DOUBLE:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gdouble.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_STRING:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to nul-terminated C strings.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_POINTER:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #gpointer.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_BOXED:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type from which all boxed types are derived.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_PARAM:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type from which all #GParamSpec types are derived.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_OBJECT:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type for #GObject.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
|
2010-06-17 18:03:51 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_VARIANT:
|
|
|
|
|
*
|
|
|
|
|
* The fundamental type corresponding to #GVariant.
|
|
|
|
|
*
|
2010-06-18 01:08:13 +02:00
|
|
|
|
* All floating #GVariant instances passed through the #GType system are
|
|
|
|
|
* consumed.
|
|
|
|
|
*
|
|
|
|
|
* Note that callbacks in closures, and signal handlers
|
|
|
|
|
* for signals of return type %G_TYPE_VARIANT, must never return floating
|
|
|
|
|
* variants.
|
|
|
|
|
*
|
2010-06-17 18:03:51 +02:00
|
|
|
|
* Note: GLib 2.24 did include a boxed type with this name. It was replaced
|
|
|
|
|
* with this fundamental type in 2.26.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.26
|
|
|
|
|
*/
|
|
|
|
|
#define G_TYPE_VARIANT G_TYPE_MAKE_FUNDAMENTAL (21)
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
|
2001-11-25 22:59:53 +01:00
|
|
|
|
/* Reserved fundamental type numbers to create new fundamental
|
|
|
|
|
* type IDs with G_TYPE_MAKE_FUNDAMENTAL().
|
2019-07-23 12:14:49 +02:00
|
|
|
|
*
|
|
|
|
|
* Open an issue on https://gitlab.gnome.org/GNOME/glib/issues/new for
|
|
|
|
|
* reservations.
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_MAKE_FUNDAMENTAL:
|
|
|
|
|
* @x: the fundamental type number.
|
|
|
|
|
*
|
|
|
|
|
* Get the type ID for the fundamental type number @x.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Use g_type_fundamental_next() instead of this macro to create new fundamental
|
|
|
|
|
* types.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the GType
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_RESERVED_GLIB_FIRST:
|
|
|
|
|
*
|
|
|
|
|
* First fundamental type number to create a new fundamental type id with
|
|
|
|
|
* G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
|
|
|
|
|
*/
|
2010-06-17 18:03:51 +02:00
|
|
|
|
#define G_TYPE_RESERVED_GLIB_FIRST (22)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_RESERVED_GLIB_LAST:
|
|
|
|
|
*
|
|
|
|
|
* Last fundamental type number reserved for GLib.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_RESERVED_GLIB_LAST (31)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_RESERVED_BSE_FIRST:
|
|
|
|
|
*
|
|
|
|
|
* First fundamental type number to create a new fundamental type id with
|
|
|
|
|
* G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_RESERVED_BSE_FIRST (32)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_RESERVED_BSE_LAST:
|
|
|
|
|
*
|
|
|
|
|
* Last fundamental type number reserved for BSE.
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_RESERVED_BSE_LAST (48)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_RESERVED_USER_FIRST:
|
|
|
|
|
*
|
|
|
|
|
* First available fundamental type number to create new fundamental
|
|
|
|
|
* type id with G_TYPE_MAKE_FUNDAMENTAL().
|
|
|
|
|
*/
|
2001-11-25 22:59:53 +01:00
|
|
|
|
#define G_TYPE_RESERVED_USER_FIRST (49)
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Type Checking Macros
|
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_FUNDAMENTAL:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a fundamental type.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE is @type is fundamental
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-21 18:49:34 +01:00
|
|
|
|
#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_DERIVED:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is derived (or in object-oriented terminology:
|
|
|
|
|
* inherited) from another type (this holds true for all non-fundamental
|
|
|
|
|
* types).
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is derived
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-21 18:49:34 +01:00
|
|
|
|
#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_INTERFACE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is an interface type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* An interface type provides a pure API, the implementation
|
|
|
|
|
* of which is provided by another type (which is then said to conform
|
|
|
|
|
* to the interface). GLib interfaces are somewhat analogous to Java
|
|
|
|
|
* interfaces and C++ classes containing only pure virtual functions,
|
|
|
|
|
* with the difference that GType interfaces are not derivable (but see
|
|
|
|
|
* g_type_interface_add_prerequisite() for an alternative).
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is an interface
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_CLASSED:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a classed type.
|
|
|
|
|
*
|
2023-04-13 16:37:00 +02:00
|
|
|
|
* A classed type has an associated #GTypeClass which can be derived to store
|
|
|
|
|
* class-wide virtual function pointers and data for all instances of the type.
|
|
|
|
|
* This allows for subclassing. All #GObjects are classed; none of the scalar
|
|
|
|
|
* fundamental types built into GLib are classed.
|
|
|
|
|
*
|
|
|
|
|
* Interfaces are not classed: while their #GTypeInterface struct could be
|
|
|
|
|
* considered similar to #GTypeClass, and classes can derive interfaces,
|
|
|
|
|
* #GTypeInterface doesn’t allow for subclassing.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is classed
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_INSTANTIATABLE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type can be instantiated. Instantiation is the
|
|
|
|
|
* process of creating an instance (object) of this type.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is instantiatable
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_DERIVABLE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a derivable type. A derivable type can
|
|
|
|
|
* be used as the base class of a flat (single-level) class hierarchy.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is derivable
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_DEEP_DERIVABLE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a deep derivable type. A deep derivable type
|
|
|
|
|
* can be used as the base class of a deep (multi-level) class hierarchy.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is deep derivable
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_ABSTRACT:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
2011-03-24 09:33:55 +01:00
|
|
|
|
* Checks if @type is an abstract type. An abstract type cannot be
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* instantiated and is normally used as an abstract base class for
|
|
|
|
|
* derived classes.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is abstract
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))
|
2008-06-21 14:45:49 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_VALUE_ABSTRACT:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 14:45:49 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is an abstract value type. An abstract value type introduces
|
|
|
|
|
* a value table, but can't be used for g_value_init() and is normally used as
|
|
|
|
|
* an abstract base type for derived value types.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is an abstract value type
|
2008-06-21 14:45:49 +02:00
|
|
|
|
*/
|
2001-11-13 22:49:13 +01:00
|
|
|
|
#define G_TYPE_IS_VALUE_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_VALUE_TYPE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a value type and can be used with g_value_init().
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is a value type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar 7 09:36:33 2001 Tim Janik <timj@gtk.org>
* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.
* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.
* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.
* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.
* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.
* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.
* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.
* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.
* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.
* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.
* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().
* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
* *.[hc]: many fixes and cleanups.
* many warning improvements.
Tue Feb 27 18:35:15 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.
* gparam.c: fixed G_PARAM_USER_MASK.
* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.
* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.
* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.
* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.
* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).
Wed Mar 7 09:32:06 2001 Tim Janik <timj@gtk.org>
* glib-object.h: add gvaluearray.h.
* gstring.[hc]: fixup naming of g_string_sprint*.
* gtypes.h: fixed GCompareDataFunc naming.
Wed Mar 7 09:33:27 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: shuffled rules to avoid excessive
rebuilds.
* gobject/gobject-sections.txt: updates.
* gobject/tmpl/*: bunch of updates, added another patch
from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 15:46:45 +01:00
|
|
|
|
#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_HAS_VALUE_TABLE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: A #GType value
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @type has a #GTypeValueTable.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type has a value table
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar 7 09:36:33 2001 Tim Janik <timj@gtk.org>
* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.
* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.
* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.
* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.
* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.
* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.
* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.
* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.
* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.
* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.
* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().
* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
* *.[hc]: many fixes and cleanups.
* many warning improvements.
Tue Feb 27 18:35:15 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.
* gparam.c: fixed G_PARAM_USER_MASK.
* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.
* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.
* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.
* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.
* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).
Wed Mar 7 09:32:06 2001 Tim Janik <timj@gtk.org>
* glib-object.h: add gvaluearray.h.
* gstring.[hc]: fixup naming of g_string_sprint*.
* gtypes.h: fixed GCompareDataFunc naming.
Wed Mar 7 09:33:27 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: shuffled rules to avoid excessive
rebuilds.
* gobject/gobject-sections.txt: updates.
* gobject/tmpl/*: bunch of updates, added another patch
from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 15:46:45 +01:00
|
|
|
|
#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL)
|
2021-02-09 11:45:00 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_FINAL:
|
|
|
|
|
* @type: a #GType value
|
|
|
|
|
*
|
|
|
|
|
* Checks if @type is a final type. A final type cannot be derived any
|
|
|
|
|
* further.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @type is final
|
2021-02-09 11:45:00 +01:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.70
|
|
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
#define G_TYPE_IS_FINAL(type) (g_type_test_flags ((type), G_TYPE_FLAG_FINAL)) GOBJECT_AVAILABLE_MACRO_IN_2_70
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2022-10-21 02:04:01 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_IS_DEPRECATED:
|
|
|
|
|
* @type: a #GType value
|
|
|
|
|
*
|
|
|
|
|
* Checks if @type is deprecated. Instantiating a deprecated type will
|
|
|
|
|
* trigger a warning if running with `G_ENABLE_DIAGNOSTIC=1`.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the type is deprecated
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.76
|
|
|
|
|
*/
|
|
|
|
|
#define G_TYPE_IS_DEPRECATED(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEPRECATED)) GOBJECT_AVAILABLE_MACRO_IN_2_76
|
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
/* Typedefs
|
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GType:
|
|
|
|
|
*
|
|
|
|
|
* A numerical value which represents the unique identifier of a registered
|
|
|
|
|
* type.
|
|
|
|
|
*/
|
2022-12-15 00:55:17 +01:00
|
|
|
|
#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_SIZE_T
|
|
|
|
|
typedef guintptr GType;
|
|
|
|
|
#elif GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined (G_CXX_STD_VERSION)
|
2001-11-21 18:49:34 +01:00
|
|
|
|
typedef gsize GType;
|
2022-12-15 00:55:17 +01:00
|
|
|
|
#else /* for historic reasons, C++ on non-Morello/CHERI systems links against gulong GTypes */
|
2007-06-22 11:34:33 +02:00
|
|
|
|
typedef gulong GType;
|
|
|
|
|
#endif
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef struct _GValue GValue;
|
|
|
|
|
typedef union _GTypeCValue GTypeCValue;
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
typedef struct _GTypePlugin GTypePlugin;
|
|
|
|
|
typedef struct _GTypeClass GTypeClass;
|
|
|
|
|
typedef struct _GTypeInterface GTypeInterface;
|
|
|
|
|
typedef struct _GTypeInstance GTypeInstance;
|
|
|
|
|
typedef struct _GTypeInfo GTypeInfo;
|
|
|
|
|
typedef struct _GTypeFundamentalInfo GTypeFundamentalInfo;
|
|
|
|
|
typedef struct _GInterfaceInfo GInterfaceInfo;
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef struct _GTypeValueTable GTypeValueTable;
|
2001-04-01 06:04:46 +02:00
|
|
|
|
typedef struct _GTypeQuery GTypeQuery;
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Basic Type Structures
|
|
|
|
|
*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeClass:
|
|
|
|
|
*
|
|
|
|
|
* An opaque structure used as the base of all classes.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GTypeClass
|
|
|
|
|
{
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
/*< private >*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
GType g_type;
|
|
|
|
|
};
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeInstance:
|
|
|
|
|
*
|
|
|
|
|
* An opaque structure used as the base of all type instances.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GTypeInstance
|
|
|
|
|
{
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
/*< private >*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
GTypeClass *g_class;
|
|
|
|
|
};
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeInterface:
|
|
|
|
|
*
|
|
|
|
|
* An opaque structure used as the base of all interface types.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GTypeInterface
|
|
|
|
|
{
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
/*< private >*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
GType g_type; /* iface type */
|
|
|
|
|
GType g_instance_type;
|
|
|
|
|
};
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeQuery:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @type: the #GType value of the type
|
|
|
|
|
* @type_name: the name of the type
|
|
|
|
|
* @class_size: the size of the class structure
|
|
|
|
|
* @instance_size: the size of the instance structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* A structure holding information for a specific type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
|
|
|
|
* See also: g_type_query()
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-04-01 06:04:46 +02:00
|
|
|
|
struct _GTypeQuery
|
|
|
|
|
{
|
|
|
|
|
GType type;
|
|
|
|
|
const gchar *type_name;
|
|
|
|
|
guint class_size;
|
|
|
|
|
guint instance_size;
|
|
|
|
|
};
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
/* Casts, checks and accessors for structured types
|
|
|
|
|
* usage of these macros is reserved to type implementations only
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
/*< protected >*/
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_INSTANCE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: Location of a #GTypeInstance structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @instance is a valid #GTypeInstance structure,
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* otherwise issues a warning and returns %FALSE. %NULL is not a valid
|
|
|
|
|
* #GTypeInstance.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @instance is valid
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define G_TYPE_CHECK_INSTANCE(instance) (_G_TYPE_CHI ((GTypeInstance*) (instance)))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_INSTANCE_CAST:
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* @instance: (nullable): Location of a #GTypeInstance structure
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_type: The type to be returned
|
|
|
|
|
* @c_type: The corresponding C type of @g_type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks that @instance is an instance of the type identified by @g_type
|
|
|
|
|
* and issues a warning if this is not the case. Returns @instance casted
|
|
|
|
|
* to a pointer to @c_type.
|
2014-08-31 00:45:18 +02:00
|
|
|
|
*
|
|
|
|
|
* No warning will be issued if @instance is %NULL, and %NULL will be returned.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_INSTANCE_TYPE:
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* @instance: (nullable): Location of a #GTypeInstance structure.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @g_type: The type to be checked
|
|
|
|
|
*
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* Checks if @instance is an instance of the type identified by @g_type. If
|
|
|
|
|
* @instance is %NULL, %FALSE will be returned.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @instance is an instance of @g_type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type)))
|
2014-05-28 10:57:28 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE:
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* @instance: (nullable): Location of a #GTypeInstance structure.
|
2014-05-28 10:57:28 +02:00
|
|
|
|
* @g_type: The fundamental type to be checked
|
|
|
|
|
*
|
|
|
|
|
* Checks if @instance is an instance of the fundamental type identified by @g_type.
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* If @instance is %NULL, %FALSE will be returned.
|
2014-05-28 10:57:28 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @instance is an instance of @g_type
|
2014-05-28 10:57:28 +02:00
|
|
|
|
*/
|
|
|
|
|
#define G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE(instance, g_type) (_G_TYPE_CIFT ((instance), (g_type)))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INSTANCE_GET_CLASS:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: Location of the #GTypeInstance structure
|
|
|
|
|
* @g_type: The #GType of the class to be returned
|
|
|
|
|
* @c_type: The C type of the class structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Get the class structure of a given @instance, casted
|
|
|
|
|
* to a specified ancestor type @g_type of the instance.
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* Note that while calling a GInstanceInitFunc(), the class pointer
|
|
|
|
|
* gets modified, so it might not always return the expected pointer.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Returns: a pointer to the class structure
|
|
|
|
|
*/
|
2000-11-05 06:07:26 +01:00
|
|
|
|
#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INSTANCE_GET_INTERFACE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: Location of the #GTypeInstance structure
|
|
|
|
|
* @g_type: The #GType of the interface to be returned
|
|
|
|
|
* @c_type: The C type of the interface structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Get the interface structure for interface @g_type of a given @instance.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Returns: a pointer to the interface structure
|
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_CLASS_CAST:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_class: Location of a #GTypeClass structure
|
|
|
|
|
* @g_type: The type to be returned
|
|
|
|
|
* @c_type: The corresponding C type of class structure of @g_type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks that @g_class is a class structure of the type identified by @g_type
|
|
|
|
|
* and issues a warning if this is not the case. Returns @g_class casted
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* to a pointer to @c_type. %NULL is not a valid class structure.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type) (_G_TYPE_CCC ((g_class), (g_type), c_type))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_CLASS_TYPE:
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* @g_class: (nullable): Location of a #GTypeClass structure
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_type: The type to be checked
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @g_class is a class structure of the type identified by
|
2014-08-31 00:45:18 +02:00
|
|
|
|
* @g_type. If @g_class is %NULL, %FALSE will be returned.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @g_class is a class structure of @g_type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) (_G_TYPE_CCT ((g_class), (g_type)))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_VALUE:
|
|
|
|
|
* @value: a #GValue
|
|
|
|
|
*
|
|
|
|
|
* Checks if @value has been initialized to hold values
|
|
|
|
|
* of a value type.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @value is initialized
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define G_TYPE_CHECK_VALUE(value) (_G_TYPE_CHV ((value)))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CHECK_VALUE_TYPE:
|
|
|
|
|
* @value: a #GValue
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_type: The type to be checked
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Checks if @value has been initialized to hold values
|
|
|
|
|
* of type @g_type.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
2023-04-13 14:51:04 +02:00
|
|
|
|
* Returns: %TRUE if @value has been initialized to hold values of type @g_type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar 7 09:36:33 2001 Tim Janik <timj@gtk.org>
* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.
* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.
* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.
* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.
* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.
* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.
* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.
* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.
* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.
* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.
* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().
* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
* *.[hc]: many fixes and cleanups.
* many warning improvements.
Tue Feb 27 18:35:15 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.
* gparam.c: fixed G_PARAM_USER_MASK.
* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.
* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.
* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.
* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.
* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).
Wed Mar 7 09:32:06 2001 Tim Janik <timj@gtk.org>
* glib-object.h: add gvaluearray.h.
* gstring.[hc]: fixup naming of g_string_sprint*.
* gtypes.h: fixed GCompareDataFunc naming.
Wed Mar 7 09:33:27 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: shuffled rules to avoid excessive
rebuilds.
* gobject/gobject-sections.txt: updates.
* gobject/tmpl/*: bunch of updates, added another patch
from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 15:46:45 +01:00
|
|
|
|
#define G_TYPE_CHECK_VALUE_TYPE(value, g_type) (_G_TYPE_CVH ((value), (g_type)))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FROM_INSTANCE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: Location of a valid #GTypeInstance structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Get the type identifier from a given @instance structure.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #GType
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FROM_CLASS:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_class: Location of a valid #GTypeClass structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Get the type identifier from a given @class structure.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #GType
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
#define G_TYPE_FROM_CLASS(g_class) (((GTypeClass*) (g_class))->g_type)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FROM_INTERFACE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @g_iface: Location of a valid #GTypeInterface structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Get the type identifier from a given @interface structure.
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #GType
|
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type)
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_INSTANCE_GET_PRIVATE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: the instance of a type deriving from @private_type
|
|
|
|
|
* @g_type: the type identifying which private data to retrieve
|
|
|
|
|
* @c_type: The C type for the private structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Gets the private structure for a particular type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* The private structure must have been registered in the
|
|
|
|
|
* class_init function with g_type_class_add_private().
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* Deprecated: 2.58: Use G_ADD_PRIVATE() and the generated
|
2018-05-25 11:06:05 +02:00
|
|
|
|
* `your_type_get_instance_private()` function instead
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* Returns: (not nullable): a pointer to the private data structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) GOBJECT_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE)
|
2003-03-10 17:41:28 +01:00
|
|
|
|
|
2010-03-17 15:11:00 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_CLASS_GET_PRIVATE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @klass: the class of a type deriving from @private_type
|
|
|
|
|
* @g_type: the type identifying which private data to retrieve
|
|
|
|
|
* @c_type: The C type for the private structure
|
2010-03-17 15:11:00 +01:00
|
|
|
|
*
|
|
|
|
|
* Gets the private class structure for a particular type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2010-03-17 15:11:00 +01:00
|
|
|
|
* The private structure must have been registered in the
|
|
|
|
|
* get_type() function with g_type_add_class_private().
|
|
|
|
|
*
|
|
|
|
|
* This macro should only be used in type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.24
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* Returns: (not nullable): a pointer to the private data structure
|
2010-03-17 15:11:00 +01:00
|
|
|
|
*/
|
|
|
|
|
#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type)))
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeDebugFlags:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @G_TYPE_DEBUG_NONE: Print no messages
|
|
|
|
|
* @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping
|
|
|
|
|
* @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions
|
|
|
|
|
* @G_TYPE_DEBUG_MASK: Mask covering all debug flags
|
2014-10-09 22:38:10 +02:00
|
|
|
|
* @G_TYPE_DEBUG_INSTANCE_COUNT: Keep a count of instances of each type
|
2012-10-15 18:01:01 +02:00
|
|
|
|
*
|
|
|
|
|
* These flags used to be passed to g_type_init_with_debug_flags() which
|
|
|
|
|
* is now deprecated.
|
|
|
|
|
*
|
2023-04-28 00:56:59 +02:00
|
|
|
|
* If you need to enable debugging features, use the `GOBJECT_DEBUG`
|
2012-10-15 18:01:01 +02:00
|
|
|
|
* environment variable.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 2.36: g_type_init() is now done automatically
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2001-02-04 08:03:52 +01:00
|
|
|
|
typedef enum /*< skip >*/
|
|
|
|
|
{
|
2001-02-16 08:22:59 +01:00
|
|
|
|
G_TYPE_DEBUG_NONE = 0,
|
2001-02-04 08:03:52 +01:00
|
|
|
|
G_TYPE_DEBUG_OBJECTS = 1 << 0,
|
|
|
|
|
G_TYPE_DEBUG_SIGNALS = 1 << 1,
|
2014-10-09 22:38:10 +02:00
|
|
|
|
G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
|
|
|
|
|
G_TYPE_DEBUG_MASK = 0x07
|
2022-10-05 19:39:21 +02:00
|
|
|
|
} GTypeDebugFlags GOBJECT_DEPRECATED_TYPE_IN_2_36;
|
2019-03-15 19:30:16 +01:00
|
|
|
|
|
2001-02-04 08:03:52 +01:00
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
/* --- prototypes --- */
|
2019-05-27 20:50:09 +02:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_DEPRECATED_IN_2_36
|
2001-06-29 04:50:46 +02:00
|
|
|
|
void g_type_init (void);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_DEPRECATED_IN_2_36
|
2001-06-29 04:50:46 +02:00
|
|
|
|
void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);
|
2019-05-27 20:50:09 +02:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
|
const gchar * g_type_name (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
GQuark g_type_qname (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
GType g_type_from_name (const gchar *name);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
GType g_type_parent (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-06-19 14:13:22 +02:00
|
|
|
|
guint g_type_depth (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
changed prototype of g_boxed_type_register_static() to contain an optional
Wed Mar 7 09:36:33 2001 Tim Janik <timj@gtk.org>
* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.
* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.
* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.
* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.
* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.
* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.
* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.
* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.
* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.
* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.
* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().
* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
* *.[hc]: many fixes and cleanups.
* many warning improvements.
Tue Feb 27 18:35:15 2001 Tim Janik <timj@gtk.org>
* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.
* gparam.c: fixed G_PARAM_USER_MASK.
* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.
* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.
* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.
* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.
* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).
Wed Mar 7 09:32:06 2001 Tim Janik <timj@gtk.org>
* glib-object.h: add gvaluearray.h.
* gstring.[hc]: fixup naming of g_string_sprint*.
* gtypes.h: fixed GCompareDataFunc naming.
Wed Mar 7 09:33:27 2001 Tim Janik <timj@gtk.org>
* gobject/Makefile.am: shuffled rules to avoid excessive
rebuilds.
* gobject/gobject-sections.txt: updates.
* gobject/tmpl/*: bunch of updates, added another patch
from Eric Lemings <eric.b.lemings@lmco.com>.
2001-03-07 15:46:45 +01:00
|
|
|
|
GType g_type_next_base (GType leaf_type,
|
|
|
|
|
GType root_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gboolean g_type_is_a (GType type,
|
|
|
|
|
GType is_a_type);
|
2022-05-20 03:06:18 +02:00
|
|
|
|
|
|
|
|
|
/* Hoist exact GType comparisons into the caller */
|
|
|
|
|
#define g_type_is_a(a,b) ((a) == (b) || (g_type_is_a) ((a), (b)))
|
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gpointer g_type_class_ref (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gpointer g_type_class_peek (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-11-27 18:08:06 +01:00
|
|
|
|
gpointer g_type_class_peek_static (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
void g_type_class_unref (gpointer g_class);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gpointer g_type_class_peek_parent (gpointer g_class);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gpointer g_type_interface_peek (gpointer instance_class,
|
|
|
|
|
GType iface_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-09-10 20:03:31 +02:00
|
|
|
|
gpointer g_type_interface_peek_parent (gpointer g_iface);
|
2001-02-18 00:30:48 +01:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-09-29 16:52:42 +02:00
|
|
|
|
gpointer g_type_default_interface_ref (GType g_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-09-29 16:52:42 +02:00
|
|
|
|
gpointer g_type_default_interface_peek (GType g_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-09-29 16:52:42 +02:00
|
|
|
|
void g_type_default_interface_unref (gpointer g_iface);
|
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
/* g_free() the returned arrays */
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
GType* g_type_children (GType type,
|
|
|
|
|
guint *n_children);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
GType* g_type_interfaces (GType type,
|
|
|
|
|
guint *n_interfaces);
|
|
|
|
|
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
/* per-type _static_ data */
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
void g_type_set_qdata (GType type,
|
|
|
|
|
GQuark quark,
|
|
|
|
|
gpointer data);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
|
gpointer g_type_get_qdata (GType type,
|
|
|
|
|
GQuark quark);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-04-01 06:04:46 +02:00
|
|
|
|
void g_type_query (GType type,
|
|
|
|
|
GTypeQuery *query);
|
2001-02-18 00:30:48 +01:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_44
|
2014-10-09 22:38:10 +02:00
|
|
|
|
int g_type_get_instance_count (GType type);
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
/* --- type registration --- */
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GBaseInitFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to do base initialization
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* of the class structures of derived types.
|
|
|
|
|
*
|
|
|
|
|
* This function is called as part of the initialization process of all derived
|
|
|
|
|
* classes and should reallocate or reset all dynamic class members copied over
|
|
|
|
|
* from the parent class.
|
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* For example, class members (such as strings) that are not sufficiently
|
|
|
|
|
* handled by a plain memory copy of the parent class into the derived class
|
|
|
|
|
* have to be altered. See GClassInitFunc() for a discussion of the class
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* initialization process.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GBaseInitFunc) (gpointer g_class);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GBaseFinalizeFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to finalize those portions
|
|
|
|
|
* of a derived types class structure that were setup from the corresponding
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* GBaseInitFunc() function.
|
|
|
|
|
*
|
|
|
|
|
* Class finalization basically works the inverse way in which class
|
|
|
|
|
* initialization is performed.
|
|
|
|
|
*
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* See GClassInitFunc() for a discussion of the class initialization process.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GBaseFinalizeFunc) (gpointer g_class);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GClassInitFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @class_data: The @class_data member supplied via the #GTypeInfo structure.
|
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to initialize the class
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* of a specific type.
|
|
|
|
|
*
|
|
|
|
|
* This function should initialize all static class members.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* The initialization process of a class involves:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
|
|
|
|
* - Copying common members from the parent class over to the
|
|
|
|
|
* derived class structure.
|
|
|
|
|
* - Zero initialization of the remaining members not copied
|
|
|
|
|
* over from the parent class.
|
|
|
|
|
* - Invocation of the GBaseInitFunc() initializers of all parent
|
|
|
|
|
* types and the class' type.
|
|
|
|
|
* - Invocation of the class' GClassInitFunc() initializer.
|
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Since derived classes are partially initialized through a memory copy
|
|
|
|
|
* of the parent class, the general rule is that GBaseInitFunc() and
|
|
|
|
|
* GBaseFinalizeFunc() should take care of necessary reinitialization
|
|
|
|
|
* and release of those class members that were introduced by the type
|
|
|
|
|
* that specified these GBaseInitFunc()/GBaseFinalizeFunc().
|
|
|
|
|
* GClassInitFunc() should only care about initializing static
|
|
|
|
|
* class members, while dynamic class members (such as allocated strings
|
|
|
|
|
* or reference counted resources) are better handled by a GBaseInitFunc()
|
|
|
|
|
* for this type, so proper initialization of the dynamic class members
|
|
|
|
|
* is performed for class initialization of derived types as well.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* An example may help to correspond the intend of the different class
|
|
|
|
|
* initializers:
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* typedef struct {
|
|
|
|
|
* GObjectClass parent_class;
|
|
|
|
|
* gint static_integer;
|
|
|
|
|
* gchar *dynamic_string;
|
|
|
|
|
* } TypeAClass;
|
|
|
|
|
* static void
|
|
|
|
|
* type_a_base_class_init (TypeAClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* class->dynamic_string = g_strdup ("some string");
|
|
|
|
|
* }
|
|
|
|
|
* static void
|
|
|
|
|
* type_a_base_class_finalize (TypeAClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* g_free (class->dynamic_string);
|
|
|
|
|
* }
|
|
|
|
|
* static void
|
|
|
|
|
* type_a_class_init (TypeAClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* class->static_integer = 42;
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* typedef struct {
|
|
|
|
|
* TypeAClass parent_class;
|
|
|
|
|
* gfloat static_float;
|
|
|
|
|
* GString *dynamic_gstring;
|
|
|
|
|
* } TypeBClass;
|
|
|
|
|
* static void
|
|
|
|
|
* type_b_base_class_init (TypeBClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* class->dynamic_gstring = g_string_new ("some other string");
|
|
|
|
|
* }
|
|
|
|
|
* static void
|
|
|
|
|
* type_b_base_class_finalize (TypeBClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* g_string_free (class->dynamic_gstring);
|
|
|
|
|
* }
|
|
|
|
|
* static void
|
|
|
|
|
* type_b_class_init (TypeBClass *class)
|
|
|
|
|
* {
|
|
|
|
|
* class->static_float = 3.14159265358979323846;
|
|
|
|
|
* }
|
|
|
|
|
* ]|
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Initialization of TypeBClass will first cause initialization of
|
|
|
|
|
* TypeAClass (derived classes reference their parent classes, see
|
|
|
|
|
* g_type_class_ref() on this).
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Initialization of TypeAClass roughly involves zero-initializing its fields,
|
|
|
|
|
* then calling its GBaseInitFunc() type_a_base_class_init() to allocate
|
|
|
|
|
* its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
|
|
|
|
|
* type_a_class_init() to initialize its static members (static_integer).
|
|
|
|
|
* The first step in the initialization process of TypeBClass is then
|
|
|
|
|
* a plain memory copy of the contents of TypeAClass into TypeBClass and
|
|
|
|
|
* zero-initialization of the remaining fields in TypeBClass.
|
|
|
|
|
* The dynamic members of TypeAClass within TypeBClass now need
|
|
|
|
|
* reinitialization which is performed by calling type_a_base_class_init()
|
|
|
|
|
* with an argument of TypeBClass.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
|
|
|
|
|
* is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
|
|
|
|
|
* and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
|
|
|
|
|
* is called to complete the initialization process with the static members
|
|
|
|
|
* (static_float).
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Corresponding finalization counter parts to the GBaseInitFunc() functions
|
|
|
|
|
* have to be provided to release allocated resources at class finalization
|
|
|
|
|
* time.
|
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GClassInitFunc) (gpointer g_class,
|
|
|
|
|
gpointer class_data);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GClassFinalizeFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @class_data: The @class_data member supplied via the #GTypeInfo structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to finalize a class.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* This function is rarely needed, as dynamically allocated class resources
|
|
|
|
|
* should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
|
|
|
|
|
* structure of a static type is invalid, because classes of static types
|
|
|
|
|
* will never be finalized (they are artificially kept alive when their
|
|
|
|
|
* reference count drops to zero).
|
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GClassFinalizeFunc) (gpointer g_class,
|
|
|
|
|
gpointer class_data);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GInstanceInitFunc:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance: The instance to initialize
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The class of the type the instance is
|
|
|
|
|
* created for
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to initialize a new
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* instance of a type.
|
|
|
|
|
*
|
|
|
|
|
* This function initializes all instance members and allocates any resources
|
|
|
|
|
* required by it.
|
2014-04-29 09:47:14 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Initialization of a derived instance involves calling all its parent
|
|
|
|
|
* types instance initializers, so the class member of the instance
|
|
|
|
|
* is altered during its initialization to always point to the class that
|
|
|
|
|
* belongs to the type the current initializer was introduced for.
|
2014-04-29 09:47:14 +02:00
|
|
|
|
*
|
|
|
|
|
* The extended members of @instance are guaranteed to have been filled with
|
|
|
|
|
* zeros before this function is called.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GInstanceInitFunc) (GTypeInstance *instance,
|
|
|
|
|
gpointer g_class);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GInterfaceInitFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_iface: (type GObject.TypeInterface): The interface structure to initialize
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to initialize a new
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* interface.
|
|
|
|
|
*
|
|
|
|
|
* This function should initialize all internal data and* allocate any
|
|
|
|
|
* resources required by the interface.
|
2014-04-29 09:47:14 +02:00
|
|
|
|
*
|
|
|
|
|
* The members of @iface_data are guaranteed to have been filled with
|
|
|
|
|
* zeros before this function is called.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GInterfaceInitFunc) (gpointer g_iface,
|
|
|
|
|
gpointer iface_data);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GInterfaceFinalizeFunc:
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_iface: (type GObject.TypeInterface): The interface structure to finalize
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function used by the type system to finalize an interface.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* This function should destroy any internal data and release any resources
|
|
|
|
|
* allocated by the corresponding GInterfaceInitFunc() function.
|
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef void (*GInterfaceFinalizeFunc) (gpointer g_iface,
|
|
|
|
|
gpointer iface_data);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeClassCacheFunc:
|
|
|
|
|
* @cache_data: data that was given to the g_type_add_class_cache_func() call
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_class: (type GObject.TypeClass): The #GTypeClass structure which is
|
|
|
|
|
* unreferenced
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback function which is called when the reference count of a class
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* drops to zero.
|
|
|
|
|
*
|
|
|
|
|
* It may use g_type_class_ref() to prevent the class from being freed. You
|
|
|
|
|
* should not call g_type_class_unref() from a #GTypeClassCacheFunc function
|
|
|
|
|
* to prevent infinite recursion, use g_type_class_unref_uncached() instead.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* The functions have to check the class id passed in to figure
|
|
|
|
|
* whether they actually want to cache the class of this type, since all
|
|
|
|
|
* classes are routed through the same #GTypeClassCacheFunc chain.
|
|
|
|
|
*
|
2014-04-16 23:56:02 +02:00
|
|
|
|
* Returns: %TRUE to stop further #GTypeClassCacheFuncs from being
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* called, %FALSE to continue
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
typedef gboolean (*GTypeClassCacheFunc) (gpointer cache_data,
|
|
|
|
|
GTypeClass *g_class);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeInterfaceCheckFunc:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @check_data: data passed to g_type_add_interface_check()
|
2013-12-06 13:23:09 +01:00
|
|
|
|
* @g_iface: (type GObject.TypeInterface): the interface that has been
|
|
|
|
|
* initialized
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A callback called after an interface vtable is initialized.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* See g_type_add_interface_check().
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2004-10-24 03:22:30 +02:00
|
|
|
|
typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data,
|
2003-10-02 07:24:21 +02:00
|
|
|
|
gpointer g_iface);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeFundamentalFlags:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @G_TYPE_FLAG_CLASSED: Indicates a classed type
|
2020-11-02 18:22:01 +01:00
|
|
|
|
* @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiatable type (implies classed)
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type
|
|
|
|
|
* @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Bit masks used to check or determine specific characteristics of a
|
|
|
|
|
* fundamental type.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
typedef enum /*< skip >*/
|
|
|
|
|
{
|
2022-03-31 14:58:36 +02:00
|
|
|
|
/* There is no G_TYPE_FUNDAMENTAL_FLAGS_NONE: this is implemented to use
|
|
|
|
|
* the same bits as GTypeFlags */
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
G_TYPE_FLAG_CLASSED = (1 << 0),
|
|
|
|
|
G_TYPE_FLAG_INSTANTIATABLE = (1 << 1),
|
|
|
|
|
G_TYPE_FLAG_DERIVABLE = (1 << 2),
|
|
|
|
|
G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3)
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
} GTypeFundamentalFlags;
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeFlags:
|
2022-03-31 14:58:36 +02:00
|
|
|
|
* @G_TYPE_FLAG_NONE: No special flags. Since: 2.74
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* created for an abstract type
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type
|
|
|
|
|
* that introduces a value table, but can't be used for
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* g_value_init()
|
2021-02-09 11:45:00 +01:00
|
|
|
|
* @G_TYPE_FLAG_FINAL: Indicates a final type. A final type is a non-derivable
|
|
|
|
|
* leaf node in a deep derivable type hierarchy tree. Since: 2.70
|
2022-10-21 02:04:01 +02:00
|
|
|
|
* @G_TYPE_FLAG_DEPRECATED: The type is deprecated and may be removed in a
|
|
|
|
|
* future version. A warning will be emitted if it is instantiated while
|
|
|
|
|
* running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Bit masks used to check or determine characteristics of a type.
|
|
|
|
|
*/
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
typedef enum /*< skip >*/
|
|
|
|
|
{
|
2022-10-05 19:39:21 +02:00
|
|
|
|
G_TYPE_FLAG_NONE GOBJECT_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
|
2021-02-09 11:45:00 +01:00
|
|
|
|
G_TYPE_FLAG_ABSTRACT = (1 << 4),
|
|
|
|
|
G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5),
|
2022-10-21 02:04:01 +02:00
|
|
|
|
G_TYPE_FLAG_FINAL GOBJECT_AVAILABLE_ENUMERATOR_IN_2_70 = (1 << 6),
|
|
|
|
|
G_TYPE_FLAG_DEPRECATED GOBJECT_AVAILABLE_ENUMERATOR_IN_2_76 = (1 << 7)
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
} GTypeFlags;
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeInfo:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @class_size: Size of the class structure (required for interface, classed and instantiatable types)
|
|
|
|
|
* @base_init: Location of the base initialization function (optional)
|
|
|
|
|
* @base_finalize: Location of the base finalization function (optional)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @class_init: Location of the class initialization function for
|
|
|
|
|
* classed and instantiatable types. Location of the default vtable
|
2024-04-01 12:54:59 +02:00
|
|
|
|
* initialization function for interface types. (optional) This function
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* is used both to fill in virtual functions in the class or default vtable,
|
|
|
|
|
* and to do type-specific setup such as registering signals and object
|
|
|
|
|
* properties.
|
|
|
|
|
* @class_finalize: Location of the class finalization function for
|
2014-05-05 12:30:56 +02:00
|
|
|
|
* classed and instantiatable types. Location of the default vtable
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* finalization function for interface types. (optional)
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @class_data: User-supplied data passed to the class init/finalize functions
|
|
|
|
|
* @instance_size: Size of the instance (object) structure (required for instantiatable types only)
|
2023-02-04 16:55:30 +01:00
|
|
|
|
* @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10 this field is ignored.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @instance_init: Location of the instance initialization function (optional, for instantiatable types only)
|
|
|
|
|
* @value_table: A #GTypeValueTable function table for generic handling of GValues
|
|
|
|
|
* of this type (usually only useful for fundamental types)
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* This structure is used to provide the type system with the information
|
|
|
|
|
* required to initialize and destruct (finalize) a type's class and
|
|
|
|
|
* its instances.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* The initialized structure is passed to the g_type_register_static() function
|
|
|
|
|
* (or is copied into the provided #GTypeInfo structure in the
|
|
|
|
|
* g_type_plugin_complete_type_info()). The type system will perform a deep
|
|
|
|
|
* copy of this structure, so its memory does not need to be persistent
|
|
|
|
|
* across invocation of g_type_register_static().
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GTypeInfo
|
|
|
|
|
{
|
|
|
|
|
/* interface types, classed types, instantiated types */
|
|
|
|
|
guint16 class_size;
|
2001-11-22 04:20:07 +01:00
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
GBaseInitFunc base_init;
|
|
|
|
|
GBaseFinalizeFunc base_finalize;
|
2001-11-22 04:20:07 +01:00
|
|
|
|
|
2003-09-02 19:57:22 +02:00
|
|
|
|
/* interface types, classed types, instantiated types */
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
GClassInitFunc class_init;
|
|
|
|
|
GClassFinalizeFunc class_finalize;
|
|
|
|
|
gconstpointer class_data;
|
2001-11-22 04:20:07 +01:00
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
/* instantiated types */
|
|
|
|
|
guint16 instance_size;
|
|
|
|
|
guint16 n_preallocs;
|
|
|
|
|
GInstanceInitFunc instance_init;
|
2001-11-22 04:20:07 +01:00
|
|
|
|
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
/* value handling */
|
|
|
|
|
const GTypeValueTable *value_table;
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
};
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeFundamentalInfo:
|
|
|
|
|
* @type_flags: #GTypeFundamentalFlags describing the characteristics of the fundamental type
|
|
|
|
|
*
|
|
|
|
|
* A structure that provides information to the type system which is
|
|
|
|
|
* used specifically for managing fundamental types.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GTypeFundamentalInfo
|
|
|
|
|
{
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
GTypeFundamentalFlags type_flags;
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
};
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GInterfaceInfo:
|
|
|
|
|
* @interface_init: location of the interface initialization function
|
|
|
|
|
* @interface_finalize: location of the interface finalization function
|
|
|
|
|
* @interface_data: user-supplied data passed to the interface init/finalize functions
|
|
|
|
|
*
|
|
|
|
|
* A structure that provides information to the type system which is
|
|
|
|
|
* used specifically for managing interface types.
|
|
|
|
|
*/
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
struct _GInterfaceInfo
|
|
|
|
|
{
|
|
|
|
|
GInterfaceInitFunc interface_init;
|
|
|
|
|
GInterfaceFinalizeFunc interface_finalize;
|
|
|
|
|
gpointer interface_data;
|
|
|
|
|
};
|
2023-05-21 15:27:00 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValueInitFunc:
|
|
|
|
|
* @value: the value to initialize
|
|
|
|
|
*
|
|
|
|
|
* Initializes the value contents by setting the fields of the `value->data`
|
|
|
|
|
* array.
|
|
|
|
|
*
|
|
|
|
|
* The data array of the #GValue passed into this function was zero-filled
|
|
|
|
|
* with `memset()`, so no care has to be taken to free any old contents.
|
|
|
|
|
* For example, in the case of a string value that may never be %NULL, the
|
|
|
|
|
* implementation might look like:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* value->data[0].v_pointer = g_strdup ("");
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef void (* GTypeValueInitFunc) (GValue *value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValueFreeFunc:
|
|
|
|
|
* @value: the value to free
|
|
|
|
|
*
|
|
|
|
|
* Frees any old contents that might be left in the `value->data` array of
|
|
|
|
|
* the given value.
|
|
|
|
|
*
|
|
|
|
|
* No resources may remain allocated through the #GValue contents after this
|
|
|
|
|
* function returns. E.g. for our above string type:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* // only free strings without a specific flag for static storage
|
|
|
|
|
* if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
|
|
|
|
|
* g_free (value->data[0].v_pointer);
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef void (* GTypeValueFreeFunc) (GValue *value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValueCopyFunc:
|
|
|
|
|
* @src_value: the value to copy
|
|
|
|
|
* @dest_value: (out): the location of the copy
|
|
|
|
|
*
|
|
|
|
|
* Copies the content of a #GValue into another.
|
|
|
|
|
*
|
|
|
|
|
* The @dest_value is a #GValue with zero-filled data section and @src_value
|
|
|
|
|
* is a properly initialized #GValue of same type, or derived type.
|
|
|
|
|
*
|
|
|
|
|
* The purpose of this function is to copy the contents of @src_value
|
|
|
|
|
* into @dest_value in a way, that even after @src_value has been freed, the
|
|
|
|
|
* contents of @dest_value remain valid. String type example:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef void (* GTypeValueCopyFunc) (const GValue *src_value,
|
|
|
|
|
GValue *dest_value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValuePeekPointerFunc:
|
|
|
|
|
* @value: the value to peek
|
|
|
|
|
*
|
|
|
|
|
* If the value contents fit into a pointer, such as objects or strings,
|
|
|
|
|
* return this pointer, so the caller can peek at the current contents.
|
|
|
|
|
*
|
|
|
|
|
* To extend on our above string example:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* return value->data[0].v_pointer;
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): a pointer to the value contents
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef gpointer (* GTypeValuePeekPointerFunc) (const GValue *value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValueCollectFunc:
|
|
|
|
|
* @value: the value to initialize
|
|
|
|
|
* @n_collect_values: the number of collected values
|
|
|
|
|
* @collect_values: (array length=n_collect_values): the collected values
|
|
|
|
|
* @collect_flags: optional flags
|
|
|
|
|
*
|
|
|
|
|
* This function is responsible for converting the values collected from
|
|
|
|
|
* a variadic argument list into contents suitable for storage in a #GValue.
|
|
|
|
|
*
|
|
|
|
|
* This function should setup @value similar to #GTypeValueInitFunc; e.g.
|
|
|
|
|
* for a string value that does not allow `NULL` pointers, it needs to either
|
|
|
|
|
* emit an error, or do an implicit conversion by storing an empty string.
|
|
|
|
|
*
|
|
|
|
|
* The @value passed in to this function has a zero-filled data array, so
|
|
|
|
|
* just like for #GTypeValueInitFunc it is guaranteed to not contain any old
|
|
|
|
|
* contents that might need freeing.
|
|
|
|
|
*
|
|
|
|
|
* The @n_collect_values argument is the string length of the `collect_format`
|
|
|
|
|
* field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
|
|
|
|
|
* with length of @n_collect_values, containing the collected values according
|
|
|
|
|
* to `collect_format`.
|
|
|
|
|
*
|
|
|
|
|
* The @collect_flags argument provided as a hint by the caller. It may
|
|
|
|
|
* contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
|
|
|
|
|
* value contents may be considered ‘static’ for the duration of the @value
|
|
|
|
|
* lifetime. Thus an extra copy of the contents stored in @collect_values is
|
|
|
|
|
* not required for assignment to @value.
|
|
|
|
|
*
|
|
|
|
|
* For our above string example, we continue with:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* if (!collect_values[0].v_pointer)
|
|
|
|
|
* value->data[0].v_pointer = g_strdup ("");
|
|
|
|
|
* else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
|
|
|
|
|
* {
|
|
|
|
|
* value->data[0].v_pointer = collect_values[0].v_pointer;
|
|
|
|
|
* // keep a flag for the value_free() implementation to not free this string
|
|
|
|
|
* value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
|
|
|
|
|
* }
|
|
|
|
|
* else
|
|
|
|
|
* value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
|
|
|
|
|
* return NULL;
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* It should be noted, that it is generally a bad idea to follow the
|
|
|
|
|
* %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
|
|
|
|
|
* reentrancy requirements and reference count assertions performed
|
|
|
|
|
* by the signal emission code, reference counts should always be
|
|
|
|
|
* incremented for reference counted contents stored in the `value->data`
|
|
|
|
|
* array. To deviate from our string example for a moment, and taking
|
|
|
|
|
* a look at an exemplary implementation for `GTypeValueTable.collect_value()`
|
|
|
|
|
* of `GObject`:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* GObject *object = G_OBJECT (collect_values[0].v_pointer);
|
|
|
|
|
* g_return_val_if_fail (object != NULL,
|
|
|
|
|
* g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
|
|
|
|
|
* // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
|
|
|
|
|
* value->data[0].v_pointer = g_object_ref (object);
|
|
|
|
|
* return NULL;
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* The reference count for valid objects is always incremented, regardless
|
|
|
|
|
* of `collect_flags`. For invalid objects, the example returns a newly
|
|
|
|
|
* allocated string without altering `value`.
|
|
|
|
|
*
|
|
|
|
|
* Upon success, `collect_value()` needs to return `NULL`. If, however,
|
|
|
|
|
* an error condition occurred, `collect_value()` should return a newly
|
|
|
|
|
* allocated string containing an error diagnostic.
|
|
|
|
|
*
|
|
|
|
|
* The calling code makes no assumptions about the `value` contents being
|
|
|
|
|
* valid upon error returns, `value` is simply thrown away without further
|
|
|
|
|
* freeing. As such, it is a good idea to not allocate `GValue` contents
|
|
|
|
|
* prior to returning an error; however, `collect_values()` is not obliged
|
|
|
|
|
* to return a correctly setup @value for error returns, simply because
|
|
|
|
|
* any non-`NULL` return is considered a fatal programming error, and
|
|
|
|
|
* further program behaviour is undefined.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full) (nullable): `NULL` on success, otherwise a
|
|
|
|
|
* newly allocated error string on failure
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef gchar * (* GTypeValueCollectFunc) (GValue *value,
|
|
|
|
|
guint n_collect_values,
|
|
|
|
|
GTypeCValue *collect_values,
|
|
|
|
|
guint collect_flags);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GTypeValueLCopyFunc:
|
|
|
|
|
* @value: the value to lcopy
|
|
|
|
|
* @n_collect_values: the number of collected values
|
|
|
|
|
* @collect_values: (array length=n_collect_values): the collected
|
|
|
|
|
* locations for storage
|
|
|
|
|
* @collect_flags: optional flags
|
|
|
|
|
*
|
|
|
|
|
* This function is responsible for storing the `value`
|
|
|
|
|
* contents into arguments passed through a variadic argument list which
|
|
|
|
|
* got collected into `collect_values` according to `lcopy_format`.
|
|
|
|
|
*
|
|
|
|
|
* The `n_collect_values` argument equals the string length of
|
|
|
|
|
* `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
|
|
|
|
|
*
|
|
|
|
|
* In contrast to #GTypeValueCollectFunc, this function is obliged to always
|
|
|
|
|
* properly support %G_VALUE_NOCOPY_CONTENTS.
|
|
|
|
|
*
|
|
|
|
|
* Similar to #GTypeValueCollectFunc the function may prematurely abort by
|
|
|
|
|
* returning a newly allocated string describing an error condition. To
|
|
|
|
|
* complete the string example:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* gchar **string_p = collect_values[0].v_pointer;
|
|
|
|
|
* g_return_val_if_fail (string_p != NULL,
|
|
|
|
|
* g_strdup ("string location passed as NULL"));
|
|
|
|
|
*
|
|
|
|
|
* if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
|
|
|
|
|
* *string_p = value->data[0].v_pointer;
|
|
|
|
|
* else
|
|
|
|
|
* *string_p = g_strdup (value->data[0].v_pointer);
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* And an illustrative version of this function for reference-counted
|
|
|
|
|
* types:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* GObject **object_p = collect_values[0].v_pointer;
|
|
|
|
|
* g_return_val_if_fail (object_p != NULL,
|
|
|
|
|
* g_strdup ("object location passed as NULL"));
|
|
|
|
|
*
|
|
|
|
|
* if (value->data[0].v_pointer == NULL)
|
|
|
|
|
* *object_p = NULL;
|
|
|
|
|
* else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
|
|
|
|
|
* *object_p = value->data[0].v_pointer;
|
|
|
|
|
* else
|
|
|
|
|
* *object_p = g_object_ref (value->data[0].v_pointer);
|
|
|
|
|
*
|
|
|
|
|
* return NULL;
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full) (nullable): `NULL` on success, otherwise
|
|
|
|
|
* a newly allocated error string on failure
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.78
|
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
GOBJECT_AVAILABLE_TYPE_IN_2_78
|
2023-05-21 15:27:00 +02:00
|
|
|
|
typedef gchar * (* GTypeValueLCopyFunc) (const GValue *value,
|
|
|
|
|
guint n_collect_values,
|
|
|
|
|
GTypeCValue *collect_values,
|
|
|
|
|
guint collect_flags);
|
|
|
|
|
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* GTypeValueTable:
|
2023-05-21 15:27:00 +02:00
|
|
|
|
* @value_init: Function to initialize a GValue
|
|
|
|
|
* @value_free: Function to free a GValue
|
|
|
|
|
* @value_copy: Function to copy a GValue
|
|
|
|
|
* @value_peek_pointer: Function to peek the contents of a GValue if they fit
|
|
|
|
|
* into a pointer
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @collect_format: A string format describing how to collect the contents of
|
2023-05-21 15:27:00 +02:00
|
|
|
|
* this value bit-by-bit. Each character in the format represents
|
|
|
|
|
* an argument to be collected, and the characters themselves indicate
|
|
|
|
|
* the type of the argument. Currently supported arguments are:
|
|
|
|
|
* - `'i'`: Integers, passed as `collect_values[].v_int`
|
|
|
|
|
* - `'l'`: Longs, passed as `collect_values[].v_long`
|
|
|
|
|
* - `'d'`: Doubles, passed as `collect_values[].v_double`
|
|
|
|
|
* - `'p'`: Pointers, passed as `collect_values[].v_pointer`
|
|
|
|
|
* It should be noted that for variable argument list construction,
|
|
|
|
|
* ANSI C promotes every type smaller than an integer to an int, and
|
|
|
|
|
* floats to doubles. So for collection of short int or char, `'i'`
|
|
|
|
|
* needs to be used, and for collection of floats `'d'`.
|
|
|
|
|
* @collect_value: Function to initialize a GValue from the values
|
|
|
|
|
* collected from variadic arguments
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @lcopy_format: Format description of the arguments to collect for @lcopy_value,
|
2023-05-21 15:27:00 +02:00
|
|
|
|
* analogous to @collect_format. Usually, @lcopy_format string consists
|
|
|
|
|
* only of `'p'`s to provide lcopy_value() with pointers to storage locations.
|
|
|
|
|
* @lcopy_value: Function to store the contents of a value into the
|
|
|
|
|
* locations collected from variadic arguments
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* The #GTypeValueTable provides the functions required by the #GValue
|
|
|
|
|
* implementation, to serve as a container for values of a type.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*/
|
2023-05-30 13:37:12 +02:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
struct _GTypeValueTable
|
|
|
|
|
{
|
2023-05-21 15:27:00 +02:00
|
|
|
|
GTypeValueInitFunc value_init;
|
|
|
|
|
GTypeValueFreeFunc value_free;
|
|
|
|
|
GTypeValueCopyFunc value_copy;
|
|
|
|
|
GTypeValuePeekPointerFunc value_peek_pointer;
|
|
|
|
|
|
2012-03-07 13:54:04 +01:00
|
|
|
|
const gchar *collect_format;
|
2023-05-21 15:27:00 +02:00
|
|
|
|
GTypeValueCollectFunc collect_value;
|
|
|
|
|
|
2012-03-07 13:54:04 +01:00
|
|
|
|
const gchar *lcopy_format;
|
2023-05-21 15:27:00 +02:00
|
|
|
|
GTypeValueLCopyFunc lcopy_value;
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
};
|
2023-05-30 13:37:12 +02:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2023-05-21 15:27:00 +02:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
GType g_type_register_static (GType parent_type,
|
|
|
|
|
const gchar *type_name,
|
|
|
|
|
const GTypeInfo *info,
|
|
|
|
|
GTypeFlags flags);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2006-04-21 18:53:02 +02:00
|
|
|
|
GType g_type_register_static_simple (GType parent_type,
|
|
|
|
|
const gchar *type_name,
|
|
|
|
|
guint class_size,
|
|
|
|
|
GClassInitFunc class_init,
|
|
|
|
|
guint instance_size,
|
|
|
|
|
GInstanceInitFunc instance_init,
|
|
|
|
|
GTypeFlags flags);
|
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
GType g_type_register_dynamic (GType parent_type,
|
|
|
|
|
const gchar *type_name,
|
|
|
|
|
GTypePlugin *plugin,
|
|
|
|
|
GTypeFlags flags);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
GType g_type_register_fundamental (GType type_id,
|
|
|
|
|
const gchar *type_name,
|
|
|
|
|
const GTypeInfo *info,
|
|
|
|
|
const GTypeFundamentalInfo *finfo,
|
|
|
|
|
GTypeFlags flags);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
void g_type_add_interface_static (GType instance_type,
|
|
|
|
|
GType interface_type,
|
|
|
|
|
const GInterfaceInfo *info);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
void g_type_add_interface_dynamic (GType instance_type,
|
|
|
|
|
GType interface_type,
|
|
|
|
|
GTypePlugin *plugin);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-03-07 20:36:02 +01:00
|
|
|
|
void g_type_interface_add_prerequisite (GType interface_type,
|
|
|
|
|
GType prerequisite_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2004-01-09 15:40:31 +01:00
|
|
|
|
GType*g_type_interface_prerequisites (GType interface_type,
|
|
|
|
|
guint *n_prerequisites);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_68
|
2019-11-25 19:40:39 +01:00
|
|
|
|
GType g_type_interface_instantiatable_prerequisite
|
|
|
|
|
(GType interface_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_DEPRECATED_IN_2_58
|
2004-01-09 15:40:31 +01:00
|
|
|
|
void g_type_class_add_private (gpointer g_class,
|
|
|
|
|
gsize private_size);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_38
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
gint g_type_add_instance_private (GType class_type,
|
|
|
|
|
gsize private_size);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2004-01-09 15:40:31 +01:00
|
|
|
|
gpointer g_type_instance_get_private (GTypeInstance *instance,
|
|
|
|
|
GType private_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_38
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
void g_type_class_adjust_private_offset (gpointer g_class,
|
|
|
|
|
gint *private_size_or_offset);
|
2004-01-09 15:40:31 +01:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2010-03-17 15:11:00 +01:00
|
|
|
|
void g_type_add_class_private (GType class_type,
|
|
|
|
|
gsize private_size);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2010-03-17 15:11:00 +01:00
|
|
|
|
gpointer g_type_class_get_private (GTypeClass *klass,
|
|
|
|
|
GType private_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_38
|
2013-04-23 16:38:23 +02:00
|
|
|
|
gint g_type_class_get_instance_private_offset (gpointer g_class);
|
2010-03-17 15:11:00 +01:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_34
|
2010-01-03 20:47:56 +01:00
|
|
|
|
void g_type_ensure (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_36
|
2012-12-07 17:34:52 +01:00
|
|
|
|
guint g_type_get_type_registration_serial (void);
|
|
|
|
|
|
2004-01-09 15:40:31 +01:00
|
|
|
|
|
|
|
|
|
/* --- GType boilerplate --- */
|
2014-02-03 18:40:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DECLARE_FINAL_TYPE:
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @ModuleObjName: The name of the new type, in camel case (like `GtkWidget`)
|
2015-02-03 15:57:54 +01:00
|
|
|
|
* @module_obj_name: The name of the new type in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_` (like `gtk_widget`)
|
|
|
|
|
* @MODULE: The name of the module, in all caps (like `GTK`)
|
|
|
|
|
* @OBJ_NAME: The bare name of the type, in all caps (like `WIDGET`)
|
|
|
|
|
* @ParentName: the name of the parent type, in camel case (like `GtkWidget`)
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* A convenience macro for emitting the usual declarations in the header file
|
|
|
|
|
* for a type which is not (at the present time) intended to be subclassed.
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
|
|
|
|
* You might use it in a header as follows:
|
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* #ifndef _myapp_window_h_
|
|
|
|
|
* #define _myapp_window_h_
|
|
|
|
|
*
|
|
|
|
|
* #include <gtk/gtk.h>
|
|
|
|
|
*
|
2015-01-28 12:30:23 +01:00
|
|
|
|
* #define MY_APP_TYPE_WINDOW my_app_window_get_type ()
|
2015-02-03 15:57:54 +01:00
|
|
|
|
* G_DECLARE_FINAL_TYPE (MyAppWindow, my_app_window, MY_APP, WINDOW, GtkWindow)
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
|
|
|
|
* MyAppWindow * my_app_window_new (void);
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* #endif
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2022-02-19 18:41:42 +01:00
|
|
|
|
* And use it as follow in your C file:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* struct _MyAppWindow
|
|
|
|
|
* {
|
|
|
|
|
* GtkWindow parent;
|
|
|
|
|
* ...
|
|
|
|
|
* };
|
|
|
|
|
* G_DEFINE_TYPE (MyAppWindow, my_app_window, GTK_TYPE_WINDOW)
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* This results in the following things happening:
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the usual `my_app_window_get_type()` function is declared with a return type of #GType
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `MyAppWindow` type is defined as a `typedef` of `struct _MyAppWindow`. The struct itself is not
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* defined and should be defined from the .c file before G_DEFINE_TYPE() is used.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `MY_APP_WINDOW()` cast is emitted as `static inline` function along with the `MY_APP_IS_WINDOW()` type
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* checking function
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `MyAppWindowClass` type is defined as a struct containing `GtkWindowClass`. This is done for the
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* convenience of the person defining the type and should not be considered to be part of the ABI. In
|
|
|
|
|
* particular, without a firm declaration of the instance structure, it is not possible to subclass the type
|
|
|
|
|
* and therefore the fact that the size of the class structure is exposed is not a concern and it can be
|
|
|
|
|
* freely changed at any point in the future.
|
|
|
|
|
*
|
2015-01-28 12:47:05 +01:00
|
|
|
|
* - g_autoptr() support being added for your type, based on the type of your parent class
|
|
|
|
|
*
|
|
|
|
|
* You can only use this function if your parent type also supports g_autoptr().
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Because the type macro (`MY_APP_TYPE_WINDOW` in the above example) is not a callable, you must continue to
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* manually define this as a macro for yourself.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* The declaration of the `_get_type()` function is the first thing emitted by the macro. This allows this macro
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* to be used in the usual way with export control and API versioning macros.
|
|
|
|
|
*
|
|
|
|
|
* If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE().
|
|
|
|
|
*
|
|
|
|
|
* If you are writing a library, it is important to note that it is possible to convert a type from using
|
|
|
|
|
* G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
|
|
|
|
|
* should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
|
|
|
|
|
* subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
|
|
|
|
|
* reorder items without breaking the API and/or ABI.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.44
|
|
|
|
|
**/
|
|
|
|
|
#define G_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
|
|
|
|
|
GType module_obj_name##_get_type (void); \
|
2015-01-30 16:40:03 +01:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
typedef struct _##ModuleObjName ModuleObjName; \
|
|
|
|
|
typedef struct { ParentName##Class parent_class; } ModuleObjName##Class; \
|
|
|
|
|
\
|
2015-02-02 16:25:31 +01:00
|
|
|
|
_GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
|
2019-12-13 20:07:51 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \
|
2015-01-28 12:47:05 +01:00
|
|
|
|
\
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
|
2022-06-06 22:12:20 +02:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
|
2015-01-30 16:40:03 +01:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2014-02-03 18:40:17 +01:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* G_DECLARE_DERIVABLE_TYPE:
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @ModuleObjName: The name of the new type, in camel case (like `GtkWidget`)
|
2015-02-03 15:57:54 +01:00
|
|
|
|
* @module_obj_name: The name of the new type in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_` (like `gtk_widget`)
|
|
|
|
|
* @MODULE: The name of the module, in all caps (like `GTK`)
|
|
|
|
|
* @OBJ_NAME: The bare name of the type, in all caps (like `WIDGET`)
|
|
|
|
|
* @ParentName: the name of the parent type, in camel case (like `GtkWidget`)
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
2019-07-20 16:05:12 +02:00
|
|
|
|
* A convenience macro for emitting the usual declarations in the
|
|
|
|
|
* header file for a type which is intended to be subclassed.
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
|
|
|
|
* You might use it in a header as follows:
|
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* #ifndef _gtk_frobber_h_
|
|
|
|
|
* #define _gtk_frobber_h_
|
|
|
|
|
*
|
|
|
|
|
* #define GTK_TYPE_FROBBER gtk_frobber_get_type ()
|
|
|
|
|
* GDK_AVAILABLE_IN_3_12
|
2015-02-03 15:57:54 +01:00
|
|
|
|
* G_DECLARE_DERIVABLE_TYPE (GtkFrobber, gtk_frobber, GTK, FROBBER, GtkWidget)
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
|
|
|
|
* struct _GtkFrobberClass
|
|
|
|
|
* {
|
|
|
|
|
* GtkWidgetClass parent_class;
|
|
|
|
|
*
|
|
|
|
|
* void (* handle_frob) (GtkFrobber *frobber,
|
|
|
|
|
* guint n_frobs);
|
|
|
|
|
*
|
|
|
|
|
* gpointer padding[12];
|
|
|
|
|
* };
|
|
|
|
|
*
|
|
|
|
|
* GtkWidget * gtk_frobber_new (void);
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* #endif
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2022-02-19 18:41:42 +01:00
|
|
|
|
* Since the instance structure is public it is often needed to declare a
|
|
|
|
|
* private struct as follow in your C file:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* typedef struct _GtkFrobberPrivate GtkFrobberPrivate;
|
|
|
|
|
* struct _GtkFrobberPrivate
|
|
|
|
|
* {
|
|
|
|
|
* ...
|
|
|
|
|
* };
|
|
|
|
|
* G_DEFINE_TYPE_WITH_PRIVATE (GtkFrobber, gtk_frobber, GTK_TYPE_WIDGET)
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* This results in the following things happening:
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the usual `gtk_frobber_get_type()` function is declared with a return type of #GType
|
2014-02-03 18:40:17 +01:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `GtkFrobber` struct is created with `GtkWidget` as the first and only item. You are expected to use
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* a private structure from your .c file to store your instance variables.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `GtkFrobberClass` type is defined as a typedef to `struct _GtkFrobberClass`, which is left undefined.
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* You should do this from the header file directly after you use the macro.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `GTK_FROBBER()` and `GTK_FROBBER_CLASS()` casts are emitted as `static inline` functions along with
|
|
|
|
|
* the `GTK_IS_FROBBER()` and `GTK_IS_FROBBER_CLASS()` type checking functions and `GTK_FROBBER_GET_CLASS()`
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* function.
|
|
|
|
|
*
|
2015-01-28 12:47:05 +01:00
|
|
|
|
* - g_autoptr() support being added for your type, based on the type of your parent class
|
|
|
|
|
*
|
|
|
|
|
* You can only use this function if your parent type also supports g_autoptr().
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Because the type macro (`GTK_TYPE_FROBBER` in the above example) is not a callable, you must continue to
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* manually define this as a macro for yourself.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* The declaration of the `_get_type()` function is the first thing emitted by the macro. This allows this macro
|
2014-02-03 18:40:17 +01:00
|
|
|
|
* to be used in the usual way with export control and API versioning macros.
|
|
|
|
|
*
|
|
|
|
|
* If you are writing a library, it is important to note that it is possible to convert a type from using
|
|
|
|
|
* G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you
|
|
|
|
|
* should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
|
|
|
|
|
* subclassed. Once a class structure has been exposed it is not possible to change its size or remove or
|
|
|
|
|
* reorder items without breaking the API and/or ABI. If you want to declare your own class structure, use
|
|
|
|
|
* G_DECLARE_DERIVABLE_TYPE(). If you want to declare a class without exposing the class or instance
|
|
|
|
|
* structures, use G_DECLARE_FINAL_TYPE().
|
|
|
|
|
*
|
|
|
|
|
* If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your
|
|
|
|
|
* class structure to leave space for the addition of future virtual functions.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.44
|
|
|
|
|
**/
|
|
|
|
|
#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
|
|
|
|
|
GType module_obj_name##_get_type (void); \
|
2015-01-30 16:40:03 +01:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
2015-01-27 19:50:04 +01:00
|
|
|
|
typedef struct _##ModuleObjName ModuleObjName; \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
|
2015-01-27 19:50:04 +01:00
|
|
|
|
struct _##ModuleObjName { ParentName parent_instance; }; \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
\
|
2015-02-02 16:25:31 +01:00
|
|
|
|
_GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \
|
2019-12-13 20:07:51 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \
|
2015-01-28 12:47:05 +01:00
|
|
|
|
\
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \
|
2014-02-03 18:40:17 +01:00
|
|
|
|
return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \
|
2015-02-02 04:16:29 +01:00
|
|
|
|
return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
|
2015-01-30 16:40:03 +01:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2014-02-03 18:40:17 +01:00
|
|
|
|
|
2015-02-03 16:40:07 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DECLARE_INTERFACE:
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @ModuleObjName: The name of the new type, in camel case (like `GtkWidget`)
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* @module_obj_name: The name of the new type in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_` (like `gtk_widget`)
|
|
|
|
|
* @MODULE: The name of the module, in all caps (like `GTK`)
|
|
|
|
|
* @OBJ_NAME: The bare name of the type, in all caps (like `WIDGET`)
|
|
|
|
|
* @PrerequisiteName: the name of the prerequisite type, in camel case (like `GtkWidget`)
|
2015-02-03 16:40:07 +01:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* A convenience macro for emitting the usual declarations in the header file for a #GInterface type.
|
2015-02-03 16:40:07 +01:00
|
|
|
|
*
|
|
|
|
|
* You might use it in a header as follows:
|
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* #ifndef _my_model_h_
|
|
|
|
|
* #define _my_model_h_
|
|
|
|
|
*
|
|
|
|
|
* #define MY_TYPE_MODEL my_model_get_type ()
|
|
|
|
|
* GDK_AVAILABLE_IN_3_12
|
|
|
|
|
* G_DECLARE_INTERFACE (MyModel, my_model, MY, MODEL, GObject)
|
|
|
|
|
*
|
|
|
|
|
* struct _MyModelInterface
|
|
|
|
|
* {
|
|
|
|
|
* GTypeInterface g_iface;
|
|
|
|
|
*
|
|
|
|
|
* gpointer (* get_item) (MyModel *model);
|
|
|
|
|
* };
|
|
|
|
|
*
|
|
|
|
|
* gpointer my_model_get_item (MyModel *model);
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* #endif
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2022-02-19 18:41:42 +01:00
|
|
|
|
* And use it as follow in your C file:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* G_DEFINE_INTERFACE (MyModel, my_model, G_TYPE_OBJECT);
|
|
|
|
|
*
|
|
|
|
|
* static void
|
|
|
|
|
* my_model_default_init (MyModelInterface *iface)
|
|
|
|
|
* {
|
|
|
|
|
* ...
|
|
|
|
|
* }
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* This results in the following things happening:
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the usual `my_model_get_type()` function is declared with a return type of #GType
|
2015-02-03 16:40:07 +01:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `MyModelInterface` type is defined as a typedef to `struct _MyModelInterface`,
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* which is left undefined. You should do this from the header file directly after
|
|
|
|
|
* you use the macro.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* - the `MY_MODEL()` cast is emitted as `static inline` functions along with
|
|
|
|
|
* the `MY_IS_MODEL()` type checking function and `MY_MODEL_GET_IFACE()` function.
|
2015-02-03 16:40:07 +01:00
|
|
|
|
*
|
|
|
|
|
* - g_autoptr() support being added for your type, based on your prerequisite type.
|
|
|
|
|
*
|
|
|
|
|
* You can only use this function if your prerequisite type also supports g_autoptr().
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Because the type macro (`MY_TYPE_MODEL` in the above example) is not a callable, you must continue to
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* manually define this as a macro for yourself.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* The declaration of the `_get_type()` function is the first thing emitted by the macro. This allows this macro
|
2015-02-03 16:40:07 +01:00
|
|
|
|
* to be used in the usual way with export control and API versioning macros.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.44
|
|
|
|
|
**/
|
|
|
|
|
#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName) \
|
|
|
|
|
GType module_obj_name##_get_type (void); \
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
|
|
|
|
typedef struct _##ModuleObjName ModuleObjName; \
|
|
|
|
|
typedef struct _##ModuleObjName##Interface ModuleObjName##Interface; \
|
|
|
|
|
\
|
|
|
|
|
_GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, PrerequisiteName) \
|
|
|
|
|
\
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
|
2015-02-03 16:40:07 +01:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \
|
2015-02-03 16:40:07 +01:00
|
|
|
|
return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \
|
2019-08-27 10:08:36 +02:00
|
|
|
|
G_GNUC_UNUSED static inline ModuleObjName##Interface * MODULE##_##OBJ_NAME##_GET_IFACE (gpointer ptr) { \
|
2015-02-03 16:40:07 +01:00
|
|
|
|
return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_TYPE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* A convenience macro for type implementations, which declares a class
|
|
|
|
|
* initialization function, an instance initialization function (see #GTypeInfo
|
|
|
|
|
* for information about these) and a static variable named `t_n_parent_class`
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* pointing to the parent class. Furthermore, it defines a `*_get_type()` function.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2004-01-09 15:40:31 +01:00
|
|
|
|
*/
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define G_DEFINE_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_TYPE_WITH_CODE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @t_n: The name of the new type in lowercase, with words separated by `_`.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @_C_: Custom code that gets inserted in the `*_get_type()` function.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* A convenience macro for type implementations.
|
|
|
|
|
*
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* Similar to G_DEFINE_TYPE(), but allows you to insert custom code into the
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* `*_get_type()` function, e.g. interface implementations via G_IMPLEMENT_INTERFACE().
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_TYPE_WITH_PRIVATE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* A convenience macro for type implementations, which declares a class
|
|
|
|
|
* initialization function, an instance initialization function (see #GTypeInfo
|
|
|
|
|
* for information about these), a static variable named `t_n_parent_class`
|
|
|
|
|
* pointing to the parent class, and adds private instance data to the type.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Furthermore, it defines a `*_get_type()` function. See G_DEFINE_TYPE_EXTENDED()
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* for an example.
|
|
|
|
|
*
|
2013-07-26 20:40:10 +02:00
|
|
|
|
* Note that private structs added with this macros must have a struct
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* name of the form `TN ## Private`.
|
2013-07-26 20:40:10 +02:00
|
|
|
|
*
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* The private instance data can be retrieved using the automatically generated
|
|
|
|
|
* getter function `t_n_get_instance_private()`.
|
|
|
|
|
*
|
|
|
|
|
* See also: G_ADD_PRIVATE()
|
|
|
|
|
*
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* Since: 2.38
|
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, G_ADD_PRIVATE (TN))
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_ABSTRACT_TYPE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* A convenience macro for type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Similar to G_DEFINE_TYPE(), but defines an abstract type.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_ABSTRACT_TYPE_WITH_CODE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @_C_: Custom code that gets inserted in the `type_name_get_type()` function.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* A convenience macro for type implementations.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* allows you to insert custom code into the `*_get_type()` function, e.g.
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* interface implementations via G_IMPLEMENT_INTERFACE().
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
2013-08-22 20:52:17 +02:00
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines an abstract type.
|
|
|
|
|
*
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
2013-07-05 13:23:11 +02:00
|
|
|
|
* Since: 2.38
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, G_ADD_PRIVATE (TN))
|
2021-02-09 11:56:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_FINAL_TYPE:
|
|
|
|
|
* @TN: the name of the new type, in Camel case
|
|
|
|
|
* @t_n: the name of the new type, in lower case, with words
|
|
|
|
|
* separated by `_` (snake case)
|
|
|
|
|
* @T_P: the #GType of the parent type
|
|
|
|
|
*
|
|
|
|
|
* A convenience macro for type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Similar to G_DEFINE_TYPE(), but defines a final type.
|
|
|
|
|
*
|
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.70
|
|
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
#define G_DEFINE_FINAL_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_FINAL, {}) GOBJECT_AVAILABLE_MACRO_IN_2_70
|
2021-02-09 11:56:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_FINAL_TYPE_WITH_CODE:
|
|
|
|
|
* @TN: the name of the new type, in Camel case
|
|
|
|
|
* @t_n: the name of the new type, in lower case, with words
|
|
|
|
|
* separated by `_` (snake case)
|
|
|
|
|
* @T_P: the #GType of the parent type
|
|
|
|
|
* @_C_: Custom code that gets inserted in the `type_name_get_type()` function.
|
|
|
|
|
*
|
|
|
|
|
* A convenience macro for type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Similar to G_DEFINE_TYPE_WITH_CODE(), but defines a final type and
|
|
|
|
|
* allows you to insert custom code into the `*_get_type()` function, e.g.
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* interface implementations via G_IMPLEMENT_INTERFACE().
|
2021-02-09 11:56:15 +01:00
|
|
|
|
*
|
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.70
|
|
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
#define G_DEFINE_FINAL_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_FINAL) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() GOBJECT_AVAILABLE_MACRO_IN_2_70
|
2021-02-09 11:56:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_FINAL_TYPE_WITH_PRIVATE:
|
|
|
|
|
* @TN: the name of the new type, in Camel case
|
|
|
|
|
* @t_n: the name of the new type, in lower case, with words
|
|
|
|
|
* separated by `_` (snake case)
|
|
|
|
|
* @T_P: the #GType of the parent type
|
|
|
|
|
*
|
|
|
|
|
* A convenience macro for type implementations.
|
|
|
|
|
*
|
|
|
|
|
* Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines a final type.
|
|
|
|
|
*
|
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.70
|
|
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
#define G_DEFINE_FINAL_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_FINAL, G_ADD_PRIVATE (TN)) GOBJECT_AVAILABLE_MACRO_IN_2_70
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_TYPE_EXTENDED:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`.
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* @T_P: The #GType of the parent type.
|
|
|
|
|
* @_f_: #GTypeFlags to pass to g_type_register_static()
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @_C_: Custom code that gets inserted in the `*_get_type()` function.
|
2009-04-09 20:56:49 +02:00
|
|
|
|
*
|
|
|
|
|
* The most general convenience macro for type implementations, on which
|
|
|
|
|
* G_DEFINE_TYPE(), etc are based.
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* G_DEFINE_TYPE_EXTENDED (GtkGadget,
|
|
|
|
|
* gtk_gadget,
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* GTK_TYPE_WIDGET,
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* 0,
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* G_ADD_PRIVATE (GtkGadget)
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* gtk_gadget_gizmo_init));
|
|
|
|
|
* ]|
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* expands to
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* static void gtk_gadget_init (GtkGadget *self);
|
|
|
|
|
* static void gtk_gadget_class_init (GtkGadgetClass *klass);
|
|
|
|
|
* static gpointer gtk_gadget_parent_class = NULL;
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* static gint GtkGadget_private_offset;
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* static void gtk_gadget_class_intern_init (gpointer klass)
|
|
|
|
|
* {
|
|
|
|
|
* gtk_gadget_parent_class = g_type_class_peek_parent (klass);
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* if (GtkGadget_private_offset != 0)
|
|
|
|
|
* g_type_class_adjust_private_offset (klass, &GtkGadget_private_offset);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* gtk_gadget_class_init ((GtkGadgetClass*) klass);
|
|
|
|
|
* }
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* static inline gpointer gtk_gadget_get_instance_private (GtkGadget *self)
|
|
|
|
|
* {
|
|
|
|
|
* return (G_STRUCT_MEMBER_P (self, GtkGadget_private_offset));
|
|
|
|
|
* }
|
2009-04-09 20:56:49 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* GType
|
|
|
|
|
* gtk_gadget_get_type (void)
|
|
|
|
|
* {
|
2023-09-12 10:26:21 +02:00
|
|
|
|
* static GType static_g_define_type_id = 0;
|
|
|
|
|
* if (g_once_init_enter_pointer (&static_g_define_type_id))
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* {
|
|
|
|
|
* GType g_define_type_id =
|
|
|
|
|
* g_type_register_static_simple (GTK_TYPE_WIDGET,
|
|
|
|
|
* g_intern_static_string ("GtkGadget"),
|
|
|
|
|
* sizeof (GtkGadgetClass),
|
|
|
|
|
* (GClassInitFunc) gtk_gadget_class_intern_init,
|
|
|
|
|
* sizeof (GtkGadget),
|
|
|
|
|
* (GInstanceInitFunc) gtk_gadget_init,
|
2013-04-04 13:10:28 +02:00
|
|
|
|
* 0);
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* {
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* GtkGadget_private_offset =
|
|
|
|
|
* g_type_add_instance_private (g_define_type_id, sizeof (GtkGadgetPrivate));
|
|
|
|
|
* }
|
|
|
|
|
* {
|
2011-11-30 04:02:00 +01:00
|
|
|
|
* const GInterfaceInfo g_implement_interface_info = {
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* (GInterfaceInitFunc) gtk_gadget_gizmo_init
|
|
|
|
|
* };
|
2008-06-21 19:25:17 +02:00
|
|
|
|
* g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* }
|
2023-09-12 10:26:21 +02:00
|
|
|
|
* g_once_init_leave_pointer (&static_g_define_type_id, g_define_type_id);
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* }
|
2020-11-11 19:12:22 +01:00
|
|
|
|
* return static_g_define_type_id;
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* }
|
|
|
|
|
* ]|
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* The only pieces which have to be manually provided are the definitions of
|
|
|
|
|
* the instance and class structure and the definitions of the instance and
|
|
|
|
|
* class init functions.
|
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Since: 2.4
|
|
|
|
|
*/
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
2004-01-09 15:40:31 +01:00
|
|
|
|
|
2009-12-01 10:33:12 +01:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_INTERFACE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words separated by `_`.
|
|
|
|
|
* @T_P: The #GType of the prerequisite type for the interface, or %G_TYPE_INVALID
|
|
|
|
|
* for no prerequisite type.
|
2009-12-01 10:33:12 +01:00
|
|
|
|
*
|
|
|
|
|
* A convenience macro for #GTypeInterface definitions, which declares
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* a default vtable initialization function and defines a `*_get_type()`
|
2009-12-01 10:33:12 +01:00
|
|
|
|
* function.
|
|
|
|
|
*
|
|
|
|
|
* The macro expects the interface initialization function to have the
|
2014-03-03 00:20:37 +01:00
|
|
|
|
* name `t_n ## _default_init`, and the interface structure to have the
|
|
|
|
|
* name `TN ## Interface`.
|
2009-12-01 10:33:12 +01:00
|
|
|
|
*
|
2018-12-28 00:46:42 +01:00
|
|
|
|
* The initialization function has signature
|
|
|
|
|
* `static void t_n ## _default_init (TypeName##Interface *klass);`, rather than
|
|
|
|
|
* the full #GInterfaceInitFunc signature, for brevity and convenience. If you
|
|
|
|
|
* need to use an initialization function with an `iface_data` argument, you
|
|
|
|
|
* must write the #GTypeInterface definitions manually.
|
|
|
|
|
*
|
2009-12-21 23:04:43 +01:00
|
|
|
|
* Since: 2.24
|
2009-12-01 10:33:12 +01:00
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_INTERFACE_WITH_CODE:
|
|
|
|
|
* @TN: The name of the new type, in Camel case.
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @t_n: The name of the new type, in lowercase, with words separated by `_`.
|
|
|
|
|
* @T_P: The #GType of the prerequisite type for the interface, or %G_TYPE_INVALID
|
|
|
|
|
* for no prerequisite type.
|
|
|
|
|
* @_C_: Custom code that gets inserted in the `*_get_type()` function.
|
2009-12-01 10:33:12 +01:00
|
|
|
|
*
|
2021-07-31 23:47:26 +02:00
|
|
|
|
* A convenience macro for #GTypeInterface definitions.
|
|
|
|
|
*
|
|
|
|
|
* Similar to G_DEFINE_INTERFACE(), but allows you to insert custom code
|
|
|
|
|
* into the `*_get_type()` function, e.g. additional interface implementations
|
|
|
|
|
* via G_IMPLEMENT_INTERFACE(), or additional prerequisite types.
|
|
|
|
|
*
|
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for a similar example using
|
2009-12-01 10:33:12 +01:00
|
|
|
|
* G_DEFINE_TYPE_WITH_CODE().
|
|
|
|
|
*
|
2009-12-21 23:04:43 +01:00
|
|
|
|
* Since: 2.24
|
2009-12-01 10:33:12 +01:00
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
|
|
|
|
|
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_IMPLEMENT_INTERFACE:
|
|
|
|
|
* @TYPE_IFACE: The #GType of the interface to add
|
2018-12-05 15:09:35 +01:00
|
|
|
|
* @iface_init: (type GInterfaceInitFunc): The interface init function, of type #GInterfaceInitFunc
|
2009-04-09 20:56:49 +02:00
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* A convenience macro to ease interface addition in the `_C_` section
|
2009-04-09 20:56:49 +02:00
|
|
|
|
* of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* See G_DEFINE_TYPE_EXTENDED() for an example.
|
2009-04-09 20:56:49 +02:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Note that this macro can only be used together with the `G_DEFINE_TYPE_*`
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* macros, since it depends on variable names from those macros.
|
2009-04-09 20:56:49 +02:00
|
|
|
|
*
|
2008-06-21 18:14:18 +02:00
|
|
|
|
* Since: 2.4
|
2004-01-09 15:40:31 +01:00
|
|
|
|
*/
|
|
|
|
|
#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \
|
2006-09-22 14:06:28 +02:00
|
|
|
|
const GInterfaceInfo g_implement_interface_info = { \
|
2018-02-07 18:27:54 +01:00
|
|
|
|
(GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \
|
2004-01-09 15:40:31 +01:00
|
|
|
|
}; \
|
|
|
|
|
g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
|
|
|
|
|
}
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_ADD_PRIVATE:
|
|
|
|
|
* @TypeName: the name of the type in CamelCase
|
|
|
|
|
*
|
|
|
|
|
* A convenience macro to ease adding private data to instances of a new type
|
|
|
|
|
* in the @_C_ section of G_DEFINE_TYPE_WITH_CODE() or
|
|
|
|
|
* G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
|
|
|
|
|
*
|
|
|
|
|
* For instance:
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* typedef struct _MyObject MyObject;
|
|
|
|
|
* typedef struct _MyObjectClass MyObjectClass;
|
|
|
|
|
*
|
|
|
|
|
* typedef struct {
|
|
|
|
|
* gint foo;
|
|
|
|
|
* gint bar;
|
|
|
|
|
* } MyObjectPrivate;
|
|
|
|
|
*
|
|
|
|
|
* G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT,
|
|
|
|
|
* G_ADD_PRIVATE (MyObject))
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Will add `MyObjectPrivate` as the private data to any instance of the
|
|
|
|
|
* `MyObject` type.
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* `G_DEFINE_TYPE_*` macros will automatically create a private function
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* based on the arguments to this macro, which can be used to safely
|
|
|
|
|
* retrieve the private data from an instance of the type; for instance:
|
|
|
|
|
*
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* gint
|
|
|
|
|
* my_object_get_foo (MyObject *obj)
|
|
|
|
|
* {
|
2013-06-24 16:43:04 +02:00
|
|
|
|
* MyObjectPrivate *priv = my_object_get_instance_private (obj);
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
*
|
2015-09-15 22:42:10 +02:00
|
|
|
|
* g_return_val_if_fail (MY_IS_OBJECT (obj), 0);
|
|
|
|
|
*
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* return priv->foo;
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* void
|
|
|
|
|
* my_object_set_bar (MyObject *obj,
|
|
|
|
|
* gint bar)
|
|
|
|
|
* {
|
2013-06-24 16:43:04 +02:00
|
|
|
|
* MyObjectPrivate *priv = my_object_get_instance_private (obj);
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
*
|
2015-09-15 22:42:10 +02:00
|
|
|
|
* g_return_if_fail (MY_IS_OBJECT (obj));
|
|
|
|
|
*
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* if (priv->bar != bar)
|
|
|
|
|
* priv->bar = bar;
|
|
|
|
|
* }
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2017-12-08 15:34:34 +01:00
|
|
|
|
* Since GLib 2.72, the returned `MyObjectPrivate` pointer is guaranteed to be
|
|
|
|
|
* aligned to at least the alignment of the largest basic GLib type (typically
|
2017-12-08 15:57:28 +01:00
|
|
|
|
* this is #guint64 or #gdouble). If you need larger alignment for an element in
|
|
|
|
|
* the struct, you should allocate it on the heap (aligned), or arrange for your
|
|
|
|
|
* `MyObjectPrivate` struct to be appropriately padded.
|
2017-12-08 15:34:34 +01:00
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Note that this macro can only be used together with the `G_DEFINE_TYPE_*`
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* macros, since it depends on variable names from those macros.
|
|
|
|
|
*
|
2013-07-26 20:40:10 +02:00
|
|
|
|
* Also note that private structs added with these macros must have a struct
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* name of the form `TypeNamePrivate`.
|
2013-07-26 20:40:10 +02:00
|
|
|
|
*
|
2019-07-14 18:50:35 +02:00
|
|
|
|
* It is safe to call the `_get_instance_private` function on %NULL or invalid
|
|
|
|
|
* objects since it's only adding an offset to the instance pointer. In that
|
|
|
|
|
* case the returned pointer must not be dereferenced.
|
2015-09-15 22:42:10 +02:00
|
|
|
|
*
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
* Since: 2.38
|
|
|
|
|
*/
|
|
|
|
|
#define G_ADD_PRIVATE(TypeName) { \
|
|
|
|
|
TypeName##_private_offset = \
|
|
|
|
|
g_type_add_instance_private (g_define_type_id, sizeof (TypeName##Private)); \
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 21:41:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_PRIVATE_OFFSET:
|
|
|
|
|
* @TypeName: the name of the type in CamelCase
|
|
|
|
|
* @field: the name of the field in the private data structure
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to the offset of the @field inside the instance private data
|
|
|
|
|
* structure for @TypeName.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Note that this macro can only be used together with the `G_DEFINE_TYPE_*`
|
2013-06-19 21:41:02 +02:00
|
|
|
|
* and G_ADD_PRIVATE() macros, since it depends on variable names from
|
|
|
|
|
* those macros.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.38
|
|
|
|
|
*/
|
|
|
|
|
#define G_PRIVATE_OFFSET(TypeName, field) \
|
|
|
|
|
(TypeName##_private_offset + (G_STRUCT_OFFSET (TypeName##Private, field)))
|
|
|
|
|
|
2013-06-23 15:50:49 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_PRIVATE_FIELD_P:
|
|
|
|
|
* @TypeName: the name of the type in CamelCase
|
|
|
|
|
* @inst: the instance of @TypeName you wish to access
|
|
|
|
|
* @field_name: the name of the field in the private data structure
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to a pointer to the @field_name inside the @inst private data
|
|
|
|
|
* structure for @TypeName.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Note that this macro can only be used together with the `G_DEFINE_TYPE_*`
|
2013-06-23 15:50:49 +02:00
|
|
|
|
* and G_ADD_PRIVATE() macros, since it depends on variable names from
|
|
|
|
|
* those macros.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.38
|
|
|
|
|
*/
|
|
|
|
|
#define G_PRIVATE_FIELD_P(TypeName, inst, field_name) \
|
|
|
|
|
G_STRUCT_MEMBER_P (inst, G_PRIVATE_OFFSET (TypeName, field_name))
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* G_PRIVATE_FIELD:
|
|
|
|
|
* @TypeName: the name of the type in CamelCase
|
|
|
|
|
* @inst: the instance of @TypeName you wish to access
|
|
|
|
|
* @field_type: the type of the field in the private data structure
|
|
|
|
|
* @field_name: the name of the field in the private data structure
|
|
|
|
|
*
|
|
|
|
|
* Evaluates to the @field_name inside the @inst private data
|
|
|
|
|
* structure for @TypeName.
|
|
|
|
|
*
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* Note that this macro can only be used together with the `G_DEFINE_TYPE_*`
|
2013-06-23 15:50:49 +02:00
|
|
|
|
* and G_ADD_PRIVATE() macros, since it depends on variable names from
|
|
|
|
|
* those macros.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.38
|
|
|
|
|
*/
|
|
|
|
|
#define G_PRIVATE_FIELD(TypeName, inst, field_type, field_name) \
|
|
|
|
|
G_STRUCT_MEMBER (field_type, inst, G_PRIVATE_OFFSET (TypeName, field_name))
|
|
|
|
|
|
2013-06-27 16:15:40 +02:00
|
|
|
|
/* we need to have this macro under conditional expansion, as it references
|
|
|
|
|
* a function that has been added in 2.38. see bug:
|
|
|
|
|
* https://bugzilla.gnome.org/show_bug.cgi?id=703191
|
|
|
|
|
*/
|
|
|
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
|
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
|
2004-01-10 02:46:23 +01:00
|
|
|
|
static void type_name##_class_intern_init (gpointer klass) \
|
|
|
|
|
{ \
|
2004-01-24 18:23:52 +01:00
|
|
|
|
type_name##_parent_class = g_type_class_peek_parent (klass); \
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
if (TypeName##_private_offset != 0) \
|
|
|
|
|
g_type_class_adjust_private_offset (klass, &TypeName##_private_offset); \
|
2004-01-10 02:46:23 +01:00
|
|
|
|
type_name##_class_init ((TypeName##Class*) klass); \
|
2013-06-27 16:15:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
|
|
|
|
|
static void type_name##_class_intern_init (gpointer klass) \
|
|
|
|
|
{ \
|
|
|
|
|
type_name##_parent_class = g_type_class_peek_parent (klass); \
|
|
|
|
|
type_name##_class_init ((TypeName##Class*) klass); \
|
|
|
|
|
}
|
|
|
|
|
#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 */
|
|
|
|
|
|
2023-09-12 10:26:21 +02:00
|
|
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_80
|
|
|
|
|
#define _g_type_once_init_type GType
|
|
|
|
|
#define _g_type_once_init_enter g_once_init_enter_pointer
|
|
|
|
|
#define _g_type_once_init_leave g_once_init_leave_pointer
|
|
|
|
|
#else /* if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_80 */
|
|
|
|
|
#define _g_type_once_init_type gsize
|
|
|
|
|
#define _g_type_once_init_enter g_once_init_enter
|
|
|
|
|
#define _g_type_once_init_leave g_once_init_leave
|
|
|
|
|
#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_80 */
|
|
|
|
|
|
2017-05-19 21:54:39 +02:00
|
|
|
|
/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
|
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
|
2013-06-27 16:15:40 +02:00
|
|
|
|
\
|
|
|
|
|
static void type_name##_init (TypeName *self); \
|
|
|
|
|
static void type_name##_class_init (TypeName##Class *klass); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType type_name##_get_type_once (void); \
|
2013-06-27 16:15:40 +02:00
|
|
|
|
static gpointer type_name##_parent_class = NULL; \
|
|
|
|
|
static gint TypeName##_private_offset; \
|
|
|
|
|
\
|
|
|
|
|
_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
|
2004-01-10 02:46:23 +01:00
|
|
|
|
\
|
2014-02-09 23:08:21 +01:00
|
|
|
|
G_GNUC_UNUSED \
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
static inline gpointer \
|
2016-01-18 19:48:42 +01:00
|
|
|
|
type_name##_get_instance_private (TypeName *self) \
|
Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.
The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.
For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.
https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-05-09 23:41:26 +02:00
|
|
|
|
{ \
|
|
|
|
|
return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \
|
|
|
|
|
} \
|
|
|
|
|
\
|
2004-01-10 02:46:23 +01:00
|
|
|
|
GType \
|
|
|
|
|
type_name##_get_type (void) \
|
|
|
|
|
{ \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
static _g_type_once_init_type static_g_define_type_id = 0;
|
2017-05-19 21:54:39 +02:00
|
|
|
|
/* Prelude goes here */
|
|
|
|
|
|
|
|
|
|
/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
|
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
if (_g_type_once_init_enter (&static_g_define_type_id)) \
|
2004-01-10 02:46:23 +01:00
|
|
|
|
{ \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
GType g_define_type_id = type_name##_get_type_once (); \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
_g_type_once_init_leave (&static_g_define_type_id, g_define_type_id); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
2020-11-11 19:12:22 +01:00
|
|
|
|
return static_g_define_type_id; \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} /* closes type_name##_get_type() */ \
|
|
|
|
|
\
|
2022-06-24 14:46:41 +02:00
|
|
|
|
G_NO_INLINE \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType \
|
|
|
|
|
type_name##_get_type_once (void) \
|
|
|
|
|
{ \
|
|
|
|
|
GType g_define_type_id = \
|
2006-04-21 18:53:02 +02:00
|
|
|
|
g_type_register_static_simple (TYPE_PARENT, \
|
|
|
|
|
g_intern_static_string (#TypeName), \
|
|
|
|
|
sizeof (TypeName##Class), \
|
2018-02-07 18:27:54 +01:00
|
|
|
|
(GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \
|
2006-04-21 18:53:02 +02:00
|
|
|
|
sizeof (TypeName), \
|
2018-02-07 18:27:54 +01:00
|
|
|
|
(GInstanceInitFunc)(void (*)(void)) type_name##_init, \
|
2006-04-21 18:53:02 +02:00
|
|
|
|
(GTypeFlags) flags); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
{ /* custom code follows */
|
2006-05-02 15:00:52 +02:00
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_END() \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
/* following custom code */ \
|
2006-05-02 15:00:52 +02:00
|
|
|
|
} \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
return g_define_type_id; \
|
|
|
|
|
} /* closes type_name##_get_type_once() */
|
2004-01-10 02:46:23 +01:00
|
|
|
|
|
2017-05-19 21:54:39 +02:00
|
|
|
|
/* This was defined before we had G_DEFINE_TYPE_WITH_CODE_AND_PRELUDE, it's simplest
|
|
|
|
|
* to keep it.
|
|
|
|
|
*/
|
|
|
|
|
#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
|
|
|
|
|
_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
|
|
|
|
|
_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
|
|
|
|
|
|
2022-03-31 14:58:36 +02:00
|
|
|
|
/* Intentionally using (GTypeFlags) 0 instead of G_TYPE_FLAG_NONE here,
|
|
|
|
|
* to avoid deprecation warnings with older GLIB_VERSION_MAX_ALLOWED */
|
2009-12-01 10:33:12 +01:00
|
|
|
|
#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \
|
|
|
|
|
\
|
|
|
|
|
static void type_name##_default_init (TypeName##Interface *klass); \
|
|
|
|
|
\
|
|
|
|
|
GType \
|
|
|
|
|
type_name##_get_type (void) \
|
|
|
|
|
{ \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
static _g_type_once_init_type static_g_define_type_id = 0; \
|
|
|
|
|
if (_g_type_once_init_enter (&static_g_define_type_id)) \
|
2009-12-01 10:33:12 +01:00
|
|
|
|
{ \
|
|
|
|
|
GType g_define_type_id = \
|
|
|
|
|
g_type_register_static_simple (G_TYPE_INTERFACE, \
|
|
|
|
|
g_intern_static_string (#TypeName), \
|
|
|
|
|
sizeof (TypeName##Interface), \
|
2018-02-16 18:42:55 +01:00
|
|
|
|
(GClassInitFunc)(void (*)(void)) type_name##_default_init, \
|
2009-12-01 10:33:12 +01:00
|
|
|
|
0, \
|
|
|
|
|
(GInstanceInitFunc)NULL, \
|
|
|
|
|
(GTypeFlags) 0); \
|
Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++
Note that it's not reported with gcc. It's only reported with g++.
C++ code to reproduce this warning:
#include <glib-object.h>
G_BEGIN_DECLS
#define GARROW_TYPE_FILE (garrow_file_get_type())
G_DECLARE_INTERFACE(GArrowFile,
garrow_file,
GARROW,
FILE,
GObject)
struct _GArrowFileInterface {
GTypeInterface g_iface;
};
G_DEFINE_INTERFACE(GArrowFile,
garrow_file,
G_TYPE_OBJECT)
static void
garrow_file_default_init(GArrowFileInterface *iface)
{
}
G_END_DECLS
Build command line:
% g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)
Message:
In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
from a.cpp:1:
a.cpp: In function 'GType garrow_file_get_type()':
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
if (TYPE_PREREQ) \
^~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
G_DEFINE_INTERFACE(GArrowFile,
^~~~~~~~~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
^~~~~~~~~~~~~~~~~~~~~~~
a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
G_TYPE_OBJECT)
^~~~~~~~~~~~~
2018-12-20 03:24:53 +01:00
|
|
|
|
if (TYPE_PREREQ != G_TYPE_INVALID) \
|
2009-12-01 10:33:12 +01:00
|
|
|
|
g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \
|
|
|
|
|
{ /* custom code follows */
|
|
|
|
|
#define _G_DEFINE_INTERFACE_EXTENDED_END() \
|
|
|
|
|
/* following custom code */ \
|
|
|
|
|
} \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
_g_type_once_init_leave (&static_g_define_type_id, g_define_type_id); \
|
2009-12-01 10:33:12 +01:00
|
|
|
|
} \
|
2020-11-11 19:12:22 +01:00
|
|
|
|
return static_g_define_type_id; \
|
2009-12-01 10:33:12 +01:00
|
|
|
|
} /* closes type_name##_get_type() */
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2008-05-24 16:08:04 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_BOXED_TYPE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @TypeName: The name of the new type, in Camel case
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @type_name: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @copy_func: the #GBoxedCopyFunc for the new type
|
|
|
|
|
* @free_func: the #GBoxedFreeFunc for the new type
|
|
|
|
|
*
|
2021-07-22 14:16:41 +02:00
|
|
|
|
* A convenience macro for defining a new custom boxed type.
|
|
|
|
|
*
|
|
|
|
|
* Using this macro is the recommended way of defining new custom boxed
|
|
|
|
|
* types, over calling g_boxed_type_register_static() directly. It defines
|
|
|
|
|
* a `type_name_get_type()` function which will return the newly defined
|
|
|
|
|
* #GType, enabling lazy instantiation.
|
|
|
|
|
*
|
2022-04-25 12:39:27 +02:00
|
|
|
|
* You might start by putting declarations in a header as follows:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* #define MY_TYPE_STRUCT my_struct_get_type ()
|
|
|
|
|
* GType my_struct_get_type (void) G_GNUC_CONST;
|
|
|
|
|
*
|
|
|
|
|
* MyStruct * my_struct_new (void);
|
|
|
|
|
* void my_struct_free (MyStruct *self);
|
|
|
|
|
* MyStruct * my_struct_copy (MyStruct *self);
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
|
|
|
|
* And then use this macro and define your implementation in the source file as
|
|
|
|
|
* follows:
|
|
|
|
|
*
|
2021-07-22 14:16:41 +02:00
|
|
|
|
* |[<!-- language="C" -->
|
2022-04-25 12:39:27 +02:00
|
|
|
|
* MyStruct *
|
|
|
|
|
* my_struct_new (void)
|
|
|
|
|
* {
|
|
|
|
|
* // ... your code to allocate a new MyStruct ...
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* void
|
|
|
|
|
* my_struct_free (MyStruct *self)
|
|
|
|
|
* {
|
|
|
|
|
* // ... your code to free a MyStruct ...
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* MyStruct *
|
|
|
|
|
* my_struct_copy (MyStruct *self)
|
|
|
|
|
* {
|
|
|
|
|
* // ... your code return a newly allocated copy of a MyStruct ...
|
|
|
|
|
* }
|
|
|
|
|
*
|
2021-07-22 14:16:41 +02:00
|
|
|
|
* G_DEFINE_BOXED_TYPE (MyStruct, my_struct, my_struct_copy, my_struct_free)
|
|
|
|
|
*
|
|
|
|
|
* void
|
|
|
|
|
* foo ()
|
|
|
|
|
* {
|
2022-04-25 12:39:27 +02:00
|
|
|
|
* MyStruct *ms;
|
|
|
|
|
*
|
|
|
|
|
* ms = my_struct_new ();
|
2021-07-22 14:16:41 +02:00
|
|
|
|
* // ... your code ...
|
2022-04-25 12:39:27 +02:00
|
|
|
|
* my_struct_free (ms);
|
2021-07-22 14:16:41 +02:00
|
|
|
|
* }
|
|
|
|
|
* ]|
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.26
|
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {})
|
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_BOXED_TYPE_WITH_CODE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @TypeName: The name of the new type, in Camel case
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @type_name: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @copy_func: the #GBoxedCopyFunc for the new type
|
|
|
|
|
* @free_func: the #GBoxedFreeFunc for the new type
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* @_C_: Custom code that gets inserted in the `*_get_type()` function
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* A convenience macro for boxed type implementations.
|
2021-07-31 23:47:26 +02:00
|
|
|
|
*
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* `type_name_get_type()` function, e.g. to register value transformations with
|
2015-04-20 15:11:12 +02:00
|
|
|
|
* g_value_register_transform_func(), for instance:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* G_DEFINE_BOXED_TYPE_WITH_CODE (GdkRectangle, gdk_rectangle,
|
|
|
|
|
* gdk_rectangle_copy,
|
|
|
|
|
* gdk_rectangle_free,
|
|
|
|
|
* register_rectangle_transform_funcs (g_define_type_id))
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2022-03-04 17:21:55 +01:00
|
|
|
|
* Similarly to the `G_DEFINE_TYPE_*` family of macros, the #GType of the newly
|
2015-04-20 15:11:12 +02:00
|
|
|
|
* defined boxed type is exposed in the `g_define_type_id` variable.
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.26
|
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
|
|
|
|
|
2013-09-19 08:41:22 +02:00
|
|
|
|
/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64.
|
|
|
|
|
* See https://bugzilla.gnome.org/show_bug.cgi?id=647145
|
|
|
|
|
*/
|
2022-09-14 01:31:39 +02:00
|
|
|
|
#if !defined (G_CXX_STD_VERSION) && (G_GNUC_CHECK_VERSION(2, 7)) && \
|
|
|
|
|
!(defined (__APPLE__) && defined (__ppc64__))
|
2008-05-24 16:08:04 +02:00
|
|
|
|
#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType type_name##_get_type_once (void); \
|
|
|
|
|
\
|
2008-05-24 16:08:04 +02:00
|
|
|
|
GType \
|
|
|
|
|
type_name##_get_type (void) \
|
|
|
|
|
{ \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
static _g_type_once_init_type static_g_define_type_id = 0; \
|
|
|
|
|
if (_g_type_once_init_enter (&static_g_define_type_id)) \
|
2008-05-24 16:08:04 +02:00
|
|
|
|
{ \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
GType g_define_type_id = type_name##_get_type_once (); \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
_g_type_once_init_leave (&static_g_define_type_id, g_define_type_id); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
2020-11-11 19:12:22 +01:00
|
|
|
|
return static_g_define_type_id; \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
|
|
|
|
\
|
2022-06-24 14:46:41 +02:00
|
|
|
|
G_NO_INLINE \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType \
|
|
|
|
|
type_name##_get_type_once (void) \
|
|
|
|
|
{ \
|
|
|
|
|
GType (* _g_register_boxed) \
|
|
|
|
|
(const gchar *, \
|
|
|
|
|
union \
|
|
|
|
|
{ \
|
|
|
|
|
TypeName * (*do_copy_type) (TypeName *); \
|
|
|
|
|
TypeName * (*do_const_copy_type) (const TypeName *); \
|
|
|
|
|
GBoxedCopyFunc do_copy_boxed; \
|
|
|
|
|
} __attribute__((__transparent_union__)), \
|
|
|
|
|
union \
|
|
|
|
|
{ \
|
|
|
|
|
void (* do_free_type) (TypeName *); \
|
|
|
|
|
GBoxedFreeFunc do_free_boxed; \
|
|
|
|
|
} __attribute__((__transparent_union__)) \
|
|
|
|
|
) = g_boxed_type_register_static; \
|
|
|
|
|
GType g_define_type_id = \
|
|
|
|
|
_g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \
|
|
|
|
|
{ /* custom code follows */
|
2008-05-24 16:08:04 +02:00
|
|
|
|
#else
|
|
|
|
|
#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType type_name##_get_type_once (void); \
|
|
|
|
|
\
|
2008-05-24 16:08:04 +02:00
|
|
|
|
GType \
|
|
|
|
|
type_name##_get_type (void) \
|
|
|
|
|
{ \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
static _g_type_once_init_type static_g_define_type_id = 0; \
|
|
|
|
|
if (_g_type_once_init_enter (&static_g_define_type_id)) \
|
2008-05-24 16:08:04 +02:00
|
|
|
|
{ \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
GType g_define_type_id = type_name##_get_type_once (); \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
_g_type_once_init_leave (&static_g_define_type_id, g_define_type_id); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
2020-11-11 19:12:22 +01:00
|
|
|
|
return static_g_define_type_id; \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
|
|
|
|
\
|
2022-06-24 14:46:41 +02:00
|
|
|
|
G_NO_INLINE \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType \
|
|
|
|
|
type_name##_get_type_once (void) \
|
|
|
|
|
{ \
|
|
|
|
|
GType g_define_type_id = \
|
|
|
|
|
g_boxed_type_register_static (g_intern_static_string (#TypeName), \
|
|
|
|
|
(GBoxedCopyFunc) copy_func, \
|
|
|
|
|
(GBoxedFreeFunc) free_func); \
|
|
|
|
|
{ /* custom code follows */
|
2008-05-24 16:08:04 +02:00
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_POINTER_TYPE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @TypeName: The name of the new type, in Camel case
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @type_name: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* A convenience macro for pointer type implementations, which defines a
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* `type_name_get_type()` function registering the pointer type.
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.26
|
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_POINTER_TYPE(TypeName, type_name) G_DEFINE_POINTER_TYPE_WITH_CODE (TypeName, type_name, {})
|
|
|
|
|
/**
|
|
|
|
|
* G_DEFINE_POINTER_TYPE_WITH_CODE:
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* @TypeName: The name of the new type, in Camel case
|
2008-05-24 16:08:04 +02:00
|
|
|
|
* @type_name: The name of the new type, in lowercase, with words
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* separated by `_`
|
|
|
|
|
* @_C_: Custom code that gets inserted in the `*_get_type()` function
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* A convenience macro for pointer type implementations.
|
2014-06-01 02:55:00 +02:00
|
|
|
|
* Similar to G_DEFINE_POINTER_TYPE(), but allows to insert
|
2021-01-20 16:42:55 +01:00
|
|
|
|
* custom code into the `type_name_get_type()` function.
|
2008-05-24 16:08:04 +02:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.26
|
|
|
|
|
*/
|
|
|
|
|
#define G_DEFINE_POINTER_TYPE_WITH_CODE(TypeName, type_name, _C_) _G_DEFINE_POINTER_TYPE_BEGIN (TypeName, type_name) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
|
|
|
|
|
|
|
|
|
|
#define _G_DEFINE_POINTER_TYPE_BEGIN(TypeName, type_name) \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType type_name##_get_type_once (void); \
|
|
|
|
|
\
|
2008-05-24 16:08:04 +02:00
|
|
|
|
GType \
|
|
|
|
|
type_name##_get_type (void) \
|
|
|
|
|
{ \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
static _g_type_once_init_type static_g_define_type_id = 0; \
|
|
|
|
|
if (_g_type_once_init_enter (&static_g_define_type_id)) \
|
2008-05-24 16:08:04 +02:00
|
|
|
|
{ \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
GType g_define_type_id = type_name##_get_type_once (); \
|
2023-09-12 10:26:21 +02:00
|
|
|
|
_g_type_once_init_leave (&static_g_define_type_id, g_define_type_id); \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
2020-11-11 19:12:22 +01:00
|
|
|
|
return static_g_define_type_id; \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
} \
|
|
|
|
|
\
|
2022-06-24 14:46:41 +02:00
|
|
|
|
G_NO_INLINE \
|
2018-05-05 00:41:08 +02:00
|
|
|
|
static GType \
|
|
|
|
|
type_name##_get_type_once (void) \
|
|
|
|
|
{ \
|
|
|
|
|
GType g_define_type_id = \
|
|
|
|
|
g_pointer_type_register_static (g_intern_static_string (#TypeName)); \
|
|
|
|
|
{ /* custom code follows */
|
2008-05-24 16:08:04 +02:00
|
|
|
|
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
/* --- protected (for fundamental type implementations) --- */
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
GTypePlugin* g_type_get_plugin (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2000-11-11 01:03:19 +01:00
|
|
|
|
GTypePlugin* g_type_interface_get_plugin (GType instance_type,
|
2002-12-04 00:54:55 +01:00
|
|
|
|
GType interface_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-22 00:48:19 +01:00
|
|
|
|
GType g_type_fundamental_next (void);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-22 00:48:19 +01:00
|
|
|
|
GType g_type_fundamental (GType type_id);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
GTypeInstance* g_type_create_instance (GType type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
void g_type_free_instance (GTypeInstance *instance);
|
2003-10-02 07:24:21 +02:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
void g_type_add_class_cache_func (gpointer cache_data,
|
|
|
|
|
GTypeClassCacheFunc cache_func);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
void g_type_remove_class_cache_func (gpointer cache_data,
|
|
|
|
|
GTypeClassCacheFunc cache_func);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
void g_type_class_unref_uncached (gpointer g_class);
|
2003-10-02 07:24:21 +02:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-10-02 07:24:21 +02:00
|
|
|
|
void g_type_add_interface_check (gpointer check_data,
|
|
|
|
|
GTypeInterfaceCheckFunc check_func);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2003-10-02 07:24:21 +02:00
|
|
|
|
void g_type_remove_interface_check (gpointer check_data,
|
2004-10-24 03:22:30 +02:00
|
|
|
|
GTypeInterfaceCheckFunc check_func);
|
2003-10-02 07:24:21 +02:00
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-13 22:49:13 +01:00
|
|
|
|
GTypeValueTable* g_type_value_table_peek (GType type);
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*< private >*/
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2007-03-12 13:28:56 +01:00
|
|
|
|
gboolean g_type_check_instance (GTypeInstance *instance) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
GTypeInstance* g_type_check_instance_cast (GTypeInstance *instance,
|
|
|
|
|
GType iface_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-13 22:49:13 +01:00
|
|
|
|
gboolean g_type_check_instance_is_a (GTypeInstance *instance,
|
2007-03-12 13:28:56 +01:00
|
|
|
|
GType iface_type) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_2_42
|
2014-05-28 10:57:28 +02:00
|
|
|
|
gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *instance,
|
|
|
|
|
GType fundamental_type) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-01-09 03:18:57 +01:00
|
|
|
|
GTypeClass* g_type_check_class_cast (GTypeClass *g_class,
|
|
|
|
|
GType is_a_type);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-13 22:49:13 +01:00
|
|
|
|
gboolean g_type_check_class_is_a (GTypeClass *g_class,
|
2007-03-12 13:28:56 +01:00
|
|
|
|
GType is_a_type) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2007-03-12 13:28:56 +01:00
|
|
|
|
gboolean g_type_check_is_value_type (GType type) G_GNUC_CONST;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2014-08-08 13:01:10 +02:00
|
|
|
|
gboolean g_type_check_value (const GValue *value) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2014-08-08 13:01:10 +02:00
|
|
|
|
gboolean g_type_check_value_holds (const GValue *value,
|
2007-03-12 13:28:56 +01:00
|
|
|
|
GType type) G_GNUC_PURE;
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2001-11-13 22:49:13 +01:00
|
|
|
|
gboolean g_type_test_flags (GType type,
|
2007-03-12 13:28:56 +01:00
|
|
|
|
guint flags) G_GNUC_CONST;
|
define gstring in terms of gchar*. this typedef reflects the type name of
Fri Jun 23 17:20:26 2000 Tim Janik <timj@gtk.org>
* glib.h: define gstring in terms of gchar*. this typedef reflects
the type name of the primitive G_TYPE_STRING in the gobject module.
Sat Jun 24 23:03:04 2000 Tim Janik <timj@gtk.org>
* gtype.[hc]: provide G_TYPE_CHAR, G_TYPE_UCHAR, G_TYPE_BOOLEAN,
G_TYPE_INT, G_TYPE_UINT, G_TYPE_LONG, G_TYPE_ULONG, G_TYPE_FLOAT,
G_TYPE_DOUBLE and G_TYPE_STRING fundamental types.
added a GTypeValueTable* pointer to GTypeInfo structure for types
to implement GValue handling functions.
GTypeValueTable contains the following members:
value_init(): initialize a GValue structure.
value_free(): free GValue structure contents (optional).
value_copy(): copy one GValue contents to another GValue structure of
collect_type: varargs collection type for the first variable argument
to be collected by collect_value().
collect_value(): variable arguments collection function (optional).
lcopy_type: varargs collection type for the first variable argument
to be location copyied by lcopy_value().
lcopy_value(): variable arguments location copy function (optional).
g_type_value_table_peek(): new function to retrive the GTypeValueTable*
for a type node. ValueTables get inherited from parent types, unless
overridden through the GTypeInfo structure. internally, GTypeValueTable
support means an added overhead of one pointer per static or used
dynamic type node.
g_type_add_class_cache_func(): provide a cache_func/data pair to be
called prior to a type nodes last_unref() function, this can be used
to prevent premature class destruction. multiple installed cache_func()
will be chained upon last_unref() untill one of them returns TRUE.
the cache_func()s have to check the type id passed in to figure whether
they actually wants to cache the class of this type (since any types are
routed through the cache_func() chain).
g_type_remove_class_cache_func(): remove a previously installed
cache_func/data pair. the cache maintained by this function has to be
clear when calling g_type_remove_class_cache_func() to avoid leaks.
g_type_class_unref_uncached(): class unref function for cache_func()
implementations, unreferences a class omitting the cache chain (and
therefore unref->cache->unref->... loops).
* gvaluetypes.[hc]: provide the value setters/getters for the primitive
fundamental types boolean, char, uchar, int, uint, long, ulong, float,
double and string.
* gvalue.[hc]: provide G_TYPE_IS_VALUE() in terms of whether a
GTypeValueTable is provided for this type.
removed g_value_init_default(), g_value_validate(), g_value_defaults(),
g_value_set_default() and g_values_cmp() as these are supplied by the
GParamSpec API now.
moved g_values_exchange() into the "implementation details" section,
since it just provides the underlying functionality for
g_value_convert().
* gvaluecollector.h: renamed the varargs value container from
GParamCValue to GTypeCValue as the value collection methods are
supplied by the type system now.
G_PARAM_COLLECT_VALUE() and G_PARAM_LCOPY_VALUE() got renamed to
G_VALUE_COLLECT() and G_VALUE_LCOPY() and operate without a
GParamSpec structure now.
* genums.h: macros cleanups/fixes.
* genum.c: provide G_TYPE_ENUM and G_TYPE_FLAGS type
and assorted g_value_{s|g}et_{enum|flags}() implementations.
* gobject.[hc]:
provide G_IS_VALUE_OBJECT(), G_TYPE_OBJECT ValueTable methods
and g_value_{s|g}et_object().
* gparam.[hc]: reduced class to value_set_default(),
value_validate() and values_cmp(). also parameters now need to fill
in a GType value_type; field to indicate the GValue type they
are handling. provide g_param_value_set_default(),
g_param_value_defaults(), g_param_value_validate() and
g_param_values_cmp().
* gparamspecs.[hc]: got rid of the g_value_* functions and
the G_IS_VALUE_* macros. adapted param spec implementations
according to the GParamSpecClass changes.
2000-06-25 00:30:10 +02:00
|
|
|
|
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
2001-06-20 04:32:10 +02:00
|
|
|
|
/* --- debugging functions --- */
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
|
const gchar * g_type_name_from_instance (GTypeInstance *instance);
|
2022-10-05 19:39:21 +02:00
|
|
|
|
GOBJECT_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
|
const gchar * g_type_name_from_class (GTypeClass *g_class);
|
2001-06-20 04:32:10 +02:00
|
|
|
|
|
|
|
|
|
|
2001-02-04 08:03:52 +01:00
|
|
|
|
/* --- implementation bits --- */
|
2022-10-17 16:13:32 +02:00
|
|
|
|
#if defined(G_DISABLE_CAST_CHECKS) || defined(__OPTIMIZE__)
|
gtype: avoid "-Wcast-align" warning with optimized G_TYPE_CHECK_INSTANCE_CAST()
We can get a "-Wcast-align", if the target type that we cast to ("ct") has a
larger alignment than GTypeInstance.
That can happen on i686 architecture, if the GObject type has larger
alignment than the parent struct (or GObject). Since on i686, embeding
a "long long" or a "long double" in a struct still does not increase
the alignment beyond 4 bytes, this usually only happens when using the
__attribute__() to increase the alignment (or to have a field that has
the alignment increased).
It can happen on x86_64 when having a "long double" field.
The compiler warning is hard to avoid but not very useful, because it purely
operates on the pointer types at compile time. G_TYPE_CHECK_INSTANCE_CAST()
instead asserts (in non-optimized mode) that the pointer really points
to the expected GTypeInstance (and if that's the case, then the alignment
should be suitable already).
This is like in commit ed553e8e309d ('gtype: Eliminate -Wcast-align warnings
with G_TYPE_CHECK_INSTANCE_CAST'). But also fix the optimized code path.
With the unpatched G_TYPE_CHECK_INSTANCE_CAST() macro, the unit test would
now show the problem (with gcc-9.3.1-2.fc30.i686 or
gcc-12.2.1-4.fc37.x86_64):
$ export G_DISABLE_CAST_CHECKS=1
$ export CFLAGS='-Wcast-align=strict'
$ meson build
$ ninja -C build
...
In file included from ../gobject/gobject.h:26,
from ../gobject/gbinding.h:31,
from ../glib/glib-object.h:24,
from ../gobject/tests/objects-refcount1.c:2:
../gobject/tests/objects-refcount1.c: In function ‘my_test_dispose’:
../gobject/gtype.h:2523:42: warning: cast increases required alignment of target type [-Wcast-align]
2523 | # define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
| ^
../gobject/gtype.h:517:66: note: in expansion of macro ‘_G_TYPE_CIC’
517 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
| ^~~~~~~~~~~
../gobject/tests/objects-refcount1.c:9:37: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’
9 | #define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../gobject/tests/objects-refcount1.c:96:10: note: in expansion of macro ‘MY_TEST’
96 | test = MY_TEST (object);
| ^~~~~~~
2022-12-15 18:29:08 +01:00
|
|
|
|
# define _G_TYPE_CIC(ip, gt, ct) ((ct*) (void *) ip)
|
|
|
|
|
# define _G_TYPE_CCC(cp, gt, ct) ((ct*) (void *) cp)
|
Automatically disable cast checks when building with optimization
Cast checks are slow. We seem to have some rough consensus that they are
important for debug builds, but not for release builds. Problem is, very
few apps define G_DISABLE_CAST_CHECKS for release builds. Worse, it's
undocumented, so there's no way apps could even be expected to know
about it.
We can get the right default is almost all situations by making this
depend on the __OPTIMIZE__ preprocessor definition. This is a GCC-specific
thing, although Clang supports it too. If the compiler does not define
__OPTIMIZE__, then this commit does no harm: you can still use
G_DISABLE_CAST_CHECKS as before. When checking __OPTIMIZE__, we are
supposed to ensure our code has the same behavior as it would if we do
not, which will be true except in case the check fails (which is
programmer error).
Downside: this will not automatically do the right thing with -Og,
because __OPTIMIZE__ is always defined to 1. We don't want to disable
cast checks automatically if using -O0 or -Og. There's no way to
automatically fix this, but we can create an escape hatch by allowing
you to define G_DISABLE_CAST_CHECKS=0 to force-enable cast checks. In
practice, I don't think this matters much because -Og kinda failed:
GCC's man page says it should be a superior debugging experience to -O0,
but it optimizes variables away so it's definitely not.
Another downside: this is bad if you really *do* want cast checks in
release builds. The same solution applies: define
G_DISABLE_CAST_CHECKS=0 and you'll get your cast checks.
2022-08-03 22:31:30 +02:00
|
|
|
|
#else
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
# define _G_TYPE_CIC(ip, gt, ct) \
|
2017-12-08 15:53:58 +01:00
|
|
|
|
((ct*) (void *) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
# define _G_TYPE_CCC(cp, gt, ct) \
|
2017-12-08 15:53:58 +01:00
|
|
|
|
((ct*) (void *) g_type_check_class_cast ((GTypeClass*) cp, gt))
|
Automatically disable cast checks when building with optimization
Cast checks are slow. We seem to have some rough consensus that they are
important for debug builds, but not for release builds. Problem is, very
few apps define G_DISABLE_CAST_CHECKS for release builds. Worse, it's
undocumented, so there's no way apps could even be expected to know
about it.
We can get the right default is almost all situations by making this
depend on the __OPTIMIZE__ preprocessor definition. This is a GCC-specific
thing, although Clang supports it too. If the compiler does not define
__OPTIMIZE__, then this commit does no harm: you can still use
G_DISABLE_CAST_CHECKS as before. When checking __OPTIMIZE__, we are
supposed to ensure our code has the same behavior as it would if we do
not, which will be true except in case the check fails (which is
programmer error).
Downside: this will not automatically do the right thing with -Og,
because __OPTIMIZE__ is always defined to 1. We don't want to disable
cast checks automatically if using -O0 or -Og. There's no way to
automatically fix this, but we can create an escape hatch by allowing
you to define G_DISABLE_CAST_CHECKS=0 to force-enable cast checks. In
practice, I don't think this matters much because -Og kinda failed:
GCC's man page says it should be a superior debugging experience to -O0,
but it optimizes variables away so it's definitely not.
Another downside: this is bad if you really *do* want cast checks in
release builds. The same solution applies: define
G_DISABLE_CAST_CHECKS=0 and you'll get your cast checks.
2022-08-03 22:31:30 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip))
|
|
|
|
|
#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
|
2000-11-05 06:07:26 +01:00
|
|
|
|
#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
|
2014-05-28 10:57:28 +02:00
|
|
|
|
#define _G_TYPE_CIFT(ip, ft) (g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ip, ft))
|
2001-08-15 11:19:52 +02:00
|
|
|
|
#ifdef __GNUC__
|
2002-09-12 06:03:54 +02:00
|
|
|
|
# define _G_TYPE_CIT(ip, gt) (G_GNUC_EXTENSION ({ \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \
|
2009-09-19 01:16:11 +02:00
|
|
|
|
if (!__inst) \
|
|
|
|
|
__r = FALSE; \
|
|
|
|
|
else if (__inst->g_class && __inst->g_class->g_type == __t) \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
__r = TRUE; \
|
|
|
|
|
else \
|
2001-11-13 22:49:13 +01:00
|
|
|
|
__r = g_type_check_instance_is_a (__inst, __t); \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
__r; \
|
2002-09-12 06:03:54 +02:00
|
|
|
|
}))
|
|
|
|
|
# define _G_TYPE_CCT(cp, gt) (G_GNUC_EXTENSION ({ \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \
|
2009-09-19 01:16:11 +02:00
|
|
|
|
if (!__class) \
|
|
|
|
|
__r = FALSE; \
|
|
|
|
|
else if (__class->g_type == __t) \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
__r = TRUE; \
|
|
|
|
|
else \
|
2001-11-13 22:49:13 +01:00
|
|
|
|
__r = g_type_check_class_is_a (__class, __t); \
|
2001-08-15 11:19:52 +02:00
|
|
|
|
__r; \
|
2002-09-12 06:03:54 +02:00
|
|
|
|
}))
|
2004-02-03 21:30:23 +01:00
|
|
|
|
# define _G_TYPE_CVH(vl, gt) (G_GNUC_EXTENSION ({ \
|
2014-08-08 13:01:10 +02:00
|
|
|
|
const GValue *__val = (const GValue*) vl; GType __t = gt; gboolean __r; \
|
2009-09-19 01:16:11 +02:00
|
|
|
|
if (!__val) \
|
|
|
|
|
__r = FALSE; \
|
2009-10-03 12:37:36 +02:00
|
|
|
|
else if (__val->g_type == __t) \
|
2004-02-03 21:30:23 +01:00
|
|
|
|
__r = TRUE; \
|
|
|
|
|
else \
|
|
|
|
|
__r = g_type_check_value_holds (__val, __t); \
|
|
|
|
|
__r; \
|
|
|
|
|
}))
|
2001-08-15 11:19:52 +02:00
|
|
|
|
#else /* !__GNUC__ */
|
2001-11-13 22:49:13 +01:00
|
|
|
|
# define _G_TYPE_CIT(ip, gt) (g_type_check_instance_is_a ((GTypeInstance*) ip, gt))
|
|
|
|
|
# define _G_TYPE_CCT(cp, gt) (g_type_check_class_is_a ((GTypeClass*) cp, gt))
|
2014-08-08 13:01:10 +02:00
|
|
|
|
# define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((const GValue*) vl, gt))
|
2001-08-15 11:19:52 +02:00
|
|
|
|
#endif /* !__GNUC__ */
|
2008-06-21 18:14:18 +02:00
|
|
|
|
/**
|
|
|
|
|
* G_TYPE_FLAG_RESERVED_ID_BIT:
|
|
|
|
|
*
|
|
|
|
|
* A bit in the type number that's supposed to be left untouched.
|
|
|
|
|
*/
|
2002-01-04 04:38:53 +01:00
|
|
|
|
#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0))
|
added newly added gobject/ headers.
Tue Oct 24 22:09:14 2000 Tim Janik <timj@gtk.org>
* glib-object.h: added newly added gobject/ headers.
* gmesage.c: print g_message() output to stderr instead of stdout.
Wed Oct 25 20:27:02 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_free_instance): for the moment, freeing object
structures will fill their memory portion with 0xAA. there's a
FIXME there, remove this line at a later point.
Tue Oct 24 23:10:26 2000 Tim Janik <timj@gtk.org>
* glib-genmarshal.1:
* glib-genmarshal.c: added publically installed marshaller generator.
* gtype.h: added G_TYPE_INSTANCE_GET_INTERFACE() to retrive a certain
interface VTable from instances.
Mon Oct 23 08:28:15 2000 Tim Janik <timj@gtk.org>
* gobject.[hc]: new functions for closure maintenance:
(g_object_watch_closure): maintain validity of the object and
the closure for objects that are used as data part of a closure.
(g_cclosure_new_object): convenience function to create C closures
that have an object as data argument.
(g_closure_new_object): convenience function to create closures
that have an object as data argument.
* gclosure.[hc]: implementation of GClosure mechanism.
a closure is basically an encapsulation of a callback function
and its environment. ideally, most places supporting callback
functions will simply take a GClosure* pointer and thus unify
callback environments wrg destroy notification etc.
GClosure provides destroy notifiers for arbitrary data pointers,
reference counting, invalidation notification (it can be invalidated
which is merely a deactivate state) and a marshallinbg abstraction.
GCClosure is also provided in these files, they present a specialized
GClosure implementation for C language callbacks.
* genum.c: macro cleanups.
* gboxed.[hc]: new files, for boxed type abstraction.
(g_boxed_copy): copy a boxed structure
(g_boxed_free): free a boxed structure
(g_value_set_boxed):
(g_value_get_boxed): standard GValue functions for boxed types
(g_boxed_type_register_static): convenience function for easy
introduction of new G_TYPE_BOXED derivatives.
* gparam.[hc]: introduced g_param_type_register_static(), a short hand
for creation of new GParamSpec derived types.
* gtype.[hc]: many fixes, introduced ability to flag individual
type nodes as ABSTRACT upon registration, added value_peek_pointer()
to the value table to peek at GValue contents as a pointer for types
that support this. fixed up GValue checks.
* gvalue.[hc]: added g_value_fits_pointer() and g_value_get_as_pointer()
to peek at the value contents as pointer.
* *.[hc]: adaptions to type macro fixes and changes in the type
registration API.
* many const corrections over the place.
Sat Oct 21 02:49:56 2000 Tim Janik <timj@gtk.org>
* gtype.c (g_type_conforms_to): this function basically behaves like
and is_a check, except that it _additionally_ features interfaces
for instantiatable types. enforce this in the second branch as well
(`type' conforms_to `type') even if `type' is not an interface type.
Fri Oct 20 15:31:04 2000 Tim Janik <timj@gtk.org>
* gvaluetypes.[hc]: added G_TYPE_POINTER implementation from jrb.
* gtype.[hc]:
* gobject.c:
* gvaluetypes.c: added GTypeValueTable.value_peek_pointer and
suitable implementations of this for G_TYPE_STRING, G_TYPE_OBJECT
and G_TYPE_POINTER.
Mon Aug 21 04:13:37 2000 Tim Janik <timj@gtk.org>
* gbsearcharray.[hc]: long standing needed generic implementation
of a binary searchable, sorted and dynamically sized array.
2000-10-25 22:36:35 +02:00
|
|
|
|
|
2022-12-15 00:55:19 +01:00
|
|
|
|
/**
|
|
|
|
|
* GPOINTER_TO_TYPE:
|
|
|
|
|
* @p: The pointer to convert to a #GType
|
|
|
|
|
*
|
|
|
|
|
* This macro should be used instead of GPOINTER_TO_SIZE() to ensure
|
|
|
|
|
* portability since #GType is not guaranteed to be the same as #gsize.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.80
|
|
|
|
|
*/
|
|
|
|
|
#define GPOINTER_TO_TYPE(p) ((GType) (guintptr) (p)) GOBJECT_AVAILABLE_MACRO_IN_2_80
|
|
|
|
|
/**
|
|
|
|
|
* GTYPE_TO_POINTER:
|
|
|
|
|
* @t: The #GType to convert to a pointer
|
|
|
|
|
*
|
|
|
|
|
* This macro should be used instead of GSIZE_TO_POINTER() to ensure
|
|
|
|
|
* portability since #GType is not guaranteed to be the same as #gsize.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.80
|
|
|
|
|
*/
|
|
|
|
|
#define GTYPE_TO_POINTER(t) ((gpointer) (guintptr) (t)) GOBJECT_AVAILABLE_MACRO_IN_2_80
|
|
|
|
|
|
2001-03-09 22:39:51 +01:00
|
|
|
|
G_END_DECLS
|
add reserved fundamental ids for gtk types (for transition time). added
Fri May 5 01:15:48 2000 Tim Janik <timj@gtk.org>
* gtype.h: add reserved fundamental ids for gtk types (for transition
time). added G_TYPE_FUNDAMENTAL_MAX for gtk.
Mon Apr 17 20:45:50 2000 Tim Janik <timj@gtk.org>
* glib-gobject.c (g_object_base_class_finalize): oops, don't unset
n_params prior to destructing them.
Tue Apr 11 04:28:10 2000 Tim Janik <timj@gtk.org>
* fixed a couple of bugs in the initial parameter/object
implementations, after getting beast running on GObject and GValue.
Fri Apr 7 04:27:49 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: completed parameter set/get implementations,
along with asyncronous parameter changed notification queue.
Sun Apr 2 04:54:36 2000 Tim Janik <timj@gtk.org>
* glib-gobject.[hc]: GObject implementation, that is facilities
for setting/getting quarked data and reference counting.
* glib-gparamspecs.[hc]: first actuall parameter implementations
for GLib, so far we have: char, uchar, bool, int, uint, long,
ulong, enum, flags, float, double, string and object. each of these
GParamSpecs is a new instantiatable type in its own respect,
so the .c file derives 13 new types from G_TYPE_PARAM and
defines over 50 (*2) conversion facilities.
* glib-gvaluecollector.h: generic varargs handling stubs for
GParamSpecs, private header file (does get installed for
inclusion into user code though).
* glib-gvalue.[hc]: GValue functionality implementation.
* glib-gparam.[hc]: basis GParamSpec implementation for
the virtual base type G_TYPE_PARAM.
* glib-genums.[hc]: enum/flags type implementation, based on
bseenum.[hc].
* glib-extra.[hc]: GLib additions, including 1.3 compatibility
routines and various other functions, from string manipulation
over list manipulation up to a unix signal GSource.
* glib-gtype.[hc]: GLib Type System implementation, heavily
based on BSE's dynamic type system.
2000-05-12 17:22:31 +02:00
|
|
|
|
|
|
|
|
|
#endif /* __G_TYPE_H__ */
|