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