5864ee16ab8fe6667bf3f78e9e72a40f37812024
[platform/upstream/glib.git] / docs / reference / gobject / tmpl / gtype.sgml
1 <!-- ##### SECTION Title ##### -->
2 GType
3
4 <!-- ##### SECTION Short_Description ##### -->
5 The GLib Runtime type identification and management system
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 The GType API is the foundation of the GObject system.  It provides the
10 facilities for registering and managing all fundamental data types,
11 user-defined object and interface types.  Before using any GType
12 or GObject functions, g_type_init() must be called to initialize the
13 type system.
14 </para>
15 <para>
16 For type creation and registration purposes, all types fall into one of
17 two categories: static or dynamic.  Static types are never loaded or
18 unloaded at run-time as dynamic types may be.  Static types are created
19 with g_type_register_static() that gets type specific information passed
20 in via a #GTypeInfo structure.
21 Dynamic types are created with g_type_register_dynamic() which takes a
22 #GTypePlugin structure instead. The remaining type information (the
23 #GTypeInfo structure) is retrieved during runtime through #GTypePlugin
24 and the g_type_plugin_*() API.
25 These registration functions are usually called only once from a 
26 function whose only purpose is to return the type identifier for a 
27 specific class.  Once the type (or class or interface) is registered,
28 it may be instantiated, inherited, or implemented depending on exactly
29 what sort of type it is.
30 There is also a third registration function for registering fundamental
31 types called g_type_register_fundamental() which requires both a #GTypeInfo
32 structure and a #GTypeFundamentalInfo structure but it is seldom used
33 since most fundamental types are predefined rather than user-defined.
34 </para>
35
36 <!-- ##### SECTION See_Also ##### -->
37 <para>
38
39 </para>
40
41 <!-- ##### TYPEDEF GType ##### -->
42 <para>
43 A numerical value which represents the unique identifier of a registered
44 type.
45 </para>
46
47
48 <!-- ##### MACRO G_TYPE_FUNDAMENTAL ##### -->
49 <para>
50 Returns the fundamental type which is the ancestor of @type.
51 Fundamental types are types that serve as fundaments for the derived types, 
52 thus they are the roots of distinct inheritance hierarchies.
53 </para>
54
55 @type: A #GType value.
56
57
58 <!-- ##### MACRO G_TYPE_FUNDAMENTAL_MAX ##### -->
59 <para>
60 An integer constant that represents the number of identifiers reserved
61 for types that are assigned at compile-time.
62 </para>
63
64
65
66 <!-- ##### MACRO G_TYPE_MAKE_FUNDAMENTAL ##### -->
67 <para>
68 Returns the type ID for the fundamental type number @x.
69 Use g_type_fundamental_next() instead of this macro to create new fundamental 
70 types.
71 </para>
72
73 @x: the fundamental type number.
74
75
76 <!-- ##### MACRO G_TYPE_IS_ABSTRACT ##### -->
77 <para>
78 Returns %TRUE if @type is an abstract type.  An abstract type can not be
79 instantiated and is normally used as an abstract base class for
80 derived classes.
81 </para>
82
83 @type: A #GType value.
84
85
86 <!-- ##### MACRO G_TYPE_IS_DERIVED ##### -->
87 <para>
88 Returns %TRUE if @type is derived (or in object-oriented terminology:
89 inherited) from another type (this holds true for all non-fundamental
90 types).
91 </para>
92
93 @type: A #GType value.
94
95
96 <!-- ##### MACRO G_TYPE_IS_FUNDAMENTAL ##### -->
97 <para>
98 Returns %TRUE if @type is a fundamental type.
99 </para>
100
101 @type: A #GType value.
102
103
104 <!-- ##### MACRO G_TYPE_IS_VALUE_TYPE ##### -->
105 <para>
106 Returns %TRUE if @type is a value type which can be used for
107 g_value_init(). 
108 </para>
109
110 @type: A #GType value.
111
112
113 <!-- ##### MACRO G_TYPE_HAS_VALUE_TABLE ##### -->
114 <para>
115 Returns %TRUE if @type has a #GTypeValueTable.
116 </para>
117
118 @type: A #GType value.
119
120
121 <!-- ##### MACRO G_TYPE_IS_CLASSED ##### -->
122 <para>
123 Returns %TRUE if @type is a classed type.
124 </para>
125
126 @type: A #GType value.
127
128
129 <!-- ##### MACRO G_TYPE_IS_INSTANTIATABLE ##### -->
130 <para>
131 Returns %TRUE if @type can be instantiated.  Instantiation is the
132 process of creating an instance (object) of this type.
133 </para>
134
135 @type: A #GType value.
136
137
138 <!-- ##### MACRO G_TYPE_IS_DERIVABLE ##### -->
139 <para>
140 Returns %TRUE if @type is a derivable type.  A derivable type can
141 be used as the base class of a flat (single-level) class hierarchy.
142 </para>
143
144 @type: A #GType value.
145
146
147 <!-- ##### MACRO G_TYPE_IS_DEEP_DERIVABLE ##### -->
148 <para>
149 Returns %TRUE if @type is a deep derivable type.  A deep derivable type
150 can be used as the base class of a deep (multi-level) class hierarchy.
151 </para>
152
153 @type: A #GType value.
154
155
156 <!-- ##### MACRO G_TYPE_IS_INTERFACE ##### -->
157 <para>
158 Returns %TRUE if @type is an interface type.
159 Interface types are types that provide pure APIs, the implementation
160 of which is provided by another type (which is then said to conform
161 to the interface).  GLib interfaces are somewhat analogous to Java
162 interfaces and C++ classes containing only pure virtual functions, 
163 with the difference that GType interfaces are not derivable (but see
164 g_type_interface_add_prerequisite() for an alternative).
165 </para>
166
167 @type: A #GType value.
168
169
170 <!-- ##### STRUCT GTypeInterface ##### -->
171 <para>
172 An opaque structure used as the base of all interface types.
173 </para>
174
175
176 <!-- ##### STRUCT GTypeInstance ##### -->
177 <para>
178 An opaque structure used as the base of all type instances.
179 </para>
180
181
182 <!-- ##### STRUCT GTypeClass ##### -->
183 <para>
184
185 </para>
186
187
188 <!-- ##### STRUCT GTypeInfo ##### -->
189 <para>
190 This structure is used to provide the type system with the information
191 required to initialize and destruct (finalize) a type's class and
192 instances thereof.
193 The initialized structure is passed to the g_type_register_static() function
194 (or is copied into the provided #GTypeInfo structure in the
195 g_type_plugin_complete_type_info()). The type system will perform a deep
196 copy of this structure, so it's memory does not need to be persistent
197 across invocation of g_type_register_static().
198 </para>
199
200 @class_size:     Size of the class structure (required for interface, classed and instantiatable types).
201 @base_init:      Location of the base initialization function (optional).
202 @base_finalize:  Location of the base finalization function (optional).
203 @class_init:     Location of the class initialization function for
204   classed and types. Location of the default vtable inititalization
205   function for interface types. (optional) This function is used both
206   to fill in virtual functions in the class or default vtable, and
207   to do type-specific setup such as registering signals and object
208   properties.
209 @class_finalize: Location of the class finalization function for
210   classed and types. Location fo the default vtable finalization
211   function for interface types. (optional)
212 @class_data:     User-supplied data passed to the class init/finalize functions.
213 @instance_size:  Size of the instance (object) structure (required for instantiatable types only).
214 @n_preallocs:    Number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching).
215 @instance_init:  Location of the instance initialization function (optional, for instantiatable types only).
216 @value_table:    A #GTypeValueTable function table for generic handling of GValues of this type (usually only
217                  useful for fundamental types).
218
219 <!-- ##### STRUCT GTypeFundamentalInfo ##### -->
220 <para>
221 A structure that provides information to the type system which is
222 used specifically for managing fundamental types.  
223 </para>
224
225 @type_flags: 
226
227 <!-- ##### STRUCT GInterfaceInfo ##### -->
228 <para>
229 A structure that provides information to the type system which is
230 used specifically for managing interface types.
231 </para>
232
233 @interface_init:        Location of the function that initializes the interface.
234 @interface_finalize:    Location of the function that finalizes the interface.
235 @interface_data:        Location of user data passed to the @interface_init and
236                         @interface_finalize functions (optional).
237
238 <!-- ##### STRUCT GTypeValueTable ##### -->
239 <para>
240 The #GTypeValueTable provides the functions required by the #GValue implementation,
241 to serve as a container for values of a type.
242 </para>
243
244 @value_init:            Default initialize @values contents by poking values
245                         directly into the value-&gt;data array. The data array of
246                         the #GValue passed into this function was zero-filled
247                         with <function>memset()</function>, so no care has to
248                         be taken to free any
249                         old contents. E.g. for the implementation of a string
250                         value that may never be %NULL, the implementation might
251                         look like:
252 <programlisting>
253 {
254   value-&gt;data[0].v_pointer = g_strdup ("");
255 }
256 </programlisting>
257 @value_free:            Free any old contents that might be left in the
258                         data array of the passed in @value. No resources may
259                         remain allocated through the #GValue contents after
260                         this function returns. E.g. for our above string type:
261 <programlisting>
262 {
263   /* only free strings without a specific flag for static storage */
264   if (!(value-&gt;data[1].v_uint &amp; G_VALUE_NOCOPY_CONTENTS))
265     g_free (value-&gt;data[0].v_pointer);
266 }
267 </programlisting>
268 @value_copy:            @dest_value is a #GValue with zero-filled data section
269                         and @src_value is a properly setup #GValue of same or
270                         derived type.
271                         The purpose of this function is to copy the contents of
272                         @src_value into @dest_value in a way, that even after
273                         @src_value has been freed, the contents of @dest_value
274                         remain valid. String type example:
275 <programlisting>
276 {
277   dest_value-&gt;data[0].v_pointer = g_strdup (src_value-&gt;data[0].v_pointer);
278 }
279 </programlisting>
280 @value_peek_pointer:    If the value contents fit into a pointer, such as objects
281                         or strings, return this pointer, so the caller can peek at
282                         the current contents. To extend on our above string example:
283 <programlisting>
284 {
285   return value-&gt;data[0].v_pointer;
286 }
287 </programlisting>
288 @collect_format:        A string format describing how to collect the contents of
289                         this value, bit-by-bit. Each character in the format represents
290                         an argument to be collected, the characters themselves indicate
291                         the type of the argument. Currently supported arguments are:
292 <variablelist>
293   <varlistentry><term></term><listitem><para>
294         'i' - Integers. passed as collect_values[].v_int.
295   </para></listitem></varlistentry>
296   <varlistentry><term></term><listitem><para>
297         'l' - Longs. passed as collect_values[].v_long.
298   </para></listitem></varlistentry>
299   <varlistentry><term></term><listitem><para>
300         'd' - Doubles. passed as collect_values[].v_double.
301   </para></listitem></varlistentry>
302   <varlistentry><term></term><listitem><para>
303         'p' - Pointers. passed as collect_values[].v_pointer.
304   </para></listitem></varlistentry>
305 </variablelist>
306                         It should be noted, that for variable argument list construction,
307                         ANSI C promotes every type smaller than an integer to an int, and
308                         floats to doubles. So for collection of short int or char, 'i'
309                         needs to be used, and for collection of floats 'd'.
310 @collect_value:         The collect_value() function is responsible for converting the
311                         values collected from a variable argument list into contents
312                         suitable for storage in a GValue. This function should setup
313                         @value similar to value_init(), e.g. for a string value that
314                         does not allow %NULL pointers, it needs to either spew an error,
315                         or do an implicit conversion by storing an empty string.
316                         The @value passed in to this function has a zero-filled data
317                         array, so just like for value_init() it is guaranteed to not
318                         contain any old contents that might need freeing.
319                         @n_collect_values is exactly the string length of @collect_format,
320                         and @collect_values is an array of unions #GTypeCValue with
321                         length @n_collect_values, containing the collected values
322                         according to @collect_format.
323                         @collect_flags is an argument provided as a hint by the caller,
324                         which may contain the flag #G_VALUE_NOCOPY_CONTENTS indicating,
325                         that the collected value contents may be considered "static"
326                         for the duration of the @value lifetime.
327                         Thus an extra copy of the contents stored in @collect_values is
328                         not required for assignment to @value.
329                         For our above string example, we continue with:
330 <programlisting>
331 {
332   if (!collect_values[0].v_pointer)
333     value->data[0].v_pointer = g_strdup ("");
334   else if (collect_flags &amp; G_VALUE_NOCOPY_CONTENTS)
335     {
336       value-&gt;data[0].v_pointer = collect_values[0].v_pointer;
337       /* keep a flag for the value_free() implementation to not free this string */
338       value-&gt;data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
339     }
340   else
341     value-&gt;data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
342
343   return NULL;
344 }
345 </programlisting>
346                         It should be noted, that it is generally a bad idea to follow the
347                         #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
348                         reentrancy requirements and reference count assertions performed
349                         by the #GSignal code, reference counts should always be incremented
350                         for reference counted contents stored in the value-&gt;data array.
351                         To deviate from our string example for a moment, and taking a look
352                         at an exemplary implementation for collect_value() of #GObject:
353 <programlisting>
354 {
355   if (collect_values[0].v_pointer)
356     {
357       GObject *object = G_OBJECT (collect_values[0].v_pointer);
358
359       /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
360       value-&gt;data[0].v_pointer = g_object_ref (object);
361       return NULL;
362     }
363   else
364     return g_strdup_printf ("Object passed as invalid NULL pointer");
365 }
366 </programlisting>
367                         The reference count for valid objects is always incremented,
368                         regardless of @collect_flags. For invalid objects, the example
369                         returns a newly allocated string without altering @value.
370                         Upon success, collect_value() needs to return %NULL, if however
371                         a malicious condition occurred, collect_value() may spew an
372                         error by returning a newly allocated non-%NULL string, giving
373                         a suitable description of the error condition.
374                         The calling code makes no assumptions about the @value
375                         contents being valid upon error returns, @value
376                         is simply thrown away without further freeing. As such, it is
377                         a good idea to not allocate #GValue contents, prior to returning
378                         an error, however, collect_values() is not obliged to return
379                         a correctly setup @value for error returns, simply because
380                         any non-%NULL return is considered a fatal condition so further
381                         program behaviour is undefined.
382 @lcopy_format:          Format description of the arguments to collect for @lcopy_value,
383                         analogous to @collect_format. Usually, @lcopy_format string consists
384                         only of 'p's to provide lcopy_value() with pointers to storage locations.
385 @lcopy_value:           This function is responsible for storing the @value contents into
386                         arguments passed through a variable argument list which got
387                         collected into @collect_values according to @lcopy_format.
388                         @n_collect_values equals the string length of @lcopy_format,
389                         and @collect_flags may contain #G_VALUE_NOCOPY_CONTENTS.
390                         In contrast to collect_value(), lcopy_value() is obliged to
391                         always properly support #G_VALUE_NOCOPY_CONTENTS.
392                         Similar to collect_value() the function may prematurely abort
393                         by returning a newly allocated string describing an error condition.
394                         To complete the string example:
395 <programlisting>
396 {
397   gchar **string_p = collect_values[0].v_pointer;
398
399   if (!string_p)
400     return g_strdup_printf ("string location passed as NULL");
401
402   if (collect_flags &amp; G_VALUE_NOCOPY_CONTENTS)
403     *string_p = value-&gt;data[0].v_pointer;
404   else
405     *string_p = g_strdup (value-&gt;data[0].v_pointer);
406
407 }
408 </programlisting>
409                         And an exemplary version of lcopy_value() for
410                         reference-counted types:
411 <programlisting>
412 {
413   GObject **object_p = collect_values[0].v_pointer;
414
415   if (!object_p)
416     return g_strdup_printf ("object location passed as NULL");
417   if (!value-&gt;data[0].v_pointer)
418     *object_p = NULL;
419   else if (collect_flags &amp; G_VALUE_NOCOPY_CONTENTS) /* always honour */
420     *object_p = value-&gt;data[0].v_pointer;
421   else
422     *object_p = g_object_ref (value-&gt;data[0].v_pointer);
423   return NULL;
424 }
425 </programlisting>
426
427 <!-- ##### MACRO G_TYPE_FROM_INSTANCE ##### -->
428 <para>
429 Returns the type identifier from a given @instance structure.
430 </para>
431
432 @instance: Location of a valid #GTypeInstance structure.
433
434
435 <!-- ##### MACRO G_TYPE_FROM_CLASS ##### -->
436 <para>
437 Returns the type identifier from a given @class structure.
438 </para>
439
440 @g_class: Location of a valid #GTypeClass structure.
441
442
443 <!-- ##### MACRO G_TYPE_FROM_INTERFACE ##### -->
444 <para>
445 Returns the type identifier from a given @interface structure.
446 </para>
447
448 @g_iface: Location of a valid #GTypeInterface structure.
449
450
451 <!-- ##### MACRO G_TYPE_INSTANCE_GET_CLASS ##### -->
452 <para>
453 Returns the class structure of a given @instance, casted
454 to a specified anchestor type @g_type of the instance.
455 </para>
456
457 @instance:      Location of the #GTypeInstance structure.
458 @g_type:        The anchestor type of the class to be returned.
459 @c_type:        The corresponding C type of @g_type.
460
461
462 <!-- ##### MACRO G_TYPE_INSTANCE_GET_INTERFACE ##### -->
463 <para>
464 Returns the interface structure for interface @g_type of a given @instance.
465 </para>
466
467 @instance: Location of the #GTypeInstance structure.
468 @g_type: The interface type to be returned.
469 @c_type: The corresponding C type of @g_type.
470
471
472 <!-- ##### MACRO G_TYPE_INSTANCE_GET_PRIVATE ##### -->
473 <para>
474 Gets the private structure for a particular type.
475 The private structure must have been registered in the
476 class_init function with g_type_class_add_private().
477 </para>
478
479 @instance: the instance of a type deriving from @private_type.
480 @g_type: the type identifying which private data to retrieve.
481 @c_type: The C type for the private structure.
482
483
484 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE ##### -->
485 <para>
486
487 </para>
488
489 @instance: 
490
491
492 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE_CAST ##### -->
493 <para>
494
495 </para>
496
497 @instance: 
498 @g_type: 
499 @c_type: 
500
501
502 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE_TYPE ##### -->
503 <para>
504
505 </para>
506
507 @instance: 
508 @g_type: 
509
510
511 <!-- ##### MACRO G_TYPE_CHECK_CLASS_CAST ##### -->
512 <para>
513
514 </para>
515
516 @g_class: 
517 @g_type: 
518 @c_type: 
519
520
521 <!-- ##### MACRO G_TYPE_CHECK_CLASS_TYPE ##### -->
522 <para>
523
524 </para>
525
526 @g_class: 
527 @g_type: 
528
529
530 <!-- ##### MACRO G_TYPE_CHECK_VALUE ##### -->
531 <para>
532
533 </para>
534
535 @value: 
536
537
538 <!-- ##### MACRO G_TYPE_CHECK_VALUE_TYPE ##### -->
539 <para>
540
541 </para>
542
543 @value: 
544 @g_type: 
545
546
547 <!-- ##### MACRO G_TYPE_FLAG_RESERVED_ID_BIT ##### -->
548 <para>
549 A bit in the type number that's supposed to be left untouched.
550 </para>
551
552
553 <!-- ##### FUNCTION g_type_init ##### -->
554 <para>
555 Prior to any use of the type system, g_type_init() has to be called to initialize
556 the type system and assorted other code portions (such as the various fundamental
557 type implementations or the signal system).
558 </para>
559
560
561
562 <!-- ##### ENUM GTypeDebugFlags ##### -->
563 <para>
564 The <type>GTypeDebugFlags</type> enumeration values can be passed to
565 g_type_init_with_debug_flags() to trigger debugging messages during runtime.
566 Note that the messages can also be triggered by setting the
567 <envar>GOBJECT_DEBUG</envar> environment variable to a ':'-separated list of 
568 "objects" and "signals".
569
570 </para>
571
572 @G_TYPE_DEBUG_NONE: Print no messages.
573 @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping.
574 @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions.
575 @G_TYPE_DEBUG_MASK: 
576
577 <!-- ##### FUNCTION g_type_init_with_debug_flags ##### -->
578 <para>
579 Similar to g_type_init(), but additionally sets debug flags.
580 </para>
581
582 @debug_flags: Bitwise combination of #GTypeDebugFlags values for debugging purposes.
583
584
585 <!-- ##### FUNCTION g_type_name ##### -->
586 <para>
587 Returns the unique name that is assigned to a type ID (this is the preferred method
588 to find out whether a specific type has been registered for the passed in ID yet).
589 </para>
590
591 @type:          Type to return name for.
592 @Returns:       Static type name or %NULL.
593
594
595 <!-- ##### FUNCTION g_type_qname ##### -->
596 <para>
597 Return the corresponding quark of the type IDs name.
598 </para>
599
600 @type:    Type to return quark of type name for.
601 @Returns: The type names quark or 0.
602
603
604 <!-- ##### FUNCTION g_type_from_name ##### -->
605 <para>
606 Lookup the type ID from a given type name, returns 0 if no type has been registered under this name
607 (this is the preferred method to find out by name whether a specific type has been registered yet).
608 </para>
609
610 @name:    Type name to lookup.
611 @Returns: Corresponding type ID or 0.
612
613
614 <!-- ##### FUNCTION g_type_parent ##### -->
615 <para>
616 Return the direct parent type of the passed in type.
617 If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
618 </para>
619
620 @type:    The derived type.
621 @Returns: The parent type.
622
623
624 <!-- ##### FUNCTION g_type_depth ##### -->
625 <para>
626 Returns the length of the ancestry of the passed in type. This includes the
627 type itself, so that e.g. a fundamental type has depth 1.
628 </para>
629
630 @type:    A #GType value.
631 @Returns: The depth of @type.
632
633
634 <!-- ##### FUNCTION g_type_next_base ##### -->
635 <para>
636 Given a @leaf_type and a @root_type which is contained in its anchestry, return
637 the type that @root_type is the immediate parent of.
638 In other words, this function determines the type that is derived directly from
639 @root_type which is also a base class of @leaf_type.  Given a root type and a
640 leaf type, this function can be used to determine the types and order in which
641 the leaf type is descended from the root type.
642 </para>
643
644 @leaf_type:     Descendant of @root_type and the type to be returned.
645 @root_type:     Immediate parent of the returned type.
646 @Returns:       Immediate child of @root_type and anchestor of @leaf_type.
647
648
649 <!-- ##### FUNCTION g_type_is_a ##### -->
650 <para>
651 If @is_a_type is a derivable type, check whether @type is a descendant of @is_a_type.
652 If @is_a_type is an interface, check whether @type conforms to it.
653 </para>
654
655 @type:      Type to check anchestry for.
656 @is_a_type: Possible anchestor of @type or interface @type could conform to.
657 @Returns:   %TRUE if @type is_a @is_a_type holds true.
658
659
660 <!-- ##### FUNCTION g_type_class_ref ##### -->
661 <para>
662 Increments the reference count of the class structure belonging to
663 @type. This function will demand-create the class if it doesn't
664 exist already.
665 </para>
666
667 @type:    Type ID of a classed type.
668 @Returns: The #GTypeClass structure for the given type ID.
669
670
671 <!-- ##### FUNCTION g_type_class_peek ##### -->
672 <para>
673 This function is essentially the same as g_type_class_ref(), except that
674 the classes reference count isn't incremented. Therefore, this function
675 may return %NULL if the class of the type passed in does not currently
676 exist (hasn't been referenced before).
677 </para>
678
679 @type:          Type ID of a classed type.
680 @Returns:       The #GTypeClass structure for the given type ID or %NULL
681                 if the class does not currently exist.
682
683
684 <!-- ##### FUNCTION g_type_class_unref ##### -->
685 <para>
686 Decrements the reference count of the class structure being passed in.
687 Once the last reference count of a class has been released, classes
688 may be finalized by the type system, so further dereferencing of a
689 class pointer after g_type_class_unref() are invalid.
690 </para>
691
692 @g_class:       The #GTypeClass structure to unreference.
693
694
695 <!-- ##### FUNCTION g_type_class_peek_parent ##### -->
696 <para>
697 This is a convenience function, often needed in class initializers.
698 It essentially takes the immediate parent type of the class passed in,
699 and returns the class structure thereof. Since derived classes hold
700 a reference count on their parent classes as long as they are instantiated,
701 the returned class will always exist. This function is essentially
702 equivalent to:
703
704 <programlisting>
705 g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
706 </programlisting>
707
708 </para>
709
710 @g_class: The #GTypeClass structure to retrieve the parent class for.
711 @Returns: The parent class of @g_class.
712
713
714 <!-- ##### FUNCTION g_type_class_add_private ##### -->
715 <para>
716 Registers a private structure for a instantiatable type;
717 when an object is allocated, the private structures for
718 the type and and all of its parent types are allocated
719 sequentially in the same memory block as the public
720 structures. This function should be called in the
721 type's class_init() function. The private structure can
722 be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro.
723 The following example shows attaching a private structure
724 <structname>MyObjectPrivate</structname> to an object
725 <structname>MyObject</structname> defined in the standard GObject
726 fashion.
727 </para>
728 <programlisting>
729 typedef struct _MyObjectPrivate MyObjectPrivate;
730
731 struct _MyObjectPrivate {
732   int some_field;
733 };
734
735 &num;define MY_OBJECT_GET_PRIVATE(o)  \
736    (G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))
737
738 static void
739 my_object_class_init (MyObjectClass *klass)
740 {
741   g_type_class_add_private (klass, sizeof (MyObjectPrivate));
742 }
743
744 static int
745 my_object_get_some_field (MyObject *my_object)
746 {
747   MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);
748
749   return priv->some_field;
750 }
751 </programlisting>
752
753 @g_class: class structure for an instantiatable type
754 @private_size: size of private structure.
755
756
757 <!-- ##### FUNCTION g_type_interface_peek ##### -->
758 <para>
759 Returns the #GTypeInterface structure of an interface to which the passed in 
760 class conforms.
761 </para>
762
763 @instance_class: A #GTypeClass structure.
764 @iface_type:     An interface ID which this class conforms to.
765 @Returns:        The #GTypeInterface structure of @iface_type, or %NULL if the
766                  class is not instantiated.
767
768
769 <!-- ##### FUNCTION g_type_interface_peek_parent ##### -->
770 <para>
771 Returns the corresponding #GTypeInterface structure of the parent type
772 of the instance type to which @g_iface belongs. This is useful when 
773 deriving the implementation of an interface from the parent type and 
774 then possibly overriding some methods. 
775 </para>
776
777 @g_iface: A #GTypeInterface structure.
778 @Returns: The corresponding #GTypeInterface structure of the parent type
779    of the instance type to which @g_iface belongs, or %NULL if the parent type
780    doesn't conform to the interface.
781
782
783 <!-- ##### FUNCTION g_type_default_interface_ref ##### -->
784 <para>
785 Increments the reference count for the interface type @g_type,
786 and returns the default interface vtable for the type.
787 </para>
788 <para>  
789 If the type is not currently in use, then the default vtable
790 for the type will be created and initalized by calling
791 the base interface init and default vtable init functions for
792 the type (the @<structfield>base_init</structfield>
793 and <structfield>class_init</structfield> members of #GTypeInfo).
794 Calling g_type_default_interface_ref() is useful when you
795 want to make sure that signals and properties for an interface
796 have been installed.
797 </para>
798
799 @g_type: an interface type
800 @Returns: the default vtable for the interface; call 
801  g_type_default_interface_unref() when you are done using
802  the interface.
803
804
805 <!-- ##### FUNCTION g_type_default_interface_peek ##### -->
806 <para>
807 If the interface type @g_type is currently in use, returns
808 its default interface vtable.    
809 </para>
810
811 @g_type: an interface type
812 @Returns: the default vtable for the interface; or %NULL
813  if the type is not currently in use.
814
815
816 <!-- ##### FUNCTION g_type_default_interface_unref ##### -->
817 <para>
818 Decrements the reference count for the type corresponding to the
819 interface default vtable @g_iface. If the type is dynamic, then
820 when no one is using the interface and all references have
821 been released, the finalize function for the interface's default
822 vtable (the <structfield>class_finalize</structfield> member of
823 #GTypeInfo) will be called.
824 </para>
825
826 @g_iface: the default vtable structure for a interface, as
827   returned by g_type_default_interface_ref()
828
829
830 <!-- ##### FUNCTION g_type_children ##### -->
831 <para>
832 Return a newly allocated and 0-terminated array of type IDs, listing the
833 child types of @type. The return value has to be g_free()ed after use.
834 </para>
835
836 @type:       The parent type.
837 @n_children: Optional #guint pointer to contain the number of child types.
838 @Returns:    Newly allocated and 0-terminated array of child types.
839
840
841 <!-- ##### FUNCTION g_type_interfaces ##### -->
842 <para>
843 Return a newly allocated and 0-terminated array of type IDs, listing the
844 interface types that @type conforms to. The return value has to be
845 g_free()ed after use.
846 </para>
847
848 @type:         The type to list interface types for.
849 @n_interfaces: Optional #guint pointer to contain the number of interface types.
850 @Returns:      Newly allocated and 0-terminated array of interface types.
851
852
853 <!-- ##### FUNCTION g_type_interface_prerequisites ##### -->
854 <para>
855 Returns the prerequisites of an interfaces type.
856 </para>
857
858 @interface_type: an interface type
859 @n_prerequisites: location to return the number of prerequisites, or %NULL
860 @Returns: a newly-allocated zero-terminated array of #GType containing 
861    the prerequisites of @interface_type
862 @Since: 2.2
863
864
865 <!-- ##### FUNCTION g_type_set_qdata ##### -->
866 <para>
867 Attaches arbitrary data to a type.
868 </para>
869
870 @type: a #GType
871 @quark: a #GQuark id to identify the data
872 @data: the data
873
874
875 <!-- ##### FUNCTION g_type_get_qdata ##### -->
876 <para>
877 Obtains data which has previously been attached to @type
878 with g_type_set_qdata().
879 </para>
880
881 @type: a #GType
882 @quark: a #GQuark id to identify the data
883 @Returns: the data, or %NULL if no data was found
884
885
886 <!-- ##### FUNCTION g_type_query ##### -->
887 <para>
888 Queries the type system for information about a specific type. 
889 This function will fill in a user-provided structure to hold type-specific 
890 information. If an invalid #GType is passed in, the @type member of the 
891 #GTypeQuery is 0. All members filled into the #GTypeQuery structure should
892 be considered constant and have to be left untouched.
893 </para>
894
895 @type: the #GType value of a static, classed type.
896 @query: A user provided structure that is filled in with constant values 
897         upon success.
898
899
900 <!-- ##### STRUCT GTypeQuery ##### -->
901 <para>
902 A structure holding information for a specific type. It is
903 filled in by the g_type_query() function.
904 </para>
905
906 @type: the #GType value of the type.
907 @type_name: the name of the type.
908 @class_size: the size of the class structure.
909 @instance_size: the size of the instance structure.
910
911 <!-- ##### USER_FUNCTION GBaseInitFunc ##### -->
912 <para>
913 A callback function used by the type system to do base initialization
914 of the class structures of derived types. It is called as part of the
915 initialization process of all derived classes and should reallocate
916 or reset all dynamic class members copied over from the parent class.
917 Therefore class members, e.g. strings, that are not sufficiently
918 handled by a plain memory copy of the parent class into the derived class
919 have to be altered. See GClassInitFunc() for a discussion of the class
920 intialization process.
921 </para>
922
923 @g_class: The #GTypeClass structure to initialize.
924
925
926 <!-- ##### USER_FUNCTION GBaseFinalizeFunc ##### -->
927 <para>
928 A callback function used by the type system to finalize those portions
929 of a derived types class structure that were setup from the corresponding
930 GBaseInitFunc() function. Class finalization basically works the inverse
931 way in which class intialization is performed.
932 See GClassInitFunc() for a discussion of the class intialization process.
933 </para>
934
935 @g_class: The #GTypeClass structure to finalize.
936
937
938 <!-- ##### USER_FUNCTION GClassInitFunc ##### -->
939 <para>
940 A callback function used by the type system to initialize the class
941 of a specific type. This function should initialize all static class
942 members.
943 The initialization process of a class involves:
944 <variablelist>
945   <varlistentry><term></term><listitem><para>
946         1 - Copying common members from the parent class over to the
947         derived class structure.
948   </para></listitem></varlistentry>
949   <varlistentry><term></term><listitem><para>
950         2 -  Zero initialization of the remaining members not copied
951         over from the parent class.
952   </para></listitem></varlistentry>
953   <varlistentry><term></term><listitem><para>
954         3 - Invocation of the GBaseInitFunc() initializers of all parent
955         types and the class' type.
956   </para></listitem></varlistentry>
957   <varlistentry><term></term><listitem><para>
958         4 - Invocation of the class' GClassInitFunc() initializer.
959   </para></listitem></varlistentry>
960 </variablelist>
961 Since derived classes are partially initialized through a memory copy
962 of the parent class, the general rule is that GBaseInitFunc() and
963 GBaseFinalizeFunc() should take care of necessary reinitialization
964 and release of those class members that were introduced by the type
965 that specified these GBaseInitFunc()/GBaseFinalizeFunc().
966 GClassInitFunc() should only care about initializing static
967 class members, while dynamic class members (such as allocated strings
968 or reference counted resources) are better handled by a GBaseInitFunc()
969 for this type, so proper initialization of the dynamic class members
970 is performed for class initialization of derived types as well.
971 An example may help to correspond the intend of the different class
972 initializers:
973
974 <programlisting>
975 typedef struct {
976   GObjectClass parent_class;
977   gint         static_integer;
978   gchar       *dynamic_string;
979 } TypeAClass;
980 static void
981 type_a_base_class_init (TypeAClass *class)
982 {
983   class->dynamic_string = g_strdup ("some string");
984 }
985 static void
986 type_a_base_class_finalize (TypeAClass *class)
987 {
988   g_free (class->dynamic_string);
989 }
990 static void
991 type_a_class_init (TypeAClass *class)
992 {
993   class->static_integer = 42;
994 }
995
996 typedef struct {
997   TypeAClass   parent_class;
998   gfloat       static_float;
999   GString     *dynamic_gstring;
1000 } TypeBClass;
1001 static void
1002 type_b_base_class_init (TypeBClass *class)
1003 {
1004   class->dynamic_gstring = g_string_new ("some other string");
1005 }
1006 static void
1007 type_b_base_class_finalize (TypeBClass *class)
1008 {
1009   g_string_free (class->dynamic_gstring);
1010 }
1011 static void
1012 type_b_class_init (TypeBClass *class)
1013 {
1014   class->static_float = 3.14159265358979323846;
1015 }
1016 </programlisting>
1017 Initialization of TypeBClass will first cause initialization of
1018 TypeAClass (derived classes reference their parent classes, see
1019 g_type_class_ref() on this).
1020 Initialization of TypeAClass roughly involves zero-initializing its fields,
1021 then calling its GBaseInitFunc() type_a_base_class_init() that allocates
1022 its dynamic members (dynamic_string) and finally calling its GClassInitFunc()
1023 type_a_class_init() to initialize its static members (static_integer).
1024 The first step in the initialization process of TypeBClass is then
1025 a plain memory copy of the contents of TypeAClass into TypeBClass and 
1026 zero-initialization of the remaining fields in TypeBClass.
1027 The dynamic members of TypeAClass within TypeBClass now need
1028 reinitialization which is performed by calling type_a_base_class_init()
1029 with an argument of TypeBClass.
1030 After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
1031 is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
1032 and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
1033 is called to complete the initialization process with the static members
1034 (static_float).
1035 Corresponding finalization counter parts to the GBaseInitFunc() functions
1036 have to be provided to release allocated resources at class finalization
1037 time.
1038 </para>
1039
1040 @g_class:       The #GTypeClass structure to initialize.
1041 @class_data:    The @class_data member supplied via the #GTypeInfo structure.
1042
1043
1044 <!-- ##### USER_FUNCTION GClassFinalizeFunc ##### -->
1045 <para>
1046 A callback function used by the type system to finalize a class.
1047 This function is rarely needed, as dynamically allocated class resources
1048 should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
1049 Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
1050 structure of a static type is invalid, because classes of static types
1051 will never be finalized (they are artificially kept alive when their
1052 reference count drops to zero).
1053 </para>
1054
1055 @g_class:       The #GTypeClass structure to finalize.
1056 @class_data:    The @class_data member supplied via the #GTypeInfo structure.
1057
1058
1059 <!-- ##### USER_FUNCTION GInstanceInitFunc ##### -->
1060 <para>
1061 A callback function used by the type system to initialize a new
1062 instance of a type. This function initializes all instance members and
1063 allocates any resources required by it.
1064 Initialization of a derived instance involves calling all its parent
1065 types instance initializers, therefore the class member of the instance
1066 is altered during its initialization to always point to the class that
1067 belongs to the type the current initializer was introduced for.
1068 </para>
1069
1070 @instance:      The instance to initialize.
1071 @g_class:       The class of the type the instance is created for.
1072
1073
1074 <!-- ##### USER_FUNCTION GInterfaceInitFunc ##### -->
1075 <para>
1076 A callback function used by the type system to initialize a new
1077 interface.  This function should initialize all internal data and
1078 allocate any resources required by the interface.
1079 </para>
1080
1081 @g_iface:       The interface structure to initialize.
1082 @iface_data:    The @class_data supplied via the #GTypeInfo structure.
1083
1084
1085 <!-- ##### USER_FUNCTION GInterfaceFinalizeFunc ##### -->
1086 <para>
1087 A callback function used by the type system to finalize an interface.
1088 This function should destroy any internal data and release any resources
1089 allocated by the corresponding GInterfaceInitFunc() function.
1090 </para>
1091
1092 @g_iface:       The interface structure to finalize.
1093 @iface_data:    The @class_data supplied via the #GTypeInfo structure.
1094
1095
1096 <!-- ##### USER_FUNCTION GTypeClassCacheFunc ##### -->
1097 <para>
1098 A callback function which is called when the reference count of a class 
1099 drops to zero. It may use g_type_class_ref() to prevent the class from
1100 being freed. You should not call g_type_class_unref() from a 
1101 #GTypeClassCacheFunc function to prevent infinite recursion, use 
1102 g_type_class_unref_uncached() instead.
1103 </para>
1104 <para>
1105 The functions have to check the class id passed in to figure 
1106 whether they actually want to cache the class of this type, since all
1107 classes are routed through the same #GTypeClassCacheFunc chain.
1108 </para>
1109
1110 @cache_data: data that was given to the g_type_add_class_cache_func() call
1111 @g_class: The #GTypeClass structure which is unreferenced
1112 @Returns: %TRUE to stop further #GTypeClassCacheFunc<!-- -->s from being 
1113 called, %FALSE to continue.
1114
1115
1116 <!-- ##### ENUM GTypeFlags ##### -->
1117 <para>
1118 Bit masks used to check or determine characteristics of a type.
1119 </para>
1120
1121 @G_TYPE_FLAG_ABSTRACT:  Indicates an abstract type. No instances can be
1122                         created for an abstract type.
1123 @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type
1124                         that introduces a value table, but can't be used for
1125                         g_value_init().
1126
1127 <!-- ##### ENUM GTypeFundamentalFlags ##### -->
1128 <para>
1129 Bit masks used to check or determine specific characteristics of a
1130 fundamental type.
1131 </para>
1132
1133 @G_TYPE_FLAG_CLASSED:           Indicates a classed type.
1134 @G_TYPE_FLAG_INSTANTIATABLE:    Indicates an instantiable type (implies classed).
1135 @G_TYPE_FLAG_DERIVABLE:                 Indicates a flat derivable type.
1136 @G_TYPE_FLAG_DEEP_DERIVABLE:    Indicates a deep derivable type (implies derivable).
1137
1138 <!-- ##### FUNCTION g_type_register_static ##### -->
1139 <para>
1140 Registers @type_name as the name of a new static type derived from
1141 @parent_type.  The type system uses the information contained in the
1142 #GTypeInfo structure pointed to by @info to manage the type and its
1143 instances (if not abstract).  The value of @flags determines the nature
1144 (e.g. abstract or not) of the type.
1145 </para>
1146
1147 @parent_type:   Type which this type will be derived from.
1148 @type_name:     0-terminated string used as the name of the new type.
1149 @info:          The #GTypeInfo structure for this type.
1150 @flags:                 Bitwise combination of #GTypeFlags values.
1151 @Returns:       The new type identifier.
1152
1153
1154 <!-- ##### FUNCTION g_type_register_dynamic ##### -->
1155 <para>
1156 Registers @type_name as the name of a new dynamic type derived from
1157 @parent_type.  The type system uses the information contained in the
1158 #GTypePlugin structure pointed to by @plugin to manage the type and its
1159 instances (if not abstract).  The value of @flags determines the nature
1160 (e.g. abstract or not) of the type.
1161 </para>
1162
1163 @parent_type:   Type which this type will be derived from.
1164 @type_name:     0-terminated string used as the name of the new type.
1165 @plugin:        The #GTypePlugin structure to retrieve the #GTypeInfo from.
1166 @flags:                 Bitwise combination of #GTypeFlags values.
1167 @Returns:       The new type identifier or #G_TYPE_INVALID if registration failed.
1168
1169
1170 <!-- ##### FUNCTION g_type_register_fundamental ##### -->
1171 <para>
1172 Registers @type_id as the predefined identifier and @type_name as the
1173 name of a fundamental type.  The type system uses the information
1174 contained in the #GTypeInfo structure pointed to by @info and the 
1175 #GTypeFundamentalInfo structure pointed to by @finfo to manage the
1176 type and its instances.  The value of @flags determines additional
1177 characteristics of the fundamental type.
1178 </para>
1179
1180 @type_id:       A predefined #GTypeFundamentals value.
1181 @type_name:     0-terminated string used as the name of the new type.
1182 @info:          The #GTypeInfo structure for this type.
1183 @finfo:                 The #GTypeFundamentalInfo structure for this type.
1184 @flags:                 Bitwise combination of #GTypeFlags values.
1185 @Returns:       The predefined type identifier.
1186
1187
1188 <!-- ##### FUNCTION g_type_add_interface_static ##### -->
1189 <para>
1190 Adds the static @interface_type to @instantiable_type.  The information
1191 contained in the #GTypeInterfaceInfo structure pointed to by @info
1192 is used to manage the relationship.
1193 </para>
1194
1195 @instance_type:          #GType value of an instantiable type.
1196 @interface_type: #GType value of an interface type.
1197 @info:           The #GInterfaceInfo structure for this
1198                  (@instance_type, @interface_type) combination.
1199
1200
1201 <!-- ##### FUNCTION g_type_add_interface_dynamic ##### -->
1202 <para>
1203 Adds the dynamic @interface_type to @instantiable_type. The information
1204 contained in the #GTypePlugin structure pointed to by @plugin
1205 is used to manage the relationship.
1206 </para>
1207
1208 @instance_type: the #GType value of an instantiable type.
1209 @interface_type: the #GType value of an interface type.
1210 @plugin: the #GTypePlugin structure to retrieve the #GInterfaceInfo from.
1211
1212
1213 <!-- ##### FUNCTION g_type_interface_add_prerequisite ##### -->
1214 <para>
1215 Adds @prerequisite_type to the list of prerequisites of @interface_type.
1216 This means that any type implementing @interface_type must also implement
1217 @prerequisite_type. Prerequisites can be thought of as an alternative to
1218 interface derivation (which GType doesn't support). An interface can have
1219 at most one instantiatable prerequisite type.
1220 </para>
1221
1222 @interface_type: #GType value of an interface type.
1223 @prerequisite_type: #GType value of an interface or instantiatable type.
1224
1225
1226 <!-- ##### FUNCTION g_type_get_plugin ##### -->
1227 <para>
1228 Returns the #GTypePlugin structure for @type or
1229 %NULL if @type does not have a #GTypePlugin structure.
1230 </para>
1231
1232 @type:          The #GType to retrieve the plugin for.
1233 @Returns:       The corresponding plugin if @type is a dynamic type,
1234                 %NULL otherwise.
1235
1236
1237 <!-- ##### FUNCTION g_type_interface_get_plugin ##### -->
1238 <para>
1239 Returns the #GTypePlugin structure for the dynamic interface 
1240 @interface_type which has been added to @instance_type, or 
1241 %NULL if @interface_type has not been added to @instance_type or does 
1242 not have a #GTypePlugin structure. See g_type_add_interface_dynamic().
1243 </para>
1244
1245 @instance_type: the #GType value of an instantiatable type.
1246 @interface_type: the #GType value of an interface type.
1247 @Returns: the #GTypePlugin for the dynamic interface @interface_type
1248    of @instance_type.
1249
1250
1251 <!-- ##### FUNCTION g_type_fundamental_next ##### -->
1252 <para>
1253 Returns the next free fundamental type id which can be used to
1254 register a new fundamental type with g_type_register_fundamental().
1255 The returned type ID represents the highest currently registered
1256 fundamental type identifier.
1257
1258 </para>
1259
1260 @Returns: The nextmost fundamental type ID to be registered,
1261           or 0 if the type system ran out of fundamental type IDs.
1262
1263
1264 <!-- ##### FUNCTION g_type_fundamental ##### -->
1265 <para>
1266 Internal function, used to extract the fundamental type ID portion.
1267 use G_TYPE_FUNDAMENTAL() instead.
1268 </para>
1269
1270 @type_id: valid type ID
1271 @Returns: fundamental type ID
1272
1273
1274 <!-- ##### FUNCTION g_type_create_instance ##### -->
1275 <para>
1276 Creates and initializes an instance of @type if @type is valid and can
1277 be instantiated. The type system only performs basic allocation and
1278 structure setups for instances, actual instance creation should happen
1279 through functions supplied by the type's fundamental type implementation.
1280 So use of g_type_create_instance() is reserved for implementators of
1281 fundamental types only. E.g. instances of the #GObject hierarchy
1282 should be created via g_object_new() and <emphasis>never</emphasis>
1283 directly through g_type_create_instance() which doesn't handle
1284 things like singleton objects or object construction.
1285 Note: Do <emphasis>not</emphasis> use this function, unless you're
1286 implementing a fundamental type. Also language bindings should <emphasis>not</emphasis>
1287 use this function but g_object_new() instead.
1288 </para>
1289
1290 @type:    An instantiatable type to create an instance for.
1291 @Returns: An allocated and initialized instance, subject to further
1292           treatment by the fundamental type implementation.
1293
1294
1295 <!-- ##### FUNCTION g_type_free_instance ##### -->
1296 <para>
1297 Frees an instance of a type, returning it to the instance pool for the type,
1298 if there is one.
1299 </para>
1300 <para>
1301 Like g_type_create_instance(), this function is reserved for implementors of 
1302 fundamental types.
1303 </para>
1304
1305 @instance: an instance of a type.
1306
1307
1308 <!-- ##### FUNCTION g_type_add_class_cache_func ##### -->
1309 <para>
1310 Adds a #GTypeClassCacheFunc to be called before the reference count of a class 
1311 goes from one to zero. This can be used to prevent premature class destruction.
1312 All installed #GTypeClassCacheFunc functions will be chained until one of them 
1313 returns %TRUE. The functions have to check the class id passed in to figure 
1314 whether they actually want to cache the class of this type, since all classes
1315 are routed through the same #GTypeClassCacheFunc chain.
1316 </para>
1317
1318 @cache_data: data to be passed to @cache_func
1319 @cache_func: a #GTypeClassCacheFunc
1320
1321
1322 <!-- ##### FUNCTION g_type_remove_class_cache_func ##### -->
1323 <para>
1324 Removes a previously installed #GTypeClassCacheFunc. The cache maintained 
1325 by @cache_func has to be empty when calling g_type_remove_class_cache_func() 
1326 to avoid leaks.
1327 </para>
1328
1329 @cache_data: data that was given when adding @cache_func
1330 @cache_func: a #GTypeClassCacheFunc 
1331
1332
1333 <!-- ##### FUNCTION g_type_class_unref_uncached ##### -->
1334 <para>
1335 A variant of g_type_class_unref() for use in #GTypeClassCacheFunc
1336 implementations. It unreferences a class without consulting the chain
1337 of #GTypeClassCacheFunc<!-- -->s, avoiding the recursion which would occur
1338 otherwise.
1339 </para>
1340
1341 @g_class: The #GTypeClass structure to unreference.
1342
1343
1344 <!-- ##### FUNCTION g_type_add_interface_check ##### -->
1345 <para>
1346 Adds a function to be called after an interface vtable is
1347 initialized for any class. That is, after the @interface_init
1348 member of #GInterfaceInfo has been called.
1349 </para>
1350 <para>
1351 This function is useful when you want to check an invariant
1352 that depends on the interfaces of a class. For instance,
1353 the implementation of #GObject uses this facility to check
1354 that an object implements all of the properties that are
1355 defined on its interfaces.    
1356 </para>
1357
1358 @check_data: data to pass to @check_func
1359 @check_func: function to be called after each interface
1360    is initialized.
1361
1362
1363 <!-- ##### FUNCTION g_type_remove_interface_check ##### -->
1364 <para>
1365 Removes an interface check function added with
1366 g_type_add_interface_check().
1367 </para>
1368
1369 @check_data: callback data passed to g_type_add_interface_check()
1370 @chec_func: callback function passed to g_type_add_interface_check()
1371
1372
1373 <!-- ##### USER_FUNCTION GTypeInterfaceCheckFunc ##### -->
1374 <para>
1375 A callback called after an interface vtable is initialized.
1376 See g_type_add_interface_check().
1377 </para>
1378
1379 @func_data: data passed to g_type_add_interface_check().
1380 @g_iface: the interface that has been initialized
1381
1382
1383 <!-- ##### FUNCTION g_type_value_table_peek ##### -->
1384 <para>
1385 Returns the location of the #GTypeValueTable associated with @type.
1386 <emphasis>Note, this function should only be used from source code
1387 that implements or has internal knowledge of the implementation of
1388 @type.</emphasis>
1389 </para>
1390
1391 @type:    A #GType value.
1392 @Returns: Location of the #GTypeValueTable associated with @type or
1393           %NULL if there is no #GTypeValueTable associated with @type.
1394
1395
1396 <!-- ##### MACRO G_TYPE_INVALID ##### -->
1397 <para>
1398 An invalid #GType, used as error return value in some functions which return
1399 a #GType. 
1400 </para>
1401
1402
1403
1404 <!-- ##### MACRO G_TYPE_NONE ##### -->
1405 <para>
1406 A fundamental type which is used as a replacement for the C
1407 <literal>void</literal> return type.
1408 </para>
1409
1410
1411
1412 <!-- ##### MACRO G_TYPE_INTERFACE ##### -->
1413 <para>
1414 The fundamental type from which all interfaces are derived.
1415 </para>
1416
1417
1418
1419 <!-- ##### MACRO G_TYPE_CHAR ##### -->
1420 <para>
1421 The fundamental type corresponding to #gchar.
1422 </para>
1423
1424
1425
1426 <!-- ##### MACRO G_TYPE_UCHAR ##### -->
1427 <para>
1428 The fundamental type corresponding to #guchar.
1429 </para>
1430
1431
1432
1433 <!-- ##### MACRO G_TYPE_BOOLEAN ##### -->
1434 <para>
1435 The fundamental type corresponding to #gboolean.
1436 </para>
1437
1438
1439
1440 <!-- ##### MACRO G_TYPE_INT ##### -->
1441 <para>
1442 The fundamental type corresponding to #gint.
1443 </para>
1444
1445
1446
1447 <!-- ##### MACRO G_TYPE_UINT ##### -->
1448 <para>
1449 The fundamental type corresponding to #guint.
1450 </para>
1451
1452
1453
1454 <!-- ##### MACRO G_TYPE_LONG ##### -->
1455 <para>
1456 The fundamental type corresponding to #glong.
1457 </para>
1458
1459
1460
1461 <!-- ##### MACRO G_TYPE_ULONG ##### -->
1462 <para>
1463 The fundamental type corresponding to #gulong.
1464 </para>
1465
1466
1467
1468 <!-- ##### MACRO G_TYPE_INT64 ##### -->
1469 <para>
1470 The fundamental type corresponding to #gint64.
1471 </para>
1472
1473
1474
1475 <!-- ##### MACRO G_TYPE_UINT64 ##### -->
1476 <para>
1477 The fundamental type corresponding to #guint64.
1478 </para>
1479
1480
1481
1482 <!-- ##### MACRO G_TYPE_ENUM ##### -->
1483 <para>
1484 The fundamental type from which all enumeration types are derived.
1485 </para>
1486
1487
1488
1489 <!-- ##### MACRO G_TYPE_FLAGS ##### -->
1490 <para>
1491 The fundamental type from which all flags types are derived.
1492 </para>
1493
1494
1495
1496 <!-- ##### MACRO G_TYPE_FLOAT ##### -->
1497 <para>
1498 The fundamental type corresponding to #gfloat.
1499 </para>
1500
1501
1502
1503 <!-- ##### MACRO G_TYPE_DOUBLE ##### -->
1504 <para>
1505 The fundamental type corresponding to #gdouble.
1506 </para>
1507
1508
1509
1510 <!-- ##### MACRO G_TYPE_STRING ##### -->
1511 <para>
1512 The fundamental type corresponding to nul-terminated C strings.
1513 </para>
1514
1515
1516
1517 <!-- ##### MACRO G_TYPE_POINTER ##### -->
1518 <para>
1519 The fundamental type corresponding to #gpointer.
1520 </para>
1521
1522
1523
1524 <!-- ##### MACRO G_TYPE_BOXED ##### -->
1525 <para>
1526 The fundamental type from which all boxed types are derived.
1527 </para>
1528
1529
1530
1531 <!-- ##### MACRO G_TYPE_PARAM ##### -->
1532 <para>
1533 The fundamental type from which all #GParamSpec types are derived.
1534 </para>
1535
1536
1537
1538 <!-- ##### MACRO G_TYPE_OBJECT ##### -->
1539 <para>
1540 The fundamental type for #GObject.
1541 </para>
1542
1543
1544 <!-- ##### MACRO G_TYPE_RESERVED_GLIB_FIRST ##### -->
1545 <para>
1546 First fundamental type number to create a new fundamental type id with
1547 G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
1548 </para>
1549
1550
1551
1552 <!-- ##### MACRO G_TYPE_RESERVED_GLIB_LAST ##### -->
1553 <para>
1554 Last fundamental type number reserved for GLib.
1555 </para>
1556
1557
1558
1559 <!-- ##### MACRO G_TYPE_RESERVED_BSE_FIRST ##### -->
1560 <para>
1561 First fundamental type number to create a new fundamental type id with
1562 G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
1563 </para>
1564
1565
1566
1567 <!-- ##### MACRO G_TYPE_RESERVED_BSE_LAST ##### -->
1568 <para>
1569 Last fundamental type number reserved for BSE.
1570 </para>
1571
1572
1573
1574 <!-- ##### MACRO G_TYPE_RESERVED_USER_FIRST ##### -->
1575 <para>
1576 First available fundamental type number to create new fundamental 
1577 type id with G_TYPE_MAKE_FUNDAMENTAL().
1578 </para>
1579
1580 <!--
1581 Local variables:
1582 mode: sgml
1583 sgml-parent-document: ("../gobject-docs.sgml" "book" "refsect2" "")
1584 End:
1585 -->
1586
1587
1588