1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
7
<link rel="start" href="index.html" title="GObject Reference Manual">
8
<link rel="up" href="rn01.html" title="API Reference">
9
<link rel="prev" href="rn01.html" title="API Reference">
10
<link rel="next" href="GTypePlugin.html" title="GTypePlugin">
11
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="preface" href="pr01.html" title="Introduction">
14
<link rel="part" href="pt01.html" title="Part I. Concepts">
15
<link rel="chapter" href="ch01.html" title="Background">
16
<link rel="chapter" href="ch02.html" title="The Glib Dynamic Type System">
17
<link rel="chapter" href="chapter-gobject.html" title="The GObject base class">
18
<link rel="chapter" href="chapter-signal.html" title="The GObject messaging system">
19
<link rel="reference" href="rn01.html" title="API Reference">
20
<link rel="reference" href="rn02.html" title="Tools Reference">
21
<link rel="part" href="pt02.html" title="Part IV. Tutorial">
22
<link rel="chapter" href="howto-gobject.html" title="How To define and implement a new GObject?">
23
<link rel="chapter" href="howto-interface.html" title="How To define and implement Interfaces?">
24
<link rel="chapter" href="howto-signals.html" title="Howto create and use signals">
25
<link rel="part" href="pt03.html" title="Part V. Related Tools">
26
<link rel="chapter" href="tools-gob.html" title="GObject builder">
27
<link rel="chapter" href="tools-ginspector.html" title="Graphical inspection of Gobjects">
28
<link rel="chapter" href="tools-refdb.html" title="Debugging reference count problems">
29
<link rel="chapter" href="tools-gtkdoc.html" title="Writing API docs">
30
<link rel="index" href="ix01.html" title="Index">
31
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
32
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
33
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
34
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
35
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
36
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
37
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
39
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
40
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
42
<td><a accesskey="p" href="rn01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
43
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
44
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
45
<th width="100%" align="center">GObject Reference Manual</th>
46
<td><a accesskey="n" href="GTypePlugin.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
48
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3021948" class="shortcut">Top</a>
50
<a href="#id3024162" class="shortcut">Description</a></nobr></td></tr>
52
<div class="refentry" lang="en">
53
<a name="gobject-Type-Information"></a><div class="titlepage"></div>
54
<div class="refnamediv"><table width="100%"><tr>
57
<a name="id3021948"></a><span class="refentrytitle">GType</span>
59
<p>GType — The GLib Runtime type identification and management system</p>
61
<td valign="top" align="right"></td>
63
<div class="refsynopsisdiv">
65
<pre class="synopsis">
67
#include <glib-object.h>
70
typedef <a href="gobject-Type-Information.html#GType">GType</a>;
71
#define <a href="gobject-Type-Information.html#G-TYPE-FUNDAMENTAL:CAPS">G_TYPE_FUNDAMENTAL</a> (type)
72
#define <a href="gobject-Type-Information.html#G-TYPE-FUNDAMENTAL-MAX:CAPS">G_TYPE_FUNDAMENTAL_MAX</a>
73
#define <a href="gobject-Type-Information.html#G-TYPE-MAKE-FUNDAMENTAL:CAPS">G_TYPE_MAKE_FUNDAMENTAL</a> (x)
74
#define <a href="gobject-Type-Information.html#G-TYPE-IS-ABSTRACT:CAPS">G_TYPE_IS_ABSTRACT</a> (type)
75
#define <a href="gobject-Type-Information.html#G-TYPE-IS-DERIVED:CAPS">G_TYPE_IS_DERIVED</a> (type)
76
#define <a href="gobject-Type-Information.html#G-TYPE-IS-FUNDAMENTAL:CAPS">G_TYPE_IS_FUNDAMENTAL</a> (type)
77
#define <a href="gobject-Type-Information.html#G-TYPE-IS-VALUE-TYPE:CAPS">G_TYPE_IS_VALUE_TYPE</a> (type)
78
#define <a href="gobject-Type-Information.html#G-TYPE-HAS-VALUE-TABLE:CAPS">G_TYPE_HAS_VALUE_TABLE</a> (type)
79
#define <a href="gobject-Type-Information.html#G-TYPE-IS-CLASSED:CAPS">G_TYPE_IS_CLASSED</a> (type)
80
#define <a href="gobject-Type-Information.html#G-TYPE-IS-INSTANTIATABLE:CAPS">G_TYPE_IS_INSTANTIATABLE</a> (type)
81
#define <a href="gobject-Type-Information.html#G-TYPE-IS-DERIVABLE:CAPS">G_TYPE_IS_DERIVABLE</a> (type)
82
#define <a href="gobject-Type-Information.html#G-TYPE-IS-DEEP-DERIVABLE:CAPS">G_TYPE_IS_DEEP_DERIVABLE</a> (type)
83
#define <a href="gobject-Type-Information.html#G-TYPE-IS-INTERFACE:CAPS">G_TYPE_IS_INTERFACE</a> (type)
84
<a href="gobject-Type-Information.html#GTypeInterface">GTypeInterface</a>;
85
<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a>;
86
<a href="gobject-Type-Information.html#GTypeClass">GTypeClass</a>;
87
<a href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a>;
88
<a href="gobject-Type-Information.html#GTypeFundamentalInfo">GTypeFundamentalInfo</a>;
89
<a href="gobject-Type-Information.html#GInterfaceInfo">GInterfaceInfo</a>;
90
<a href="gobject-Type-Information.html#GTypeValueTable">GTypeValueTable</a>;
91
#define <a href="gobject-Type-Information.html#G-TYPE-FROM-INSTANCE:CAPS">G_TYPE_FROM_INSTANCE</a> (instance)
92
#define <a href="gobject-Type-Information.html#G-TYPE-FROM-CLASS:CAPS">G_TYPE_FROM_CLASS</a> (g_class)
93
#define <a href="gobject-Type-Information.html#G-TYPE-FROM-INTERFACE:CAPS">G_TYPE_FROM_INTERFACE</a> (g_iface)
94
#define <a href="gobject-Type-Information.html#G-TYPE-INSTANCE-GET-CLASS:CAPS">G_TYPE_INSTANCE_GET_CLASS</a> (instance, g_type, c_type)
95
#define <a href="gobject-Type-Information.html#G-TYPE-INSTANCE-GET-INTERFACE:CAPS">G_TYPE_INSTANCE_GET_INTERFACE</a> (instance, g_type, c_type)
96
#define <a href="gobject-Type-Information.html#G-TYPE-INSTANCE-GET-PRIVATE:CAPS">G_TYPE_INSTANCE_GET_PRIVATE</a> (instance, g_type, c_type)
97
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-INSTANCE:CAPS">G_TYPE_CHECK_INSTANCE</a> (instance)
98
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-INSTANCE-CAST:CAPS">G_TYPE_CHECK_INSTANCE_CAST</a> (instance, g_type, c_type)
99
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-INSTANCE-TYPE:CAPS">G_TYPE_CHECK_INSTANCE_TYPE</a> (instance, g_type)
100
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-CLASS-CAST:CAPS">G_TYPE_CHECK_CLASS_CAST</a> (g_class, g_type, c_type)
101
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-CLASS-TYPE:CAPS">G_TYPE_CHECK_CLASS_TYPE</a> (g_class, g_type)
102
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-VALUE:CAPS">G_TYPE_CHECK_VALUE</a> (value)
103
#define <a href="gobject-Type-Information.html#G-TYPE-CHECK-VALUE-TYPE:CAPS">G_TYPE_CHECK_VALUE_TYPE</a> (value, g_type)
104
#define <a href="gobject-Type-Information.html#G-TYPE-FLAG-RESERVED-ID-BIT:CAPS">G_TYPE_FLAG_RESERVED_ID_BIT</a>
105
void <a href="gobject-Type-Information.html#g-type-init">g_type_init</a> (void);
106
enum <a href="gobject-Type-Information.html#GTypeDebugFlags">GTypeDebugFlags</a>;
107
void <a href="gobject-Type-Information.html#g-type-init-with-debug-flags">g_type_init_with_debug_flags</a> (<a href="gobject-Type-Information.html#GTypeDebugFlags">GTypeDebugFlags</a> debug_flags);
109
href="../glib/glib-Basic-Types.html#gchar"
110
>gchar</a>* <a href="gobject-Type-Information.html#g-type-name">g_type_name</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
112
href="../glib/glib-Quarks.html#GQuark"
113
>GQuark</a> <a href="gobject-Type-Information.html#g-type-qname">g_type_qname</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
114
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-from-name">g_type_from_name</a> (const <a
115
href="../glib/glib-Basic-Types.html#gchar"
117
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-parent">g_type_parent</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
119
href="../glib/glib-Basic-Types.html#guint"
120
>guint</a> <a href="gobject-Type-Information.html#g-type-depth">g_type_depth</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
121
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-next-base">g_type_next_base</a> (<a href="gobject-Type-Information.html#GType">GType</a> leaf_type,
122
<a href="gobject-Type-Information.html#GType">GType</a> root_type);
124
href="../glib/glib-Basic-Types.html#gboolean"
125
>gboolean</a> <a href="gobject-Type-Information.html#g-type-is-a">g_type_is_a</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
126
<a href="gobject-Type-Information.html#GType">GType</a> is_a_type);
128
href="../glib/glib-Basic-Types.html#gpointer"
129
>gpointer</a> <a href="gobject-Type-Information.html#g-type-class-ref">g_type_class_ref</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
131
href="../glib/glib-Basic-Types.html#gpointer"
132
>gpointer</a> <a href="gobject-Type-Information.html#g-type-class-peek">g_type_class_peek</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
134
href="../glib/glib-Basic-Types.html#gpointer"
135
>gpointer</a> <a href="gobject-Type-Information.html#g-type-class-peek-static">g_type_class_peek_static</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
136
void <a href="gobject-Type-Information.html#g-type-class-unref">g_type_class_unref</a> (<a
137
href="../glib/glib-Basic-Types.html#gpointer"
138
>gpointer</a> g_class);
140
href="../glib/glib-Basic-Types.html#gpointer"
141
>gpointer</a> <a href="gobject-Type-Information.html#g-type-class-peek-parent">g_type_class_peek_parent</a> (<a
142
href="../glib/glib-Basic-Types.html#gpointer"
143
>gpointer</a> g_class);
144
void <a href="gobject-Type-Information.html#g-type-class-add-private">g_type_class_add_private</a> (<a
145
href="../glib/glib-Basic-Types.html#gpointer"
146
>gpointer</a> g_class,
148
href="../glib/glib-Basic-Types.html#gsize"
149
>gsize</a> private_size);
151
href="../glib/glib-Basic-Types.html#gpointer"
152
>gpointer</a> <a href="gobject-Type-Information.html#g-type-interface-peek">g_type_interface_peek</a> (<a
153
href="../glib/glib-Basic-Types.html#gpointer"
154
>gpointer</a> instance_class,
155
<a href="gobject-Type-Information.html#GType">GType</a> iface_type);
157
href="../glib/glib-Basic-Types.html#gpointer"
158
>gpointer</a> <a href="gobject-Type-Information.html#g-type-interface-peek-parent">g_type_interface_peek_parent</a> (<a
159
href="../glib/glib-Basic-Types.html#gpointer"
160
>gpointer</a> g_iface);
162
href="../glib/glib-Basic-Types.html#gpointer"
163
>gpointer</a> <a href="gobject-Type-Information.html#g-type-default-interface-ref">g_type_default_interface_ref</a> (<a href="gobject-Type-Information.html#GType">GType</a> g_type);
165
href="../glib/glib-Basic-Types.html#gpointer"
166
>gpointer</a> <a href="gobject-Type-Information.html#g-type-default-interface-peek">g_type_default_interface_peek</a> (<a href="gobject-Type-Information.html#GType">GType</a> g_type);
167
void <a href="gobject-Type-Information.html#g-type-default-interface-unref">g_type_default_interface_unref</a> (<a
168
href="../glib/glib-Basic-Types.html#gpointer"
169
>gpointer</a> g_iface);
170
<a href="gobject-Type-Information.html#GType">GType</a>* <a href="gobject-Type-Information.html#g-type-children">g_type_children</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
172
href="../glib/glib-Basic-Types.html#guint"
173
>guint</a> *n_children);
174
<a href="gobject-Type-Information.html#GType">GType</a>* <a href="gobject-Type-Information.html#g-type-interfaces">g_type_interfaces</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
176
href="../glib/glib-Basic-Types.html#guint"
177
>guint</a> *n_interfaces);
178
<a href="gobject-Type-Information.html#GType">GType</a>* <a href="gobject-Type-Information.html#g-type-interface-prerequisites">g_type_interface_prerequisites</a> (<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
180
href="../glib/glib-Basic-Types.html#guint"
181
>guint</a> *n_prerequisites);
182
void <a href="gobject-Type-Information.html#g-type-set-qdata">g_type_set_qdata</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
184
href="../glib/glib-Quarks.html#GQuark"
187
href="../glib/glib-Basic-Types.html#gpointer"
190
href="../glib/glib-Basic-Types.html#gpointer"
191
>gpointer</a> <a href="gobject-Type-Information.html#g-type-get-qdata">g_type_get_qdata</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
193
href="../glib/glib-Quarks.html#GQuark"
195
void <a href="gobject-Type-Information.html#g-type-query">g_type_query</a> (<a href="gobject-Type-Information.html#GType">GType</a> type,
196
<a href="gobject-Type-Information.html#GTypeQuery">GTypeQuery</a> *query);
197
<a href="gobject-Type-Information.html#GTypeQuery">GTypeQuery</a>;
198
void (<a href="gobject-Type-Information.html#GBaseInitFunc">*GBaseInitFunc</a>) (<a
199
href="../glib/glib-Basic-Types.html#gpointer"
200
>gpointer</a> g_class);
201
void (<a href="gobject-Type-Information.html#GBaseFinalizeFunc">*GBaseFinalizeFunc</a>) (<a
202
href="../glib/glib-Basic-Types.html#gpointer"
203
>gpointer</a> g_class);
204
void (<a href="gobject-Type-Information.html#GClassInitFunc">*GClassInitFunc</a>) (<a
205
href="../glib/glib-Basic-Types.html#gpointer"
206
>gpointer</a> g_class,
208
href="../glib/glib-Basic-Types.html#gpointer"
209
>gpointer</a> class_data);
210
void (<a href="gobject-Type-Information.html#GClassFinalizeFunc">*GClassFinalizeFunc</a>) (<a
211
href="../glib/glib-Basic-Types.html#gpointer"
212
>gpointer</a> g_class,
214
href="../glib/glib-Basic-Types.html#gpointer"
215
>gpointer</a> class_data);
216
void (<a href="gobject-Type-Information.html#GInstanceInitFunc">*GInstanceInitFunc</a>) (<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a> *instance,
218
href="../glib/glib-Basic-Types.html#gpointer"
219
>gpointer</a> g_class);
220
void (<a href="gobject-Type-Information.html#GInterfaceInitFunc">*GInterfaceInitFunc</a>) (<a
221
href="../glib/glib-Basic-Types.html#gpointer"
222
>gpointer</a> g_iface,
224
href="../glib/glib-Basic-Types.html#gpointer"
225
>gpointer</a> iface_data);
226
void (<a href="gobject-Type-Information.html#GInterfaceFinalizeFunc">*GInterfaceFinalizeFunc</a>) (<a
227
href="../glib/glib-Basic-Types.html#gpointer"
228
>gpointer</a> g_iface,
230
href="../glib/glib-Basic-Types.html#gpointer"
231
>gpointer</a> iface_data);
233
href="../glib/glib-Basic-Types.html#gboolean"
234
>gboolean</a> (<a href="gobject-Type-Information.html#GTypeClassCacheFunc">*GTypeClassCacheFunc</a>) (<a
235
href="../glib/glib-Basic-Types.html#gpointer"
236
>gpointer</a> cache_data,
237
<a href="gobject-Type-Information.html#GTypeClass">GTypeClass</a> *g_class);
238
enum <a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a>;
239
enum <a href="gobject-Type-Information.html#GTypeFundamentalFlags">GTypeFundamentalFlags</a>;
240
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-register-static">g_type_register_static</a> (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
242
href="../glib/glib-Basic-Types.html#gchar"
243
>gchar</a> *type_name,
244
const <a href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a> *info,
245
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);
246
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-register-static-simple">g_type_register_static_simple</a> (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
248
href="../glib/glib-Basic-Types.html#gchar"
249
>gchar</a> *type_name,
251
href="../glib/glib-Basic-Types.html#guint"
252
>guint</a> class_size,
253
<a href="gobject-Type-Information.html#GClassInitFunc">GClassInitFunc</a> class_init,
255
href="../glib/glib-Basic-Types.html#guint"
256
>guint</a> instance_size,
257
<a href="gobject-Type-Information.html#GInstanceInitFunc">GInstanceInitFunc</a> instance_init,
258
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);
259
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-register-dynamic">g_type_register_dynamic</a> (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
261
href="../glib/glib-Basic-Types.html#gchar"
262
>gchar</a> *type_name,
263
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a> *plugin,
264
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);
265
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-register-fundamental">g_type_register_fundamental</a> (<a href="gobject-Type-Information.html#GType">GType</a> type_id,
267
href="../glib/glib-Basic-Types.html#gchar"
268
>gchar</a> *type_name,
269
const <a href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a> *info,
270
const <a href="gobject-Type-Information.html#GTypeFundamentalInfo">GTypeFundamentalInfo</a> *finfo,
271
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);
272
void <a href="gobject-Type-Information.html#g-type-add-interface-static">g_type_add_interface_static</a> (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
273
<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
274
const <a href="gobject-Type-Information.html#GInterfaceInfo">GInterfaceInfo</a> *info);
275
void <a href="gobject-Type-Information.html#g-type-add-interface-dynamic">g_type_add_interface_dynamic</a> (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
276
<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
277
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a> *plugin);
278
void <a href="gobject-Type-Information.html#g-type-interface-add-prerequisite">g_type_interface_add_prerequisite</a> (<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
279
<a href="gobject-Type-Information.html#GType">GType</a> prerequisite_type);
280
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a>* <a href="gobject-Type-Information.html#g-type-get-plugin">g_type_get_plugin</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
281
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a>* <a href="gobject-Type-Information.html#g-type-interface-get-plugin">g_type_interface_get_plugin</a> (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
282
<a href="gobject-Type-Information.html#GType">GType</a> interface_type);
283
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-fundamental-next">g_type_fundamental_next</a> (void);
284
<a href="gobject-Type-Information.html#GType">GType</a> <a href="gobject-Type-Information.html#g-type-fundamental">g_type_fundamental</a> (<a href="gobject-Type-Information.html#GType">GType</a> type_id);
285
<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a>* <a href="gobject-Type-Information.html#g-type-create-instance">g_type_create_instance</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
286
void <a href="gobject-Type-Information.html#g-type-free-instance">g_type_free_instance</a> (<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a> *instance);
287
void <a href="gobject-Type-Information.html#g-type-add-class-cache-func">g_type_add_class_cache_func</a> (<a
288
href="../glib/glib-Basic-Types.html#gpointer"
289
>gpointer</a> cache_data,
290
<a href="gobject-Type-Information.html#GTypeClassCacheFunc">GTypeClassCacheFunc</a> cache_func);
291
void <a href="gobject-Type-Information.html#g-type-remove-class-cache-func">g_type_remove_class_cache_func</a> (<a
292
href="../glib/glib-Basic-Types.html#gpointer"
293
>gpointer</a> cache_data,
294
<a href="gobject-Type-Information.html#GTypeClassCacheFunc">GTypeClassCacheFunc</a> cache_func);
295
void <a href="gobject-Type-Information.html#g-type-class-unref-uncached">g_type_class_unref_uncached</a> (<a
296
href="../glib/glib-Basic-Types.html#gpointer"
297
>gpointer</a> g_class);
298
void <a href="gobject-Type-Information.html#g-type-add-interface-check">g_type_add_interface_check</a> (<a
299
href="../glib/glib-Basic-Types.html#gpointer"
300
>gpointer</a> check_data,
301
<a href="gobject-Type-Information.html#GTypeInterfaceCheckFunc">GTypeInterfaceCheckFunc</a> check_func);
302
void <a href="gobject-Type-Information.html#g-type-remove-interface-check">g_type_remove_interface_check</a> (<a
303
href="../glib/glib-Basic-Types.html#gpointer"
304
>gpointer</a> check_data,
305
<a href="gobject-Type-Information.html#GTypeInterfaceCheckFunc">GTypeInterfaceCheckFunc</a> check_func);
306
void (<a href="gobject-Type-Information.html#GTypeInterfaceCheckFunc">*GTypeInterfaceCheckFunc</a>) (<a
307
href="../glib/glib-Basic-Types.html#gpointer"
308
>gpointer</a> check_data,
310
href="../glib/glib-Basic-Types.html#gpointer"
311
>gpointer</a> g_iface);
312
<a href="gobject-Type-Information.html#GTypeValueTable">GTypeValueTable</a>* <a href="gobject-Type-Information.html#g-type-value-table-peek">g_type_value_table_peek</a> (<a href="gobject-Type-Information.html#GType">GType</a> type);
313
#define <a href="gobject-Type-Information.html#G-DEFINE-TYPE:CAPS">G_DEFINE_TYPE</a> (TN, t_n, T_P)
314
#define <a href="gobject-Type-Information.html#G-DEFINE-TYPE-WITH-CODE:CAPS">G_DEFINE_TYPE_WITH_CODE</a> (TN, t_n, T_P, _C_)
315
#define <a href="gobject-Type-Information.html#G-DEFINE-ABSTRACT-TYPE:CAPS">G_DEFINE_ABSTRACT_TYPE</a> (TN, t_n, T_P)
316
#define <a href="gobject-Type-Information.html#G-DEFINE-ABSTRACT-TYPE-WITH-CODE:CAPS">G_DEFINE_ABSTRACT_TYPE_WITH_CODE</a> (TN, t_n, T_P, _C_)
317
#define <a href="gobject-Type-Information.html#G-IMPLEMENT-INTERFACE:CAPS">G_IMPLEMENT_INTERFACE</a> (TYPE_IFACE, iface_init)
318
#define <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS">G_DEFINE_TYPE_EXTENDED</a> (TN, t_n, T_P, _f_, _C_)
321
#define <a href="gobject-Type-Information.html#G-TYPE-INVALID:CAPS">G_TYPE_INVALID</a>
322
#define <a href="gobject-Type-Information.html#G-TYPE-NONE:CAPS">G_TYPE_NONE</a>
323
#define <a href="gobject-Type-Information.html#G-TYPE-INTERFACE:CAPS">G_TYPE_INTERFACE</a>
324
#define <a href="gobject-Type-Information.html#G-TYPE-CHAR:CAPS">G_TYPE_CHAR</a>
325
#define <a href="gobject-Type-Information.html#G-TYPE-UCHAR:CAPS">G_TYPE_UCHAR</a>
326
#define <a href="gobject-Type-Information.html#G-TYPE-BOOLEAN:CAPS">G_TYPE_BOOLEAN</a>
327
#define <a href="gobject-Type-Information.html#G-TYPE-INT:CAPS">G_TYPE_INT</a>
328
#define <a href="gobject-Type-Information.html#G-TYPE-UINT:CAPS">G_TYPE_UINT</a>
329
#define <a href="gobject-Type-Information.html#G-TYPE-LONG:CAPS">G_TYPE_LONG</a>
330
#define <a href="gobject-Type-Information.html#G-TYPE-ULONG:CAPS">G_TYPE_ULONG</a>
331
#define <a href="gobject-Type-Information.html#G-TYPE-INT64:CAPS">G_TYPE_INT64</a>
332
#define <a href="gobject-Type-Information.html#G-TYPE-UINT64:CAPS">G_TYPE_UINT64</a>
333
#define <a href="gobject-Type-Information.html#G-TYPE-ENUM:CAPS">G_TYPE_ENUM</a>
334
#define <a href="gobject-Type-Information.html#G-TYPE-FLAGS:CAPS">G_TYPE_FLAGS</a>
335
#define <a href="gobject-Type-Information.html#G-TYPE-FLOAT:CAPS">G_TYPE_FLOAT</a>
336
#define <a href="gobject-Type-Information.html#G-TYPE-DOUBLE:CAPS">G_TYPE_DOUBLE</a>
337
#define <a href="gobject-Type-Information.html#G-TYPE-STRING:CAPS">G_TYPE_STRING</a>
338
#define <a href="gobject-Type-Information.html#G-TYPE-POINTER:CAPS">G_TYPE_POINTER</a>
339
#define <a href="gobject-Type-Information.html#G-TYPE-BOXED:CAPS">G_TYPE_BOXED</a>
340
#define <a href="gobject-Type-Information.html#G-TYPE-PARAM:CAPS">G_TYPE_PARAM</a>
341
#define <a href="gobject-Type-Information.html#G-TYPE-OBJECT:CAPS">G_TYPE_OBJECT</a>
342
#define <a href="gobject-Type-Information.html#G-TYPE-GTYPE:CAPS">G_TYPE_GTYPE</a>
344
#define <a href="gobject-Type-Information.html#G-TYPE-RESERVED-GLIB-FIRST:CAPS">G_TYPE_RESERVED_GLIB_FIRST</a>
345
#define <a href="gobject-Type-Information.html#G-TYPE-RESERVED-GLIB-LAST:CAPS">G_TYPE_RESERVED_GLIB_LAST</a>
346
#define <a href="gobject-Type-Information.html#G-TYPE-RESERVED-BSE-FIRST:CAPS">G_TYPE_RESERVED_BSE_FIRST</a>
347
#define <a href="gobject-Type-Information.html#G-TYPE-RESERVED-BSE-LAST:CAPS">G_TYPE_RESERVED_BSE_LAST</a>
348
#define <a href="gobject-Type-Information.html#G-TYPE-RESERVED-USER-FIRST:CAPS">G_TYPE_RESERVED_USER_FIRST</a>
352
<div class="refsect1" lang="en">
353
<a name="id3024162"></a><h2>Description</h2>
355
The GType API is the foundation of the GObject system. It provides the
356
facilities for registering and managing all fundamental data types,
357
user-defined object and interface types. Before using any GType
358
or GObject functions, <a href="gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a> must be called to initialize the
362
For type creation and registration purposes, all types fall into one of
363
two categories: static or dynamic. Static types are never loaded or
364
unloaded at run-time as dynamic types may be. Static types are created
365
with <a href="gobject-Type-Information.html#g-type-register-static"><code class="function">g_type_register_static()</code></a> that gets type specific information passed
366
in via a <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure.
367
Dynamic types are created with <a href="gobject-Type-Information.html#g-type-register-dynamic"><code class="function">g_type_register_dynamic()</code></a> which takes a
368
<a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure instead. The remaining type information (the
369
<a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure) is retrieved during runtime through <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a>
370
and the g_type_plugin_*() API.
371
These registration functions are usually called only once from a
372
function whose only purpose is to return the type identifier for a
373
specific class. Once the type (or class or interface) is registered,
374
it may be instantiated, inherited, or implemented depending on exactly
375
what sort of type it is.
376
There is also a third registration function for registering fundamental
377
types called <a href="gobject-Type-Information.html#g-type-register-fundamental"><code class="function">g_type_register_fundamental()</code></a> which requires both a <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>
378
structure and a <a href="gobject-Type-Information.html#GTypeFundamentalInfo"><span class="type">GTypeFundamentalInfo</span></a> structure but it is seldom used
379
since most fundamental types are predefined rather than user-defined.
382
A final word about type names.
383
Such an identifier needs to be at least three characters long. There is no
384
upper length limit. The first character needs to be a letter (a-z or A-Z)
385
or an underscore '_'. Subsequent characters can be letters, numbers or
389
<div class="refsect1" lang="en">
390
<a name="id3021834"></a><h2>Details</h2>
391
<div class="refsect2" lang="en">
392
<a name="id3021845"></a><h3>
393
<a name="GType"></a>GType</h3>
394
<a class="indexterm" name="id3021857"></a><p>
395
A numerical value which represents the unique identifier of a registered
400
<div class="refsect2" lang="en">
401
<a name="id3021867"></a><h3>
402
<a name="G-TYPE-FUNDAMENTAL:CAPS"></a>G_TYPE_FUNDAMENTAL()</h3>
403
<a class="indexterm" name="id3021880"></a><pre class="programlisting">#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type))
406
Returns the fundamental type which is the ancestor of <em class="parameter"><code>type</code></em>.
407
Fundamental types are types that serve as ultimate bases for the derived types,
408
thus they are the roots of distinct inheritance hierarchies.
410
<div class="variablelist"><table border="0">
411
<col align="left" valign="top">
413
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
414
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
422
<div class="refsect2" lang="en">
423
<a name="id3024537"></a><h3>
424
<a name="G-TYPE-FUNDAMENTAL-MAX:CAPS"></a>G_TYPE_FUNDAMENTAL_MAX</h3>
425
<a class="indexterm" name="id3024550"></a><pre class="programlisting">#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT)
428
An integer constant that represents the number of identifiers reserved
429
for types that are assigned at compile-time.
433
<div class="refsect2" lang="en">
434
<a name="id3024568"></a><h3>
435
<a name="G-TYPE-MAKE-FUNDAMENTAL:CAPS"></a>G_TYPE_MAKE_FUNDAMENTAL()</h3>
436
<a class="indexterm" name="id3024581"></a><pre class="programlisting">#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
439
Returns the type ID for the fundamental type number <em class="parameter"><code>x</code></em>.
440
Use <a href="gobject-Type-Information.html#g-type-fundamental-next"><code class="function">g_type_fundamental_next()</code></a> instead of this macro to create new fundamental
443
<div class="variablelist"><table border="0">
444
<col align="left" valign="top">
446
<td><span class="term"><em class="parameter"><code>x</code></em> :</span></td>
447
<td>the fundamental type number.
455
<div class="refsect2" lang="en">
456
<a name="id3024634"></a><h3>
457
<a name="G-TYPE-IS-ABSTRACT:CAPS"></a>G_TYPE_IS_ABSTRACT()</h3>
458
<a class="indexterm" name="id3024647"></a><pre class="programlisting">#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))
462
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
463
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is an abstract type. An abstract type can not be
464
instantiated and is normally used as an abstract base class for
467
<div class="variablelist"><table border="0">
468
<col align="left" valign="top">
470
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
471
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
479
<div class="refsect2" lang="en">
480
<a name="id3024709"></a><h3>
481
<a name="G-TYPE-IS-DERIVED:CAPS"></a>G_TYPE_IS_DERIVED()</h3>
482
<a class="indexterm" name="id3024722"></a><pre class="programlisting">#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX)
486
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
487
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is derived (or in object-oriented terminology:
488
inherited) from another type (this holds true for all non-fundamental
491
<div class="variablelist"><table border="0">
492
<col align="left" valign="top">
494
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
495
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
503
<div class="refsect2" lang="en">
504
<a name="id3024784"></a><h3>
505
<a name="G-TYPE-IS-FUNDAMENTAL:CAPS"></a>G_TYPE_IS_FUNDAMENTAL()</h3>
506
<a class="indexterm" name="id3024796"></a><pre class="programlisting">#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX)
510
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
511
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is a fundamental type.
513
<div class="variablelist"><table border="0">
514
<col align="left" valign="top">
516
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
517
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
525
<div class="refsect2" lang="en">
526
<a name="id3024855"></a><h3>
527
<a name="G-TYPE-IS-VALUE-TYPE:CAPS"></a>G_TYPE_IS_VALUE_TYPE()</h3>
528
<a class="indexterm" name="id3024869"></a><pre class="programlisting">#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type))
532
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
533
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is a value type and can be used with
534
<a href="gobject-Generic-values.html#g-value-init"><code class="function">g_value_init()</code></a>.
536
<div class="variablelist"><table border="0">
537
<col align="left" valign="top">
539
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
540
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
548
<div class="refsect2" lang="en">
549
<a name="id3024939"></a><h3>
550
<a name="G-TYPE-HAS-VALUE-TABLE:CAPS"></a>G_TYPE_HAS_VALUE_TABLE()</h3>
551
<a class="indexterm" name="id3024952"></a><pre class="programlisting">#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL)
555
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
556
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> has a <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a>.
558
<div class="variablelist"><table border="0">
559
<col align="left" valign="top">
561
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
562
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
570
<div class="refsect2" lang="en">
571
<a name="id3025019"></a><h3>
572
<a name="G-TYPE-IS-CLASSED:CAPS"></a>G_TYPE_IS_CLASSED()</h3>
573
<a class="indexterm" name="id3025032"></a><pre class="programlisting">#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
577
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
578
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is a classed type.
580
<div class="variablelist"><table border="0">
581
<col align="left" valign="top">
583
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
584
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
592
<div class="refsect2" lang="en">
593
<a name="id3025091"></a><h3>
594
<a name="G-TYPE-IS-INSTANTIATABLE:CAPS"></a>G_TYPE_IS_INSTANTIATABLE()</h3>
595
<a class="indexterm" name="id3025105"></a><pre class="programlisting">#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
599
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
600
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> can be instantiated. Instantiation is the
601
process of creating an instance (object) of this type.
603
<div class="variablelist"><table border="0">
604
<col align="left" valign="top">
606
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
607
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
615
<div class="refsect2" lang="en">
616
<a name="id3025165"></a><h3>
617
<a name="G-TYPE-IS-DERIVABLE:CAPS"></a>G_TYPE_IS_DERIVABLE()</h3>
618
<a class="indexterm" name="id3025179"></a><pre class="programlisting">#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))
622
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
623
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is a derivable type. A derivable type can
624
be used as the base class of a flat (single-level) class hierarchy.
626
<div class="variablelist"><table border="0">
627
<col align="left" valign="top">
629
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
630
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
638
<div class="refsect2" lang="en">
639
<a name="id3025239"></a><h3>
640
<a name="G-TYPE-IS-DEEP-DERIVABLE:CAPS"></a>G_TYPE_IS_DEEP_DERIVABLE()</h3>
641
<a class="indexterm" name="id3025252"></a><pre class="programlisting">#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
645
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
646
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is a deep derivable type. A deep derivable type
647
can be used as the base class of a deep (multi-level) class hierarchy.
649
<div class="variablelist"><table border="0">
650
<col align="left" valign="top">
652
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
653
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
661
<div class="refsect2" lang="en">
662
<a name="id3025313"></a><h3>
663
<a name="G-TYPE-IS-INTERFACE:CAPS"></a>G_TYPE_IS_INTERFACE()</h3>
664
<a class="indexterm" name="id3025326"></a><pre class="programlisting">#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
668
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
669
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is an interface type.
670
An interface type provides a pure API, the implementation
671
of which is provided by another type (which is then said to conform
672
to the interface). GLib interfaces are somewhat analogous to Java
673
interfaces and C++ classes containing only pure virtual functions,
674
with the difference that GType interfaces are not derivable (but see
675
<a href="gobject-Type-Information.html#g-type-interface-add-prerequisite"><code class="function">g_type_interface_add_prerequisite()</code></a> for an alternative).
677
<div class="variablelist"><table border="0">
678
<col align="left" valign="top">
680
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
681
<td>A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
689
<div class="refsect2" lang="en">
690
<a name="id3025402"></a><h3>
691
<a name="GTypeInterface"></a>GTypeInterface</h3>
692
<a class="indexterm" name="id3025414"></a><pre class="programlisting">typedef struct {
696
An opaque structure used as the base of all interface types.
700
<div class="refsect2" lang="en">
701
<a name="id3025431"></a><h3>
702
<a name="GTypeInstance"></a>GTypeInstance</h3>
703
<a class="indexterm" name="id3025443"></a><pre class="programlisting">typedef struct {
707
An opaque structure used as the base of all type instances.
711
<div class="refsect2" lang="en">
712
<a name="id3025460"></a><h3>
713
<a name="GTypeClass"></a>GTypeClass</h3>
714
<a class="indexterm" name="id3025472"></a><pre class="programlisting">typedef struct {
718
An opaque structure used as the base of all classes.
722
<div class="refsect2" lang="en">
723
<a name="id3025488"></a><h3>
724
<a name="GTypeInfo"></a>GTypeInfo</h3>
725
<a class="indexterm" name="id3025500"></a><pre class="programlisting">typedef struct {
726
/* interface types, classed types, instantiated types */
729
GBaseInitFunc base_init;
730
GBaseFinalizeFunc base_finalize;
732
/* interface types, classed types, instantiated types */
733
GClassInitFunc class_init;
734
GClassFinalizeFunc class_finalize;
735
gconstpointer class_data;
737
/* instantiated types */
738
guint16 instance_size;
740
GInstanceInitFunc instance_init;
743
const GTypeValueTable *value_table;
747
This structure is used to provide the type system with the information
748
required to initialize and destruct (finalize) a type's class and
750
The initialized structure is passed to the <a href="gobject-Type-Information.html#g-type-register-static"><code class="function">g_type_register_static()</code></a> function
751
(or is copied into the provided <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure in the
752
<a href="GTypePlugin.html#g-type-plugin-complete-type-info"><code class="function">g_type_plugin_complete_type_info()</code></a>). The type system will perform a deep
753
copy of this structure, so its memory does not need to be persistent
754
across invocation of <a href="gobject-Type-Information.html#g-type-register-static"><code class="function">g_type_register_static()</code></a>.
756
<div class="variablelist"><table border="0">
757
<col align="left" valign="top">
760
<td><span class="term"><a
761
href="../glib/glib-Basic-Types.html#guint16"
762
>guint16</a> <em class="structfield"><code>class_size</code></em>;</span></td>
763
<td> Size of the class structure (required for interface, classed and instantiatable types).
767
<td><span class="term"><a href="gobject-Type-Information.html#GBaseInitFunc">GBaseInitFunc</a> <em class="structfield"><code>base_init</code></em>;</span></td>
768
<td> Location of the base initialization function (optional).
772
<td><span class="term"><a href="gobject-Type-Information.html#GBaseFinalizeFunc">GBaseFinalizeFunc</a> <em class="structfield"><code>base_finalize</code></em>;</span></td>
773
<td> Location of the base finalization function (optional).
777
<td><span class="term"><a href="gobject-Type-Information.html#GClassInitFunc">GClassInitFunc</a> <em class="structfield"><code>class_init</code></em>;</span></td>
778
<td> Location of the class initialization function for
779
classed and types. Location of the default vtable inititalization
780
function for interface types. (optional) This function is used both
781
to fill in virtual functions in the class or default vtable, and
782
to do type-specific setup such as registering signals and object
787
<td><span class="term"><a href="gobject-Type-Information.html#GClassFinalizeFunc">GClassFinalizeFunc</a> <em class="structfield"><code>class_finalize</code></em>;</span></td>
788
<td>Location of the class finalization function for
789
classed and types. Location fo the default vtable finalization
790
function for interface types. (optional)
794
<td><span class="term"><a
795
href="../glib/glib-Basic-Types.html#gconstpointer"
796
>gconstpointer</a> <em class="structfield"><code>class_data</code></em>;</span></td>
797
<td> User-supplied data passed to the class init/finalize functions.
801
<td><span class="term"><a
802
href="../glib/glib-Basic-Types.html#guint16"
803
>guint16</a> <em class="structfield"><code>instance_size</code></em>;</span></td>
804
<td> Size of the instance (object) structure (required for instantiatable types only).
808
<td><span class="term"><a
809
href="../glib/glib-Basic-Types.html#guint16"
810
>guint16</a> <em class="structfield"><code>n_preallocs</code></em>;</span></td>
811
<td> 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, it is ignored, since instances are allocated with the <a
812
href="../glib/glib-Memory-Slices.html"
813
>slice allocator</a> now.
817
<td><span class="term"><a href="gobject-Type-Information.html#GInstanceInitFunc">GInstanceInitFunc</a> <em class="structfield"><code>instance_init</code></em>;</span></td>
818
<td> Location of the instance initialization function (optional, for instantiatable types only).
822
<td><span class="term">const <a href="gobject-Type-Information.html#GTypeValueTable">GTypeValueTable</a> *<em class="structfield"><code>value_table</code></em>;</span></td>
823
<td> A <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a> function table for generic handling of GValues of this type (usually only
824
useful for fundamental types).
832
<div class="refsect2" lang="en">
833
<a name="id3025823"></a><h3>
834
<a name="GTypeFundamentalInfo"></a>GTypeFundamentalInfo</h3>
835
<a class="indexterm" name="id3025836"></a><pre class="programlisting">typedef struct {
836
GTypeFundamentalFlags type_flags;
837
} GTypeFundamentalInfo;
840
A structure that provides information to the type system which is
841
used specifically for managing fundamental types.
843
<div class="variablelist"><table border="0">
844
<col align="left" valign="top">
846
<td><span class="term"><a href="gobject-Type-Information.html#GTypeFundamentalFlags">GTypeFundamentalFlags</a> <em class="structfield"><code>type_flags</code></em>;</span></td>
848
<a href="gobject-Type-Information.html#GTypeFundamentalFlags"><span class="type">GTypeFundamentalFlags</span></a> describing the characteristics of the fundamental type
855
<div class="refsect2" lang="en">
856
<a name="id3025888"></a><h3>
857
<a name="GInterfaceInfo"></a>GInterfaceInfo</h3>
858
<a class="indexterm" name="id3025900"></a><pre class="programlisting">typedef struct {
859
GInterfaceInitFunc interface_init;
860
GInterfaceFinalizeFunc interface_finalize;
861
gpointer interface_data;
865
A structure that provides information to the type system which is
866
used specifically for managing interface types.
868
<div class="variablelist"><table border="0">
869
<col align="left" valign="top">
872
<td><span class="term"><a href="gobject-Type-Information.html#GInterfaceInitFunc">GInterfaceInitFunc</a> <em class="structfield"><code>interface_init</code></em>;</span></td>
873
<td>location of the interface initialization function
877
<td><span class="term"><a href="gobject-Type-Information.html#GInterfaceFinalizeFunc">GInterfaceFinalizeFunc</a> <em class="structfield"><code>interface_finalize</code></em>;</span></td>
878
<td>location of the interface finalization function
882
<td><span class="term"><a
883
href="../glib/glib-Basic-Types.html#gpointer"
884
>gpointer</a> <em class="structfield"><code>interface_data</code></em>;</span></td>
885
<td>user-supplied data passed to the interface init/finalize functions
893
<div class="refsect2" lang="en">
894
<a name="id3025989"></a><h3>
895
<a name="GTypeValueTable"></a>GTypeValueTable</h3>
896
<a class="indexterm" name="id3026001"></a><pre class="programlisting">typedef struct {
897
void (*value_init) (GValue *value);
898
void (*value_free) (GValue *value);
899
void (*value_copy) (const GValue *src_value,
901
/* varargs functionality (optional) */
902
gpointer (*value_peek_pointer) (const GValue *value);
903
gchar *collect_format;
904
gchar* (*collect_value) (GValue *value,
905
guint n_collect_values,
906
GTypeCValue *collect_values,
907
guint collect_flags);
909
gchar* (*lcopy_value) (const GValue *value,
910
guint n_collect_values,
911
GTypeCValue *collect_values,
912
guint collect_flags);
916
The <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a> provides the functions required by the <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> implementation,
917
to serve as a container for values of a type.
919
<div class="variablelist"><table border="0">
920
<col align="left" valign="top">
923
<td><span class="term"><em class="structfield"><code>value_init</code></em> ()</span></td>
924
<td> Default initialize <em class="parameter"><code>values</code></em> contents by poking values
925
directly into the value->data array. The data array of
926
the <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> passed into this function was zero-filled
927
with <code class="function"><code class="function">memset()</code></code>, so no care has to
929
old contents. E.g. for the implementation of a string
930
value that may never be <a
931
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
932
><code class="literal">NULL</code></a>, the implementation might
934
<pre class="programlisting">
936
value->data[0].v_pointer = g_strdup ("");
942
<td><span class="term"><em class="structfield"><code>value_free</code></em> ()</span></td>
943
<td> Free any old contents that might be left in the
944
data array of the passed in <em class="parameter"><code>value</code></em>. No resources may
945
remain allocated through the <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> contents after
946
this function returns. E.g. for our above string type:
947
<pre class="programlisting">
949
/* only free strings without a specific flag for static storage */
950
if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
951
g_free (value->data[0].v_pointer);
957
<td><span class="term"><em class="structfield"><code>value_copy</code></em> ()</span></td>
958
<td> <em class="parameter"><code>dest_value</code></em> is a <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> with zero-filled data section
959
and <em class="parameter"><code>src_value</code></em> is a properly setup <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> of same or
961
The purpose of this function is to copy the contents of
962
<em class="parameter"><code>src_value</code></em> into <em class="parameter"><code>dest_value</code></em> in a way, that even after
963
<em class="parameter"><code>src_value</code></em> has been freed, the contents of <em class="parameter"><code>dest_value</code></em>
964
remain valid. String type example:
965
<pre class="programlisting">
967
dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
973
<td><span class="term"><em class="structfield"><code>value_peek_pointer</code></em> ()</span></td>
974
<td> If the value contents fit into a pointer, such as objects
975
or strings, return this pointer, so the caller can peek at
976
the current contents. To extend on our above string example:
977
<pre class="programlisting">
979
return value->data[0].v_pointer;
985
<td><span class="term"><a
986
href="../glib/glib-Basic-Types.html#gchar"
987
>gchar</a> *<em class="structfield"><code>collect_format</code></em>;</span></td>
988
<td> A string format describing how to collect the contents of
989
this value bit-by-bit. Each character in the format represents
990
an argument to be collected, and the characters themselves indicate
991
the type of the argument. Currently supported arguments are:
992
<div class="variablelist"><table border="0">
993
<col align="left" valign="top">
996
<td><span class="term"></span></td>
998
'i' - Integers. passed as collect_values[].v_int.
1002
<td><span class="term"></span></td>
1004
'l' - Longs. passed as collect_values[].v_long.
1008
<td><span class="term"></span></td>
1010
'd' - Doubles. passed as collect_values[].v_double.
1014
<td><span class="term"></span></td>
1016
'p' - Pointers. passed as collect_values[].v_pointer.
1021
It should be noted that for variable argument list construction,
1022
ANSI C promotes every type smaller than an integer to an int, and
1023
floats to doubles. So for collection of short int or char, 'i'
1024
needs to be used, and for collection of floats 'd'.
1028
<td><span class="term"><em class="structfield"><code>collect_value</code></em> ()</span></td>
1029
<td> The <code class="function">collect_value()</code> function is responsible for converting the
1030
values collected from a variable argument list into contents
1031
suitable for storage in a GValue. This function should setup
1032
<em class="parameter"><code>value</code></em> similar to <code class="function">value_init()</code>; e.g. for a string value that
1034
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1035
><code class="literal">NULL</code></a> pointers, it needs to either spew an error,
1036
or do an implicit conversion by storing an empty string.
1037
The <em class="parameter"><code>value</code></em> passed in to this function has a zero-filled data
1038
array, so just like for <code class="function">value_init()</code> it is guaranteed to not
1039
contain any old contents that might need freeing.
1040
<em class="parameter"><code>n_collect_values</code></em> is exactly the string length of <em class="parameter"><code>collect_format</code></em>,
1041
and <em class="parameter"><code>collect_values</code></em> is an array of unions <a href="gobject-Varargs-Value-Collection.html#GTypeCValue"><span class="type">GTypeCValue</span></a> with
1042
length <em class="parameter"><code>n_collect_values</code></em>, containing the collected values
1043
according to <em class="parameter"><code>collect_format</code></em>.
1044
<em class="parameter"><code>collect_flags</code></em> is an argument provided as a hint by the caller.
1045
It may contain the flag <span class="type">G_VALUE_NOCOPY_CONTENTS</span> indicating,
1046
that the collected value contents may be considered "static"
1047
for the duration of the <em class="parameter"><code>value</code></em> lifetime.
1048
Thus an extra copy of the contents stored in <em class="parameter"><code>collect_values</code></em> is
1049
not required for assignment to <em class="parameter"><code>value</code></em>.
1050
For our above string example, we continue with:
1051
<pre class="programlisting">
1053
if (!collect_values[0].v_pointer)
1054
value->data[0].v_pointer = g_strdup ("");
1055
else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
1057
value->data[0].v_pointer = collect_values[0].v_pointer;
1058
/* keep a flag for the value_free() implementation to not free this string */
1059
value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
1062
value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
1067
It should be noted, that it is generally a bad idea to follow the
1068
<span class="type">G_VALUE_NOCOPY_CONTENTS</span> hint for reference counted types. Due to
1069
reentrancy requirements and reference count assertions performed
1070
by the <span class="type">GSignal</span> code, reference counts should always be incremented
1071
for reference counted contents stored in the value->data array.
1072
To deviate from our string example for a moment, and taking a look
1073
at an exemplary implementation for <code class="function">collect_value()</code> of <span class="type">GObject:</span>
1074
<pre class="programlisting">
1076
if (collect_values[0].v_pointer)
1078
GObject *object = G_OBJECT (collect_values[0].v_pointer);
1080
/* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
1081
value->data[0].v_pointer = g_object_ref (object);
1085
return g_strdup_printf ("Object passed as invalid NULL pointer");
1088
The reference count for valid objects is always incremented,
1089
regardless of <em class="parameter"><code>collect_flags</code></em>. For invalid objects, the example
1090
returns a newly allocated string without altering <em class="parameter"><code>value</code></em>.
1091
Upon success, <code class="function">collect_value()</code> needs to return <a
1092
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1093
><code class="literal">NULL</code></a>. If, however,
1094
an error condition occurred, <code class="function">collect_value()</code> may spew an
1095
error by returning a newly allocated non-<a
1096
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1097
><code class="literal">NULL</code></a> string, giving
1098
a suitable description of the error condition.
1099
The calling code makes no assumptions about the <em class="parameter"><code>value</code></em>
1100
contents being valid upon error returns, <em class="parameter"><code>value</code></em>
1101
is simply thrown away without further freeing. As such, it is
1102
a good idea to not allocate <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> contents, prior to returning
1103
an error, however, <code class="function">collect_values()</code> is not obliged to return
1104
a correctly setup <em class="parameter"><code>value</code></em> for error returns, simply because
1106
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1107
><code class="literal">NULL</code></a> return is considered a fatal condition so further
1108
program behaviour is undefined.
1112
<td><span class="term"><a
1113
href="../glib/glib-Basic-Types.html#gchar"
1114
>gchar</a> *<em class="structfield"><code>lcopy_format</code></em>;</span></td>
1115
<td> Format description of the arguments to collect for <em class="parameter"><code>lcopy_value</code></em>,
1116
analogous to <em class="parameter"><code>collect_format</code></em>. Usually, <em class="parameter"><code>lcopy_format</code></em> string consists
1117
only of 'p's to provide <code class="function">lcopy_value()</code> with pointers to storage locations.
1121
<td><span class="term"><em class="structfield"><code>lcopy_value</code></em> ()</span></td>
1122
<td> This function is responsible for storing the <em class="parameter"><code>value</code></em> contents into
1123
arguments passed through a variable argument list which got
1124
collected into <em class="parameter"><code>collect_values</code></em> according to <em class="parameter"><code>lcopy_format</code></em>.
1125
<em class="parameter"><code>n_collect_values</code></em> equals the string length of <em class="parameter"><code>lcopy_format</code></em>,
1126
and <em class="parameter"><code>collect_flags</code></em> may contain <span class="type">G_VALUE_NOCOPY_CONTENTS</span>.
1127
In contrast to <code class="function">collect_value()</code>, <code class="function">lcopy_value()</code> is obliged to
1128
always properly support <span class="type">G_VALUE_NOCOPY_CONTENTS</span>.
1129
Similar to <code class="function">collect_value()</code> the function may prematurely abort
1130
by returning a newly allocated string describing an error condition.
1131
To complete the string example:
1132
<pre class="programlisting">
1134
gchar **string_p = collect_values[0].v_pointer;
1137
return g_strdup_printf ("string location passed as NULL");
1139
if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
1140
*string_p = value->data[0].v_pointer;
1142
*string_p = g_strdup (value->data[0].v_pointer);
1146
And an illustrative version of <code class="function">lcopy_value()</code> for
1147
reference-counted types:
1148
<pre class="programlisting">
1150
GObject **object_p = collect_values[0].v_pointer;
1153
return g_strdup_printf ("object location passed as NULL");
1154
if (!value->data[0].v_pointer)
1156
else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) /* always honour */
1157
*object_p = value->data[0].v_pointer;
1159
*object_p = g_object_ref (value->data[0].v_pointer);
1170
<div class="refsect2" lang="en">
1171
<a name="id3026876"></a><h3>
1172
<a name="G-TYPE-FROM-INSTANCE:CAPS"></a>G_TYPE_FROM_INSTANCE()</h3>
1173
<a class="indexterm" name="id3026889"></a><pre class="programlisting">#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
1176
Returns the type identifier from a given <em class="parameter"><code>instance</code></em> structure.
1181
This macro should only be used in type implementations.
1183
<div class="variablelist"><table border="0">
1184
<col align="left" valign="top">
1186
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1187
<td>Location of a valid <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1195
<div class="refsect2" lang="en">
1196
<a name="id3026946"></a><h3>
1197
<a name="G-TYPE-FROM-CLASS:CAPS"></a>G_TYPE_FROM_CLASS()</h3>
1198
<a class="indexterm" name="id3026959"></a><pre class="programlisting">#define G_TYPE_FROM_CLASS(g_class) (((GTypeClass*) (g_class))->g_type)
1201
Returns the type identifier from a given <em class="parameter"><code>class</code></em> structure.
1206
This macro should only be used in type implementations.
1208
<div class="variablelist"><table border="0">
1209
<col align="left" valign="top">
1211
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
1212
<td>Location of a valid <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure.
1220
<div class="refsect2" lang="en">
1221
<a name="id3027014"></a><h3>
1222
<a name="G-TYPE-FROM-INTERFACE:CAPS"></a>G_TYPE_FROM_INTERFACE()</h3>
1223
<a class="indexterm" name="id3027027"></a><pre class="programlisting">#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type)
1226
Returns the type identifier from a given <em class="parameter"><code>interface</code></em> structure.
1231
This macro should only be used in type implementations.
1233
<div class="variablelist"><table border="0">
1234
<col align="left" valign="top">
1236
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
1237
<td>Location of a valid <a href="gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> structure.
1245
<div class="refsect2" lang="en">
1246
<a name="id3027084"></a><h3>
1247
<a name="G-TYPE-INSTANCE-GET-CLASS:CAPS"></a>G_TYPE_INSTANCE_GET_CLASS()</h3>
1248
<a class="indexterm" name="id3027097"></a><pre class="programlisting">#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type))
1251
Returns the class structure of a given <em class="parameter"><code>instance</code></em>, casted
1252
to a specified ancestor type <em class="parameter"><code>g_type</code></em> of the instance.
1254
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1255
<h3 class="title">Warning</h3>
1257
that while calling a <a href="gobject-Type-Information.html#GInstanceInitFunc"><code class="function">GInstanceInitFunc()</code></a>, the class pointer gets
1258
modified, so it might not always return the expected pointer.
1262
This macro should only be used in type implementations.
1264
<div class="variablelist"><table border="0">
1265
<col align="left" valign="top">
1268
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1269
<td> Location of the <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1273
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1274
<td> The anchestor type of the class to be returned.
1278
<td><span class="term"><em class="parameter"><code>c_type</code></em> :</span></td>
1279
<td> The corresponding C type of <em class="parameter"><code>g_type</code></em>.
1288
<div class="refsect2" lang="en">
1289
<a name="id3027209"></a><h3>
1290
<a name="G-TYPE-INSTANCE-GET-INTERFACE:CAPS"></a>G_TYPE_INSTANCE_GET_INTERFACE()</h3>
1291
<a class="indexterm" name="id3027223"></a><pre class="programlisting">#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))
1294
Returns the interface structure for interface <em class="parameter"><code>g_type</code></em> of a given <em class="parameter"><code>instance</code></em>.
1299
This macro should only be used in type implementations.
1301
<div class="variablelist"><table border="0">
1302
<col align="left" valign="top">
1305
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1306
<td>Location of the <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1310
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1311
<td>The interface type to be returned.
1315
<td><span class="term"><em class="parameter"><code>c_type</code></em> :</span></td>
1316
<td>The corresponding C type of <em class="parameter"><code>g_type</code></em>.
1325
<div class="refsect2" lang="en">
1326
<a name="id3027318"></a><h3>
1327
<a name="G-TYPE-INSTANCE-GET-PRIVATE:CAPS"></a>G_TYPE_INSTANCE_GET_PRIVATE()</h3>
1328
<a class="indexterm" name="id3027333"></a><pre class="programlisting">#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))
1331
Gets the private structure for a particular type.
1332
The private structure must have been registered in the
1333
class_init function with <a href="gobject-Type-Information.html#g-type-class-add-private"><code class="function">g_type_class_add_private()</code></a>.
1336
This macro should only be used in type implementations.
1338
<div class="variablelist"><table border="0">
1339
<col align="left" valign="top">
1342
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1343
<td>the instance of a type deriving from <em class="parameter"><code>private_type</code></em>.
1347
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1348
<td>the type identifying which private data to retrieve.
1352
<td><span class="term"><em class="parameter"><code>c_type</code></em> :</span></td>
1353
<td>The C type for the private structure.
1358
<p class="since">Since 2.4
1364
<div class="refsect2" lang="en">
1365
<a name="id3027428"></a><h3>
1366
<a name="G-TYPE-CHECK-INSTANCE:CAPS"></a>G_TYPE_CHECK_INSTANCE()</h3>
1367
<a class="indexterm" name="id3027441"></a><pre class="programlisting">#define G_TYPE_CHECK_INSTANCE(instance) (_G_TYPE_CHI ((GTypeInstance*) (instance)))
1371
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1372
><code class="literal">TRUE</code></a> if <em class="parameter"><code>instance</code></em> is a valid <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure,
1373
otherwise emits a warning and returns <a
1374
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
1375
><code class="literal">FALSE</code></a>.
1380
This macro should only be used in type implementations.
1382
<div class="variablelist"><table border="0">
1383
<col align="left" valign="top">
1385
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1386
<td>Location of a <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1394
<div class="refsect2" lang="en">
1395
<a name="id3027525"></a><h3>
1396
<a name="G-TYPE-CHECK-INSTANCE-CAST:CAPS"></a>G_TYPE_CHECK_INSTANCE_CAST()</h3>
1397
<a class="indexterm" name="id3027538"></a><pre class="programlisting">#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
1400
Checks that <em class="parameter"><code>instance</code></em> is an instance of the type identified by <em class="parameter"><code>g_type</code></em>
1401
and emits a warning if this is not the case. Returns <em class="parameter"><code>instance</code></em> casted
1402
to a pointer to <em class="parameter"><code>c_type</code></em>.
1405
This macro should only be used in type implementations.
1407
<div class="variablelist"><table border="0">
1408
<col align="left" valign="top">
1411
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1412
<td>Location of a <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1416
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1417
<td>The type to be returned.
1421
<td><span class="term"><em class="parameter"><code>c_type</code></em> :</span></td>
1422
<td>The corresponding C type of <em class="parameter"><code>g_type</code></em>.
1431
<div class="refsect2" lang="en">
1432
<a name="id3027646"></a><h3>
1433
<a name="G-TYPE-CHECK-INSTANCE-TYPE:CAPS"></a>G_TYPE_CHECK_INSTANCE_TYPE()</h3>
1434
<a class="indexterm" name="id3027659"></a><pre class="programlisting">#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type)))
1438
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1439
><code class="literal">TRUE</code></a> if <em class="parameter"><code>instance</code></em> is an instance of the type identified by <em class="parameter"><code>g_type</code></em>.
1440
Otherwise emits a warning and returns <a
1441
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
1442
><code class="literal">FALSE</code></a>.
1445
This macro should only be used in type implementations.
1447
<div class="variablelist"><table border="0">
1448
<col align="left" valign="top">
1451
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
1452
<td>Location of a <a href="gobject-Type-Information.html#GTypeInstance"><span class="type">GTypeInstance</span></a> structure.
1456
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1457
<td>The type to be checked
1466
<div class="refsect2" lang="en">
1467
<a name="id3027754"></a><h3>
1468
<a name="G-TYPE-CHECK-CLASS-CAST:CAPS"></a>G_TYPE_CHECK_CLASS_CAST()</h3>
1469
<a class="indexterm" name="id3027768"></a><pre class="programlisting">#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type) (_G_TYPE_CCC ((g_class), (g_type), c_type))
1472
Checks that <em class="parameter"><code>g_class</code></em> is a class structure of the type identified by <em class="parameter"><code>g_type</code></em>
1473
and emits a warning if this is not the case. Returns <em class="parameter"><code>g_class</code></em> casted
1474
to a pointer to <em class="parameter"><code>c_type</code></em>.
1477
This macro should only be used in type implementations.
1479
<div class="variablelist"><table border="0">
1480
<col align="left" valign="top">
1483
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
1484
<td>Location of a <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure.
1488
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1489
<td>The type to be returned.
1493
<td><span class="term"><em class="parameter"><code>c_type</code></em> :</span></td>
1494
<td>The corresponding C type of class structure of <em class="parameter"><code>g_type</code></em>.
1503
<div class="refsect2" lang="en">
1504
<a name="id3027876"></a><h3>
1505
<a name="G-TYPE-CHECK-CLASS-TYPE:CAPS"></a>G_TYPE_CHECK_CLASS_TYPE()</h3>
1506
<a class="indexterm" name="id3027890"></a><pre class="programlisting">#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) (_G_TYPE_CCT ((g_class), (g_type)))
1510
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1511
><code class="literal">TRUE</code></a> if <em class="parameter"><code>g_class</code></em> is a class structure of the type identified by
1512
<em class="parameter"><code>g_type</code></em>. Otherwise emits a warning and returns <a
1513
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
1514
><code class="literal">FALSE</code></a>.
1517
This macro should only be used in type implementations.
1519
<div class="variablelist"><table border="0">
1520
<col align="left" valign="top">
1523
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
1524
<td>Location of a <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure.
1528
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1529
<td>The type to be checked.
1538
<div class="refsect2" lang="en">
1539
<a name="id3027985"></a><h3>
1540
<a name="G-TYPE-CHECK-VALUE:CAPS"></a>G_TYPE_CHECK_VALUE()</h3>
1541
<a class="indexterm" name="id3027997"></a><pre class="programlisting">#define G_TYPE_CHECK_VALUE(value) (_G_TYPE_CHV ((value)))
1545
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1546
><code class="literal">TRUE</code></a> if <em class="parameter"><code>value</code></em> has been initialized to hold values
1550
This macro should only be used in type implementations.
1552
<div class="variablelist"><table border="0">
1553
<col align="left" valign="top">
1555
<td><span class="term"><em class="parameter"><code>value</code></em> :</span></td>
1556
<td>a <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a>
1564
<div class="refsect2" lang="en">
1565
<a name="id3028060"></a><h3>
1566
<a name="G-TYPE-CHECK-VALUE-TYPE:CAPS"></a>G_TYPE_CHECK_VALUE_TYPE()</h3>
1567
<a class="indexterm" name="id3028074"></a><pre class="programlisting">#define G_TYPE_CHECK_VALUE_TYPE(value, g_type) (_G_TYPE_CVH ((value), (g_type)))
1571
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1572
><code class="literal">TRUE</code></a> if <em class="parameter"><code>value</code></em> has been initialized to hold values
1573
of type <em class="parameter"><code>g_type</code></em>.
1576
This macro should only be used in type implementations.
1578
<div class="variablelist"><table border="0">
1579
<col align="left" valign="top">
1582
<td><span class="term"><em class="parameter"><code>value</code></em> :</span></td>
1583
<td>a <a href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a>
1587
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
1588
<td>The type to be checked.
1597
<div class="refsect2" lang="en">
1598
<a name="id3028157"></a><h3>
1599
<a name="G-TYPE-FLAG-RESERVED-ID-BIT:CAPS"></a>G_TYPE_FLAG_RESERVED_ID_BIT</h3>
1600
<a class="indexterm" name="id3028170"></a><pre class="programlisting">#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0))
1603
A bit in the type number that's supposed to be left untouched.
1607
<div class="refsect2" lang="en">
1608
<a name="id3028187"></a><h3>
1609
<a name="g-type-init"></a>g_type_init ()</h3>
1610
<a class="indexterm" name="id3028200"></a><pre class="programlisting">void g_type_init (void);</pre>
1612
Prior to any use of the type system, <a href="gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a> has to be called to initialize
1613
the type system and assorted other code portions (such as the various fundamental
1614
type implementations or the signal system).
1618
<div class="refsect2" lang="en">
1619
<a name="id3028234"></a><h3>
1620
<a name="GTypeDebugFlags"></a>enum GTypeDebugFlags</h3>
1621
<a class="indexterm" name="id3028248"></a><pre class="programlisting">typedef enum /*< skip >*/
1623
G_TYPE_DEBUG_NONE = 0,
1624
G_TYPE_DEBUG_OBJECTS = 1 << 0,
1625
G_TYPE_DEBUG_SIGNALS = 1 << 1,
1626
G_TYPE_DEBUG_MASK = 0x03
1630
The <span class="type">GTypeDebugFlags</span> enumeration values can be passed to
1631
<a href="gobject-Type-Information.html#g-type-init-with-debug-flags"><code class="function">g_type_init_with_debug_flags()</code></a> to trigger debugging messages during runtime.
1632
Note that the messages can also be triggered by setting the
1633
<code class="envar">GOBJECT_DEBUG</code> environment variable to a ':'-separated list of
1634
"objects" and "signals".
1637
<div class="variablelist"><table border="0">
1638
<col align="left" valign="top">
1641
<td><span class="term"><a name="G-TYPE-DEBUG-NONE:CAPS"></a><code class="literal">G_TYPE_DEBUG_NONE</code></span></td>
1642
<td>Print no messages.
1646
<td><span class="term"><a name="G-TYPE-DEBUG-OBJECTS:CAPS"></a><code class="literal">G_TYPE_DEBUG_OBJECTS</code></span></td>
1647
<td>Print messages about object bookkeeping.
1651
<td><span class="term"><a name="G-TYPE-DEBUG-SIGNALS:CAPS"></a><code class="literal">G_TYPE_DEBUG_SIGNALS</code></span></td>
1652
<td>Print messages about signal emissions.
1656
<td><span class="term"><a name="G-TYPE-DEBUG-MASK:CAPS"></a><code class="literal">G_TYPE_DEBUG_MASK</code></span></td>
1657
<td>Mask covering all debug flags.
1665
<div class="refsect2" lang="en">
1666
<a name="id3028382"></a><h3>
1667
<a name="g-type-init-with-debug-flags"></a>g_type_init_with_debug_flags ()</h3>
1668
<a class="indexterm" name="id3028395"></a><pre class="programlisting">void g_type_init_with_debug_flags (<a href="gobject-Type-Information.html#GTypeDebugFlags">GTypeDebugFlags</a> debug_flags);</pre>
1670
Similar to <a href="gobject-Type-Information.html#g-type-init"><code class="function">g_type_init()</code></a>, but additionally sets debug flags.
1672
<div class="variablelist"><table border="0">
1673
<col align="left" valign="top">
1675
<td><span class="term"><em class="parameter"><code>debug_flags</code></em> :</span></td>
1676
<td>Bitwise combination of <a href="gobject-Type-Information.html#GTypeDebugFlags"><span class="type">GTypeDebugFlags</span></a> values for debugging purposes.
1684
<div class="refsect2" lang="en">
1685
<a name="id3028463"></a><h3>
1686
<a name="g-type-name"></a>g_type_name ()</h3>
1687
<a class="indexterm" name="id3028475"></a><pre class="programlisting">const <a
1688
href="../glib/glib-Basic-Types.html#gchar"
1689
>gchar</a>* g_type_name (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1691
Returns the unique name that is assigned to a type ID (this is the preferred method
1692
to find out whether a specific type has been registered for the passed in ID yet).
1694
<div class="variablelist"><table border="0">
1695
<col align="left" valign="top">
1698
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1699
<td> Type to return name for.
1703
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1704
<td> Static type name or <a
1705
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1706
><code class="literal">NULL</code></a>.
1715
<div class="refsect2" lang="en">
1716
<a name="id3028546"></a><h3>
1717
<a name="g-type-qname"></a>g_type_qname ()</h3>
1718
<a class="indexterm" name="id3028559"></a><pre class="programlisting"><a
1719
href="../glib/glib-Quarks.html#GQuark"
1720
>GQuark</a> g_type_qname (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1722
Return the corresponding quark of the type IDs name.
1724
<div class="variablelist"><table border="0">
1725
<col align="left" valign="top">
1728
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1729
<td> Type to return quark of type name for.
1733
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1734
<td>The type names quark or 0.
1743
<div class="refsect2" lang="en">
1744
<a name="id3028618"></a><h3>
1745
<a name="g-type-from-name"></a>g_type_from_name ()</h3>
1746
<a class="indexterm" name="id3028630"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_from_name (const <a
1747
href="../glib/glib-Basic-Types.html#gchar"
1748
>gchar</a> *name);</pre>
1750
Lookup the type ID from a given type name, returning 0 if no type has been registered under this name
1751
(this is the preferred method to find out by name whether a specific type has been registered yet).
1753
<div class="variablelist"><table border="0">
1754
<col align="left" valign="top">
1757
<td><span class="term"><em class="parameter"><code>name</code></em> :</span></td>
1758
<td> Type name to lookup.
1762
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1763
<td>Corresponding type ID or 0.
1772
<div class="refsect2" lang="en">
1773
<a name="id3028691"></a><h3>
1774
<a name="g-type-parent"></a>g_type_parent ()</h3>
1775
<a class="indexterm" name="id3028704"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_parent (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1777
Return the direct parent type of the passed in type.
1778
If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
1780
<div class="variablelist"><table border="0">
1781
<col align="left" valign="top">
1784
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1785
<td> The derived type.
1789
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1790
<td>The parent type.
1799
<div class="refsect2" lang="en">
1800
<a name="id3028763"></a><h3>
1801
<a name="g-type-depth"></a>g_type_depth ()</h3>
1802
<a class="indexterm" name="id3028776"></a><pre class="programlisting"><a
1803
href="../glib/glib-Basic-Types.html#guint"
1804
>guint</a> g_type_depth (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1806
Returns the length of the ancestry of the passed in type. This includes the
1807
type itself, so that e.g. a fundamental type has depth 1.
1809
<div class="variablelist"><table border="0">
1810
<col align="left" valign="top">
1813
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1814
<td> A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
1818
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1819
<td>The depth of <em class="parameter"><code>type</code></em>.
1828
<div class="refsect2" lang="en">
1829
<a name="id3028850"></a><h3>
1830
<a name="g-type-next-base"></a>g_type_next_base ()</h3>
1831
<a class="indexterm" name="id3028862"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_next_base (<a href="gobject-Type-Information.html#GType">GType</a> leaf_type,
1832
<a href="gobject-Type-Information.html#GType">GType</a> root_type);</pre>
1834
Given a <em class="parameter"><code>leaf_type</code></em> and a <em class="parameter"><code>root_type</code></em> which is contained in its anchestry, return
1835
the type that <em class="parameter"><code>root_type</code></em> is the immediate parent of.
1836
In other words, this function determines the type that is derived directly from
1837
<em class="parameter"><code>root_type</code></em> which is also a base class of <em class="parameter"><code>leaf_type</code></em>. Given a root type and a
1838
leaf type, this function can be used to determine the types and order in which
1839
the leaf type is descended from the root type.
1841
<div class="variablelist"><table border="0">
1842
<col align="left" valign="top">
1845
<td><span class="term"><em class="parameter"><code>leaf_type</code></em> :</span></td>
1846
<td> Descendant of <em class="parameter"><code>root_type</code></em> and the type to be returned.
1850
<td><span class="term"><em class="parameter"><code>root_type</code></em> :</span></td>
1851
<td> Immediate parent of the returned type.
1855
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1856
<td> Immediate child of <em class="parameter"><code>root_type</code></em> and anchestor of <em class="parameter"><code>leaf_type</code></em>.
1865
<div class="refsect2" lang="en">
1866
<a name="id3028996"></a><h3>
1867
<a name="g-type-is-a"></a>g_type_is_a ()</h3>
1868
<a class="indexterm" name="id3029008"></a><pre class="programlisting"><a
1869
href="../glib/glib-Basic-Types.html#gboolean"
1870
>gboolean</a> g_type_is_a (<a href="gobject-Type-Information.html#GType">GType</a> type,
1871
<a href="gobject-Type-Information.html#GType">GType</a> is_a_type);</pre>
1873
If <em class="parameter"><code>is_a_type</code></em> is a derivable type, check whether <em class="parameter"><code>type</code></em> is a descendant of <em class="parameter"><code>is_a_type</code></em>.
1874
If <em class="parameter"><code>is_a_type</code></em> is an interface, check whether <em class="parameter"><code>type</code></em> conforms to it.
1876
<div class="variablelist"><table border="0">
1877
<col align="left" valign="top">
1880
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1881
<td> Type to check anchestry for.
1885
<td><span class="term"><em class="parameter"><code>is_a_type</code></em> :</span></td>
1886
<td>Possible anchestor of <em class="parameter"><code>type</code></em> or interface <em class="parameter"><code>type</code></em> could conform to.
1890
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1892
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
1893
><code class="literal">TRUE</code></a> if <em class="parameter"><code>type</code></em> is_a <em class="parameter"><code>is_a_type</code></em> holds true.
1902
<div class="refsect2" lang="en">
1903
<a name="id3029153"></a><h3>
1904
<a name="g-type-class-ref"></a>g_type_class_ref ()</h3>
1905
<a class="indexterm" name="id3029166"></a><pre class="programlisting"><a
1906
href="../glib/glib-Basic-Types.html#gpointer"
1907
>gpointer</a> g_type_class_ref (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1909
Increments the reference count of the class structure belonging to
1910
<em class="parameter"><code>type</code></em>. This function will demand-create the class if it doesn't
1913
<div class="variablelist"><table border="0">
1914
<col align="left" valign="top">
1917
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1918
<td> Type ID of a classed type.
1922
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1923
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure for the given type ID.
1932
<div class="refsect2" lang="en">
1933
<a name="id3029240"></a><h3>
1934
<a name="g-type-class-peek"></a>g_type_class_peek ()</h3>
1935
<a class="indexterm" name="id3029253"></a><pre class="programlisting"><a
1936
href="../glib/glib-Basic-Types.html#gpointer"
1937
>gpointer</a> g_type_class_peek (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1939
This function is essentially the same as <a href="gobject-Type-Information.html#g-type-class-ref"><code class="function">g_type_class_ref()</code></a>, except that
1940
the classes reference count isn't incremented. As a consequence, this function
1942
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1943
><code class="literal">NULL</code></a> if the class of the type passed in does not currently
1944
exist (hasn't been referenced before).
1946
<div class="variablelist"><table border="0">
1947
<col align="left" valign="top">
1950
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1951
<td> Type ID of a classed type.
1955
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1956
<td> The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure for the given type ID or <a
1957
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1958
><code class="literal">NULL</code></a>
1959
if the class does not currently exist.
1968
<div class="refsect2" lang="en">
1969
<a name="id3029354"></a><h3>
1970
<a name="g-type-class-peek-static"></a>g_type_class_peek_static ()</h3>
1971
<a class="indexterm" name="id3029369"></a><pre class="programlisting"><a
1972
href="../glib/glib-Basic-Types.html#gpointer"
1973
>gpointer</a> g_type_class_peek_static (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
1975
A more efficient version of <a href="gobject-Type-Information.html#g-type-class-peek"><code class="function">g_type_class_peek()</code></a> which works only for
1978
<div class="variablelist"><table border="0">
1979
<col align="left" valign="top">
1982
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
1983
<td>Type ID of a classed type.
1987
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1988
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure for the given type ID or <a
1989
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
1990
><code class="literal">NULL</code></a>
1991
if the class does not currently exist or is dynamically loaded.
1996
<p class="since">Since 2.4
2002
<div class="refsect2" lang="en">
2003
<a name="id3029465"></a><h3>
2004
<a name="g-type-class-unref"></a>g_type_class_unref ()</h3>
2005
<a class="indexterm" name="id3029478"></a><pre class="programlisting">void g_type_class_unref (<a
2006
href="../glib/glib-Basic-Types.html#gpointer"
2007
>gpointer</a> g_class);</pre>
2009
Decrements the reference count of the class structure being passed in.
2010
Once the last reference count of a class has been released, classes
2011
may be finalized by the type system, so further dereferencing of a
2012
class pointer after <a href="gobject-Type-Information.html#g-type-class-unref"><code class="function">g_type_class_unref()</code></a> are invalid.
2014
<div class="variablelist"><table border="0">
2015
<col align="left" valign="top">
2017
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2018
<td> The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to unreference.
2026
<div class="refsect2" lang="en">
2027
<a name="id3029547"></a><h3>
2028
<a name="g-type-class-peek-parent"></a>g_type_class_peek_parent ()</h3>
2029
<a class="indexterm" name="id3029560"></a><pre class="programlisting"><a
2030
href="../glib/glib-Basic-Types.html#gpointer"
2031
>gpointer</a> g_type_class_peek_parent (<a
2032
href="../glib/glib-Basic-Types.html#gpointer"
2033
>gpointer</a> g_class);</pre>
2035
This is a convenience function often needed in class initializers.
2036
It returns the class structure of the immediate parent type of the class passed in.
2037
Since derived classes hold
2038
a reference count on their parent classes as long as they are instantiated,
2039
the returned class will always exist. This function is essentially
2043
<pre class="programlisting">
2044
g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
2049
<div class="variablelist"><table border="0">
2050
<col align="left" valign="top">
2053
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2054
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to retrieve the parent class for.
2058
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2059
<td>The parent class of <em class="parameter"><code>g_class</code></em>.
2068
<div class="refsect2" lang="en">
2069
<a name="id3029644"></a><h3>
2070
<a name="g-type-class-add-private"></a>g_type_class_add_private ()</h3>
2071
<a class="indexterm" name="id3029659"></a><pre class="programlisting">void g_type_class_add_private (<a
2072
href="../glib/glib-Basic-Types.html#gpointer"
2073
>gpointer</a> g_class,
2075
href="../glib/glib-Basic-Types.html#gsize"
2076
>gsize</a> private_size);</pre>
2078
Registers a private structure for a instantiatable type;
2079
when an object is allocated, the private structures for
2080
the type and and all of its parent types are allocated
2081
sequentially in the same memory block as the public
2082
structures. This function should be called in the
2083
type's <a href="gtype-instantiable-classed.html#class-init"><code class="function">class_init()</code></a> function. The private structure can
2084
be retrieved using the <a href="gobject-Type-Information.html#G-TYPE-INSTANCE-GET-PRIVATE:CAPS"><code class="function">G_TYPE_INSTANCE_GET_PRIVATE()</code></a> macro.
2085
The following example shows attaching a private structure
2086
<span class="structname">MyObjectPrivate</span> to an object
2087
<span class="structname">MyObject</span> defined in the standard GObject
2090
<pre class="programlisting">
2091
typedef struct _MyObjectPrivate MyObjectPrivate;
2093
struct _MyObjectPrivate {
2097
#define MY_OBJECT_GET_PRIVATE(o) \
2098
(G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))
2101
my_object_class_init (MyObjectClass *klass)
2103
g_type_class_add_private (klass, sizeof (MyObjectPrivate));
2107
my_object_get_some_field (MyObject *my_object)
2109
MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);
2111
return priv->some_field;
2114
<div class="variablelist"><table border="0">
2115
<col align="left" valign="top">
2118
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2119
<td>class structure for an instantiatable type
2123
<td><span class="term"><em class="parameter"><code>private_size</code></em> :</span></td>
2124
<td>size of private structure.
2129
<p class="since">Since 2.4
2135
<div class="refsect2" lang="en">
2136
<a name="id3029791"></a><h3>
2137
<a name="g-type-interface-peek"></a>g_type_interface_peek ()</h3>
2138
<a class="indexterm" name="id3029804"></a><pre class="programlisting"><a
2139
href="../glib/glib-Basic-Types.html#gpointer"
2140
>gpointer</a> g_type_interface_peek (<a
2141
href="../glib/glib-Basic-Types.html#gpointer"
2142
>gpointer</a> instance_class,
2143
<a href="gobject-Type-Information.html#GType">GType</a> iface_type);</pre>
2145
Returns the <a href="gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> structure of an interface to which the passed in
2148
<div class="variablelist"><table border="0">
2149
<col align="left" valign="top">
2152
<td><span class="term"><em class="parameter"><code>instance_class</code></em> :</span></td>
2153
<td>A <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure.
2157
<td><span class="term"><em class="parameter"><code>iface_type</code></em> :</span></td>
2158
<td> An interface ID which this class conforms to.
2162
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2163
<td> The GTypeInterface structure of iface_type if implemented
2164
by <em class="parameter"><code>instance_class</code></em>, <a
2165
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
2166
><code class="literal">NULL</code></a> otherwise
2175
<div class="refsect2" lang="en">
2176
<a name="id3029918"></a><h3>
2177
<a name="g-type-interface-peek-parent"></a>g_type_interface_peek_parent ()</h3>
2178
<a class="indexterm" name="id3029932"></a><pre class="programlisting"><a
2179
href="../glib/glib-Basic-Types.html#gpointer"
2180
>gpointer</a> g_type_interface_peek_parent (<a
2181
href="../glib/glib-Basic-Types.html#gpointer"
2182
>gpointer</a> g_iface);</pre>
2184
Returns the corresponding <a href="gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> structure of the parent type
2185
of the instance type to which <em class="parameter"><code>g_iface</code></em> belongs. This is useful when
2186
deriving the implementation of an interface from the parent type and
2187
then possibly overriding some methods.
2189
<div class="variablelist"><table border="0">
2190
<col align="left" valign="top">
2193
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
2194
<td>A <a href="gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> structure.
2198
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2199
<td>The corresponding <a href="gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> structure of the parent type
2200
of the instance type to which <em class="parameter"><code>g_iface</code></em> belongs, or <a
2201
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
2202
><code class="literal">NULL</code></a> if the parent type
2203
doesn't conform to the interface.
2212
<div class="refsect2" lang="en">
2213
<a name="id3030040"></a><h3>
2214
<a name="g-type-default-interface-ref"></a>g_type_default_interface_ref ()</h3>
2215
<a class="indexterm" name="id3030055"></a><pre class="programlisting"><a
2216
href="../glib/glib-Basic-Types.html#gpointer"
2217
>gpointer</a> g_type_default_interface_ref (<a href="gobject-Type-Information.html#GType">GType</a> g_type);</pre>
2219
Increments the reference count for the interface type <em class="parameter"><code>g_type</code></em>,
2220
and returns the default interface vtable for the type.
2223
If the type is not currently in use, then the default vtable
2224
for the type will be created and initalized by calling
2225
the base interface init and default vtable init functions for
2226
the type (the @<em class="structfield"><code>base_init</code></em>
2227
and <em class="structfield"><code>class_init</code></em> members of <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>).
2228
Calling <a href="gobject-Type-Information.html#g-type-default-interface-ref"><code class="function">g_type_default_interface_ref()</code></a> is useful when you
2229
want to make sure that signals and properties for an interface
2230
have been installed.
2232
<div class="variablelist"><table border="0">
2233
<col align="left" valign="top">
2236
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
2237
<td>an interface type
2241
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2242
<td>the default vtable for the interface; call
2243
<a href="gobject-Type-Information.html#g-type-default-interface-unref"><code class="function">g_type_default_interface_unref()</code></a> when you are done using
2249
<p class="since">Since 2.4
2255
<div class="refsect2" lang="en">
2256
<a name="id3030174"></a><h3>
2257
<a name="g-type-default-interface-peek"></a>g_type_default_interface_peek ()</h3>
2258
<a class="indexterm" name="id3030190"></a><pre class="programlisting"><a
2259
href="../glib/glib-Basic-Types.html#gpointer"
2260
>gpointer</a> g_type_default_interface_peek (<a href="gobject-Type-Information.html#GType">GType</a> g_type);</pre>
2262
If the interface type <em class="parameter"><code>g_type</code></em> is currently in use, returns
2263
its default interface vtable.
2265
<div class="variablelist"><table border="0">
2266
<col align="left" valign="top">
2269
<td><span class="term"><em class="parameter"><code>g_type</code></em> :</span></td>
2270
<td>an interface type
2274
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2275
<td>the default vtable for the interface, or <a
2276
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
2277
><code class="literal">NULL</code></a>
2278
if the type is not currently in use.
2283
<p class="since">Since 2.4
2289
<div class="refsect2" lang="en">
2290
<a name="id3030272"></a><h3>
2291
<a name="g-type-default-interface-unref"></a>g_type_default_interface_unref ()</h3>
2292
<a class="indexterm" name="id3030287"></a><pre class="programlisting">void g_type_default_interface_unref (<a
2293
href="../glib/glib-Basic-Types.html#gpointer"
2294
>gpointer</a> g_iface);</pre>
2296
Decrements the reference count for the type corresponding to the
2297
interface default vtable <em class="parameter"><code>g_iface</code></em>. If the type is dynamic, then
2298
when no one is using the interface and all references have
2299
been released, the finalize function for the interface's default
2300
vtable (the <em class="structfield"><code>class_finalize</code></em> member of
2301
<a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>) will be called.
2303
<div class="variablelist"><table border="0">
2304
<col align="left" valign="top">
2306
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
2307
<td>the default vtable structure for a interface, as
2308
returned by <a href="gobject-Type-Information.html#g-type-default-interface-ref"><code class="function">g_type_default_interface_ref()</code></a>
2312
<p class="since">Since 2.4
2318
<div class="refsect2" lang="en">
2319
<a name="id3030375"></a><h3>
2320
<a name="g-type-children"></a>g_type_children ()</h3>
2321
<a class="indexterm" name="id3030388"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a>* g_type_children (<a href="gobject-Type-Information.html#GType">GType</a> type,
2323
href="../glib/glib-Basic-Types.html#guint"
2324
>guint</a> *n_children);</pre>
2326
Return a newly allocated and 0-terminated array of type IDs, listing the
2327
child types of <em class="parameter"><code>type</code></em>. The return value has to be <a
2328
href="../glib/glib-Memory-Allocation.html#g-free"
2329
><code class="function">g_free()</code></a>ed after use.
2331
<div class="variablelist"><table border="0">
2332
<col align="left" valign="top">
2335
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
2336
<td> The parent type.
2340
<td><span class="term"><em class="parameter"><code>n_children</code></em> :</span></td>
2342
href="../glib/glib-Basic-Types.html#guint"
2343
><span class="type">guint</span></a> pointer to contain the number of child types.
2347
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2348
<td> Newly allocated and 0-terminated array of child types.
2357
<div class="refsect2" lang="en">
2358
<a name="id3030496"></a><h3>
2359
<a name="g-type-interfaces"></a>g_type_interfaces ()</h3>
2360
<a class="indexterm" name="id3030508"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a>* g_type_interfaces (<a href="gobject-Type-Information.html#GType">GType</a> type,
2362
href="../glib/glib-Basic-Types.html#guint"
2363
>guint</a> *n_interfaces);</pre>
2365
Return a newly allocated and 0-terminated array of type IDs, listing the
2366
interface types that <em class="parameter"><code>type</code></em> conforms to. The return value has to be
2368
href="../glib/glib-Memory-Allocation.html#g-free"
2369
><code class="function">g_free()</code></a>ed after use.
2371
<div class="variablelist"><table border="0">
2372
<col align="left" valign="top">
2375
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
2376
<td> The type to list interface types for.
2380
<td><span class="term"><em class="parameter"><code>n_interfaces</code></em> :</span></td>
2382
href="../glib/glib-Basic-Types.html#guint"
2383
><span class="type">guint</span></a> pointer to contain the number of interface types.
2387
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2388
<td> Newly allocated and 0-terminated array of interface types.
2397
<div class="refsect2" lang="en">
2398
<a name="id3030616"></a><h3>
2399
<a name="g-type-interface-prerequisites"></a>g_type_interface_prerequisites ()</h3>
2400
<a class="indexterm" name="id3030632"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a>* g_type_interface_prerequisites (<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
2402
href="../glib/glib-Basic-Types.html#guint"
2403
>guint</a> *n_prerequisites);</pre>
2405
Returns the prerequisites of an interfaces type.
2407
<div class="variablelist"><table border="0">
2408
<col align="left" valign="top">
2411
<td><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></td>
2412
<td>an interface type
2416
<td><span class="term"><em class="parameter"><code>n_prerequisites</code></em> :</span></td>
2417
<td>location to return the number of prerequisites, or <a
2418
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
2419
><code class="literal">NULL</code></a>
2423
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2424
<td>a newly-allocated zero-terminated array of <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> containing
2425
the prerequisites of <em class="parameter"><code>interface_type</code></em>
2430
<p class="since">Since 2.2
2436
<div class="refsect2" lang="en">
2437
<a name="id3030744"></a><h3>
2438
<a name="g-type-set-qdata"></a>g_type_set_qdata ()</h3>
2439
<a class="indexterm" name="id3030757"></a><pre class="programlisting">void g_type_set_qdata (<a href="gobject-Type-Information.html#GType">GType</a> type,
2441
href="../glib/glib-Quarks.html#GQuark"
2444
href="../glib/glib-Basic-Types.html#gpointer"
2445
>gpointer</a> data);</pre>
2447
Attaches arbitrary data to a type.
2449
<div class="variablelist"><table border="0">
2450
<col align="left" valign="top">
2453
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
2454
<td>a <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a>
2458
<td><span class="term"><em class="parameter"><code>quark</code></em> :</span></td>
2460
href="../glib/glib-Quarks.html#GQuark"
2461
><span class="type">GQuark</span></a> id to identify the data
2465
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
2475
<div class="refsect2" lang="en">
2476
<a name="id3030863"></a><h3>
2477
<a name="g-type-get-qdata"></a>g_type_get_qdata ()</h3>
2478
<a class="indexterm" name="id3030876"></a><pre class="programlisting"><a
2479
href="../glib/glib-Basic-Types.html#gpointer"
2480
>gpointer</a> g_type_get_qdata (<a href="gobject-Type-Information.html#GType">GType</a> type,
2482
href="../glib/glib-Quarks.html#GQuark"
2483
>GQuark</a> quark);</pre>
2485
Obtains data which has previously been attached to <em class="parameter"><code>type</code></em>
2486
with <a href="gobject-Type-Information.html#g-type-set-qdata"><code class="function">g_type_set_qdata()</code></a>.
2488
<div class="variablelist"><table border="0">
2489
<col align="left" valign="top">
2492
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
2493
<td>a <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a>
2497
<td><span class="term"><em class="parameter"><code>quark</code></em> :</span></td>
2499
href="../glib/glib-Quarks.html#GQuark"
2500
><span class="type">GQuark</span></a> id to identify the data
2504
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2506
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
2507
><code class="literal">NULL</code></a> if no data was found
2516
<div class="refsect2" lang="en">
2517
<a name="id3030998"></a><h3>
2518
<a name="g-type-query"></a>g_type_query ()</h3>
2519
<a class="indexterm" name="id3031011"></a><pre class="programlisting">void g_type_query (<a href="gobject-Type-Information.html#GType">GType</a> type,
2520
<a href="gobject-Type-Information.html#GTypeQuery">GTypeQuery</a> *query);</pre>
2522
Queries the type system for information about a specific type.
2523
This function will fill in a user-provided structure to hold type-specific
2524
information. If an invalid <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> is passed in, the <em class="parameter"><code>type</code></em> member of the
2525
<a href="gobject-Type-Information.html#GTypeQuery"><span class="type">GTypeQuery</span></a> is 0. All members filled into the <a href="gobject-Type-Information.html#GTypeQuery"><span class="type">GTypeQuery</span></a> structure should
2526
be considered constant and have to be left untouched.
2528
<div class="variablelist"><table border="0">
2529
<col align="left" valign="top">
2532
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
2533
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of a static, classed type.
2537
<td><span class="term"><em class="parameter"><code>query</code></em> :</span></td>
2538
<td>A user provided structure that is filled in with constant values
2548
<div class="refsect2" lang="en">
2549
<a name="id3031123"></a><h3>
2550
<a name="GTypeQuery"></a>GTypeQuery</h3>
2551
<a class="indexterm" name="id3031135"></a><pre class="programlisting">typedef struct {
2553
const gchar *type_name;
2555
guint instance_size;
2559
A structure holding information for a specific type. It is
2560
filled in by the <a href="gobject-Type-Information.html#g-type-query"><code class="function">g_type_query()</code></a> function.
2562
<div class="variablelist"><table border="0">
2563
<col align="left" valign="top">
2566
<td><span class="term"><a href="gobject-Type-Information.html#GType">GType</a> <em class="structfield"><code>type</code></em>;</span></td>
2567
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of the type.
2571
<td><span class="term">const <a
2572
href="../glib/glib-Basic-Types.html#gchar"
2573
>gchar</a> *<em class="structfield"><code>type_name</code></em>;</span></td>
2574
<td>the name of the type.
2578
<td><span class="term"><a
2579
href="../glib/glib-Basic-Types.html#guint"
2580
>guint</a> <em class="structfield"><code>class_size</code></em>;</span></td>
2581
<td>the size of the class structure.
2585
<td><span class="term"><a
2586
href="../glib/glib-Basic-Types.html#guint"
2587
>guint</a> <em class="structfield"><code>instance_size</code></em>;</span></td>
2588
<td>the size of the instance structure.
2596
<div class="refsect2" lang="en">
2597
<a name="id3031260"></a><h3>
2598
<a name="GBaseInitFunc"></a>GBaseInitFunc ()</h3>
2599
<a class="indexterm" name="id3031273"></a><pre class="programlisting">void (*GBaseInitFunc) (<a
2600
href="../glib/glib-Basic-Types.html#gpointer"
2601
>gpointer</a> g_class);</pre>
2603
A callback function used by the type system to do base initialization
2604
of the class structures of derived types. It is called as part of the
2605
initialization process of all derived classes and should reallocate
2606
or reset all dynamic class members copied over from the parent class.
2607
For example, class members (such as strings) that are not sufficiently
2608
handled by a plain memory copy of the parent class into the derived class
2609
have to be altered. See <a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a> for a discussion of the class
2610
intialization process.
2612
<div class="variablelist"><table border="0">
2613
<col align="left" valign="top">
2615
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2616
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to initialize.
2624
<div class="refsect2" lang="en">
2625
<a name="id3031347"></a><h3>
2626
<a name="GBaseFinalizeFunc"></a>GBaseFinalizeFunc ()</h3>
2627
<a class="indexterm" name="id3031360"></a><pre class="programlisting">void (*GBaseFinalizeFunc) (<a
2628
href="../glib/glib-Basic-Types.html#gpointer"
2629
>gpointer</a> g_class);</pre>
2631
A callback function used by the type system to finalize those portions
2632
of a derived types class structure that were setup from the corresponding
2633
<a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> function. Class finalization basically works the inverse
2634
way in which class intialization is performed.
2635
See <a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a> for a discussion of the class intialization process.
2637
<div class="variablelist"><table border="0">
2638
<col align="left" valign="top">
2640
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2641
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to finalize.
2649
<div class="refsect2" lang="en">
2650
<a name="id3031440"></a><h3>
2651
<a name="GClassInitFunc"></a>GClassInitFunc ()</h3>
2652
<a class="indexterm" name="id3031453"></a><pre class="programlisting">void (*GClassInitFunc) (<a
2653
href="../glib/glib-Basic-Types.html#gpointer"
2654
>gpointer</a> g_class,
2656
href="../glib/glib-Basic-Types.html#gpointer"
2657
>gpointer</a> class_data);</pre>
2659
A callback function used by the type system to initialize the class
2660
of a specific type. This function should initialize all static class
2662
The initialization process of a class involves:
2664
<div class="variablelist"><table border="0">
2665
<col align="left" valign="top">
2668
<td><span class="term"></span></td>
2670
1 - Copying common members from the parent class over to the
2671
derived class structure.
2675
<td><span class="term"></span></td>
2677
2 - Zero initialization of the remaining members not copied
2678
over from the parent class.
2682
<td><span class="term"></span></td>
2684
3 - Invocation of the <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> initializers of all parent
2685
types and the class' type.
2689
<td><span class="term"></span></td>
2691
4 - Invocation of the class' <a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a> initializer.
2697
Since derived classes are partially initialized through a memory copy
2698
of the parent class, the general rule is that <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> and
2699
<a href="gobject-Type-Information.html#GBaseFinalizeFunc"><code class="function">GBaseFinalizeFunc()</code></a> should take care of necessary reinitialization
2700
and release of those class members that were introduced by the type
2701
that specified these <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a>/<a href="gobject-Type-Information.html#GBaseFinalizeFunc"><code class="function">GBaseFinalizeFunc()</code></a>.
2702
<a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a> should only care about initializing static
2703
class members, while dynamic class members (such as allocated strings
2704
or reference counted resources) are better handled by a <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a>
2705
for this type, so proper initialization of the dynamic class members
2706
is performed for class initialization of derived types as well.
2707
An example may help to correspond the intend of the different class
2711
<pre class="programlisting">
2713
GObjectClass parent_class;
2714
gint static_integer;
2715
gchar *dynamic_string;
2718
type_a_base_class_init (TypeAClass *class)
2720
class->dynamic_string = g_strdup ("some string");
2723
type_a_base_class_finalize (TypeAClass *class)
2725
g_free (class->dynamic_string);
2728
type_a_class_init (TypeAClass *class)
2730
class->static_integer = 42;
2734
TypeAClass parent_class;
2735
gfloat static_float;
2736
GString *dynamic_gstring;
2739
type_b_base_class_init (TypeBClass *class)
2741
class->dynamic_gstring = g_string_new ("some other string");
2744
type_b_base_class_finalize (TypeBClass *class)
2746
g_string_free (class->dynamic_gstring);
2749
type_b_class_init (TypeBClass *class)
2751
class->static_float = 3.14159265358979323846;
2755
Initialization of TypeBClass will first cause initialization of
2756
TypeAClass (derived classes reference their parent classes, see
2757
<a href="gobject-Type-Information.html#g-type-class-ref"><code class="function">g_type_class_ref()</code></a> on this).
2758
Initialization of TypeAClass roughly involves zero-initializing its fields,
2759
then calling its <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> <code class="function">type_a_base_class_init()</code> to allocate
2760
its dynamic members (dynamic_string), and finally calling its <a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a>
2761
<code class="function">type_a_class_init()</code> to initialize its static members (static_integer).
2762
The first step in the initialization process of TypeBClass is then
2763
a plain memory copy of the contents of TypeAClass into TypeBClass and
2764
zero-initialization of the remaining fields in TypeBClass.
2765
The dynamic members of TypeAClass within TypeBClass now need
2766
reinitialization which is performed by calling <code class="function">type_a_base_class_init()</code>
2767
with an argument of TypeBClass.
2768
After that, the <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> of TypeBClass, <code class="function">type_b_base_class_init()</code>
2769
is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
2770
and finally the <a href="gobject-Type-Information.html#GClassInitFunc"><code class="function">GClassInitFunc()</code></a> of TypeBClass, <code class="function">type_b_class_init()</code>,
2771
is called to complete the initialization process with the static members
2773
Corresponding finalization counter parts to the <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> functions
2774
have to be provided to release allocated resources at class finalization
2777
<div class="variablelist"><table border="0">
2778
<col align="left" valign="top">
2781
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2782
<td> The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to initialize.
2786
<td><span class="term"><em class="parameter"><code>class_data</code></em> :</span></td>
2787
<td> The <em class="parameter"><code>class_data</code></em> member supplied via the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure.
2796
<div class="refsect2" lang="en">
2797
<a name="id3031836"></a><h3>
2798
<a name="GClassFinalizeFunc"></a>GClassFinalizeFunc ()</h3>
2799
<a class="indexterm" name="id3031849"></a><pre class="programlisting">void (*GClassFinalizeFunc) (<a
2800
href="../glib/glib-Basic-Types.html#gpointer"
2801
>gpointer</a> g_class,
2803
href="../glib/glib-Basic-Types.html#gpointer"
2804
>gpointer</a> class_data);</pre>
2806
A callback function used by the type system to finalize a class.
2807
This function is rarely needed, as dynamically allocated class resources
2808
should be handled by <a href="gobject-Type-Information.html#GBaseInitFunc"><code class="function">GBaseInitFunc()</code></a> and <a href="gobject-Type-Information.html#GBaseFinalizeFunc"><code class="function">GBaseFinalizeFunc()</code></a>.
2809
Also, specification of a <a href="gobject-Type-Information.html#GClassFinalizeFunc"><code class="function">GClassFinalizeFunc()</code></a> in the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>
2810
structure of a static type is invalid, because classes of static types
2811
will never be finalized (they are artificially kept alive when their
2812
reference count drops to zero).
2814
<div class="variablelist"><table border="0">
2815
<col align="left" valign="top">
2818
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2819
<td> The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to finalize.
2823
<td><span class="term"><em class="parameter"><code>class_data</code></em> :</span></td>
2824
<td> The <em class="parameter"><code>class_data</code></em> member supplied via the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure.
2833
<div class="refsect2" lang="en">
2834
<a name="id3031985"></a><h3>
2835
<a name="GInstanceInitFunc"></a>GInstanceInitFunc ()</h3>
2836
<a class="indexterm" name="id3031998"></a><pre class="programlisting">void (*GInstanceInitFunc) (<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a> *instance,
2838
href="../glib/glib-Basic-Types.html#gpointer"
2839
>gpointer</a> g_class);</pre>
2841
A callback function used by the type system to initialize a new
2842
instance of a type. This function initializes all instance members and
2843
allocates any resources required by it.
2844
Initialization of a derived instance involves calling all its parent
2845
types instance initializers, so the class member of the instance
2846
is altered during its initialization to always point to the class that
2847
belongs to the type the current initializer was introduced for.
2849
<div class="variablelist"><table border="0">
2850
<col align="left" valign="top">
2853
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
2854
<td> The instance to initialize.
2858
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2859
<td> The class of the type the instance is created for.
2868
<div class="refsect2" lang="en">
2869
<a name="id3032082"></a><h3>
2870
<a name="GInterfaceInitFunc"></a>GInterfaceInitFunc ()</h3>
2871
<a class="indexterm" name="id3032095"></a><pre class="programlisting">void (*GInterfaceInitFunc) (<a
2872
href="../glib/glib-Basic-Types.html#gpointer"
2873
>gpointer</a> g_iface,
2875
href="../glib/glib-Basic-Types.html#gpointer"
2876
>gpointer</a> iface_data);</pre>
2878
A callback function used by the type system to initialize a new
2879
interface. This function should initialize all internal data and
2880
allocate any resources required by the interface.
2882
<div class="variablelist"><table border="0">
2883
<col align="left" valign="top">
2886
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
2887
<td> The interface structure to initialize.
2891
<td><span class="term"><em class="parameter"><code>iface_data</code></em> :</span></td>
2892
<td> The <em class="parameter"><code>class_data</code></em> supplied via the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure.
2901
<div class="refsect2" lang="en">
2902
<a name="id3032181"></a><h3>
2903
<a name="GInterfaceFinalizeFunc"></a>GInterfaceFinalizeFunc ()</h3>
2904
<a class="indexterm" name="id3032194"></a><pre class="programlisting">void (*GInterfaceFinalizeFunc) (<a
2905
href="../glib/glib-Basic-Types.html#gpointer"
2906
>gpointer</a> g_iface,
2908
href="../glib/glib-Basic-Types.html#gpointer"
2909
>gpointer</a> iface_data);</pre>
2911
A callback function used by the type system to finalize an interface.
2912
This function should destroy any internal data and release any resources
2913
allocated by the corresponding <a href="gobject-Type-Information.html#GInterfaceInitFunc"><code class="function">GInterfaceInitFunc()</code></a> function.
2915
<div class="variablelist"><table border="0">
2916
<col align="left" valign="top">
2919
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
2920
<td> The interface structure to finalize.
2924
<td><span class="term"><em class="parameter"><code>iface_data</code></em> :</span></td>
2925
<td> The <em class="parameter"><code>class_data</code></em> supplied via the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure.
2934
<div class="refsect2" lang="en">
2935
<a name="id3032291"></a><h3>
2936
<a name="GTypeClassCacheFunc"></a>GTypeClassCacheFunc ()</h3>
2937
<a class="indexterm" name="id3032304"></a><pre class="programlisting"><a
2938
href="../glib/glib-Basic-Types.html#gboolean"
2939
>gboolean</a> (*GTypeClassCacheFunc) (<a
2940
href="../glib/glib-Basic-Types.html#gpointer"
2941
>gpointer</a> cache_data,
2942
<a href="gobject-Type-Information.html#GTypeClass">GTypeClass</a> *g_class);</pre>
2944
A callback function which is called when the reference count of a class
2945
drops to zero. It may use <a href="gobject-Type-Information.html#g-type-class-ref"><code class="function">g_type_class_ref()</code></a> to prevent the class from
2946
being freed. You should not call <a href="gobject-Type-Information.html#g-type-class-unref"><code class="function">g_type_class_unref()</code></a> from a
2947
<a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a> function to prevent infinite recursion, use
2948
<a href="gobject-Type-Information.html#g-type-class-unref-uncached"><code class="function">g_type_class_unref_uncached()</code></a> instead.
2951
The functions have to check the class id passed in to figure
2952
whether they actually want to cache the class of this type, since all
2953
classes are routed through the same <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a> chain.
2955
<div class="variablelist"><table border="0">
2956
<col align="left" valign="top">
2959
<td><span class="term"><em class="parameter"><code>cache_data</code></em> :</span></td>
2960
<td>data that was given to the <a href="gobject-Type-Information.html#g-type-add-class-cache-func"><code class="function">g_type_add_class_cache_func()</code></a> call
2964
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
2965
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure which is unreferenced
2969
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
2972
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
2973
><code class="literal">TRUE</code></a> to stop further <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>s from being
2975
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
2976
><code class="literal">FALSE</code></a> to continue.
2985
<div class="refsect2" lang="en">
2986
<a name="id3032490"></a><h3>
2987
<a name="GTypeFlags"></a>enum GTypeFlags</h3>
2988
<a class="indexterm" name="id3032502"></a><pre class="programlisting">typedef enum /*< skip >*/
2990
G_TYPE_FLAG_ABSTRACT = (1 << 4),
2991
G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5)
2995
Bit masks used to check or determine characteristics of a type.
2997
<div class="variablelist"><table border="0">
2998
<col align="left" valign="top">
3001
<td><span class="term"><a name="G-TYPE-FLAG-ABSTRACT:CAPS"></a><code class="literal">G_TYPE_FLAG_ABSTRACT</code></span></td>
3002
<td> Indicates an abstract type. No instances can be
3003
created for an abstract type.
3007
<td><span class="term"><a name="G-TYPE-FLAG-VALUE-ABSTRACT:CAPS"></a><code class="literal">G_TYPE_FLAG_VALUE_ABSTRACT</code></span></td>
3008
<td>Indicates an abstract value type, i.e. a type
3009
that introduces a value table, but can't be used for
3010
<a href="gobject-Generic-values.html#g-value-init"><code class="function">g_value_init()</code></a>.
3018
<div class="refsect2" lang="en">
3019
<a name="id3032585"></a><h3>
3020
<a name="GTypeFundamentalFlags"></a>enum GTypeFundamentalFlags</h3>
3021
<a class="indexterm" name="id3032598"></a><pre class="programlisting">typedef enum /*< skip >*/
3023
G_TYPE_FLAG_CLASSED = (1 << 0),
3024
G_TYPE_FLAG_INSTANTIATABLE = (1 << 1),
3025
G_TYPE_FLAG_DERIVABLE = (1 << 2),
3026
G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3)
3027
} GTypeFundamentalFlags;
3030
Bit masks used to check or determine specific characteristics of a
3033
<div class="variablelist"><table border="0">
3034
<col align="left" valign="top">
3037
<td><span class="term"><a name="G-TYPE-FLAG-CLASSED:CAPS"></a><code class="literal">G_TYPE_FLAG_CLASSED</code></span></td>
3038
<td> Indicates a classed type.
3042
<td><span class="term"><a name="G-TYPE-FLAG-INSTANTIATABLE:CAPS"></a><code class="literal">G_TYPE_FLAG_INSTANTIATABLE</code></span></td>
3043
<td> Indicates an instantiable type (implies classed).
3047
<td><span class="term"><a name="G-TYPE-FLAG-DERIVABLE:CAPS"></a><code class="literal">G_TYPE_FLAG_DERIVABLE</code></span></td>
3048
<td> Indicates a flat derivable type.
3052
<td><span class="term"><a name="G-TYPE-FLAG-DEEP-DERIVABLE:CAPS"></a><code class="literal">G_TYPE_FLAG_DEEP_DERIVABLE</code></span></td>
3053
<td> Indicates a deep derivable type (implies derivable).
3061
<div class="refsect2" lang="en">
3062
<a name="id3032717"></a><h3>
3063
<a name="g-type-register-static"></a>g_type_register_static ()</h3>
3064
<a class="indexterm" name="id3032730"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_register_static (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
3066
href="../glib/glib-Basic-Types.html#gchar"
3067
>gchar</a> *type_name,
3068
const <a href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a> *info,
3069
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);</pre>
3071
Registers <em class="parameter"><code>type_name</code></em> as the name of a new static type derived from
3072
<em class="parameter"><code>parent_type</code></em>. The type system uses the information contained in the
3073
<a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure pointed to by <em class="parameter"><code>info</code></em> to manage the type and its
3074
instances (if not abstract). The value of <em class="parameter"><code>flags</code></em> determines the nature
3075
(e.g. abstract or not) of the type.
3077
<div class="variablelist"><table border="0">
3078
<col align="left" valign="top">
3081
<td><span class="term"><em class="parameter"><code>parent_type</code></em> :</span></td>
3082
<td> Type from which this type will be derived.
3086
<td><span class="term"><em class="parameter"><code>type_name</code></em> :</span></td>
3087
<td> 0-terminated string used as the name of the new type.
3091
<td><span class="term"><em class="parameter"><code>info</code></em> :</span></td>
3092
<td> The <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure for this type.
3096
<td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td>
3097
<td> Bitwise combination of <a href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> values.
3101
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3102
<td> The new type identifier.
3111
<div class="refsect2" lang="en">
3112
<a name="id3032906"></a><h3>
3113
<a name="g-type-register-static-simple"></a>g_type_register_static_simple ()</h3>
3114
<a class="indexterm" name="id3032922"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_register_static_simple (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
3116
href="../glib/glib-Basic-Types.html#gchar"
3117
>gchar</a> *type_name,
3119
href="../glib/glib-Basic-Types.html#guint"
3120
>guint</a> class_size,
3121
<a href="gobject-Type-Information.html#GClassInitFunc">GClassInitFunc</a> class_init,
3123
href="../glib/glib-Basic-Types.html#guint"
3124
>guint</a> instance_size,
3125
<a href="gobject-Type-Information.html#GInstanceInitFunc">GInstanceInitFunc</a> instance_init,
3126
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);</pre>
3128
Registers <em class="parameter"><code>type_name</code></em> as the name of a new static type derived from
3129
<em class="parameter"><code>parent_type</code></em>. The value of <em class="parameter"><code>flags</code></em> determines the nature (e.g.
3130
abstract or not) of the type. It works by filling a <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>
3131
struct and calling <code class="function">g_type_info_register_static()</code>.
3133
<div class="variablelist"><table border="0">
3134
<col align="left" valign="top">
3137
<td><span class="term"><em class="parameter"><code>parent_type</code></em> :</span></td>
3138
<td> Type from which this type will be derived.
3142
<td><span class="term"><em class="parameter"><code>type_name</code></em> :</span></td>
3143
<td> 0-terminated string used as the name of the new type.
3147
<td><span class="term"><em class="parameter"><code>class_size</code></em> :</span></td>
3148
<td> Size of the class structure (see <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>)
3152
<td><span class="term"><em class="parameter"><code>class_init</code></em> :</span></td>
3153
<td> Location of the class initialization function (see <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>)
3157
<td><span class="term"><em class="parameter"><code>instance_size</code></em> :</span></td>
3158
<td>Size of the instance structure (see <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>)
3162
<td><span class="term"><em class="parameter"><code>instance_init</code></em> :</span></td>
3163
<td>Location of the instance initialization function (see <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a>)
3167
<td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td>
3168
<td> Bitwise combination of <a href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> values.
3172
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3173
<td> The new type identifier.
3178
<p class="since">Since 2.12
3184
<div class="refsect2" lang="en">
3185
<a name="id3033202"></a><h3>
3186
<a name="g-type-register-dynamic"></a>g_type_register_dynamic ()</h3>
3187
<a class="indexterm" name="id3033215"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_register_dynamic (<a href="gobject-Type-Information.html#GType">GType</a> parent_type,
3189
href="../glib/glib-Basic-Types.html#gchar"
3190
>gchar</a> *type_name,
3191
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a> *plugin,
3192
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);</pre>
3194
Registers <em class="parameter"><code>type_name</code></em> as the name of a new dynamic type derived from
3195
<em class="parameter"><code>parent_type</code></em>. The type system uses the information contained in the
3196
<a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure pointed to by <em class="parameter"><code>plugin</code></em> to manage the type and its
3197
instances (if not abstract). The value of <em class="parameter"><code>flags</code></em> determines the nature
3198
(e.g. abstract or not) of the type.
3200
<div class="variablelist"><table border="0">
3201
<col align="left" valign="top">
3204
<td><span class="term"><em class="parameter"><code>parent_type</code></em> :</span></td>
3205
<td> Type from which this type will be derived.
3209
<td><span class="term"><em class="parameter"><code>type_name</code></em> :</span></td>
3210
<td> 0-terminated string used as the name of the new type.
3214
<td><span class="term"><em class="parameter"><code>plugin</code></em> :</span></td>
3215
<td> The <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure to retrieve the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> from.
3219
<td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td>
3220
<td> Bitwise combination of <a href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> values.
3224
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3225
<td> The new type identifier or <a href="gobject-Type-Information.html#G-TYPE-INVALID:CAPS"><span class="type">G_TYPE_INVALID</span></a> if registration failed.
3234
<div class="refsect2" lang="en">
3235
<a name="id3033408"></a><h3>
3236
<a name="g-type-register-fundamental"></a>g_type_register_fundamental ()</h3>
3237
<a class="indexterm" name="id3033422"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_register_fundamental (<a href="gobject-Type-Information.html#GType">GType</a> type_id,
3239
href="../glib/glib-Basic-Types.html#gchar"
3240
>gchar</a> *type_name,
3241
const <a href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a> *info,
3242
const <a href="gobject-Type-Information.html#GTypeFundamentalInfo">GTypeFundamentalInfo</a> *finfo,
3243
<a href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);</pre>
3245
Registers <em class="parameter"><code>type_id</code></em> as the predefined identifier and <em class="parameter"><code>type_name</code></em> as the
3246
name of a fundamental type. The type system uses the information
3247
contained in the <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure pointed to by <em class="parameter"><code>info</code></em> and the
3248
<a href="gobject-Type-Information.html#GTypeFundamentalInfo"><span class="type">GTypeFundamentalInfo</span></a> structure pointed to by <em class="parameter"><code>finfo</code></em> to manage the
3249
type and its instances. The value of <em class="parameter"><code>flags</code></em> determines additional
3250
characteristics of the fundamental type.
3252
<div class="variablelist"><table border="0">
3253
<col align="left" valign="top">
3256
<td><span class="term"><em class="parameter"><code>type_id</code></em> :</span></td>
3257
<td> A predefined <span class="type">GTypeFundamentals</span> value.
3261
<td><span class="term"><em class="parameter"><code>type_name</code></em> :</span></td>
3262
<td> 0-terminated string used as the name of the new type.
3266
<td><span class="term"><em class="parameter"><code>info</code></em> :</span></td>
3267
<td> The <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> structure for this type.
3271
<td><span class="term"><em class="parameter"><code>finfo</code></em> :</span></td>
3272
<td> The <a href="gobject-Type-Information.html#GTypeFundamentalInfo"><span class="type">GTypeFundamentalInfo</span></a> structure for this type.
3276
<td><span class="term"><em class="parameter"><code>flags</code></em> :</span></td>
3277
<td> Bitwise combination of <a href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> values.
3281
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3282
<td> The predefined type identifier.
3291
<div class="refsect2" lang="en">
3292
<a name="id3033653"></a><h3>
3293
<a name="g-type-add-interface-static"></a>g_type_add_interface_static ()</h3>
3294
<a class="indexterm" name="id3033667"></a><pre class="programlisting">void g_type_add_interface_static (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
3295
<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
3296
const <a href="gobject-Type-Information.html#GInterfaceInfo">GInterfaceInfo</a> *info);</pre>
3298
Adds the static <em class="parameter"><code>interface_type</code></em> to <em class="parameter"><code>instantiable_type</code></em>. The information
3299
contained in the <span class="type">GTypeInterfaceInfo</span> structure pointed to by <em class="parameter"><code>info</code></em>
3300
is used to manage the relationship.
3302
<div class="variablelist"><table border="0">
3303
<col align="left" valign="top">
3306
<td><span class="term"><em class="parameter"><code>instance_type</code></em> :</span></td>
3307
<td> <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an instantiable type.
3311
<td><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></td>
3313
<a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an interface type.
3317
<td><span class="term"><em class="parameter"><code>info</code></em> :</span></td>
3318
<td> The <a href="gobject-Type-Information.html#GInterfaceInfo"><span class="type">GInterfaceInfo</span></a> structure for this
3319
(<em class="parameter"><code>instance_type</code></em>, <em class="parameter"><code>interface_type</code></em>) combination.
3328
<div class="refsect2" lang="en">
3329
<a name="id3033822"></a><h3>
3330
<a name="g-type-add-interface-dynamic"></a>g_type_add_interface_dynamic ()</h3>
3331
<a class="indexterm" name="id3033836"></a><pre class="programlisting">void g_type_add_interface_dynamic (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
3332
<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
3333
<a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a> *plugin);</pre>
3335
Adds the dynamic <em class="parameter"><code>interface_type</code></em> to <em class="parameter"><code>instantiable_type</code></em>. The information
3336
contained in the <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure pointed to by <em class="parameter"><code>plugin</code></em>
3337
is used to manage the relationship.
3339
<div class="variablelist"><table border="0">
3340
<col align="left" valign="top">
3343
<td><span class="term"><em class="parameter"><code>instance_type</code></em> :</span></td>
3344
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an instantiable type.
3348
<td><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></td>
3349
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an interface type.
3353
<td><span class="term"><em class="parameter"><code>plugin</code></em> :</span></td>
3354
<td>the <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure to retrieve the <a href="gobject-Type-Information.html#GInterfaceInfo"><span class="type">GInterfaceInfo</span></a> from.
3363
<div class="refsect2" lang="en">
3364
<a name="id3033988"></a><h3>
3365
<a name="g-type-interface-add-prerequisite"></a>g_type_interface_add_prerequisite ()</h3>
3366
<a class="indexterm" name="id3034002"></a><pre class="programlisting">void g_type_interface_add_prerequisite (<a href="gobject-Type-Information.html#GType">GType</a> interface_type,
3367
<a href="gobject-Type-Information.html#GType">GType</a> prerequisite_type);</pre>
3369
Adds <em class="parameter"><code>prerequisite_type</code></em> to the list of prerequisites of <em class="parameter"><code>interface_type</code></em>.
3370
This means that any type implementing <em class="parameter"><code>interface_type</code></em> must also implement
3371
<em class="parameter"><code>prerequisite_type</code></em>. Prerequisites can be thought of as an alternative to
3372
interface derivation (which GType doesn't support). An interface can have
3373
at most one instantiatable prerequisite type.
3375
<div class="variablelist"><table border="0">
3376
<col align="left" valign="top">
3379
<td><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></td>
3381
<a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an interface type.
3385
<td><span class="term"><em class="parameter"><code>prerequisite_type</code></em> :</span></td>
3387
<a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an interface or instantiatable type.
3396
<div class="refsect2" lang="en">
3397
<a name="id3034113"></a><h3>
3398
<a name="g-type-get-plugin"></a>g_type_get_plugin ()</h3>
3399
<a class="indexterm" name="id3034127"></a><pre class="programlisting"><a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a>* g_type_get_plugin (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
3401
Returns the <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure for <em class="parameter"><code>type</code></em> or
3403
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
3404
><code class="literal">NULL</code></a> if <em class="parameter"><code>type</code></em> does not have a <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure.
3406
<div class="variablelist"><table border="0">
3407
<col align="left" valign="top">
3410
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
3411
<td> The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> to retrieve the plugin for.
3415
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3416
<td> The corresponding plugin if <em class="parameter"><code>type</code></em> is a dynamic type,
3418
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
3419
><code class="literal">NULL</code></a> otherwise.
3428
<div class="refsect2" lang="en">
3429
<a name="id3034248"></a><h3>
3430
<a name="g-type-interface-get-plugin"></a>g_type_interface_get_plugin ()</h3>
3431
<a class="indexterm" name="id3034261"></a><pre class="programlisting"><a href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a>* g_type_interface_get_plugin (<a href="gobject-Type-Information.html#GType">GType</a> instance_type,
3432
<a href="gobject-Type-Information.html#GType">GType</a> interface_type);</pre>
3434
Returns the <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure for the dynamic interface
3435
<em class="parameter"><code>interface_type</code></em> which has been added to <em class="parameter"><code>instance_type</code></em>, or
3437
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
3438
><code class="literal">NULL</code></a> if <em class="parameter"><code>interface_type</code></em> has not been added to <em class="parameter"><code>instance_type</code></em> or does
3439
not have a <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> structure. See <a href="gobject-Type-Information.html#g-type-add-interface-dynamic"><code class="function">g_type_add_interface_dynamic()</code></a>.
3441
<div class="variablelist"><table border="0">
3442
<col align="left" valign="top">
3445
<td><span class="term"><em class="parameter"><code>instance_type</code></em> :</span></td>
3446
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an instantiatable type.
3450
<td><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></td>
3451
<td>the <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value of an interface type.
3455
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3456
<td>the <a href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a> for the dynamic interface <em class="parameter"><code>interface_type</code></em>
3457
of <em class="parameter"><code>instance_type</code></em>.
3466
<div class="refsect2" lang="en">
3467
<a name="id3034441"></a><h3>
3468
<a name="g-type-fundamental-next"></a>g_type_fundamental_next ()</h3>
3469
<a class="indexterm" name="id3034454"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_fundamental_next (void);</pre>
3471
Returns the next free fundamental type id which can be used to
3472
register a new fundamental type with <a href="gobject-Type-Information.html#g-type-register-fundamental"><code class="function">g_type_register_fundamental()</code></a>.
3473
The returned type ID represents the highest currently registered
3474
fundamental type identifier.
3477
<div class="variablelist"><table border="0">
3478
<col align="left" valign="top">
3480
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3481
<td>The nextmost fundamental type ID to be registered,
3482
or 0 if the type system ran out of fundamental type IDs.
3490
<div class="refsect2" lang="en">
3491
<a name="id3034507"></a><h3>
3492
<a name="g-type-fundamental"></a>g_type_fundamental ()</h3>
3493
<a class="indexterm" name="id3034520"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GType">GType</a> g_type_fundamental (<a href="gobject-Type-Information.html#GType">GType</a> type_id);</pre>
3495
Internal function, used to extract the fundamental type ID portion.
3496
use <a href="gobject-Type-Information.html#G-TYPE-FUNDAMENTAL:CAPS"><code class="function">G_TYPE_FUNDAMENTAL()</code></a> instead.
3498
<div class="variablelist"><table border="0">
3499
<col align="left" valign="top">
3502
<td><span class="term"><em class="parameter"><code>type_id</code></em> :</span></td>
3507
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3508
<td>fundamental type ID
3517
<div class="refsect2" lang="en">
3518
<a name="id3034589"></a><h3>
3519
<a name="g-type-create-instance"></a>g_type_create_instance ()</h3>
3520
<a class="indexterm" name="id3034602"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a>* g_type_create_instance (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
3522
Creates and initializes an instance of <em class="parameter"><code>type</code></em> if <em class="parameter"><code>type</code></em> is valid and can
3523
be instantiated. The type system only performs basic allocation and
3524
structure setups for instances: actual instance creation should happen
3525
through functions supplied by the type's fundamental type implementation.
3526
So use of <a href="gobject-Type-Information.html#g-type-create-instance"><code class="function">g_type_create_instance()</code></a> is reserved for implementators of
3527
fundamental types only. E.g. instances of the <a href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> hierarchy
3528
should be created via <a href="gobject-The-Base-Object-Type.html#g-object-new"><code class="function">g_object_new()</code></a> and <span class="emphasis"><em>never</em></span>
3529
directly through <a href="gobject-Type-Information.html#g-type-create-instance"><code class="function">g_type_create_instance()</code></a> which doesn't handle
3530
things like singleton objects or object construction.
3531
Note: Do <span class="emphasis"><em>not</em></span> use this function, unless you're
3532
implementing a fundamental type. Also language bindings should <span class="emphasis"><em>not</em></span>
3533
use this function but <a href="gobject-The-Base-Object-Type.html#g-object-new"><code class="function">g_object_new()</code></a> instead.
3535
<div class="variablelist"><table border="0">
3536
<col align="left" valign="top">
3539
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
3540
<td> An instantiatable type to create an instance for.
3544
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3545
<td>An allocated and initialized instance, subject to further
3546
treatment by the fundamental type implementation.
3555
<div class="refsect2" lang="en">
3556
<a name="id3034745"></a><h3>
3557
<a name="g-type-free-instance"></a>g_type_free_instance ()</h3>
3558
<a class="indexterm" name="id3034758"></a><pre class="programlisting">void g_type_free_instance (<a href="gobject-Type-Information.html#GTypeInstance">GTypeInstance</a> *instance);</pre>
3560
Frees an instance of a type, returning it to the instance pool for the type,
3564
Like <a href="gobject-Type-Information.html#g-type-create-instance"><code class="function">g_type_create_instance()</code></a>, this function is reserved for implementors of
3567
<div class="variablelist"><table border="0">
3568
<col align="left" valign="top">
3570
<td><span class="term"><em class="parameter"><code>instance</code></em> :</span></td>
3571
<td>an instance of a type.
3579
<div class="refsect2" lang="en">
3580
<a name="id3034823"></a><h3>
3581
<a name="g-type-add-class-cache-func"></a>g_type_add_class_cache_func ()</h3>
3582
<a class="indexterm" name="id3034836"></a><pre class="programlisting">void g_type_add_class_cache_func (<a
3583
href="../glib/glib-Basic-Types.html#gpointer"
3584
>gpointer</a> cache_data,
3585
<a href="gobject-Type-Information.html#GTypeClassCacheFunc">GTypeClassCacheFunc</a> cache_func);</pre>
3587
Adds a <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a> to be called before the reference count of a class
3588
goes from one to zero. This can be used to prevent premature class destruction.
3589
All installed <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a> functions will be chained until one of them
3591
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
3592
><code class="literal">TRUE</code></a>. The functions have to check the class id passed in to figure
3593
whether they actually want to cache the class of this type, since all classes
3594
are routed through the same <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a> chain.
3596
<div class="variablelist"><table border="0">
3597
<col align="left" valign="top">
3600
<td><span class="term"><em class="parameter"><code>cache_data</code></em> :</span></td>
3601
<td>data to be passed to <em class="parameter"><code>cache_func</code></em>
3605
<td><span class="term"><em class="parameter"><code>cache_func</code></em> :</span></td>
3606
<td>a <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>
3615
<div class="refsect2" lang="en">
3616
<a name="id3034960"></a><h3>
3617
<a name="g-type-remove-class-cache-func"></a>g_type_remove_class_cache_func ()</h3>
3618
<a class="indexterm" name="id3034974"></a><pre class="programlisting">void g_type_remove_class_cache_func (<a
3619
href="../glib/glib-Basic-Types.html#gpointer"
3620
>gpointer</a> cache_data,
3621
<a href="gobject-Type-Information.html#GTypeClassCacheFunc">GTypeClassCacheFunc</a> cache_func);</pre>
3623
Removes a previously installed <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>. The cache maintained
3624
by <em class="parameter"><code>cache_func</code></em> has to be empty when calling <a href="gobject-Type-Information.html#g-type-remove-class-cache-func"><code class="function">g_type_remove_class_cache_func()</code></a>
3627
<div class="variablelist"><table border="0">
3628
<col align="left" valign="top">
3631
<td><span class="term"><em class="parameter"><code>cache_data</code></em> :</span></td>
3632
<td>data that was given when adding <em class="parameter"><code>cache_func</code></em>
3636
<td><span class="term"><em class="parameter"><code>cache_func</code></em> :</span></td>
3637
<td>a <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>
3646
<div class="refsect2" lang="en">
3647
<a name="id3035084"></a><h3>
3648
<a name="g-type-class-unref-uncached"></a>g_type_class_unref_uncached ()</h3>
3649
<a class="indexterm" name="id3035097"></a><pre class="programlisting">void g_type_class_unref_uncached (<a
3650
href="../glib/glib-Basic-Types.html#gpointer"
3651
>gpointer</a> g_class);</pre>
3653
A variant of <a href="gobject-Type-Information.html#g-type-class-unref"><code class="function">g_type_class_unref()</code></a> for use in <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>
3654
implementations. It unreferences a class without consulting the chain
3655
of <a href="gobject-Type-Information.html#GTypeClassCacheFunc"><span class="type">GTypeClassCacheFunc</span></a>s, avoiding the recursion which would occur
3658
<div class="variablelist"><table border="0">
3659
<col align="left" valign="top">
3661
<td><span class="term"><em class="parameter"><code>g_class</code></em> :</span></td>
3662
<td>The <a href="gobject-Type-Information.html#GTypeClass"><span class="type">GTypeClass</span></a> structure to unreference.
3670
<div class="refsect2" lang="en">
3671
<a name="id3035183"></a><h3>
3672
<a name="g-type-add-interface-check"></a>g_type_add_interface_check ()</h3>
3673
<a class="indexterm" name="id3035199"></a><pre class="programlisting">void g_type_add_interface_check (<a
3674
href="../glib/glib-Basic-Types.html#gpointer"
3675
>gpointer</a> check_data,
3676
<a href="gobject-Type-Information.html#GTypeInterfaceCheckFunc">GTypeInterfaceCheckFunc</a> check_func);</pre>
3678
Adds a function to be called after an interface vtable is
3679
initialized for any class (i.e. after the <em class="parameter"><code>interface_init</code></em>
3680
member of <a href="gobject-Type-Information.html#GInterfaceInfo"><span class="type">GInterfaceInfo</span></a> has been called).
3683
This function is useful when you want to check an invariant
3684
that depends on the interfaces of a class. For instance,
3685
the implementation of <a href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> uses this facility to check
3686
that an object implements all of the properties that are
3687
defined on its interfaces.
3689
<div class="variablelist"><table border="0">
3690
<col align="left" valign="top">
3693
<td><span class="term"><em class="parameter"><code>check_data</code></em> :</span></td>
3694
<td>data to pass to <em class="parameter"><code>check_func</code></em>
3698
<td><span class="term"><em class="parameter"><code>check_func</code></em> :</span></td>
3699
<td>function to be called after each interface
3705
<p class="since">Since 2.4
3711
<div class="refsect2" lang="en">
3712
<a name="id3035313"></a><h3>
3713
<a name="g-type-remove-interface-check"></a>g_type_remove_interface_check ()</h3>
3714
<a class="indexterm" name="id3035329"></a><pre class="programlisting">void g_type_remove_interface_check (<a
3715
href="../glib/glib-Basic-Types.html#gpointer"
3716
>gpointer</a> check_data,
3717
<a href="gobject-Type-Information.html#GTypeInterfaceCheckFunc">GTypeInterfaceCheckFunc</a> check_func);</pre>
3719
Removes an interface check function added with
3720
<a href="gobject-Type-Information.html#g-type-add-interface-check"><code class="function">g_type_add_interface_check()</code></a>.
3722
<div class="variablelist"><table border="0">
3723
<col align="left" valign="top">
3726
<td><span class="term"><em class="parameter"><code>check_data</code></em> :</span></td>
3727
<td>callback data passed to <a href="gobject-Type-Information.html#g-type-add-interface-check"><code class="function">g_type_add_interface_check()</code></a>
3731
<td><span class="term"><em class="parameter"><code>check_func</code></em> :</span></td>
3732
<td>callback function passed to <a href="gobject-Type-Information.html#g-type-add-interface-check"><code class="function">g_type_add_interface_check()</code></a>
3737
<p class="since">Since 2.4
3743
<div class="refsect2" lang="en">
3744
<a name="id3035440"></a><h3>
3745
<a name="GTypeInterfaceCheckFunc"></a>GTypeInterfaceCheckFunc ()</h3>
3746
<a class="indexterm" name="id3035455"></a><pre class="programlisting">void (*GTypeInterfaceCheckFunc) (<a
3747
href="../glib/glib-Basic-Types.html#gpointer"
3748
>gpointer</a> check_data,
3750
href="../glib/glib-Basic-Types.html#gpointer"
3751
>gpointer</a> g_iface);</pre>
3753
A callback called after an interface vtable is initialized.
3754
See <a href="gobject-Type-Information.html#g-type-add-interface-check"><code class="function">g_type_add_interface_check()</code></a>.
3756
<div class="variablelist"><table border="0">
3757
<col align="left" valign="top">
3760
<td><span class="term"><em class="parameter"><code>check_data</code></em> :</span></td>
3761
<td>data passed to <a href="gobject-Type-Information.html#g-type-add-interface-check"><code class="function">g_type_add_interface_check()</code></a>.
3765
<td><span class="term"><em class="parameter"><code>g_iface</code></em> :</span></td>
3766
<td>the interface that has been initialized
3771
<p class="since">Since 2.4
3777
<div class="refsect2" lang="en">
3778
<a name="id3035554"></a><h3>
3779
<a name="g-type-value-table-peek"></a>g_type_value_table_peek ()</h3>
3780
<a class="indexterm" name="id3035566"></a><pre class="programlisting"><a href="gobject-Type-Information.html#GTypeValueTable">GTypeValueTable</a>* g_type_value_table_peek (<a href="gobject-Type-Information.html#GType">GType</a> type);</pre>
3782
Returns the location of the <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a> associated with <em class="parameter"><code>type</code></em>.
3783
<span class="emphasis"><em>Note that this function should only be used from source code
3784
that implements or has internal knowledge of the implementation of
3785
<em class="parameter"><code>type</code></em>.</em></span>
3787
<div class="variablelist"><table border="0">
3788
<col align="left" valign="top">
3791
<td><span class="term"><em class="parameter"><code>type</code></em> :</span></td>
3792
<td> A <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> value.
3796
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
3797
<td>Location of the <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a> associated with <em class="parameter"><code>type</code></em> or
3799
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
3800
><code class="literal">NULL</code></a> if there is no <a href="gobject-Type-Information.html#GTypeValueTable"><span class="type">GTypeValueTable</span></a> associated with <em class="parameter"><code>type</code></em>.
3809
<div class="refsect2" lang="en">
3810
<a name="id3035697"></a><h3>
3811
<a name="G-DEFINE-TYPE:CAPS"></a>G_DEFINE_TYPE()</h3>
3812
<a class="indexterm" name="id3035712"></a><pre class="programlisting">#define G_DEFINE_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
3815
A convenience macro for type implementations, which declares a
3816
class initialization function, an instance initialization function (see <a href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> for information about
3817
these) and a static variable named <em class="parameter"><code>t_n</code></em>_parent_class pointing to the parent class. Furthermore, it defines
3818
a *<code class="function">_get_type()</code> function. See <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_TYPE_EXTENDED()</code></a> for an example.
3820
<div class="variablelist"><table border="0">
3821
<col align="left" valign="top">
3824
<td><span class="term"><em class="parameter"><code>TN</code></em> :</span></td>
3825
<td>The name of the new type, in Camel case.
3829
<td><span class="term"><em class="parameter"><code>t_n</code></em> :</span></td>
3830
<td>The name of the new type, in lowercase, with words
3835
<td><span class="term"><em class="parameter"><code>T_P</code></em> :</span></td>
3836
<td>The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
3841
<p class="since">Since 2.4
3847
<div class="refsect2" lang="en">
3848
<a name="id3035832"></a><h3>
3849
<a name="G-DEFINE-TYPE-WITH-CODE:CAPS"></a>G_DEFINE_TYPE_WITH_CODE()</h3>
3850
<a class="indexterm" name="id3035848"></a><pre class="programlisting">#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()
3853
A convenience macro for type implementations.
3854
Similar to <a href="gobject-Type-Information.html#G-DEFINE-TYPE:CAPS"><code class="function">G_DEFINE_TYPE()</code></a>, but allows to insert custom code into the
3855
*<code class="function">_get_type()</code> function, e.g. interface implementations via <a href="gobject-Type-Information.html#G-IMPLEMENT-INTERFACE:CAPS"><code class="function">G_IMPLEMENT_INTERFACE()</code></a>.
3856
See <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_TYPE_EXTENDED()</code></a> for an example.
3858
<div class="variablelist"><table border="0">
3859
<col align="left" valign="top">
3862
<td><span class="term"><em class="parameter"><code>TN</code></em> :</span></td>
3863
<td>The name of the new type, in Camel case.
3867
<td><span class="term"><em class="parameter"><code>t_n</code></em> :</span></td>
3868
<td>The name of the new type in lowercase, with words separated by '_'.
3872
<td><span class="term"><em class="parameter"><code>T_P</code></em> :</span></td>
3873
<td>The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
3877
<td><span class="term"><em class="parameter"><code>_C_</code></em> :</span></td>
3878
<td>Custom code that gets inserted in the *<code class="function">_get_type()</code> function.
3883
<p class="since">Since 2.4
3889
<div class="refsect2" lang="en">
3890
<a name="id3035997"></a><h3>
3891
<a name="G-DEFINE-ABSTRACT-TYPE:CAPS"></a>G_DEFINE_ABSTRACT_TYPE()</h3>
3892
<a class="indexterm" name="id3036013"></a><pre class="programlisting">#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
3895
A convenience macro for type implementations.
3896
Similar to <a href="gobject-Type-Information.html#G-DEFINE-TYPE:CAPS"><code class="function">G_DEFINE_TYPE()</code></a>, but defines an abstract type.
3897
See <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_TYPE_EXTENDED()</code></a> for an example.
3899
<div class="variablelist"><table border="0">
3900
<col align="left" valign="top">
3903
<td><span class="term"><em class="parameter"><code>TN</code></em> :</span></td>
3904
<td>The name of the new type, in Camel case.
3908
<td><span class="term"><em class="parameter"><code>t_n</code></em> :</span></td>
3909
<td>The name of the new type, in lowercase, with words
3914
<td><span class="term"><em class="parameter"><code>T_P</code></em> :</span></td>
3915
<td>The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
3920
<p class="since">Since 2.4
3926
<div class="refsect2" lang="en">
3927
<a name="id3036114"></a><h3>
3928
<a name="G-DEFINE-ABSTRACT-TYPE-WITH-CODE:CAPS"></a>G_DEFINE_ABSTRACT_TYPE_WITH_CODE()</h3>
3929
<a class="indexterm" name="id3036130"></a><pre class="programlisting">#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()
3932
A convenience macro for type implementations.
3933
Similar to <a href="gobject-Type-Information.html#G-DEFINE-TYPE-WITH-CODE:CAPS"><code class="function">G_DEFINE_TYPE_WITH_CODE()</code></a>, but defines an abstract type and allows to
3934
insert custom code into the *<code class="function">_get_type()</code> function, e.g. interface implementations
3935
via <a href="gobject-Type-Information.html#G-IMPLEMENT-INTERFACE:CAPS"><code class="function">G_IMPLEMENT_INTERFACE()</code></a>. See <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_TYPE_EXTENDED()</code></a> for an example.
3937
<div class="variablelist"><table border="0">
3938
<col align="left" valign="top">
3941
<td><span class="term"><em class="parameter"><code>TN</code></em> :</span></td>
3942
<td>The name of the new type, in Camel case.
3946
<td><span class="term"><em class="parameter"><code>t_n</code></em> :</span></td>
3947
<td>The name of the new type, in lowercase, with words
3952
<td><span class="term"><em class="parameter"><code>T_P</code></em> :</span></td>
3953
<td>The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
3957
<td><span class="term"><em class="parameter"><code>_C_</code></em> :</span></td>
3958
<td>Custom code that gets inserted in the @<code class="function">type_name_get_type()</code> function.
3963
<p class="since">Since 2.4
3969
<div class="refsect2" lang="en">
3970
<a name="id3036282"></a><h3>
3971
<a name="G-IMPLEMENT-INTERFACE:CAPS"></a>G_IMPLEMENT_INTERFACE()</h3>
3972
<a class="indexterm" name="id3036297"></a><pre class="programlisting">#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)</pre>
3974
A convenience macro to ease interface addition in the <em class="parameter"><code>_C_</code></em> section
3975
of <a href="gobject-Type-Information.html#G-DEFINE-TYPE-WITH-CODE:CAPS"><code class="function">G_DEFINE_TYPE_WITH_CODE()</code></a> or <a href="gobject-Type-Information.html#G-DEFINE-ABSTRACT-TYPE-WITH-CODE:CAPS"><code class="function">G_DEFINE_ABSTRACT_TYPE_WITH_CODE()</code></a>.
3976
See <a href="gobject-Type-Information.html#G-DEFINE-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_TYPE_EXTENDED()</code></a> for an example.
3979
Note that this macro can only be used together with the G_DEFINE_TYPE_*
3980
macros, since it depends on variable names from those macros.
3982
<div class="variablelist"><table border="0">
3983
<col align="left" valign="top">
3986
<td><span class="term"><em class="parameter"><code>TYPE_IFACE</code></em> :</span></td>
3987
<td>The <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the interface to add
3991
<td><span class="term"><em class="parameter"><code>iface_init</code></em> :</span></td>
3992
<td>The interface init function
3997
<p class="since">Since 2.4
4003
<div class="refsect2" lang="en">
4004
<a name="id3036408"></a><h3>
4005
<a name="G-DEFINE-TYPE-EXTENDED:CAPS"></a>G_DEFINE_TYPE_EXTENDED()</h3>
4006
<a class="indexterm" name="id3036423"></a><pre class="programlisting">#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()
4009
The most general convenience macro for type implementations, on which
4010
<a href="gobject-Type-Information.html#G-DEFINE-TYPE:CAPS"><code class="function">G_DEFINE_TYPE()</code></a>, etc are based.
4012
<div class="informalexample">
4013
<pre class="programlisting">
4014
G_DEFINE_TYPE_EXTENDED (GtkGadget,
4018
G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
4019
gtk_gadget_gizmo_init));
4022
<pre class="programlisting">
4023
static void gtk_gadget_init (GtkGadget *self);
4024
static void gtk_gadget_class_init (GtkGadgetClass *klass);
4025
static gpointer gtk_gadget_parent_class = NULL;
4026
static void gtk_gadget_class_intern_init (gpointer klass)
4028
gtk_gadget_parent_class = g_type_class_peek_parent (klass);
4029
gtk_gadget_class_init ((GtkGadgetClass*) klass);
4033
gtk_gadget_get_type (void)
4035
static GType g_define_type_id = 0;
4036
if (G_UNLIKELY (g_define_type_id == 0))
4038
static const GTypeInfo g_define_type_info = {
4039
sizeof (GtkGadgetClass),
4040
(GBaseInitFunc) NULL,
4041
(GBaseFinalizeFunc) NULL,
4042
(GClassInitFunc) gtk_gadget_class_intern_init,
4043
(GClassFinalizeFunc) NULL,
4044
NULL, /* class_data */
4046
0, /* n_preallocs */
4047
(GInstanceInitFunc) gtk_gadget_init,
4049
g_define_type_id = g_type_register_static (GTK_TYPE_WIDGET, "GtkGadget", &g_define_type_info, 0);
4051
static const GInterfaceInfo g_implement_interface_info = {
4052
(GInterfaceInitFunc) gtk_gadget_gizmo_init
4054
g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
4057
return g_define_type_id;
4060
The only pieces which have to be manually provided are the definitions of the
4061
instance and class structure and the definitions of the instance and class
4064
<div class="variablelist"><table border="0">
4065
<col align="left" valign="top">
4068
<td><span class="term"><em class="parameter"><code>TN</code></em> :</span></td>
4073
<td><span class="term"><em class="parameter"><code>t_n</code></em> :</span></td>
4078
<td><span class="term"><em class="parameter"><code>T_P</code></em> :</span></td>
4083
<td><span class="term"><em class="parameter"><code>_f_</code></em> :</span></td>
4088
<td><span class="term"><em class="parameter"><code>_C_</code></em> :</span></td>
4094
<p class="since">Since 2.4
4098
<div class="refsect2" lang="en">
4099
<a name="id3036579"></a><h3>
4100
<a name="G-TYPE-INVALID:CAPS"></a>G_TYPE_INVALID</h3>
4101
<a class="indexterm" name="id3036592"></a><pre class="programlisting">#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0)
4104
An invalid <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> used as error return value in some functions which return
4105
a <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a>.
4109
<div class="refsect2" lang="en">
4110
<a name="id3036624"></a><h3>
4111
<a name="G-TYPE-NONE:CAPS"></a>G_TYPE_NONE</h3>
4112
<a class="indexterm" name="id3036637"></a><pre class="programlisting">#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1)
4115
A fundamental type which is used as a replacement for the C
4116
<code class="literal">void</code> return type.
4120
<div class="refsect2" lang="en">
4121
<a name="id3036659"></a><h3>
4122
<a name="G-TYPE-INTERFACE:CAPS"></a>G_TYPE_INTERFACE</h3>
4123
<a class="indexterm" name="id3036673"></a><pre class="programlisting">#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2)
4126
The fundamental type from which all interfaces are derived.
4130
<div class="refsect2" lang="en">
4131
<a name="id3036690"></a><h3>
4132
<a name="G-TYPE-CHAR:CAPS"></a>G_TYPE_CHAR</h3>
4133
<a class="indexterm" name="id3036702"></a><pre class="programlisting">#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3)
4136
The fundamental type corresponding to <a
4137
href="../glib/glib-Basic-Types.html#gchar"
4138
><span class="type">gchar</span></a>.
4139
The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer.
4140
This may or may not be the same type a the C type "gchar".
4144
<div class="refsect2" lang="en">
4145
<a name="id3036728"></a><h3>
4146
<a name="G-TYPE-UCHAR:CAPS"></a>G_TYPE_UCHAR</h3>
4147
<a class="indexterm" name="id3036741"></a><pre class="programlisting">#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4)
4150
The fundamental type corresponding to <a
4151
href="../glib/glib-Basic-Types.html#guchar"
4152
><span class="type">guchar</span></a>.
4156
<div class="refsect2" lang="en">
4157
<a name="id3036766"></a><h3>
4158
<a name="G-TYPE-BOOLEAN:CAPS"></a>G_TYPE_BOOLEAN</h3>
4159
<a class="indexterm" name="id3036779"></a><pre class="programlisting">#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5)
4162
The fundamental type corresponding to <a
4163
href="../glib/glib-Basic-Types.html#gboolean"
4164
><span class="type">gboolean</span></a>.
4168
<div class="refsect2" lang="en">
4169
<a name="id3036804"></a><h3>
4170
<a name="G-TYPE-INT:CAPS"></a>G_TYPE_INT</h3>
4171
<a class="indexterm" name="id3036817"></a><pre class="programlisting">#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)
4174
The fundamental type corresponding to <a
4175
href="../glib/glib-Basic-Types.html#gint"
4176
><span class="type">gint</span></a>.
4180
<div class="refsect2" lang="en">
4181
<a name="id3036841"></a><h3>
4182
<a name="G-TYPE-UINT:CAPS"></a>G_TYPE_UINT</h3>
4183
<a class="indexterm" name="id3036854"></a><pre class="programlisting">#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7)
4186
The fundamental type corresponding to <a
4187
href="../glib/glib-Basic-Types.html#guint"
4188
><span class="type">guint</span></a>.
4192
<div class="refsect2" lang="en">
4193
<a name="id3036878"></a><h3>
4194
<a name="G-TYPE-LONG:CAPS"></a>G_TYPE_LONG</h3>
4195
<a class="indexterm" name="id3036890"></a><pre class="programlisting">#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8)
4198
The fundamental type corresponding to <a
4199
href="../glib/glib-Basic-Types.html#glong"
4200
><span class="type">glong</span></a>.
4204
<div class="refsect2" lang="en">
4205
<a name="id3036915"></a><h3>
4206
<a name="G-TYPE-ULONG:CAPS"></a>G_TYPE_ULONG</h3>
4207
<a class="indexterm" name="id3036928"></a><pre class="programlisting">#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9)
4210
The fundamental type corresponding to <a
4211
href="../glib/glib-Basic-Types.html#gulong"
4212
><span class="type">gulong</span></a>.
4216
<div class="refsect2" lang="en">
4217
<a name="id3036953"></a><h3>
4218
<a name="G-TYPE-INT64:CAPS"></a>G_TYPE_INT64</h3>
4219
<a class="indexterm" name="id3036966"></a><pre class="programlisting">#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10)
4222
The fundamental type corresponding to <a
4223
href="../glib/glib-Basic-Types.html#gint64"
4224
><span class="type">gint64</span></a>.
4228
<div class="refsect2" lang="en">
4229
<a name="id3036991"></a><h3>
4230
<a name="G-TYPE-UINT64:CAPS"></a>G_TYPE_UINT64</h3>
4231
<a class="indexterm" name="id3037004"></a><pre class="programlisting">#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11)
4234
The fundamental type corresponding to <a
4235
href="../glib/glib-Basic-Types.html#guint64"
4236
><span class="type">guint64</span></a>.
4240
<div class="refsect2" lang="en">
4241
<a name="id3037029"></a><h3>
4242
<a name="G-TYPE-ENUM:CAPS"></a>G_TYPE_ENUM</h3>
4243
<a class="indexterm" name="id3037043"></a><pre class="programlisting">#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12)
4246
The fundamental type from which all enumeration types are derived.
4250
<div class="refsect2" lang="en">
4251
<a name="id3037059"></a><h3>
4252
<a name="G-TYPE-FLAGS:CAPS"></a>G_TYPE_FLAGS</h3>
4253
<a class="indexterm" name="id3037072"></a><pre class="programlisting">#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13)
4256
The fundamental type from which all flags types are derived.
4260
<div class="refsect2" lang="en">
4261
<a name="id3037089"></a><h3>
4262
<a name="G-TYPE-FLOAT:CAPS"></a>G_TYPE_FLOAT</h3>
4263
<a class="indexterm" name="id3037101"></a><pre class="programlisting">#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14)
4266
The fundamental type corresponding to <a
4267
href="../glib/glib-Basic-Types.html#gfloat"
4268
><span class="type">gfloat</span></a>.
4272
<div class="refsect2" lang="en">
4273
<a name="id3037126"></a><h3>
4274
<a name="G-TYPE-DOUBLE:CAPS"></a>G_TYPE_DOUBLE</h3>
4275
<a class="indexterm" name="id3037138"></a><pre class="programlisting">#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15)
4278
The fundamental type corresponding to <a
4279
href="../glib/glib-Basic-Types.html#gdouble"
4280
><span class="type">gdouble</span></a>.
4284
<div class="refsect2" lang="en">
4285
<a name="id3037164"></a><h3>
4286
<a name="G-TYPE-STRING:CAPS"></a>G_TYPE_STRING</h3>
4287
<a class="indexterm" name="id3037176"></a><pre class="programlisting">#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16)
4290
The fundamental type corresponding to nul-terminated C strings.
4294
<div class="refsect2" lang="en">
4295
<a name="id3037193"></a><h3>
4296
<a name="G-TYPE-POINTER:CAPS"></a>G_TYPE_POINTER</h3>
4297
<a class="indexterm" name="id3037205"></a><pre class="programlisting">#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17)
4300
The fundamental type corresponding to <a
4301
href="../glib/glib-Basic-Types.html#gpointer"
4302
><span class="type">gpointer</span></a>.
4306
<div class="refsect2" lang="en">
4307
<a name="id3037230"></a><h3>
4308
<a name="G-TYPE-BOXED:CAPS"></a>G_TYPE_BOXED</h3>
4309
<a class="indexterm" name="id3037242"></a><pre class="programlisting">#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18)
4312
The fundamental type from which all boxed types are derived.
4316
<div class="refsect2" lang="en">
4317
<a name="id3037259"></a><h3>
4318
<a name="G-TYPE-PARAM:CAPS"></a>G_TYPE_PARAM</h3>
4319
<a class="indexterm" name="id3037271"></a><pre class="programlisting">#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19)
4322
The fundamental type from which all <a href="gobject-GParamSpec.html#GParamSpec"><span class="type">GParamSpec</span></a> types are derived.
4326
<div class="refsect2" lang="en">
4327
<a name="id3037296"></a><h3>
4328
<a name="G-TYPE-OBJECT:CAPS"></a>G_TYPE_OBJECT</h3>
4329
<a class="indexterm" name="id3037309"></a><pre class="programlisting">#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
4332
The fundamental type for <a href="gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>.
4336
<div class="refsect2" lang="en">
4337
<a name="id3037333"></a><h3>
4338
<a name="G-TYPE-GTYPE:CAPS"></a>G_TYPE_GTYPE</h3>
4339
<a class="indexterm" name="id3037345"></a><pre class="programlisting">#define G_TYPE_GTYPE (g_gtype_get_type())
4342
The type for <a href="gobject-Type-Information.html#GType"><span class="type">GType</span></a>.
4346
<div class="refsect2" lang="en">
4347
<a name="id3037369"></a><h3>
4348
<a name="G-TYPE-RESERVED-GLIB-FIRST:CAPS"></a>G_TYPE_RESERVED_GLIB_FIRST</h3>
4349
<a class="indexterm" name="id3037383"></a><pre class="programlisting">#define G_TYPE_RESERVED_GLIB_FIRST (21)
4352
First fundamental type number to create a new fundamental type id with
4353
<a href="gobject-Type-Information.html#G-TYPE-MAKE-FUNDAMENTAL:CAPS"><code class="function">G_TYPE_MAKE_FUNDAMENTAL()</code></a> reserved for GLib.
4357
<div class="refsect2" lang="en">
4358
<a name="id3037412"></a><h3>
4359
<a name="G-TYPE-RESERVED-GLIB-LAST:CAPS"></a>G_TYPE_RESERVED_GLIB_LAST</h3>
4360
<a class="indexterm" name="id3037425"></a><pre class="programlisting">#define G_TYPE_RESERVED_GLIB_LAST (31)
4363
Last fundamental type number reserved for GLib.
4367
<div class="refsect2" lang="en">
4368
<a name="id3037441"></a><h3>
4369
<a name="G-TYPE-RESERVED-BSE-FIRST:CAPS"></a>G_TYPE_RESERVED_BSE_FIRST</h3>
4370
<a class="indexterm" name="id3037455"></a><pre class="programlisting">#define G_TYPE_RESERVED_BSE_FIRST (32)
4373
First fundamental type number to create a new fundamental type id with
4374
<a href="gobject-Type-Information.html#G-TYPE-MAKE-FUNDAMENTAL:CAPS"><code class="function">G_TYPE_MAKE_FUNDAMENTAL()</code></a> reserved for BSE.
4378
<div class="refsect2" lang="en">
4379
<a name="id3037483"></a><h3>
4380
<a name="G-TYPE-RESERVED-BSE-LAST:CAPS"></a>G_TYPE_RESERVED_BSE_LAST</h3>
4381
<a class="indexterm" name="id3037497"></a><pre class="programlisting">#define G_TYPE_RESERVED_BSE_LAST (48)
4384
Last fundamental type number reserved for BSE.
4388
<div class="refsect2" lang="en">
4389
<a name="id3037513"></a><h3>
4390
<a name="G-TYPE-RESERVED-USER-FIRST:CAPS"></a>G_TYPE_RESERVED_USER_FIRST</h3>
4391
<a class="indexterm" name="id3037526"></a><pre class="programlisting">#define G_TYPE_RESERVED_USER_FIRST (49)
4394
First available fundamental type number to create new fundamental
4395
type id with <a href="gobject-Type-Information.html#G-TYPE-MAKE-FUNDAMENTAL:CAPS"><code class="function">G_TYPE_MAKE_FUNDAMENTAL()</code></a>.