PageRenderTime 24ms CodeModel.GetById 10ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gobject/library/g_type.e

http://github.com/tybor/Liberty
Specman e | 1237 lines | 13 code | 325 blank | 899 comment | 0 complexity | 95b31e373631511d0eb81f86914430af MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1indexing
  2	description: "GType - the GLib Runtime type identification and management system."
  3	copyright: "(C) 2006 Paolo Redaelli "
  4	license: "LGPL v2 or later"
  5	date: "$Date:$"
  6	revision: "$Revision:$"
  7
  8			-- Description
  9			
 10			-- The GType API is the foundation of the GObject system. It
 11			-- provides the facilities for registering and managing all
 12			-- fundamental data types, user-defined object and interface
 13			-- types. Before using any GType or GObject functions,
 14			-- g_type_init() must be called to initialize the type
 15			-- system.
 16			
 17			-- For type creation and registration purposes, all types
 18			-- fall into one of two categories: static or dynamic. Static
 19			-- types are never loaded or unloaded at run-time as dynamic
 20			-- types may be. Static types are created with
 21			-- g_type_register_static() that gets type specific
 22			-- information passed in via a GTypeInfo structure. Dynamic
 23			-- types are created with g_type_register_dynamic() which
 24			-- takes a GTypePlugin structure instead. The remaining type
 25			-- information (the GTypeInfo structure) is retrieved during
 26			-- runtime through GTypePlugin and the g_type_plugin_*()
 27			-- API. These registration functions are usually called only
 28			-- once from a function whose only purpose is to return the
 29			-- type identifier for a specific class. Once the type (or
 30			-- class or interface) is registered, it may be instantiated,
 31			-- inherited, or implemented depending on exactly what sort
 32			-- of type it is. There is also a third registration function
 33			-- for registering fundamental types called
 34			-- g_type_register_fundamental() which requires both a
 35			-- GTypeInfo structure and a GTypeFundamentalInfo structure
 36			-- but it is seldom used since most fundamental types are
 37			-- predefined rather than user-defined.
 38
 39			-- A final word about type names. Such an identifier needs to
 40			-- be at least three characters long. There is no upper
 41			-- length limit. The first character needs to be a letter
 42			-- (a-z or A-Z) or an underscore '_'. Subsequent characters
 43			-- can be letters, numbers or any of '-_+'.
 44
 45deferred class G_TYPE
 46
 47insert G_TYPE_EXTERNALS
 48
 49feature
 50	-- Note: in libglib 2.9.1 "typedef gulong GType;" (Paolo
 51	-- 2006-01-07)
 52
 53	is_g_type (a_type_number: INTEGER): BOOLEAN is
 54			-- Is `a_type_number' a valid value for a g_type? (i.e. a
 55			-- type number that can be used for g_value_init()?
 56		do
 57			Result := (g_type_is_value_type (a_type_number)).to_boolean
 58		end
 59
 60
 61-- #define G_TYPE_FUNDAMENTAL(type)	(g_type_fundamental (type))
 62
 63-- Returns the fundamental type which is the ancestor of type. Fundamental types are types that serve as fundaments for the derived types, thus they are the roots of distinct inheritance hierarchies.
 64-- type : 	A GType value.
 65-- G_TYPE_MAKE_FUNDAMENTAL()
 66
 67-- #define	G_TYPE_MAKE_FUNDAMENTAL(x)	((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
 68
 69-- Returns the type ID for the fundamental type number x. Use g_type_fundamental_next() instead of this macro to create new fundamental types.
 70-- x : 	the fundamental type number.
 71-- G_TYPE_IS_ABSTRACT()
 72
 73-- #define G_TYPE_IS_ABSTRACT(type)                (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))
 74
 75-- Returns TRUE if type is an abstract type. An abstract type can not be instantiated and is normally used as an abstract base class for derived classes.
 76-- type : 	A GType value.
 77-- G_TYPE_IS_DERIVED()
 78
 79-- #define G_TYPE_IS_DERIVED(type)                 ((type) > G_TYPE_FUNDAMENTAL_MAX)
 80
 81-- Returns TRUE if type is derived (or in object-oriented terminology: inherited) from another type (this holds true for all non-fundamental types).
 82-- type : 	A GType value.
 83-- G_TYPE_IS_FUNDAMENTAL()
 84
 85-- #define G_TYPE_IS_FUNDAMENTAL(type)             ((type) <= G_TYPE_FUNDAMENTAL_MAX)
 86
 87-- Returns TRUE if type is a fundamental type.
 88-- type : 	A GType value.
 89-- G_TYPE_IS_VALUE_TYPE()
 90
 91-- #define G_TYPE_IS_VALUE_TYPE(type)              (g_type_check_is_value_type (type))
 92
 93-- Returns TRUE if type is a value type which can be used for g_value_init().
 94-- type : 	A GType value.
 95-- G_TYPE_HAS_VALUE_TABLE()
 96
 97-- #define G_TYPE_HAS_VALUE_TABLE(type)            (g_type_value_table_peek (type) != NULL)
 98
 99-- Returns TRUE if type has a GTypeValueTable.
100-- type : 	A GType value.
101-- G_TYPE_IS_CLASSED()
102
103-- #define G_TYPE_IS_CLASSED(type)                 (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
104
105-- Returns TRUE if type is a classed type.
106-- type : 	A GType value.
107-- G_TYPE_IS_INSTANTIATABLE()
108
109-- #define G_TYPE_IS_INSTANTIATABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
110
111-- Returns TRUE if type can be instantiated. Instantiation is the process of creating an instance (object) of this type.
112-- type : 	A GType value.
113-- G_TYPE_IS_DERIVABLE()
114
115-- #define G_TYPE_IS_DERIVABLE(type)               (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))
116
117-- Returns TRUE if type is a derivable type. A derivable type can be used as the base class of a flat (single-level) class hierarchy.
118-- type : 	A GType value.
119-- G_TYPE_IS_DEEP_DERIVABLE()
120
121-- #define G_TYPE_IS_DEEP_DERIVABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
122
123-- Returns TRUE if type is a deep derivable type. A deep derivable type can be used as the base class of a deep (multi-level) class hierarchy.
124-- type : 	A GType value.
125-- G_TYPE_IS_INTERFACE()
126
127-- #define G_TYPE_IS_INTERFACE(type)               (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
128
129-- Returns TRUE if type is an interface type. Interface types are types that provide pure APIs, the implementation of which is provided by another type (which is then said to conform to the interface). GLib interfaces are somewhat analogous to Java interfaces and C++ classes containing only pure virtual functions, with the difference that GType interfaces are not derivable (but see g_type_interface_add_prerequisite() for an alternative).
130-- type : 	A GType value.
131-- GTypeInterface
132
133-- typedef struct {
134-- } GTypeInterface;
135
136-- An opaque structure used as the base of all interface types.
137-- GTypeInstance
138
139-- typedef struct {
140-- } GTypeInstance;
141
142-- An opaque structure used as the base of all type instances.
143-- GTypeClass
144
145-- typedef struct {
146-- } GTypeClass;
147
148-- An opaque structure used as the base of all classes.
149-- GTypeInfo
150
151-- typedef struct {
152--   /* interface types, classed types, instantiated types */
153--   guint16                class_size;
154
155--   GBaseInitFunc          base_init;
156--   GBaseFinalizeFunc      base_finalize;
157
158--   /* interface types, classed types, instantiated types */
159--   GClassInitFunc         class_init;
160--   GClassFinalizeFunc     class_finalize;
161--   gconstpointer          class_data;
162
163--   /* instantiated types */
164--   guint16                instance_size;
165--   guint16                n_preallocs;
166--   GInstanceInitFunc      instance_init;
167
168--   /* value handling */
169--   const GTypeValueTable	*value_table;
170-- } GTypeInfo;
171
172-- This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type's class and instances thereof. The initialized structure is passed to the g_type_register_static() function (or is copied into the provided GTypeInfo structure in the g_type_plugin_complete_type_info()). The type system will perform a deep copy of this structure, so it's memory does not need to be persistent across invocation of g_type_register_static().
173-- guint16 class_size; 	Size of the class structure (required for interface, classed and instantiatable types).
174-- GBaseInitFunc base_init; 	Location of the base initialization function (optional).
175-- GBaseFinalizeFunc base_finalize; 	Location of the base finalization function (optional).
176-- GClassInitFunc class_init; 	Location of the class initialization function for classed and types. Location of the default vtable inititalization function for interface types. (optional) This function is used both to fill in virtual functions in the class or default vtable, and to do type-specific setup such as registering signals and object properties.
177-- GClassFinalizeFunc class_finalize; 	Location of the class finalization function for classed and types. Location fo the default vtable finalization function for interface types. (optional)
178-- gconstpointer class_data; 	User-supplied data passed to the class init/finalize functions.
179-- guint16 instance_size; 	Size of the instance (object) structure (required for instantiatable types only).
180-- guint16 n_preallocs; 	Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the slice allocator now.
181-- GInstanceInitFunc instance_init; 	Location of the instance initialization function (optional, for instantiatable types only).
182-- const GTypeValueTable *value_table; 	A GTypeValueTable function table for generic handling of GValues of this type (usually only useful for fundamental types).
183-- GTypeFundamentalInfo
184
185-- typedef struct {
186--   GTypeFundamentalFlags  type_flags;
187-- } GTypeFundamentalInfo;
188
189-- A structure that provides information to the type system which is used specifically for managing fundamental types.
190-- GTypeFundamentalFlags type_flags; 	GTypeFundamentalFlags describing the characteristics of the fundamental type
191-- GInterfaceInfo
192
193-- typedef struct {
194--   GInterfaceInitFunc     interface_init;
195--   GInterfaceFinalizeFunc interface_finalize;
196--   gpointer               interface_data;
197-- } GInterfaceInfo;
198
199-- A structure that provides information to the type system which is used specifically for managing interface types.
200-- GTypeValueTable
201
202-- typedef struct {
203--   void     (*value_init)         (GValue       *value);
204--   void     (*value_free)         (GValue       *value);
205--   void     (*value_copy)         (const GValue *src_value,
206-- 				  GValue       *dest_value);
207--   /* varargs functionality (optional) */
208--   gpointer (*value_peek_pointer) (const GValue *value);
209--   gchar	    *collect_format;
210--   gchar*   (*collect_value)      (GValue       *value,
211-- 				  guint         n_collect_values,
212-- 				  GTypeCValue  *collect_values,
213-- 				  guint		collect_flags);
214--   gchar	    *lcopy_format;
215--   gchar*   (*lcopy_value)        (const GValue *value,
216-- 				  guint         n_collect_values,
217-- 				  GTypeCValue  *collect_values,
218-- 				  guint		collect_flags);
219-- } GTypeValueTable;
220
221-- The GTypeValueTable provides the functions required by the GValue implementation, to serve as a container for values of a type.
222-- value_init () 	Default initialize values contents by poking values directly into the value->data array. The data array of the GValue passed into this function was zero-filled with memset(), so no care has to be taken to free any old contents. E.g. for the implementation of a string value that may never be NULL, the implementation might look like:
223
224-- {
225--   value->data[0].v_pointer = g_strdup ("");
226-- }
227
228-- value_free () 	Free any old contents that might be left in the data array of the passed in value. No resources may remain allocated through the GValue contents after this function returns. E.g. for our above string type:
229
230-- {
231--   /* only free strings without a specific flag for static storage */
232--   if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
233--     g_free (value->data[0].v_pointer);
234-- }
235
236-- value_copy () 	dest_value is a GValue with zero-filled data section and src_value is a properly setup GValue of same or derived type. The purpose of this function is to copy the contents of src_value into dest_value in a way, that even after src_value has been freed, the contents of dest_value remain valid. String type example:
237
238-- {
239--   dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
240-- }
241
242-- value_peek_pointer () 	If the value contents fit into a pointer, such as objects or strings, return this pointer, so the caller can peek at the current contents. To extend on our above string example:
243
244-- {
245--   return value->data[0].v_pointer;
246-- }
247
248-- gchar *collect_format; 	A string format describing how to collect the contents of this value, bit-by-bit. Each character in the format represents an argument to be collected, the characters themselves indicate the type of the argument. Currently supported arguments are:
249
250-- 'i' - Integers. passed as collect_values[].v_int.
251
252-- 'l' - Longs. passed as collect_values[].v_long.
253
254-- 'd' - Doubles. passed as collect_values[].v_double.
255
256-- 'p' - Pointers. passed as collect_values[].v_pointer.
257-- It should be noted, that for variable argument list construction, ANSI C promotes every type smaller than an integer to an int, and floats to doubles. So for collection of short int or char, 'i' needs to be used, and for collection of floats 'd'.
258-- collect_value () 	The collect_value() function is responsible for converting the values collected from a variable argument list into contents suitable for storage in a GValue. This function should setup value similar to value_init(), e.g. for a string value that does not allow NULL pointers, it needs to either spew an error, or do an implicit conversion by storing an empty string. The value passed in to this function has a zero-filled data array, so just like for value_init() it is guaranteed to not contain any old contents that might need freeing. n_collect_values is exactly the string length of collect_format, and collect_values is an array of unions GTypeCValue with length n_collect_values, containing the collected values according to collect_format. collect_flags is an argument provided as a hint by the caller, which may contain the flag G_VALUE_NOCOPY_CONTENTS indicating, that the collected value contents may be considered "static" for the duration of the value lifetime. Thus an extra copy of the contents stored in collect_values is not required for assignment to value. For our above string example, we continue with:
259
260-- {
261--   if (!collect_values[0].v_pointer)
262--     value->data[0].v_pointer = g_strdup ("");
263--   else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
264--     {
265--       value->data[0].v_pointer = collect_values[0].v_pointer;
266--       /* keep a flag for the value_free() implementation to not free this string */
267--       value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
268--     }
269--   else
270--     value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
271
272--   return NULL;
273-- }
274
275-- It should be noted, that it is generally a bad idea to follow the G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to reentrancy requirements and reference count assertions performed by the GSignal code, reference counts should always be incremented for reference counted contents stored in the value->data array. To deviate from our string example for a moment, and taking a look at an exemplary implementation for collect_value() of GObject:
276
277-- {
278--   if (collect_values[0].v_pointer)
279--     {
280--       GObject *object = G_OBJECT (collect_values[0].v_pointer);
281
282--       /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
283--       value->data[0].v_pointer = g_object_ref (object);
284--       return NULL;
285--     }
286--   else
287--     return g_strdup_printf ("Object passed as invalid NULL pointer");
288-- }
289
290-- The reference count for valid objects is always incremented, regardless of collect_flags. For invalid objects, the example returns a newly allocated string without altering value. Upon success, collect_value() needs to return NULL, if however a malicious condition occurred, collect_value() may spew an error by returning a newly allocated non-NULL string, giving a suitable description of the error condition. The calling code makes no assumptions about the value contents being valid upon error returns, value is simply thrown away without further freeing. As such, it is a good idea to not allocate GValue contents, prior to returning an error, however, collect_values() is not obliged to return a correctly setup value for error returns, simply because any non-NULL return is considered a fatal condition so further program behaviour is undefined.
291-- gchar *lcopy_format; 	Format description of the arguments to collect for lcopy_value, analogous to collect_format. Usually, lcopy_format string consists only of 'p's to provide lcopy_value() with pointers to storage locations.
292-- lcopy_value () 	This function is responsible for storing the value contents into arguments passed through a variable argument list which got collected into collect_values according to lcopy_format. n_collect_values equals the string length of lcopy_format, and collect_flags may contain G_VALUE_NOCOPY_CONTENTS. In contrast to collect_value(), lcopy_value() is obliged to always properly support G_VALUE_NOCOPY_CONTENTS. Similar to collect_value() the function may prematurely abort by returning a newly allocated string describing an error condition. To complete the string example:
293
294-- {
295--   gchar **string_p = collect_values[0].v_pointer;
296
297--   if (!string_p)
298--     return g_strdup_printf ("string location passed as NULL");
299
300--   if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
301--     *string_p = value->data[0].v_pointer;
302--   else
303--     *string_p = g_strdup (value->data[0].v_pointer);
304
305-- }
306
307-- And an exemplary version of lcopy_value() for reference-counted types:
308
309-- {
310--   GObject **object_p = collect_values[0].v_pointer;
311
312--   if (!object_p)
313--     return g_strdup_printf ("object location passed as NULL");
314--   if (!value->data[0].v_pointer)
315--     *object_p = NULL;
316--   else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) /* always honour */
317--     *object_p = value->data[0].v_pointer;
318--   else
319--     *object_p = g_object_ref (value->data[0].v_pointer);
320--   return NULL;
321-- }
322
323-- G_TYPE_FROM_INSTANCE()
324
325-- #define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
326
327-- Returns the type identifier from a given instance structure.
328
329-- This macro should only be used in type implementations.
330-- instance : 	Location of a valid GTypeInstance structure.
331-- G_TYPE_FROM_CLASS()
332
333-- #define G_TYPE_FROM_CLASS(g_class)                              (((GTypeClass*) (g_class))->g_type)
334
335-- Returns the type identifier from a given class structure.
336
337-- This macro should only be used in type implementations.
338-- g_class : 	Location of a valid GTypeClass structure.
339-- G_TYPE_FROM_INTERFACE()
340
341-- #define G_TYPE_FROM_INTERFACE(g_iface)                          (((GTypeInterface*) (g_iface))->g_type)
342
343-- Returns the type identifier from a given interface structure.
344
345-- This macro should only be used in type implementations.
346-- g_iface : 	Location of a valid GTypeInterface structure.
347-- G_TYPE_INSTANCE_GET_CLASS()
348
349-- #define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type)     (_G_TYPE_IGC ((instance), (g_type), c_type))
350
351-- Returns the class structure of a given instance, casted to a specified ancestor type g_type of the instance.
352-- Warning
353
354-- Note that while calling a GInstanceInitFunc(), the class pointer gets modified, so it might not always return the expected pointer.
355
356-- This macro should only be used in type implementations.
357-- instance : 	Location of the GTypeInstance structure.
358-- g_type : 	The anchestor type of the class to be returned.
359-- c_type : 	The corresponding C type of g_type.
360-- G_TYPE_INSTANCE_GET_INTERFACE()
361
362-- #define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))
363
364-- Returns the interface structure for interface g_type of a given instance.
365
366-- This macro should only be used in type implementations.
367-- instance : 	Location of the GTypeInstance structure.
368-- g_type : 	The interface type to be returned.
369-- c_type : 	The corresponding C type of g_type.
370-- G_TYPE_INSTANCE_GET_PRIVATE()
371
372-- #define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type)   ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))
373
374-- Gets the private structure for a particular type. The private structure must have been registered in the class_init function with g_type_class_add_private().
375
376-- This macro should only be used in type implementations.
377-- instance : 	the instance of a type deriving from private_type.
378-- g_type : 	the type identifying which private data to retrieve.
379-- c_type : 	The C type for the private structure.
380
381-- Since 2.4
382-- G_TYPE_CHECK_INSTANCE()
383
384-- #define G_TYPE_CHECK_INSTANCE(instance)				(_G_TYPE_CHI ((GTypeInstance*) (instance)))
385
386-- Returns TRUE if instance is a valid GTypeInstance structure, otherwise emits a warning and returns FALSE.
387
388-- This macro should only be used in type implementations.
389-- instance : 	Location of a GTypeInstance structure.
390-- G_TYPE_CHECK_INSTANCE_CAST()
391
392-- #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))
393
394-- Checks that instance is an instance of the type identified by g_type and emits a warning if this is not the case. Returns instance casted to a pointer to c_type.
395
396-- This macro should only be used in type implementations.
397-- instance : 	Location of a GTypeInstance structure.
398-- g_type : 	The type to be returned.
399-- c_type : 	The corresponding C type of g_type.
400-- G_TYPE_CHECK_INSTANCE_TYPE()
401
402-- #define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type)            (_G_TYPE_CIT ((instance), (g_type)))
403
404-- Returns TRUE if instance is an instance of the type identified by g_type. Otherwise emits a warning and returns FALSE.
405
406-- This macro should only be used in type implementations.
407-- instance : 	Location of a GTypeInstance structure.
408-- g_type : 	The type to be checked
409-- G_TYPE_CHECK_CLASS_CAST()
410
411-- #define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type)        (_G_TYPE_CCC ((g_class), (g_type), c_type))
412
413-- Checks that g_class is a class structure of the type identified by g_type and emits a warning if this is not the case. Returns g_class casted to a pointer to c_type.
414
415-- This macro should only be used in type implementations.
416-- g_class : 	Location of a GTypeClass structure.
417-- g_type : 	The type to be returned.
418-- c_type : 	The corresponding C type of class structure of g_type.
419-- G_TYPE_CHECK_CLASS_TYPE()
420
421-- #define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type)                (_G_TYPE_CCT ((g_class), (g_type)))
422
423-- Returns TRUE if g_class is a class structure of the type identified by g_type. Otherwise emits a warning and returns FALSE.
424
425-- This macro should only be used in type implementations.
426-- g_class : 	Location of a GTypeClass structure.
427-- g_type : 	The type to be checked.
428-- G_TYPE_CHECK_VALUE()
429
430-- #define G_TYPE_CHECK_VALUE(value)				(_G_TYPE_CHV ((value)))
431
432-- Returns TRUE if value has been initialized to hold values of a value type.
433
434-- This macro should only be used in type implementations.
435-- value : 	a GValue
436-- G_TYPE_CHECK_VALUE_TYPE()
437
438-- #define G_TYPE_CHECK_VALUE_TYPE(value, g_type)			(_G_TYPE_CVH ((value), (g_type)))
439
440-- Returns TRUE if value has been initialized to hold values of type g_type.
441
442-- This macro should only be used in type implementations.
443-- value : 	a GValue
444-- g_type : 	The type to be checked.
445-- G_TYPE_FLAG_RESERVED_ID_BIT
446
447-- #define	G_TYPE_FLAG_RESERVED_ID_BIT	((GType) (1 << 0))
448
449-- A bit in the type number that's supposed to be left untouched.
450-- g_type_init ()
451
452-- void        g_type_init                     (void);
453
454-- Prior to any use of the type system, g_type_init() has to be called to initialize the type system and assorted other code portions (such as the various fundamental type implementations or the signal system).
455-- enum GTypeDebugFlags
456
457-- typedef enum	/*< skip >*/
458-- {
459--   G_TYPE_DEBUG_NONE	= 0,
460--   G_TYPE_DEBUG_OBJECTS	= 1 << 0,
461--   G_TYPE_DEBUG_SIGNALS	= 1 << 1,
462--   G_TYPE_DEBUG_MASK	= 0x03
463-- } GTypeDebugFlags;
464
465-- The GTypeDebugFlags enumeration values can be passed to g_type_init_with_debug_flags() to trigger debugging messages during runtime. Note that the messages can also be triggered by setting the GOBJECT_DEBUG environment variable to a ':'-separated list of "objects" and "signals".
466-- G_TYPE_DEBUG_NONE 	Print no messages.
467-- G_TYPE_DEBUG_OBJECTS 	Print messages about object bookkeeping.
468-- G_TYPE_DEBUG_SIGNALS 	Print messages about signal emissions.
469-- G_TYPE_DEBUG_MASK 	Mask covering all debug flags.
470-- g_type_init_with_debug_flags ()
471
472-- void        g_type_init_with_debug_flags    (GTypeDebugFlags debug_flags);
473
474-- Similar to g_type_init(), but additionally sets debug flags.
475-- debug_flags : 	Bitwise combination of GTypeDebugFlags values for debugging purposes.
476-- g_type_name ()
477
478-- const gchar* g_type_name                    (GType type);
479
480-- Returns the unique name that is assigned to a type ID (this is the preferred method to find out whether a specific type has been registered for the passed in ID yet).
481-- type : 	Type to return name for.
482-- Returns : 	Static type name or NULL.
483-- g_type_qname ()
484
485-- GQuark      g_type_qname                    (GType type);
486
487-- Return the corresponding quark of the type IDs name.
488-- type : 	Type to return quark of type name for.
489-- Returns : 	The type names quark or 0.
490-- g_type_from_name ()
491
492-- GType       g_type_from_name                (const gchar *name);
493
494-- Lookup the type ID from a given type name, returns 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).
495-- name : 	Type name to lookup.
496-- Returns : 	Corresponding type ID or 0.
497-- g_type_parent ()
498
499-- GType       g_type_parent                   (GType type);
500
501-- Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
502-- type : 	The derived type.
503-- Returns : 	The parent type.
504-- g_type_depth ()
505
506-- guint       g_type_depth                    (GType type);
507
508-- Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.
509-- type : 	A GType value.
510-- Returns : 	The depth of type.
511-- g_type_next_base ()
512
513-- GType       g_type_next_base                (GType leaf_type,
514--                                              GType root_type);
515
516-- Given a leaf_type and a root_type which is contained in its anchestry, return the type that root_type is the immediate parent of. In other words, this function determines the type that is derived directly from root_type which is also a base class of leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.
517-- leaf_type : 	Descendant of root_type and the type to be returned.
518-- root_type : 	Immediate parent of the returned type.
519-- Returns : 	Immediate child of root_type and anchestor of leaf_type.
520											 
521-- g_type_is_a ()
522
523-- gboolean    g_type_is_a                     (GType type,
524--                                              GType is_a_type);
525
526-- If is_a_type is a derivable type, check whether type is a descendant of is_a_type. If is_a_type is an interface, check whether type conforms to it.
527-- type : 	Type to check anchestry for.
528-- is_a_type : 	Possible anchestor of type or interface type could conform to.
529-- Returns : 	TRUE if type is_a is_a_type holds true.
530-- g_type_class_ref ()
531
532-- gpointer    g_type_class_ref                (GType type);
533
534-- Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.
535-- type : 	Type ID of a classed type.
536-- Returns : 	The GTypeClass structure for the given type ID.
537-- g_type_class_peek ()
538
539-- gpointer    g_type_class_peek               (GType type);
540
541-- This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented. Therefore, this function may return NULL if the class of the type passed in does not currently exist (hasn't been referenced before).
542-- type : 	Type ID of a classed type.
543-- Returns : 	The GTypeClass structure for the given type ID or NULL if the class does not currently exist.
544-- g_type_class_peek_static ()
545
546-- gpointer    g_type_class_peek_static        (GType type);
547
548-- A more efficient version of g_type_class_peek() which works only for static types.
549-- type : 	Type ID of a classed type.
550-- Returns : 	The GTypeClass structure for the given type ID or NULL if the class does not currently exist or is dynamically loaded.
551
552-- Since 2.4
553-- g_type_class_unref ()
554
555-- void        g_type_class_unref              (gpointer g_class);
556
557-- Decrements the reference count of the class structure being passed in. Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid.
558-- g_class : 	The GTypeClass structure to unreference.
559-- g_type_class_peek_parent ()
560
561-- gpointer    g_type_class_peek_parent        (gpointer g_class);
562
563-- This is a convenience function, often needed in class initializers. It essentially takes the immediate parent type of the class passed in, and returns the class structure thereof. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist. This function is essentially equivalent to:
564
565-- g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
566
567-- g_class : 	The GTypeClass structure to retrieve the parent class for.
568-- Returns : 	The parent class of g_class.
569-- g_type_class_add_private ()
570
571-- void        g_type_class_add_private        (gpointer g_class,
572--                                              gsize private_size);
573
574-- Registers a private structure for a instantiatable type; when an object is allocated, the private structures for the type and and all of its parent types are allocated sequentially in the same memory block as the public structures. This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro. The following example shows attaching a private structure MyObjectPrivate to an object MyObject defined in the standard GObject fashion.
575
576-- typedef struct _MyObjectPrivate MyObjectPrivate;
577
578-- struct _MyObjectPrivate {
579--   int some_field;
580-- };
581
582-- #define MY_OBJECT_GET_PRIVATE(o)  \
583--    (G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))
584
585-- static void
586-- my_object_class_init (MyObjectClass *klass)
587-- {
588--   g_type_class_add_private (klass, sizeof (MyObjectPrivate));
589-- }
590
591-- static int
592-- my_object_get_some_field (MyObject *my_object)
593-- {
594--   MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);
595
596--   return priv->some_field;
597-- }
598
599-- g_class : 	class structure for an instantiatable type
600-- private_size : 	size of private structure.
601
602-- Since 2.4
603-- g_type_interface_peek ()
604
605-- gpointer    g_type_interface_peek           (gpointer instance_class,
606--                                              GType iface_type);
607
608-- Returns the GTypeInterface structure of an interface to which the passed in class conforms.
609-- instance_class : 	A GTypeClass structure.
610-- iface_type : 	An interface ID which this class conforms to.
611-- Returns : 	The GTypeInterface structure of iface_type, or NULL if the class is not instantiated.
612-- g_type_interface_peek_parent ()
613
614-- gpointer    g_type_interface_peek_parent    (gpointer g_iface);
615
616-- Returns the corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.
617-- g_iface : 	A GTypeInterface structure.
618-- Returns : 	The corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs, or NULL if the parent type doesn't conform to the interface.
619-- g_type_default_interface_ref ()
620
621-- gpointer    g_type_default_interface_ref    (GType g_type);
622
623-- Increments the reference count for the interface type g_type, and returns the default interface vtable for the type.
624
625-- If the type is not currently in use, then the default vtable for the type will be created and initalized by calling the base interface init and default vtable init functions for the type (the @base_init and class_init members of GTypeInfo). Calling g_type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.
626-- g_type : 	an interface type
627-- Returns : 	the default vtable for the interface; call g_type_default_interface_unref() when you are done using the interface.
628
629-- Since 2.4
630-- g_type_default_interface_peek ()
631
632-- gpointer    g_type_default_interface_peek   (GType g_type);
633
634-- If the interface type g_type is currently in use, returns its default interface vtable.
635-- g_type : 	an interface type
636-- Returns : 	the default vtable for the interface; or NULL if the type is not currently in use.
637
638-- Since 2.4
639-- g_type_default_interface_unref ()
640
641-- void        g_type_default_interface_unref  (gpointer g_iface);
642
643-- Decrements the reference count for the type corresponding to the interface default vtable g_iface. If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface's default vtable (the class_finalize member of GTypeInfo) will be called.
644-- g_iface : 	the default vtable structure for a interface, as returned by g_type_default_interface_ref()
645
646-- Since 2.4
647-- g_type_children ()
648
649-- GType*      g_type_children                 (GType type,
650--                                              guint *n_children);
651
652-- Return a newly allocated and 0-terminated array of type IDs, listing the child types of type. The return value has to be g_free()ed after use.
653-- type : 	The parent type.
654-- n_children : 	Optional guint pointer to contain the number of child types.
655-- Returns : 	Newly allocated and 0-terminated array of child types.
656-- g_type_interfaces ()
657
658-- GType*      g_type_interfaces               (GType type,
659--                                              guint *n_interfaces);
660
661-- Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to. The return value has to be g_free()ed after use.
662-- type : 	The type to list interface types for.
663-- n_interfaces : 	Optional guint pointer to contain the number of interface types.
664-- Returns : 	Newly allocated and 0-terminated array of interface types.
665-- g_type_interface_prerequisites ()
666
667-- GType*      g_type_interface_prerequisites  (GType interface_type,
668--                                              guint *n_prerequisites);
669
670-- Returns the prerequisites of an interfaces type.
671-- interface_type : 	an interface type
672-- n_prerequisites : 	location to return the number of prerequisites, or NULL
673-- Returns : 	a newly-allocated zero-terminated array of GType containing the prerequisites of interface_type
674
675-- Since 2.2
676-- g_type_set_qdata ()
677
678-- void        g_type_set_qdata                (GType type,
679--                                              GQuark quark,
680--                                              gpointer data);
681
682-- Attaches arbitrary data to a type.
683-- type : 	a GType
684-- quark : 	a GQuark id to identify the data
685-- data : 	the data
686-- g_type_get_qdata ()
687
688-- gpointer    g_type_get_qdata                (GType type,
689--                                              GQuark quark);
690
691-- Obtains data which has previously been attached to type with g_type_set_qdata().
692-- type : 	a GType
693-- quark : 	a GQuark id to identify the data
694-- Returns : 	the data, or NULL if no data was found
695-- g_type_query ()
696
697-- void        g_type_query                    (GType type,
698--                                              GTypeQuery *query);
699
700-- Queries the type system for information about a specific type. This function will fill in a user-provided structure to hold type-specific information. If an invalid GType is passed in, the type member of the GTypeQuery is 0. All members filled into the GTypeQuery structure should be considered constant and have to be left untouched.
701-- type : 	the GType value of a static, classed type.
702-- query : 	A user provided structure that is filled in with constant values upon success.
703-- GTypeQuery
704
705-- typedef struct {
706--   GType		type;
707--   const gchar  *type_name;
708--   guint		class_size;
709--   guint		instance_size;
710-- } GTypeQuery;
711
712-- A structure holding information for a specific type. It is filled in by the g_type_query() function.
713-- GType type; 	the GType value of the type.
714-- const gchar *type_name; 	the name of the type.
715-- guint class_size; 	the size of the class structure.
716-- guint instance_size; 	the size of the instance structure.
717-- GBaseInitFunc ()
718
719-- void        (*GBaseInitFunc)                (gpointer g_class);
720
721-- A callback function used by the type system to do base initialization of the class structures of derived types. It is called as part of the initialization process of all derived classes and should reallocate or reset all dynamic class members copied over from the parent class. Therefore class members, e.g. strings, that are not sufficiently handled by a plain memory copy of the parent class into the derived class have to be altered. See GClassInitFunc() for a discussion of the class intialization process.
722-- g_class : 	The GTypeClass structure to initialize.
723-- GBaseFinalizeFunc ()
724
725-- void        (*GBaseFinalizeFunc)            (gpointer g_class);
726
727-- A callback function used by the type system to finalize those portions of a derived types class structure that were setup from the corresponding GBaseInitFunc() function. Class finalization basically works the inverse way in which class intialization is performed. See GClassInitFunc() for a discussion of the class intialization process.
728-- g_class : 	The GTypeClass structure to finalize.
729-- GClassInitFunc ()
730
731-- void        (*GClassInitFunc)               (gpointer g_class,
732--                                              gpointer class_data);
733
734-- A callback function used by the type system to initialize the class of a specific type. This function should initialize all static class members. The initialization process of a class involves:
735
736-- 1 - Copying common members from the parent class over to the derived class structure.
737
738-- 2 - Zero initialization of the remaining members not copied over from the parent class.
739
740-- 3 - Invocation of the GBaseInitFunc() initializers of all parent types and the class' type.
741
742-- 4 - Invocation of the class' GClassInitFunc() initializer.
743
744-- Since derived classes are partially initialized through a memory copy of the parent class, the general rule is that GBaseInitFunc() and GBaseFinalizeFunc() should take care of necessary reinitialization and release of those class members that were introduced by the type that specified these GBaseInitFunc()/GBaseFinalizeFunc(). GClassInitFunc() should only care about initializing static class members, while dynamic class members (such as allocated strings or reference counted resources) are better handled by a GBaseInitFunc() for this type, so proper initialization of the dynamic class members is performed for class initialization of derived types as well. An example may help to correspond the intend of the different class initializers:
745
746-- typedef struct {
747--   GObjectClass parent_class;
748--   gint         static_integer;
749--   gchar       *dynamic_string;
750-- } TypeAClass;
751-- static void
752-- type_a_base_class_init (TypeAClass *class)
753-- {
754--   class->dynamic_string = g_strdup ("some string");
755-- }
756-- static void
757-- type_a_base_class_finalize (TypeAClass *class)
758-- {
759--   g_free (class->dynamic_string);
760-- }
761-- static void
762-- type_a_class_init (TypeAClass *class)
763-- {
764--   class->static_integer = 42;
765-- }
766
767-- typedef struct {
768--   TypeAClass   parent_class;
769--   gfloat       static_float;
770--   GString     *dynamic_gstring;
771-- } TypeBClass;
772-- static void
773-- type_b_base_class_init (TypeBClass *class)
774-- {
775--   class->dynamic_gstring = g_string_new ("some other string");
776-- }
777-- static void
778-- type_b_base_class_finalize (TypeBClass *class)
779-- {
780--   g_string_free (class->dynamic_gstring);
781-- }
782-- static void
783-- type_b_class_init (TypeBClass *class)
784-- {
785--   class->static_float = 3.14159265358979323846;
786-- }
787
788-- Initialization of TypeBClass will first cause initialization of TypeAClass (derived classes reference their parent classes, see g_type_class_ref() on this). Initialization of TypeAClass roughly involves zero-initializing its fields, then calling its GBaseInitFunc() type_a_base_class_init() that allocates its dynamic members (dynamic_string) and finally calling its GClassInitFunc() type_a_class_init() to initialize its static members (static_integer). The first step in the initialization process of TypeBClass is then a plain memory copy of the contents of TypeAClass into TypeBClass and zero-initialization of the remaining fields in TypeBClass. The dynamic members of TypeAClass within TypeBClass now need reinitialization which is performed by calling type_a_base_class_init() with an argument of TypeBClass. After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init() is called to allocate the dynamic members of TypeBClass (dynamic_gstring), and finally the GClassInitFunc() of TypeBClass, type_b_class_init(), is called to complete the initialization process with the static members (static_float). Corresponding finalization counter parts to the GBaseInitFunc() functions have to be provided to release allocated resources at class finalization time.
789-- g_class : 	The GTypeClass structure to initialize.
790-- class_data : 	The class_data member supplied via the GTypeInfo structure.
791-- GClassFinalizeFunc ()
792
793-- void        (*GClassFinalizeFunc)           (gpointer g_class,
794--                                              gpointer class_data);
795
796-- A callback function used by the type system to finalize a class. This function is rarely needed, as dynamically allocated class resources should be handled by GBaseInitFunc() and GBaseFinalizeFunc(). Also, specification of a GClassFinalizeFunc() in the GTypeInfo structure of a static type is invalid, because classes of static types will never be finalized (they are artificially kept alive when their reference count drops to zero).
797-- g_class : 	The GTypeClass structure to finalize.
798-- class_data : 	The class_data member supplied via the GTypeInfo structure.
799-- GInstanceInitFunc ()
800
801-- void        (*GInstanceInitFunc)            (GTypeInstance *instance,
802--                                              gpointer g_class);
803
804-- A callback function used by the type system to initialize a new instance of a type. This function initializes all instance members and allocates any resources required by it. Initialization of a derived instance involves calling all its parent types instance initializers, therefore the class member of the instance is altered during its initialization to always point to the class that belongs to the type the current initializer was introduced for.
805-- instance : 	The instance to initialize.
806-- g_class : 	The class of the type the instance is created for.
807-- GInterfaceInitFunc ()
808
809-- void        (*GInterfaceInitFunc)           (gpointer g_iface,
810--                                              gpointer iface_data);
811
812-- A callback function used by the type system to initialize a new interface. This function should initialize all internal data and allocate any resources required by the interface.
813-- g_iface : 	The interface structure to initialize.
814-- iface_data : 	The class_data supplied via the GTypeInfo structure.
815-- GInterfaceFinalizeFunc ()
816
817-- void        (*GInterfaceFinalizeFunc)       (gpointer g_iface,
818--                                              gpointer iface_data);
819
820-- A callback function used by the type system to finalize an interface. This function should destroy any internal data and release any resources allocated by the corresponding GInterfaceInitFunc() function.
821-- g_iface : 	The interface structure to finalize.
822-- iface_data : 	The class_data supplied via the GTypeInfo structure.
823-- GTypeClassCacheFunc ()
824
825-- gboolean    (*GTypeClassCacheFunc)          (gpointer cache_data,
826--                                              GTypeClass *g_class);
827
828-- A callback function which is called when the reference count of a class drops to zero. It may use g_type_class_ref() to prevent the class from being freed. You should not call g_type_class_unref() from a GTypeClassCacheFunc function to prevent infinite recursion, use g_type_class_unref_uncached() instead.
829
830-- The functions have to check the class id passed in to figure whether they actually want to cache the class of this type, since all classes are routed through the same GTypeClassCacheFunc chain.
831-- cache_data : 	data that was given to the g_type_add_class_cache_func() call
832-- g_class : 	The GTypeClass structure which is unreferenced
833-- Returns : 	TRUE to stop further GTypeClassCacheFuncs from being called, FALSE to continue.
834-- enum GTypeFlags
835
836-- typedef enum    /*< skip >*/
837-- {
838--   G_TYPE_FLAG_ABSTRACT		= (1 << 4),
839--   G_TYPE_FLAG_VALUE_ABSTRACT	= (1 << 5)
840-- } GTypeFlags;
841
842-- Bit masks used to check or determine characteristics of a type.
843-- G_TYPE_FLAG_ABSTRACT 	Indicates an abstract type. No instances can be created for an abstract type.
844-- G_TYPE_FLAG_VALUE_ABSTRACT 	Indicates an abstract value type, i.e. a type that introduces a value table, but can't be used for g_value_init().
845-- enum GTypeFundamentalFlags
846
847-- typedef enum    /*< skip >*/
848-- {
849--   G_TYPE_FLAG_CLASSED           = (1 << 0),
850--   G_TYPE_FLAG_INSTANTIATABLE    = (1 << 1),
851--   G_TYPE_FLAG_DERIVABLE         = (1 << 2),
852--   G_TYPE_FLAG_DEEP_DERIVABLE    = (1 << 3)
853-- } GTypeFundamentalFlags;
854
855-- Bit masks used to check or determine specific characteristics of a fundamental type.
856-- G_TYPE_FLAG_CLASSED 	Indicates a classed type.
857-- G_TYPE_FLAG_INSTANTIATABLE 	Indicates an instantiable type (implies classed).
858-- G_TYPE_FLAG_DERIVABLE 	Indicates a flat derivable type.
859-- G_TYPE_FLAG_DEEP_DERIVABLE 	Indicates a deep derivable type (implies derivable).
860-- g_type_register_static ()
861
862-- GType       g_type_register_static          (GType parent_type,
863--                                              const gchar *type_name,
864--                                              const GTypeInfo *info,
865--                                              GTypeFlags flags);
866
867-- Registers type_name as the name of a new static type derived from parent_type. The type system uses the information contained in the GTypeInfo structure pointed to by info to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.
868-- parent_type : 	Type which this type will be derived from.
869-- type_name : 	0-terminated string used as the name of the new type.
870-- info : 	The GTypeInfo structure for this type.
871-- flags : 	Bitwise combination of GTypeFlags values.
872-- Returns : 	The new type identifier.
873-- g_type_register_dynamic ()
874
875-- GType       g_type_register_dynamic         (GType parent_type,
876--                                              const gchar *type_name,
877--                                              GTypePlugin *plugin,
878--                                              GTypeFlags flags);
879
880-- Registers type_name as the name of a new dynamic type derived from parent_type. The type system uses the information contained in the GTypePlugin structure pointed to by plugin to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.
881-- parent_type : 	Type which this type will be derived from.
882-- type_name : 	0-terminated string used as the name of the new type.
883-- plugin : 	The GTypePlugin structure to retrieve the GTypeInfo from.
884-- flags : 	Bitwise combination of GTypeFlags values.
885-- Returns : 	The new type identifier or G_TYPE_INVALID if registration failed.
886-- g_type_register_fundamental ()
887
888-- GType       g_type_register_fundamental     (GType type_id,
889--                                              const gchar *type_name,
890--                                              const GTypeInfo *info,
891--                                              const GTypeFundamentalInfo *finfo,
892--                                              GTypeFlags flags);
893
894-- Registers type_id as the predefined identifier and type_name as the name of a fundamental type. The type system uses the information contained in the GTypeInfo structure pointed to by info and the GTypeFundamentalInfo structure pointed to by finfo to manage the type and its instances. The value of flags determines additional characteristics of the fundamental type.
895-- type_id : 	A predefined GTypeFundamentals value.
896-- type_name : 	0-terminated string used as the name of the new type.
897-- info : 	The GTypeInfo structure for this type.
898-- finfo : 	The GTypeFundamentalInfo structure for this type.
899-- flags : 	Bitwise combination of GTypeFlags values.
900-- Returns : 	The predefined type identifier.
901-- g_type_add_interface_static ()
902
903-- void        g_type_add_interface_static     (GType instance_type,
904--                                              GType interface_type,
905--                                              const GInterfaceInfo *info);
906
907-- Adds the static interface_type to instantiable_type. The information contained in the GTypeInterfaceInfo structure pointed to by info is used to manage the relationship.
908-- instance_type : 	GType value of an instantiable type.
909-- interface_type : 	GType value of an interface type.
910-- info : 	The GInterfaceInfo structure for this (instance_type, interface_type) combination.
911-- g_type_add_interface_dynamic ()
912
913-- void        g_type_add_interface_dynamic    (GType instance_ty…

Large files files are truncated, but you can click here to view the full file