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