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 module gobject.Type;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gobject.TypeClass;
30 private import gobject.TypeInstance;
31 private import gobject.TypeInterface;
32 private import gobject.TypePluginIF;
33 private import gobject.Value;
34 private import gobject.c.functions;
35 public  import gobject.c.types;
36 public  import gtkc.gobjecttypes;
37 
38 
39 /** */
40 public struct Type
41 {
42 	public static T* getInstanceClass(T)(ObjectG obj)
43 	{
44 		return cast(T*) (cast(GTypeInstance*)obj.getObjectGStruct()).gClass;
45 	}
46 
47 	/**
48 	 * Get the unique name that is assigned to the Objects type.
49 	 * Returns: Static type name or NULL.
50 	 */
51 	public static string name(ObjectG obj)
52 	{
53 		GType type = (cast(GTypeInstance*)obj.getObjectGStruct()).gClass.gType;
54 
55 		return name(type);
56 	}
57 
58 	/**
59 	 */
60 
61 	/**
62 	 * Adds a #GTypeClassCacheFunc to be called before the reference count of a
63 	 * class goes from one to zero. This can be used to prevent premature class
64 	 * destruction. All installed #GTypeClassCacheFunc functions will be chained
65 	 * until one of them returns %TRUE. The functions have to check the class id
66 	 * passed in to figure whether they actually want to cache the class of this
67 	 * type, since all classes are routed through the same #GTypeClassCacheFunc
68 	 * chain.
69 	 *
70 	 * Params:
71 	 *     cacheData = data to be passed to @cache_func
72 	 *     cacheFunc = a #GTypeClassCacheFunc
73 	 */
74 	public static void addClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)
75 	{
76 		g_type_add_class_cache_func(cacheData, cacheFunc);
77 	}
78 
79 	/**
80 	 * Registers a private class structure for a classed type;
81 	 * when the class is allocated, the private structures for
82 	 * the class and all of its parent types are allocated
83 	 * sequentially in the same memory block as the public
84 	 * structures, and are zero-filled.
85 	 *
86 	 * This function should be called in the
87 	 * type's get_type() function after the type is registered.
88 	 * The private structure can be retrieved using the
89 	 * G_TYPE_CLASS_GET_PRIVATE() macro.
90 	 *
91 	 * Params:
92 	 *     classType = GType of a classed type
93 	 *     privateSize = size of private structure
94 	 *
95 	 * Since: 2.24
96 	 */
97 	public static void addClassPrivate(GType classType, size_t privateSize)
98 	{
99 		g_type_add_class_private(classType, privateSize);
100 	}
101 
102 	/** */
103 	public static int addInstancePrivate(GType classType, size_t privateSize)
104 	{
105 		return g_type_add_instance_private(classType, privateSize);
106 	}
107 
108 	/**
109 	 * Adds a function to be called after an interface vtable is
110 	 * initialized for any class (i.e. after the @interface_init
111 	 * member of #GInterfaceInfo has been called).
112 	 *
113 	 * This function is useful when you want to check an invariant
114 	 * that depends on the interfaces of a class. For instance, the
115 	 * implementation of #GObject uses this facility to check that an
116 	 * object implements all of the properties that are defined on its
117 	 * interfaces.
118 	 *
119 	 * Params:
120 	 *     checkData = data to pass to @check_func
121 	 *     checkFunc = function to be called after each interface
122 	 *         is initialized
123 	 *
124 	 * Since: 2.4
125 	 */
126 	public static void addInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)
127 	{
128 		g_type_add_interface_check(checkData, checkFunc);
129 	}
130 
131 	/**
132 	 * Adds @interface_type to the dynamic @instantiable_type. The information
133 	 * contained in the #GTypePlugin structure pointed to by @plugin
134 	 * is used to manage the relationship.
135 	 *
136 	 * Params:
137 	 *     instanceType = #GType value of an instantiable type
138 	 *     interfaceType = #GType value of an interface type
139 	 *     plugin = #GTypePlugin structure to retrieve the #GInterfaceInfo from
140 	 */
141 	public static void addInterfaceDynamic(GType instanceType, GType interfaceType, TypePluginIF plugin)
142 	{
143 		g_type_add_interface_dynamic(instanceType, interfaceType, (plugin is null) ? null : plugin.getTypePluginStruct());
144 	}
145 
146 	/**
147 	 * Adds @interface_type to the static @instantiable_type.
148 	 * The information contained in the #GInterfaceInfo structure
149 	 * pointed to by @info is used to manage the relationship.
150 	 *
151 	 * Params:
152 	 *     instanceType = #GType value of an instantiable type
153 	 *     interfaceType = #GType value of an interface type
154 	 *     info = #GInterfaceInfo structure for this
155 	 *         (@instance_type, @interface_type) combination
156 	 */
157 	public static void addInterfaceStatic(GType instanceType, GType interfaceType, GInterfaceInfo* info)
158 	{
159 		g_type_add_interface_static(instanceType, interfaceType, info);
160 	}
161 
162 	/** */
163 	public static TypeClass checkClassCast(TypeClass gClass, GType isAType)
164 	{
165 		auto __p = g_type_check_class_cast((gClass is null) ? null : gClass.getTypeClassStruct(), isAType);
166 
167 		if(__p is null)
168 		{
169 			return null;
170 		}
171 
172 		return ObjectG.getDObject!(TypeClass)(cast(GTypeClass*) __p);
173 	}
174 
175 	/** */
176 	public static bool checkClassIsA(TypeClass gClass, GType isAType)
177 	{
178 		return g_type_check_class_is_a((gClass is null) ? null : gClass.getTypeClassStruct(), isAType) != 0;
179 	}
180 
181 	/**
182 	 * Private helper function to aid implementation of the
183 	 * G_TYPE_CHECK_INSTANCE() macro.
184 	 *
185 	 * Params:
186 	 *     instance_ = a valid #GTypeInstance structure
187 	 *
188 	 * Returns: %TRUE if @instance is valid, %FALSE otherwise
189 	 */
190 	public static bool checkInstance(TypeInstance instance_)
191 	{
192 		return g_type_check_instance((instance_ is null) ? null : instance_.getTypeInstanceStruct()) != 0;
193 	}
194 
195 	/** */
196 	public static TypeInstance checkInstanceCast(TypeInstance instance_, GType ifaceType)
197 	{
198 		auto __p = g_type_check_instance_cast((instance_ is null) ? null : instance_.getTypeInstanceStruct(), ifaceType);
199 
200 		if(__p is null)
201 		{
202 			return null;
203 		}
204 
205 		return ObjectG.getDObject!(TypeInstance)(cast(GTypeInstance*) __p);
206 	}
207 
208 	/** */
209 	public static bool checkInstanceIsA(TypeInstance instance_, GType ifaceType)
210 	{
211 		return g_type_check_instance_is_a((instance_ is null) ? null : instance_.getTypeInstanceStruct(), ifaceType) != 0;
212 	}
213 
214 	/** */
215 	public static bool checkInstanceIsFundamentallyA(TypeInstance instance_, GType fundamentalType)
216 	{
217 		return g_type_check_instance_is_fundamentally_a((instance_ is null) ? null : instance_.getTypeInstanceStruct(), fundamentalType) != 0;
218 	}
219 
220 	/** */
221 	public static bool checkIsValueType(GType type)
222 	{
223 		return g_type_check_is_value_type(type) != 0;
224 	}
225 
226 	/** */
227 	public static bool checkValue(Value value)
228 	{
229 		return g_type_check_value((value is null) ? null : value.getValueStruct()) != 0;
230 	}
231 
232 	/** */
233 	public static bool checkValueHolds(Value value, GType type)
234 	{
235 		return g_type_check_value_holds((value is null) ? null : value.getValueStruct(), type) != 0;
236 	}
237 
238 	/**
239 	 * Return a newly allocated and 0-terminated array of type IDs, listing
240 	 * the child types of @type.
241 	 *
242 	 * Params:
243 	 *     type = the parent type
244 	 *
245 	 * Returns: Newly allocated
246 	 *     and 0-terminated array of child types, free with g_free()
247 	 */
248 	public static GType[] children(GType type)
249 	{
250 		uint nChildren;
251 
252 		auto __p = g_type_children(type, &nChildren);
253 
254 		return __p[0 .. nChildren];
255 	}
256 
257 	/**
258 	 * Creates and initializes an instance of @type if @type is valid and
259 	 * can be instantiated. The type system only performs basic allocation
260 	 * and structure setups for instances: actual instance creation should
261 	 * happen through functions supplied by the type's fundamental type
262 	 * implementation.  So use of g_type_create_instance() is reserved for
263 	 * implementators of fundamental types only. E.g. instances of the
264 	 * #GObject hierarchy should be created via g_object_new() and never
265 	 * directly through g_type_create_instance() which doesn't handle things
266 	 * like singleton objects or object construction.
267 	 *
268 	 * The extended members of the returned instance are guaranteed to be filled
269 	 * with zeros.
270 	 *
271 	 * Note: Do not use this function, unless you're implementing a
272 	 * fundamental type. Also language bindings should not use this
273 	 * function, but g_object_new() instead.
274 	 *
275 	 * Params:
276 	 *     type = an instantiatable type to create an instance for
277 	 *
278 	 * Returns: an allocated and initialized instance, subject to further
279 	 *     treatment by the fundamental type implementation
280 	 */
281 	public static TypeInstance createInstance(GType type)
282 	{
283 		auto __p = g_type_create_instance(type);
284 
285 		if(__p is null)
286 		{
287 			return null;
288 		}
289 
290 		return ObjectG.getDObject!(TypeInstance)(cast(GTypeInstance*) __p);
291 	}
292 
293 	/**
294 	 * If the interface type @g_type is currently in use, returns its
295 	 * default interface vtable.
296 	 *
297 	 * Params:
298 	 *     gType = an interface type
299 	 *
300 	 * Returns: the default
301 	 *     vtable for the interface, or %NULL if the type is not currently
302 	 *     in use
303 	 *
304 	 * Since: 2.4
305 	 */
306 	public static TypeInterface defaultInterfacePeek(GType gType)
307 	{
308 		auto __p = g_type_default_interface_peek(gType);
309 
310 		if(__p is null)
311 		{
312 			return null;
313 		}
314 
315 		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) __p);
316 	}
317 
318 	/**
319 	 * Increments the reference count for the interface type @g_type,
320 	 * and returns the default interface vtable for the type.
321 	 *
322 	 * If the type is not currently in use, then the default vtable
323 	 * for the type will be created and initalized by calling
324 	 * the base interface init and default vtable init functions for
325 	 * the type (the @base_init and @class_init members of #GTypeInfo).
326 	 * Calling g_type_default_interface_ref() is useful when you
327 	 * want to make sure that signals and properties for an interface
328 	 * have been installed.
329 	 *
330 	 * Params:
331 	 *     gType = an interface type
332 	 *
333 	 * Returns: the default
334 	 *     vtable for the interface; call g_type_default_interface_unref()
335 	 *     when you are done using the interface.
336 	 *
337 	 * Since: 2.4
338 	 */
339 	public static TypeInterface defaultInterfaceRef(GType gType)
340 	{
341 		auto __p = g_type_default_interface_ref(gType);
342 
343 		if(__p is null)
344 		{
345 			return null;
346 		}
347 
348 		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) __p);
349 	}
350 
351 	/**
352 	 * Decrements the reference count for the type corresponding to the
353 	 * interface default vtable @g_iface. If the type is dynamic, then
354 	 * when no one is using the interface and all references have
355 	 * been released, the finalize function for the interface's default
356 	 * vtable (the @class_finalize member of #GTypeInfo) will be called.
357 	 *
358 	 * Params:
359 	 *     gIface = the default vtable
360 	 *         structure for an interface, as returned by g_type_default_interface_ref()
361 	 *
362 	 * Since: 2.4
363 	 */
364 	public static void defaultInterfaceUnref(TypeInterface gIface)
365 	{
366 		g_type_default_interface_unref((gIface is null) ? null : gIface.getTypeInterfaceStruct());
367 	}
368 
369 	/**
370 	 * Returns the length of the ancestry of the passed in type. This
371 	 * includes the type itself, so that e.g. a fundamental type has depth 1.
372 	 *
373 	 * Params:
374 	 *     type = a #GType
375 	 *
376 	 * Returns: the depth of @type
377 	 */
378 	public static uint depth(GType type)
379 	{
380 		return g_type_depth(type);
381 	}
382 
383 	/**
384 	 * Ensures that the indicated @type has been registered with the
385 	 * type system, and its _class_init() method has been run.
386 	 *
387 	 * In theory, simply calling the type's _get_type() method (or using
388 	 * the corresponding macro) is supposed take care of this. However,
389 	 * _get_type() methods are often marked %G_GNUC_CONST for performance
390 	 * reasons, even though this is technically incorrect (since
391 	 * %G_GNUC_CONST requires that the function not have side effects,
392 	 * which _get_type() methods do on the first call). As a result, if
393 	 * you write a bare call to a _get_type() macro, it may get optimized
394 	 * out by the compiler. Using g_type_ensure() guarantees that the
395 	 * type's _get_type() method is called.
396 	 *
397 	 * Params:
398 	 *     type = a #GType
399 	 *
400 	 * Since: 2.34
401 	 */
402 	public static void ensure(GType type)
403 	{
404 		g_type_ensure(type);
405 	}
406 
407 	/**
408 	 * Frees an instance of a type, returning it to the instance pool for
409 	 * the type, if there is one.
410 	 *
411 	 * Like g_type_create_instance(), this function is reserved for
412 	 * implementors of fundamental types.
413 	 *
414 	 * Params:
415 	 *     instance_ = an instance of a type
416 	 */
417 	public static void freeInstance(TypeInstance instance_)
418 	{
419 		g_type_free_instance((instance_ is null) ? null : instance_.getTypeInstanceStruct());
420 	}
421 
422 	/**
423 	 * Look up the type ID from a given type name, returning 0 if no type
424 	 * has been registered under this name (this is the preferred method
425 	 * to find out by name whether a specific type has been registered
426 	 * yet).
427 	 *
428 	 * Params:
429 	 *     name = type name to look up
430 	 *
431 	 * Returns: corresponding type ID or 0
432 	 */
433 	public static GType fromName(string name)
434 	{
435 		return g_type_from_name(Str.toStringz(name));
436 	}
437 
438 	/**
439 	 * Internal function, used to extract the fundamental type ID portion.
440 	 * Use G_TYPE_FUNDAMENTAL() instead.
441 	 *
442 	 * Params:
443 	 *     typeId = valid type ID
444 	 *
445 	 * Returns: fundamental type ID
446 	 */
447 	public static GType fundamental(GType typeId)
448 	{
449 		return g_type_fundamental(typeId);
450 	}
451 
452 	/**
453 	 * Returns the next free fundamental type id which can be used to
454 	 * register a new fundamental type with g_type_register_fundamental().
455 	 * The returned type ID represents the highest currently registered
456 	 * fundamental type identifier.
457 	 *
458 	 * Returns: the next available fundamental type ID to be registered,
459 	 *     or 0 if the type system ran out of fundamental type IDs
460 	 */
461 	public static GType fundamentalNext()
462 	{
463 		return g_type_fundamental_next();
464 	}
465 
466 	/**
467 	 * Returns the #GTypePlugin structure for @type.
468 	 *
469 	 * Params:
470 	 *     type = #GType to retrieve the plugin for
471 	 *
472 	 * Returns: the corresponding plugin
473 	 *     if @type is a dynamic type, %NULL otherwise
474 	 */
475 	public static TypePluginIF getPlugin(GType type)
476 	{
477 		auto __p = g_type_get_plugin(type);
478 
479 		if(__p is null)
480 		{
481 			return null;
482 		}
483 
484 		return ObjectG.getDObject!(TypePluginIF)(cast(GTypePlugin*) __p);
485 	}
486 
487 	/**
488 	 * Obtains data which has previously been attached to @type
489 	 * with g_type_set_qdata().
490 	 *
491 	 * Note that this does not take subtyping into account; data
492 	 * attached to one type with g_type_set_qdata() cannot
493 	 * be retrieved from a subtype using g_type_get_qdata().
494 	 *
495 	 * Params:
496 	 *     type = a #GType
497 	 *     quark = a #GQuark id to identify the data
498 	 *
499 	 * Returns: the data, or %NULL if no data was found
500 	 */
501 	public static void* getQdata(GType type, GQuark quark)
502 	{
503 		return g_type_get_qdata(type, quark);
504 	}
505 
506 	/**
507 	 * Returns an opaque serial number that represents the state of the set
508 	 * of registered types. Any time a type is registered this serial changes,
509 	 * which means you can cache information based on type lookups (such as
510 	 * g_type_from_name()) and know if the cache is still valid at a later
511 	 * time by comparing the current serial with the one at the type lookup.
512 	 *
513 	 * Returns: An unsigned int, representing the state of type registrations
514 	 *
515 	 * Since: 2.36
516 	 */
517 	public static uint getTypeRegistrationSerial()
518 	{
519 		return g_type_get_type_registration_serial();
520 	}
521 
522 	/**
523 	 * This function used to initialise the type system.  Since GLib 2.36,
524 	 * the type system is initialised automatically and this function does
525 	 * nothing.
526 	 *
527 	 * Deprecated: the type system is now initialised automatically
528 	 */
529 	public static void init()
530 	{
531 		g_type_init();
532 	}
533 
534 	/**
535 	 * This function used to initialise the type system with debugging
536 	 * flags.  Since GLib 2.36, the type system is initialised automatically
537 	 * and this function does nothing.
538 	 *
539 	 * If you need to enable debugging features, use the GOBJECT_DEBUG
540 	 * environment variable.
541 	 *
542 	 * Deprecated: the type system is now initialised automatically
543 	 *
544 	 * Params:
545 	 *     debugFlags = bitwise combination of #GTypeDebugFlags values for
546 	 *         debugging purposes
547 	 */
548 	public static void initWithDebugFlags(GTypeDebugFlags debugFlags)
549 	{
550 		g_type_init_with_debug_flags(debugFlags);
551 	}
552 
553 	/**
554 	 * Return a newly allocated and 0-terminated array of type IDs, listing
555 	 * the interface types that @type conforms to.
556 	 *
557 	 * Params:
558 	 *     type = the type to list interface types for
559 	 *
560 	 * Returns: Newly allocated
561 	 *     and 0-terminated array of interface types, free with g_free()
562 	 */
563 	public static GType[] interfaces(GType type)
564 	{
565 		uint nInterfaces;
566 
567 		auto __p = g_type_interfaces(type, &nInterfaces);
568 
569 		return __p[0 .. nInterfaces];
570 	}
571 
572 	/**
573 	 * If @is_a_type is a derivable type, check whether @type is a
574 	 * descendant of @is_a_type. If @is_a_type is an interface, check
575 	 * whether @type conforms to it.
576 	 *
577 	 * Params:
578 	 *     type = type to check anchestry for
579 	 *     isAType = possible anchestor of @type or interface that @type
580 	 *         could conform to
581 	 *
582 	 * Returns: %TRUE if @type is a @is_a_type
583 	 */
584 	public static bool isA(GType type, GType isAType)
585 	{
586 		return g_type_is_a(type, isAType) != 0;
587 	}
588 
589 	/**
590 	 * Get the unique name that is assigned to a type ID.  Note that this
591 	 * function (like all other GType API) cannot cope with invalid type
592 	 * IDs. %G_TYPE_INVALID may be passed to this function, as may be any
593 	 * other validly registered type ID, but randomized type IDs should
594 	 * not be passed in and will most likely lead to a crash.
595 	 *
596 	 * Params:
597 	 *     type = type to return name for
598 	 *
599 	 * Returns: static type name or %NULL
600 	 */
601 	public static string name(GType type)
602 	{
603 		return Str.toString(g_type_name(type));
604 	}
605 
606 	/** */
607 	public static string nameFromClass(TypeClass gClass)
608 	{
609 		return Str.toString(g_type_name_from_class((gClass is null) ? null : gClass.getTypeClassStruct()));
610 	}
611 
612 	/** */
613 	public static string nameFromInstance(TypeInstance instance_)
614 	{
615 		return Str.toString(g_type_name_from_instance((instance_ is null) ? null : instance_.getTypeInstanceStruct()));
616 	}
617 
618 	/**
619 	 * Given a @leaf_type and a @root_type which is contained in its
620 	 * anchestry, return the type that @root_type is the immediate parent
621 	 * of. In other words, this function determines the type that is
622 	 * derived directly from @root_type which is also a base class of
623 	 * @leaf_type.  Given a root type and a leaf type, this function can
624 	 * be used to determine the types and order in which the leaf type is
625 	 * descended from the root type.
626 	 *
627 	 * Params:
628 	 *     leafType = descendant of @root_type and the type to be returned
629 	 *     rootType = immediate parent of the returned type
630 	 *
631 	 * Returns: immediate child of @root_type and anchestor of @leaf_type
632 	 */
633 	public static GType nextBase(GType leafType, GType rootType)
634 	{
635 		return g_type_next_base(leafType, rootType);
636 	}
637 
638 	/**
639 	 * Return the direct parent type of the passed in type. If the passed
640 	 * in type has no parent, i.e. is a fundamental type, 0 is returned.
641 	 *
642 	 * Params:
643 	 *     type = the derived type
644 	 *
645 	 * Returns: the parent type
646 	 */
647 	public static GType parent(GType type)
648 	{
649 		return g_type_parent(type);
650 	}
651 
652 	/**
653 	 * Get the corresponding quark of the type IDs name.
654 	 *
655 	 * Params:
656 	 *     type = type to return quark of type name for
657 	 *
658 	 * Returns: the type names quark or 0
659 	 */
660 	public static GQuark qname(GType type)
661 	{
662 		return g_type_qname(type);
663 	}
664 
665 	/**
666 	 * Queries the type system for information about a specific type.
667 	 * This function will fill in a user-provided structure to hold
668 	 * type-specific information. If an invalid #GType is passed in, the
669 	 * @type member of the #GTypeQuery is 0. All members filled into the
670 	 * #GTypeQuery structure should be considered constant and have to be
671 	 * left untouched.
672 	 *
673 	 * Params:
674 	 *     type = #GType of a static, classed type
675 	 *     query = a user provided structure that is
676 	 *         filled in with constant values upon success
677 	 */
678 	public static void query(GType type, out GTypeQuery query)
679 	{
680 		g_type_query(type, &query);
681 	}
682 
683 	/**
684 	 * Registers @type_name as the name of a new dynamic type derived from
685 	 * @parent_type.  The type system uses the information contained in the
686 	 * #GTypePlugin structure pointed to by @plugin to manage the type and its
687 	 * instances (if not abstract).  The value of @flags determines the nature
688 	 * (e.g. abstract or not) of the type.
689 	 *
690 	 * Params:
691 	 *     parentType = type from which this type will be derived
692 	 *     typeName = 0-terminated string used as the name of the new type
693 	 *     plugin = #GTypePlugin structure to retrieve the #GTypeInfo from
694 	 *     flags = bitwise combination of #GTypeFlags values
695 	 *
696 	 * Returns: the new type identifier or #G_TYPE_INVALID if registration failed
697 	 */
698 	public static GType registerDynamic(GType parentType, string typeName, TypePluginIF plugin, GTypeFlags flags)
699 	{
700 		return g_type_register_dynamic(parentType, Str.toStringz(typeName), (plugin is null) ? null : plugin.getTypePluginStruct(), flags);
701 	}
702 
703 	/**
704 	 * Registers @type_id as the predefined identifier and @type_name as the
705 	 * name of a fundamental type. If @type_id is already registered, or a
706 	 * type named @type_name is already registered, the behaviour is undefined.
707 	 * The type system uses the information contained in the #GTypeInfo structure
708 	 * pointed to by @info and the #GTypeFundamentalInfo structure pointed to by
709 	 * @finfo to manage the type and its instances. The value of @flags determines
710 	 * additional characteristics of the fundamental type.
711 	 *
712 	 * Params:
713 	 *     typeId = a predefined type identifier
714 	 *     typeName = 0-terminated string used as the name of the new type
715 	 *     info = #GTypeInfo structure for this type
716 	 *     finfo = #GTypeFundamentalInfo structure for this type
717 	 *     flags = bitwise combination of #GTypeFlags values
718 	 *
719 	 * Returns: the predefined type identifier
720 	 */
721 	public static GType registerFundamental(GType typeId, string typeName, GTypeInfo* info, GTypeFundamentalInfo* finfo, GTypeFlags flags)
722 	{
723 		return g_type_register_fundamental(typeId, Str.toStringz(typeName), info, finfo, flags);
724 	}
725 
726 	/**
727 	 * Registers @type_name as the name of a new static type derived from
728 	 * @parent_type. The type system uses the information contained in the
729 	 * #GTypeInfo structure pointed to by @info to manage the type and its
730 	 * instances (if not abstract). The value of @flags determines the nature
731 	 * (e.g. abstract or not) of the type.
732 	 *
733 	 * Params:
734 	 *     parentType = type from which this type will be derived
735 	 *     typeName = 0-terminated string used as the name of the new type
736 	 *     info = #GTypeInfo structure for this type
737 	 *     flags = bitwise combination of #GTypeFlags values
738 	 *
739 	 * Returns: the new type identifier
740 	 */
741 	public static GType registerStatic(GType parentType, string typeName, GTypeInfo* info, GTypeFlags flags)
742 	{
743 		return g_type_register_static(parentType, Str.toStringz(typeName), info, flags);
744 	}
745 
746 	/**
747 	 * Registers @type_name as the name of a new static type derived from
748 	 * @parent_type.  The value of @flags determines the nature (e.g.
749 	 * abstract or not) of the type. It works by filling a #GTypeInfo
750 	 * struct and calling g_type_register_static().
751 	 *
752 	 * Params:
753 	 *     parentType = type from which this type will be derived
754 	 *     typeName = 0-terminated string used as the name of the new type
755 	 *     classSize = size of the class structure (see #GTypeInfo)
756 	 *     classInit = location of the class initialization function (see #GTypeInfo)
757 	 *     instanceSize = size of the instance structure (see #GTypeInfo)
758 	 *     instanceInit = location of the instance initialization function (see #GTypeInfo)
759 	 *     flags = bitwise combination of #GTypeFlags values
760 	 *
761 	 * Returns: the new type identifier
762 	 *
763 	 * Since: 2.12
764 	 */
765 	public static GType registerStaticSimple(GType parentType, string typeName, uint classSize, GClassInitFunc classInit, uint instanceSize, GInstanceInitFunc instanceInit, GTypeFlags flags)
766 	{
767 		return g_type_register_static_simple(parentType, Str.toStringz(typeName), classSize, classInit, instanceSize, instanceInit, flags);
768 	}
769 
770 	/**
771 	 * Removes a previously installed #GTypeClassCacheFunc. The cache
772 	 * maintained by @cache_func has to be empty when calling
773 	 * g_type_remove_class_cache_func() to avoid leaks.
774 	 *
775 	 * Params:
776 	 *     cacheData = data that was given when adding @cache_func
777 	 *     cacheFunc = a #GTypeClassCacheFunc
778 	 */
779 	public static void removeClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)
780 	{
781 		g_type_remove_class_cache_func(cacheData, cacheFunc);
782 	}
783 
784 	/**
785 	 * Removes an interface check function added with
786 	 * g_type_add_interface_check().
787 	 *
788 	 * Params:
789 	 *     checkData = callback data passed to g_type_add_interface_check()
790 	 *     checkFunc = callback function passed to g_type_add_interface_check()
791 	 *
792 	 * Since: 2.4
793 	 */
794 	public static void removeInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)
795 	{
796 		g_type_remove_interface_check(checkData, checkFunc);
797 	}
798 
799 	/**
800 	 * Attaches arbitrary data to a type.
801 	 *
802 	 * Params:
803 	 *     type = a #GType
804 	 *     quark = a #GQuark id to identify the data
805 	 *     data = the data
806 	 */
807 	public static void setQdata(GType type, GQuark quark, void* data)
808 	{
809 		g_type_set_qdata(type, quark, data);
810 	}
811 
812 	/** */
813 	public static bool testFlags(GType type, uint flags)
814 	{
815 		return g_type_test_flags(type, flags) != 0;
816 	}
817 
818 	/**
819 	 * Returns the number of instances allocated of the particular type;
820 	 * this is only available if GLib is built with debugging support and
821 	 * the instance_count debug flag is set (by setting the GOBJECT_DEBUG
822 	 * variable to include instance-count).
823 	 *
824 	 * Params:
825 	 *     type = a #GType
826 	 *
827 	 * Returns: the number of instances allocated of the given type;
828 	 *     if instance counts are not available, returns 0.
829 	 *
830 	 * Since: 2.44
831 	 */
832 	public static int getInstanceCount(GType type)
833 	{
834 		return g_type_get_instance_count(type);
835 	}
836 }