1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gobject-Type-Information.html
27  * outPack = gobject
28  * outFile = Type
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Type
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_type_
41  * omit structs:
42  * 	- GTypeClass
43  * 	- GTypeInstance
44  * 	- GTypeInterface
45  * omit prefixes:
46  * omit code:
47  * 	- GType
48  * omit signals:
49  * imports:
50  * 	- glib.Str
51  * 	- gobject.ObjectG
52  * 	- gobject.TypePlugin
53  * structWrap:
54  * 	- GTypePlugin* -> TypePlugin
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gobject.Type;
61 
62 public  import gtkc.gobjecttypes;
63 
64 private import gtkc.gobject;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.Str;
70 private import gobject.ObjectG;
71 private import gobject.TypePlugin;
72 
73 
74 
75 
76 /**
77  * Description
78  * The GType API is the foundation of the GObject system. It provides the
79  * facilities for registering and managing all fundamental data types,
80  * user-defined object and interface types. Before using any GType
81  * or GObject functions, g_type_init() must be called to initialize the
82  * type system.
83  * For type creation and registration purposes, all types fall into one of
84  * two categories: static or dynamic. Static types are never loaded or
85  * unloaded at run-time as dynamic types may be. Static types are created
86  * with g_type_register_static() that gets type specific information passed
87  * in via a GTypeInfo structure.
88  * Dynamic types are created with g_type_register_dynamic() which takes a
89  * GTypePlugin structure instead. The remaining type information (the
90  * GTypeInfo structure) is retrieved during runtime through GTypePlugin
91  * and the g_type_plugin_*() API.
92  * These registration functions are usually called only once from a
93  * function whose only purpose is to return the type identifier for a
94  * specific class. Once the type (or class or interface) is registered,
95  * it may be instantiated, inherited, or implemented depending on exactly
96  * what sort of type it is.
97  * There is also a third registration function for registering fundamental
98  * types called g_type_register_fundamental() which requires both a GTypeInfo
99  * structure and a GTypeFundamentalInfo structure but it is seldom used
100  * since most fundamental types are predefined rather than user-defined.
101  * A final word about type names.
102  * Such an identifier needs to be at least three characters long. There is no
103  * upper length limit. The first character needs to be a letter (a-z or A-Z)
104  * or an underscore '_'. Subsequent characters can be letters, numbers or
105  * any of '-_+'.
106  */
107 public class Type
108 {
109 	
110 	public static T* getInstanceClass(T)(ObjectG obj)
111 	{
112 		return cast(T*) (cast(GTypeInstance*)obj.getObjectGStruct()).gClass;
113 	}
114 	
115 	/**
116 	 * Get the unique name that is assigned to the Objects type.
117 	 * Returns: Static type name or NULL.
118 	 */
119 	public static string name(ObjectG obj)
120 	{
121 		GType type = (cast(GTypeInstance*)obj.getObjectGStruct()).gClass.gType;
122 		
123 		return name(type);
124 	}
125 	
126 	/**
127 	 */
128 	
129 	/**
130 	 * Prior to any use of the type system, g_type_init() has to be called
131 	 * to initialize the type system and assorted other code portions
132 	 * (such as the various fundamental type implementations or the signal
133 	 * system).
134 	 * Since version 2.24 this also initializes the thread system
135 	 */
136 	public static void init()
137 	{
138 		// void g_type_init (void);
139 		g_type_init();
140 	}
141 	
142 	/**
143 	 * Similar to g_type_init(), but additionally sets debug flags.
144 	 * Params:
145 	 * debugFlags = Bitwise combination of GTypeDebugFlags values for
146 	 * debugging purposes.
147 	 */
148 	public static void initWithDebugFlags(GTypeDebugFlags debugFlags)
149 	{
150 		// void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);
151 		g_type_init_with_debug_flags(debugFlags);
152 	}
153 	
154 	/**
155 	 * Get the unique name that is assigned to a type ID. Note that this
156 	 * function (like all other GType API) cannot cope with invalid type
157 	 * IDs. G_TYPE_INVALID may be passed to this function, as may be any
158 	 * other validly registered type ID, but randomized type IDs should
159 	 * not be passed in and will most likely lead to a crash.
160 	 * Params:
161 	 * type = Type to return name for.
162 	 * Returns: Static type name or NULL.
163 	 */
164 	public static string name(GType type)
165 	{
166 		// const gchar * g_type_name (GType type);
167 		return Str.toString(g_type_name(type));
168 	}
169 	
170 	/**
171 	 * Get the corresponding quark of the type IDs name.
172 	 * Params:
173 	 * type = Type to return quark of type name for.
174 	 * Returns: The type names quark or 0.
175 	 */
176 	public static GQuark qname(GType type)
177 	{
178 		// GQuark g_type_qname (GType type);
179 		return g_type_qname(type);
180 	}
181 	
182 	/**
183 	 * Lookup the type ID from a given type name, returning 0 if no type
184 	 * has been registered under this name (this is the preferred method
185 	 * to find out by name whether a specific type has been registered
186 	 * yet).
187 	 * Params:
188 	 * name = Type name to lookup.
189 	 * Returns: Corresponding type ID or 0.
190 	 */
191 	public static GType fromName(string name)
192 	{
193 		// GType g_type_from_name (const gchar *name);
194 		return g_type_from_name(Str.toStringz(name));
195 	}
196 	
197 	/**
198 	 * Return the direct parent type of the passed in type. If the passed
199 	 * in type has no parent, i.e. is a fundamental type, 0 is returned.
200 	 * Params:
201 	 * type = The derived type.
202 	 * Returns: The parent type.
203 	 */
204 	public static GType parent(GType type)
205 	{
206 		// GType g_type_parent (GType type);
207 		return g_type_parent(type);
208 	}
209 	
210 	/**
211 	 * Returns the length of the ancestry of the passed in type. This
212 	 * includes the type itself, so that e.g. a fundamental type has depth 1.
213 	 * Params:
214 	 * type = A GType value.
215 	 * Returns: The depth of type.
216 	 */
217 	public static uint depth(GType type)
218 	{
219 		// guint g_type_depth (GType type);
220 		return g_type_depth(type);
221 	}
222 	
223 	/**
224 	 * Given a leaf_type and a root_type which is contained in its
225 	 * anchestry, return the type that root_type is the immediate parent
226 	 * of. In other words, this function determines the type that is
227 	 * derived directly from root_type which is also a base class of
228 	 * leaf_type. Given a root type and a leaf type, this function can
229 	 * be used to determine the types and order in which the leaf type is
230 	 * descended from the root type.
231 	 * Params:
232 	 * leafType = Descendant of root_type and the type to be returned.
233 	 * rootType = Immediate parent of the returned type.
234 	 * Returns: Immediate child of root_type and anchestor of leaf_type.
235 	 */
236 	public static GType nextBase(GType leafType, GType rootType)
237 	{
238 		// GType g_type_next_base (GType leaf_type,  GType root_type);
239 		return g_type_next_base(leafType, rootType);
240 	}
241 	
242 	/**
243 	 * If is_a_type is a derivable type, check whether type is a
244 	 * descendant of is_a_type. If is_a_type is an interface, check
245 	 * whether type conforms to it.
246 	 * Params:
247 	 * type = Type to check anchestry for.
248 	 * isAType = Possible anchestor of type or interface type could conform to.
249 	 * Returns: TRUE if type is_a is_a_type holds true.
250 	 */
251 	public static int isA(GType type, GType isAType)
252 	{
253 		// gboolean g_type_is_a (GType type,  GType is_a_type);
254 		return g_type_is_a(type, isAType);
255 	}
256 	
257 	/**
258 	 * Increments the reference count of the class structure belonging to
259 	 * type. This function will demand-create the class if it doesn't
260 	 * exist already.
261 	 * Params:
262 	 * type = Type ID of a classed type.
263 	 * Returns: The GTypeClass structure for the given type ID. [type GObject.TypeClass][transfer none]
264 	 */
265 	public static void* classRef(GType type)
266 	{
267 		// gpointer g_type_class_ref (GType type);
268 		return g_type_class_ref(type);
269 	}
270 	
271 	/**
272 	 * This function is essentially the same as g_type_class_ref(), except that
273 	 * the classes reference count isn't incremented. As a consequence, this function
274 	 * may return NULL if the class of the type passed in does not currently
275 	 * exist (hasn't been referenced before).
276 	 * Params:
277 	 * type = Type ID of a classed type.
278 	 * Returns: The GTypeClass structure for the given type ID or NULL if the class does not currently exist. [type GObject.TypeClass][transfer none]
279 	 */
280 	public static void* classPeek(GType type)
281 	{
282 		// gpointer g_type_class_peek (GType type);
283 		return g_type_class_peek(type);
284 	}
285 	
286 	/**
287 	 * A more efficient version of g_type_class_peek() which works only for
288 	 * static types.
289 	 * Since 2.4
290 	 * Params:
291 	 * type = Type ID of a classed type.
292 	 * Returns: The GTypeClass structure for the given type ID or NULL if the class does not currently exist or is dynamically loaded. [type GObject.TypeClass][transfer none]
293 	 */
294 	public static void* classPeekStatic(GType type)
295 	{
296 		// gpointer g_type_class_peek_static (GType type);
297 		return g_type_class_peek_static(type);
298 	}
299 	
300 	/**
301 	 * Decrements the reference count of the class structure being passed in.
302 	 * Once the last reference count of a class has been released, classes
303 	 * may be finalized by the type system, so further dereferencing of a
304 	 * class pointer after g_type_class_unref() are invalid.
305 	 * Params:
306 	 * gClass = The GTypeClass structure to
307 	 * unreference. [type GObject.TypeClass]
308 	 */
309 	public static void classUnref(void* gClass)
310 	{
311 		// void g_type_class_unref (gpointer g_class);
312 		g_type_class_unref(gClass);
313 	}
314 	
315 	/**
316 	 * This is a convenience function often needed in class initializers.
317 	 * It returns the class structure of the immediate parent type of the
318 	 * class passed in. Since derived classes hold a reference count on
319 	 * their parent classes as long as they are instantiated, the returned
320 	 * class will always exist. This function is essentially equivalent
321 	 * Params:
322 	 * gClass = The GTypeClass structure to
323 	 * retrieve the parent class for. [type GObject.TypeClass]
324 	 * Returns: The parent class of g_class. [type GObject.TypeClass][transfer none]
325 	 */
326 	public static void* classPeekParent(void* gClass)
327 	{
328 		// gpointer g_type_class_peek_parent (gpointer g_class);
329 		return g_type_class_peek_parent(gClass);
330 	}
331 	
332 	/**
333 	 * Registers a private structure for an instantiatable type.
334 	 * When an object is allocated, the private structures for
335 	 * the type and all of its parent types are allocated
336 	 * sequentially in the same memory block as the public
337 	 * structures.
338 	 * Note that the accumulated size of the private structures of
339 	 * a type and all its parent types cannot excced 64kB.
340 	 * This function should be called in the type's class_init() function.
341 	 * The private structure can be retrieved using the
342 	 * G_TYPE_INSTANCE_GET_PRIVATE() macro.
343 	 * The following example shows attaching a private structure
344 	 * MyObjectPrivate to an object
345 	 * MyObject defined in the standard GObject
346 	 * fashion.
347 	 * type's class_init() function.
348 	 * $(DDOC_COMMENT example)
349 	 * Since 2.4
350 	 * Params:
351 	 * gClass = class structure for an instantiatable type
352 	 * privateSize = size of private structure.
353 	 */
354 	public static void classAddPrivate(void* gClass, gsize privateSize)
355 	{
356 		// void g_type_class_add_private (gpointer g_class,  gsize private_size);
357 		g_type_class_add_private(gClass, privateSize);
358 	}
359 	
360 	/**
361 	 * Registers a private class structure for a classed type;
362 	 * when the class is allocated, the private structures for
363 	 * the class and all of its parent types are allocated
364 	 * sequentially in the same memory block as the public
365 	 * structures. This function should be called in the
366 	 * type's get_type() function after the type is registered.
367 	 * The private structure can be retrieved using the
368 	 * G_TYPE_CLASS_GET_PRIVATE() macro.
369 	 * Since 2.24
370 	 * Params:
371 	 * classType = GType of an classed type.
372 	 * privateSize = size of private structure.
373 	 */
374 	public static void addClassPrivate(GType classType, gsize privateSize)
375 	{
376 		// void g_type_add_class_private (GType class_type,  gsize private_size);
377 		g_type_add_class_private(classType, privateSize);
378 	}
379 	
380 	/**
381 	 * Returns the GTypeInterface structure of an interface to which the
382 	 * passed in class conforms.
383 	 * Params:
384 	 * instanceClass = A GTypeClass structure. [type GObject.TypeClass]
385 	 * ifaceType = An interface ID which this class conforms to.
386 	 * Returns: The GTypeInterface structure of iface_type if implemented by instance_class, NULL otherwise. [type GObject.TypeInterface][transfer none]
387 	 */
388 	public static void* interfacePeek(void* instanceClass, GType ifaceType)
389 	{
390 		// gpointer g_type_interface_peek (gpointer instance_class,  GType iface_type);
391 		return g_type_interface_peek(instanceClass, ifaceType);
392 	}
393 	
394 	/**
395 	 * Returns the corresponding GTypeInterface structure of the parent type
396 	 * of the instance type to which g_iface belongs. This is useful when
397 	 * deriving the implementation of an interface from the parent type and
398 	 * then possibly overriding some methods.
399 	 * Params:
400 	 * gIface = A GTypeInterface structure. [type GObject.TypeInterface]
401 	 * 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. [transfer none][type GObject.TypeInterface]
402 	 */
403 	public static void* interfacePeekParent(void* gIface)
404 	{
405 		// gpointer g_type_interface_peek_parent (gpointer g_iface);
406 		return g_type_interface_peek_parent(gIface);
407 	}
408 	
409 	/**
410 	 * Increments the reference count for the interface type g_type,
411 	 * and returns the default interface vtable for the type.
412 	 * If the type is not currently in use, then the default vtable
413 	 * for the type will be created and initalized by calling
414 	 * the base interface init and default vtable init functions for
415 	 * the type (the @base_init
416 	 * and class_init members of GTypeInfo).
417 	 * Calling g_type_default_interface_ref() is useful when you
418 	 * want to make sure that signals and properties for an interface
419 	 * have been installed.
420 	 * Since 2.4
421 	 * Params:
422 	 * gType = an interface type
423 	 * Returns: the default vtable for the interface; call g_type_default_interface_unref() when you are done using the interface. [type GObject.TypeInterface][transfer none]
424 	 */
425 	public static void* defaultInterfaceRef(GType gType)
426 	{
427 		// gpointer g_type_default_interface_ref (GType g_type);
428 		return g_type_default_interface_ref(gType);
429 	}
430 	
431 	/**
432 	 * If the interface type g_type is currently in use, returns its
433 	 * default interface vtable.
434 	 * Since 2.4
435 	 * Params:
436 	 * gType = an interface type
437 	 * Returns: the default vtable for the interface, or NULL if the type is not currently in use. [type GObject.TypeInterface][transfer none]
438 	 */
439 	public static void* defaultInterfacePeek(GType gType)
440 	{
441 		// gpointer g_type_default_interface_peek (GType g_type);
442 		return g_type_default_interface_peek(gType);
443 	}
444 	
445 	/**
446 	 * Decrements the reference count for the type corresponding to the
447 	 * interface default vtable g_iface. If the type is dynamic, then
448 	 * when no one is using the interface and all references have
449 	 * been released, the finalize function for the interface's default
450 	 * vtable (the class_finalize member of
451 	 * GTypeInfo) will be called.
452 	 * Since 2.4
453 	 * Params:
454 	 * gIface = the default vtable
455 	 * structure for a interface, as returned by
456 	 * g_type_default_interface_ref(). [type GObject.TypeInterface]
457 	 */
458 	public static void defaultInterfaceUnref(void* gIface)
459 	{
460 		// void g_type_default_interface_unref (gpointer g_iface);
461 		g_type_default_interface_unref(gIface);
462 	}
463 	
464 	/**
465 	 * Return a newly allocated and 0-terminated array of type IDs, listing the
466 	 * child types of type. The return value has to be g_free()ed after use.
467 	 * Params:
468 	 * type = The parent type.
469 	 * Returns: Newly allocated and 0-terminated array of child types. [array length=n_children][transfer full]
470 	 */
471 	public static GType[] children(GType type)
472 	{
473 		// GType * g_type_children (GType type,  guint *n_children);
474 		uint nChildren;
475 		auto p = g_type_children(type, &nChildren);
476 		
477 		if(p is null)
478 		{
479 			return null;
480 		}
481 		
482 		return p[0 .. nChildren];
483 	}
484 	
485 	/**
486 	 * Return a newly allocated and 0-terminated array of type IDs, listing the
487 	 * interface types that type conforms to. The return value has to be
488 	 * g_free()ed after use.
489 	 * Params:
490 	 * type = The type to list interface types for.
491 	 * Returns: Newly allocated and 0-terminated array of interface types. [array length=n_interfaces][transfer full]
492 	 */
493 	public static GType[] interfaces(GType type)
494 	{
495 		// GType * g_type_interfaces (GType type,  guint *n_interfaces);
496 		uint nInterfaces;
497 		auto p = g_type_interfaces(type, &nInterfaces);
498 		
499 		if(p is null)
500 		{
501 			return null;
502 		}
503 		
504 		return p[0 .. nInterfaces];
505 	}
506 	
507 	/**
508 	 * Returns the prerequisites of an interfaces type.
509 	 * Since 2.2
510 	 * Params:
511 	 * interfaceType = an interface type
512 	 * Returns: a newly-allocated zero-terminated array of GType containing the prerequisites of interface_type. [array length=n_prerequisites][transfer full]
513 	 */
514 	public static GType[] interfacePrerequisites(GType interfaceType)
515 	{
516 		// GType * g_type_interface_prerequisites (GType interface_type,  guint *n_prerequisites);
517 		uint nPrerequisites;
518 		auto p = g_type_interface_prerequisites(interfaceType, &nPrerequisites);
519 		
520 		if(p is null)
521 		{
522 			return null;
523 		}
524 		
525 		return p[0 .. nPrerequisites];
526 	}
527 	
528 	/**
529 	 * Attaches arbitrary data to a type.
530 	 * Params:
531 	 * type = a GType
532 	 * quark = a GQuark id to identify the data
533 	 * data = the data
534 	 */
535 	public static void setQdata(GType type, GQuark quark, void* data)
536 	{
537 		// void g_type_set_qdata (GType type,  GQuark quark,  gpointer data);
538 		g_type_set_qdata(type, quark, data);
539 	}
540 	
541 	/**
542 	 * Obtains data which has previously been attached to type
543 	 * with g_type_set_qdata().
544 	 * Note that this does not take subtyping into account; data
545 	 * attached to one type with g_type_set_qdata() cannot
546 	 * be retrieved from a subtype using g_type_get_qdata().
547 	 * Params:
548 	 * type = a GType
549 	 * quark = a GQuark id to identify the data
550 	 * Returns: the data, or NULL if no data was found. [transfer none]
551 	 */
552 	public static void* getQdata(GType type, GQuark quark)
553 	{
554 		// gpointer g_type_get_qdata (GType type,  GQuark quark);
555 		return g_type_get_qdata(type, quark);
556 	}
557 	
558 	/**
559 	 * Queries the type system for information about a specific type.
560 	 * This function will fill in a user-provided structure to hold
561 	 * type-specific information. If an invalid GType is passed in, the
562 	 * type member of the GTypeQuery is 0. All members filled into the
563 	 * GTypeQuery structure should be considered constant and have to be
564 	 * left untouched.
565 	 * Params:
566 	 * type = the GType value of a static, classed type.
567 	 * query = A user provided structure that is
568 	 * filled in with constant values upon success. [out caller-allocates]
569 	 */
570 	public static void query(GType type, out GTypeQuery query)
571 	{
572 		// void g_type_query (GType type,  GTypeQuery *query);
573 		g_type_query(type, &query);
574 	}
575 	
576 	/**
577 	 * Registers type_name as the name of a new static type derived from
578 	 * parent_type. The type system uses the information contained in the
579 	 * GTypeInfo structure pointed to by info to manage the type and its
580 	 * instances (if not abstract). The value of flags determines the nature
581 	 * (e.g. abstract or not) of the type.
582 	 * Params:
583 	 * parentType = Type from which this type will be derived.
584 	 * typeName = 0-terminated string used as the name of the new type.
585 	 * info = The GTypeInfo structure for this type.
586 	 * flags = Bitwise combination of GTypeFlags values.
587 	 * Returns: The new type identifier.
588 	 */
589 	public static GType registerStatic(GType parentType, string typeName, GTypeInfo* info, GTypeFlags flags)
590 	{
591 		// GType g_type_register_static (GType parent_type,  const gchar *type_name,  const GTypeInfo *info,  GTypeFlags flags);
592 		return g_type_register_static(parentType, Str.toStringz(typeName), info, flags);
593 	}
594 	
595 	/**
596 	 * Registers type_name as the name of a new static type derived from
597 	 * parent_type. The value of flags determines the nature (e.g.
598 	 * abstract or not) of the type. It works by filling a GTypeInfo
599 	 * struct and calling g_type_register_static().
600 	 * Since 2.12
601 	 * Params:
602 	 * parentType = Type from which this type will be derived.
603 	 * typeName = 0-terminated string used as the name of the new type.
604 	 * classSize = Size of the class structure (see GTypeInfo)
605 	 * classInit = Location of the class initialization function (see GTypeInfo)
606 	 * instanceSize = Size of the instance structure (see GTypeInfo)
607 	 * instanceInit = Location of the instance initialization function (see GTypeInfo)
608 	 * flags = Bitwise combination of GTypeFlags values.
609 	 * Returns: The new type identifier.
610 	 */
611 	public static GType registerStaticSimple(GType parentType, string typeName, uint classSize, GClassInitFunc classInit, uint instanceSize, GInstanceInitFunc instanceInit, GTypeFlags flags)
612 	{
613 		// GType g_type_register_static_simple (GType parent_type,  const gchar *type_name,  guint class_size,  GClassInitFunc class_init,  guint instance_size,  GInstanceInitFunc instance_init,  GTypeFlags flags);
614 		return g_type_register_static_simple(parentType, Str.toStringz(typeName), classSize, classInit, instanceSize, instanceInit, flags);
615 	}
616 	
617 	/**
618 	 * Registers type_name as the name of a new dynamic type derived from
619 	 * parent_type. The type system uses the information contained in the
620 	 * GTypePlugin structure pointed to by plugin to manage the type and its
621 	 * instances (if not abstract). The value of flags determines the nature
622 	 * (e.g. abstract or not) of the type.
623 	 * Params:
624 	 * parentType = Type from which this type will be derived.
625 	 * typeName = 0-terminated string used as the name of the new type.
626 	 * plugin = The GTypePlugin structure to retrieve the GTypeInfo from.
627 	 * flags = Bitwise combination of GTypeFlags values.
628 	 * Returns: The new type identifier or G_TYPE_INVALID if registration failed.
629 	 */
630 	public static GType registerDynamic(GType parentType, string typeName, TypePlugin plugin, GTypeFlags flags)
631 	{
632 		// GType g_type_register_dynamic (GType parent_type,  const gchar *type_name,  GTypePlugin *plugin,  GTypeFlags flags);
633 		return g_type_register_dynamic(parentType, Str.toStringz(typeName), (plugin is null) ? null : plugin.getTypePluginStruct(), flags);
634 	}
635 	
636 	/**
637 	 * Registers type_id as the predefined identifier and type_name as the
638 	 * name of a fundamental type. The type system uses the information
639 	 * contained in the GTypeInfo structure pointed to by info and the
640 	 * GTypeFundamentalInfo structure pointed to by finfo to manage the
641 	 * type and its instances. The value of flags determines additional
642 	 * characteristics of the fundamental type.
643 	 * Params:
644 	 * typeId = A predefined type identifier.
645 	 * typeName = 0-terminated string used as the name of the new type.
646 	 * info = The GTypeInfo structure for this type.
647 	 * finfo = The GTypeFundamentalInfo structure for this type.
648 	 * flags = Bitwise combination of GTypeFlags values.
649 	 * Returns: The predefined type identifier.
650 	 */
651 	public static GType registerFundamental(GType typeId, string typeName, GTypeInfo* info, GTypeFundamentalInfo* finfo, GTypeFlags flags)
652 	{
653 		// GType g_type_register_fundamental (GType type_id,  const gchar *type_name,  const GTypeInfo *info,  const GTypeFundamentalInfo *finfo,  GTypeFlags flags);
654 		return g_type_register_fundamental(typeId, Str.toStringz(typeName), info, finfo, flags);
655 	}
656 	
657 	/**
658 	 * Adds the static interface_type to instantiable_type. The information
659 	 * contained in the GTypeInterfaceInfo structure pointed to by info
660 	 * is used to manage the relationship.
661 	 * Params:
662 	 * instanceType = GType value of an instantiable type.
663 	 * interfaceType = GType value of an interface type.
664 	 * info = The GInterfaceInfo structure for this
665 	 * (instance_type, interface_type) combination.
666 	 */
667 	public static void addInterfaceStatic(GType instanceType, GType interfaceType, GInterfaceInfo* info)
668 	{
669 		// void g_type_add_interface_static (GType instance_type,  GType interface_type,  const GInterfaceInfo *info);
670 		g_type_add_interface_static(instanceType, interfaceType, info);
671 	}
672 	
673 	/**
674 	 * Adds the dynamic interface_type to instantiable_type. The information
675 	 * contained in the GTypePlugin structure pointed to by plugin
676 	 * is used to manage the relationship.
677 	 * Params:
678 	 * instanceType = the GType value of an instantiable type.
679 	 * interfaceType = the GType value of an interface type.
680 	 * plugin = the GTypePlugin structure to retrieve the GInterfaceInfo from.
681 	 */
682 	public static void addInterfaceDynamic(GType instanceType, GType interfaceType, TypePlugin plugin)
683 	{
684 		// void g_type_add_interface_dynamic (GType instance_type,  GType interface_type,  GTypePlugin *plugin);
685 		g_type_add_interface_dynamic(instanceType, interfaceType, (plugin is null) ? null : plugin.getTypePluginStruct());
686 	}
687 	
688 	/**
689 	 * Adds prerequisite_type to the list of prerequisites of interface_type.
690 	 * This means that any type implementing interface_type must also implement
691 	 * prerequisite_type. Prerequisites can be thought of as an alternative to
692 	 * interface derivation (which GType doesn't support). An interface can have
693 	 * at most one instantiatable prerequisite type.
694 	 * Params:
695 	 * interfaceType = GType value of an interface type.
696 	 * prerequisiteType = GType value of an interface or instantiatable type.
697 	 */
698 	public static void interfaceAddPrerequisite(GType interfaceType, GType prerequisiteType)
699 	{
700 		// void g_type_interface_add_prerequisite (GType interface_type,  GType prerequisite_type);
701 		g_type_interface_add_prerequisite(interfaceType, prerequisiteType);
702 	}
703 	
704 	/**
705 	 * Returns the GTypePlugin structure for type or
706 	 * NULL if type does not have a GTypePlugin structure.
707 	 * Params:
708 	 * type = The GType to retrieve the plugin for.
709 	 * Returns: The corresponding plugin if type is a dynamic type, NULL otherwise. [transfer none]
710 	 */
711 	public static TypePlugin getPlugin(GType type)
712 	{
713 		// GTypePlugin *	 g_type_get_plugin (GType type);
714 		auto p = g_type_get_plugin(type);
715 		
716 		if(p is null)
717 		{
718 			return null;
719 		}
720 		
721 		return ObjectG.getDObject!(TypePlugin)(cast(GTypePlugin*) p);
722 	}
723 	
724 	/**
725 	 * Returns the GTypePlugin structure for the dynamic interface
726 	 * interface_type which has been added to instance_type, or NULL if
727 	 * interface_type has not been added to instance_type or does not
728 	 * have a GTypePlugin structure. See g_type_add_interface_dynamic().
729 	 * Params:
730 	 * instanceType = the GType value of an instantiatable type.
731 	 * interfaceType = the GType value of an interface type.
732 	 * Returns: the GTypePlugin for the dynamic interface interface_type of instance_type. [transfer none]
733 	 */
734 	public static TypePlugin interfaceGetPlugin(GType instanceType, GType interfaceType)
735 	{
736 		// GTypePlugin *	 g_type_interface_get_plugin (GType instance_type,  GType interface_type);
737 		auto p = g_type_interface_get_plugin(instanceType, interfaceType);
738 		
739 		if(p is null)
740 		{
741 			return null;
742 		}
743 		
744 		return ObjectG.getDObject!(TypePlugin)(cast(GTypePlugin*) p);
745 	}
746 	
747 	/**
748 	 * Returns the next free fundamental type id which can be used to
749 	 * register a new fundamental type with g_type_register_fundamental().
750 	 * The returned type ID represents the highest currently registered
751 	 * fundamental type identifier.
752 	 * Returns: The nextmost fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs.
753 	 */
754 	public static GType fundamentalNext()
755 	{
756 		// GType g_type_fundamental_next (void);
757 		return g_type_fundamental_next();
758 	}
759 	
760 	/**
761 	 * Internal function, used to extract the fundamental type ID portion.
762 	 * use G_TYPE_FUNDAMENTAL() instead.
763 	 * Params:
764 	 * typeId = valid type ID
765 	 * Returns: fundamental type ID
766 	 */
767 	public static GType fundamental(GType typeId)
768 	{
769 		// GType g_type_fundamental (GType type_id);
770 		return g_type_fundamental(typeId);
771 	}
772 	
773 	/**
774 	 * Creates and initializes an instance of type if type is valid and
775 	 * can be instantiated. The type system only performs basic allocation
776 	 * and structure setups for instances: actual instance creation should
777 	 * happen through functions supplied by the type's fundamental type
778 	 * implementation. So use of g_type_create_instance() is reserved for
779 	 * implementators of fundamental types only. E.g. instances of the
780 	 * GObject hierarchy should be created via g_object_new() and
781 	 * never directly through
782 	 * g_type_create_instance() which doesn't handle things like singleton
783 	 * objects or object construction. Note: Do not
784 	 * use this function, unless you're implementing a fundamental
785 	 * type. Also language bindings should not use
786 	 * this function but g_object_new() instead.
787 	 * Params:
788 	 * type = An instantiatable type to create an instance for.
789 	 * Returns: An allocated and initialized instance, subject to further treatment by the fundamental type implementation.
790 	 */
791 	public static GTypeInstance* createInstance(GType type)
792 	{
793 		// GTypeInstance * g_type_create_instance (GType type);
794 		return g_type_create_instance(type);
795 	}
796 	
797 	/**
798 	 * Frees an instance of a type, returning it to the instance pool for
799 	 * the type, if there is one.
800 	 * Like g_type_create_instance(), this function is reserved for
801 	 * implementors of fundamental types.
802 	 */
803 	public static void freeInstance(GTypeInstance* instanc)
804 	{
805 		// void g_type_free_instance (GTypeInstance *instance);
806 		g_type_free_instance(instanc);
807 	}
808 	
809 	/**
810 	 * Adds a GTypeClassCacheFunc to be called before the reference count of a
811 	 * class goes from one to zero. This can be used to prevent premature class
812 	 * destruction. All installed GTypeClassCacheFunc functions will be chained
813 	 * until one of them returns TRUE. The functions have to check the class id
814 	 * passed in to figure whether they actually want to cache the class of this
815 	 * type, since all classes are routed through the same GTypeClassCacheFunc
816 	 * chain.
817 	 * Params:
818 	 * cacheData = data to be passed to cache_func
819 	 * cacheFunc = a GTypeClassCacheFunc
820 	 */
821 	public static void addClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)
822 	{
823 		// void g_type_add_class_cache_func (gpointer cache_data,  GTypeClassCacheFunc cache_func);
824 		g_type_add_class_cache_func(cacheData, cacheFunc);
825 	}
826 	
827 	/**
828 	 * Removes a previously installed GTypeClassCacheFunc. The cache
829 	 * maintained by cache_func has to be empty when calling
830 	 * g_type_remove_class_cache_func() to avoid leaks.
831 	 * Params:
832 	 * cacheData = data that was given when adding cache_func
833 	 * cacheFunc = a GTypeClassCacheFunc
834 	 */
835 	public static void removeClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)
836 	{
837 		// void g_type_remove_class_cache_func (gpointer cache_data,  GTypeClassCacheFunc cache_func);
838 		g_type_remove_class_cache_func(cacheData, cacheFunc);
839 	}
840 	
841 	/**
842 	 * A variant of g_type_class_unref() for use in GTypeClassCacheFunc
843 	 * implementations. It unreferences a class without consulting the chain
844 	 * of GTypeClassCacheFuncs, avoiding the recursion which would occur
845 	 * otherwise.
846 	 * Params:
847 	 * gClass = The GTypeClass structure to
848 	 * unreference. [type GObject.TypeClass]
849 	 */
850 	public static void classUnrefUncached(void* gClass)
851 	{
852 		// void g_type_class_unref_uncached (gpointer g_class);
853 		g_type_class_unref_uncached(gClass);
854 	}
855 	
856 	/**
857 	 * Adds a function to be called after an interface vtable is
858 	 * initialized for any class (i.e. after the interface_init member of
859 	 * GInterfaceInfo has been called).
860 	 * This function is useful when you want to check an invariant that
861 	 * depends on the interfaces of a class. For instance, the
862 	 * implementation of GObject uses this facility to check that an
863 	 * object implements all of the properties that are defined on its
864 	 * interfaces.
865 	 * Since 2.4
866 	 * Params:
867 	 * checkData = data to pass to check_func
868 	 * checkFunc = function to be called after each interface
869 	 * is initialized.
870 	 */
871 	public static void addInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)
872 	{
873 		// void g_type_add_interface_check (gpointer check_data,  GTypeInterfaceCheckFunc check_func);
874 		g_type_add_interface_check(checkData, checkFunc);
875 	}
876 	
877 	/**
878 	 * Removes an interface check function added with
879 	 * g_type_add_interface_check().
880 	 * Since 2.4
881 	 * Params:
882 	 * checkData = callback data passed to g_type_add_interface_check()
883 	 * checkFunc = callback function passed to g_type_add_interface_check()
884 	 */
885 	public static void removeInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)
886 	{
887 		// void g_type_remove_interface_check (gpointer check_data,  GTypeInterfaceCheckFunc check_func);
888 		g_type_remove_interface_check(checkData, checkFunc);
889 	}
890 	
891 	/**
892 	 * Returns the location of the GTypeValueTable associated with type.
893 	 * Note that this function should only be used from source code
894 	 * that implements or has internal knowledge of the implementation of
895 	 * type.
896 	 * Params:
897 	 * type = A GType value.
898 	 * Returns: Location of the GTypeValueTable associated with type or NULL if there is no GTypeValueTable associated with type.
899 	 */
900 	public static GTypeValueTable* valueTablePeek(GType type)
901 	{
902 		// GTypeValueTable * g_type_value_table_peek (GType type);
903 		return g_type_value_table_peek(type);
904 	}
905 }