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