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 	 *     nChildren = location to store the length of
235 	 *         the returned array, or %NULL
236 	 *
237 	 * Return: Newly allocated
238 	 *     and 0-terminated array of child types, free with g_free()
239 	 */
240 	public static GType[] children(GType type)
241 	{
242 		uint nChildren;
243 		
244 		auto p = g_type_children(type, &nChildren);
245 		
246 		return p[0 .. nChildren];
247 	}
248 
249 	/**
250 	 * Creates and initializes an instance of @type if @type is valid and
251 	 * can be instantiated. The type system only performs basic allocation
252 	 * and structure setups for instances: actual instance creation should
253 	 * happen through functions supplied by the type's fundamental type
254 	 * implementation.  So use of g_type_create_instance() is reserved for
255 	 * implementators of fundamental types only. E.g. instances of the
256 	 * #GObject hierarchy should be created via g_object_new() and never
257 	 * directly through g_type_create_instance() which doesn't handle things
258 	 * like singleton objects or object construction.
259 	 *
260 	 * The extended members of the returned instance are guaranteed to be filled
261 	 * with zeros.
262 	 *
263 	 * Note: Do not use this function, unless you're implementing a
264 	 * fundamental type. Also language bindings should not use this
265 	 * function, but g_object_new() instead.
266 	 *
267 	 * Params:
268 	 *     type = an instantiatable type to create an instance for
269 	 *
270 	 * Return: an allocated and initialized instance, subject to further
271 	 *     treatment by the fundamental type implementation
272 	 */
273 	public static TypeInstance createInstance(GType type)
274 	{
275 		auto p = g_type_create_instance(type);
276 		
277 		if(p is null)
278 		{
279 			return null;
280 		}
281 		
282 		return ObjectG.getDObject!(TypeInstance)(cast(GTypeInstance*) p);
283 	}
284 
285 	/**
286 	 * If the interface type @g_type is currently in use, returns its
287 	 * default interface vtable.
288 	 *
289 	 * Params:
290 	 *     gType = an interface type
291 	 *
292 	 * Return: the default
293 	 *     vtable for the interface, or %NULL if the type is not currently
294 	 *     in use
295 	 *
296 	 * Since: 2.4
297 	 */
298 	public static TypeInterface defaultInterfacePeek(GType gType)
299 	{
300 		auto p = g_type_default_interface_peek(gType);
301 		
302 		if(p is null)
303 		{
304 			return null;
305 		}
306 		
307 		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) p);
308 	}
309 
310 	/**
311 	 * Increments the reference count for the interface type @g_type,
312 	 * and returns the default interface vtable for the type.
313 	 *
314 	 * If the type is not currently in use, then the default vtable
315 	 * for the type will be created and initalized by calling
316 	 * the base interface init and default vtable init functions for
317 	 * the type (the @base_init and @class_init members of #GTypeInfo).
318 	 * Calling g_type_default_interface_ref() is useful when you
319 	 * want to make sure that signals and properties for an interface
320 	 * have been installed.
321 	 *
322 	 * Params:
323 	 *     gType = an interface type
324 	 *
325 	 * Return: the default
326 	 *     vtable for the interface; call g_type_default_interface_unref()
327 	 *     when you are done using the interface.
328 	 *
329 	 * Since: 2.4
330 	 */
331 	public static TypeInterface defaultInterfaceRef(GType gType)
332 	{
333 		auto p = g_type_default_interface_ref(gType);
334 		
335 		if(p is null)
336 		{
337 			return null;
338 		}
339 		
340 		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) p);
341 	}
342 
343 	/**
344 	 * Decrements the reference count for the type corresponding to the
345 	 * interface default vtable @g_iface. If the type is dynamic, then
346 	 * when no one is using the interface and all references have
347 	 * been released, the finalize function for the interface's default
348 	 * vtable (the @class_finalize member of #GTypeInfo) will be called.
349 	 *
350 	 * Params:
351 	 *     gIface = the default vtable
352 	 *         structure for a interface, as returned by g_type_default_interface_ref()
353 	 *
354 	 * Since: 2.4
355 	 */
356 	public static void defaultInterfaceUnref(TypeInterface gIface)
357 	{
358 		g_type_default_interface_unref((gIface is null) ? null : gIface.getTypeInterfaceStruct());
359 	}
360 
361 	/**
362 	 * Returns the length of the ancestry of the passed in type. This
363 	 * includes the type itself, so that e.g. a fundamental type has depth 1.
364 	 *
365 	 * Params:
366 	 *     type = a #GType
367 	 *
368 	 * Return: the depth of @type
369 	 */
370 	public static uint depth(GType type)
371 	{
372 		return g_type_depth(type);
373 	}
374 
375 	/**
376 	 * Ensures that the indicated @type has been registered with the
377 	 * type system, and its _class_init() method has been run.
378 	 *
379 	 * In theory, simply calling the type's _get_type() method (or using
380 	 * the corresponding macro) is supposed take care of this. However,
381 	 * _get_type() methods are often marked %G_GNUC_CONST for performance
382 	 * reasons, even though this is technically incorrect (since
383 	 * %G_GNUC_CONST requires that the function not have side effects,
384 	 * which _get_type() methods do on the first call). As a result, if
385 	 * you write a bare call to a _get_type() macro, it may get optimized
386 	 * out by the compiler. Using g_type_ensure() guarantees that the
387 	 * type's _get_type() method is called.
388 	 *
389 	 * Params:
390 	 *     type = a #GType
391 	 *
392 	 * Since: 2.34
393 	 */
394 	public static void ensure(GType type)
395 	{
396 		g_type_ensure(type);
397 	}
398 
399 	/**
400 	 * Frees an instance of a type, returning it to the instance pool for
401 	 * the type, if there is one.
402 	 *
403 	 * Like g_type_create_instance(), this function is reserved for
404 	 * implementors of fundamental types.
405 	 *
406 	 * Params:
407 	 *     instanc = an instance of a type
408 	 */
409 	public static void freeInstance(TypeInstance instanc)
410 	{
411 		g_type_free_instance((instanc is null) ? null : instanc.getTypeInstanceStruct());
412 	}
413 
414 	/**
415 	 * Lookup the type ID from a given type name, returning 0 if no type
416 	 * has been registered under this name (this is the preferred method
417 	 * to find out by name whether a specific type has been registered
418 	 * yet).
419 	 *
420 	 * Params:
421 	 *     name = type name to lookup
422 	 *
423 	 * Return: corresponding type ID or 0
424 	 */
425 	public static GType fromName(string name)
426 	{
427 		return g_type_from_name(Str.toStringz(name));
428 	}
429 
430 	/**
431 	 * Internal function, used to extract the fundamental type ID portion.
432 	 * Use G_TYPE_FUNDAMENTAL() instead.
433 	 *
434 	 * Params:
435 	 *     typeId = valid type ID
436 	 *
437 	 * Return: fundamental type ID
438 	 */
439 	public static GType fundamental(GType typeId)
440 	{
441 		return g_type_fundamental(typeId);
442 	}
443 
444 	/**
445 	 * Returns the next free fundamental type id which can be used to
446 	 * register a new fundamental type with g_type_register_fundamental().
447 	 * The returned type ID represents the highest currently registered
448 	 * fundamental type identifier.
449 	 *
450 	 * Return: the next available fundamental type ID to be registered,
451 	 *     or 0 if the type system ran out of fundamental type IDs
452 	 */
453 	public static GType fundamentalNext()
454 	{
455 		return g_type_fundamental_next();
456 	}
457 
458 	/**
459 	 * Returns the #GTypePlugin structure for @type.
460 	 *
461 	 * Params:
462 	 *     type = #GType to retrieve the plugin for
463 	 *
464 	 * Return: the corresponding plugin
465 	 *     if @type is a dynamic type, %NULL otherwise
466 	 */
467 	public static TypePluginIF getPlugin(GType type)
468 	{
469 		auto p = g_type_get_plugin(type);
470 		
471 		if(p is null)
472 		{
473 			return null;
474 		}
475 		
476 		return ObjectG.getDObject!(TypePlugin, TypePluginIF)(cast(GTypePlugin*) p);
477 	}
478 
479 	/**
480 	 * Obtains data which has previously been attached to @type
481 	 * with g_type_set_qdata().
482 	 *
483 	 * Note that this does not take subtyping into account; data
484 	 * attached to one type with g_type_set_qdata() cannot
485 	 * be retrieved from a subtype using g_type_get_qdata().
486 	 *
487 	 * Params:
488 	 *     type = a #GType
489 	 *     quark = a #GQuark id to identify the data
490 	 *
491 	 * Return: the data, or %NULL if no data was found
492 	 */
493 	public static void* getQdata(GType type, GQuark quark)
494 	{
495 		return g_type_get_qdata(type, quark);
496 	}
497 
498 	/**
499 	 * Returns an opaque serial number that represents the state of the set
500 	 * of registered types. Any time a type is registered this serial changes,
501 	 * which means you can cache information based on type lookups (such as
502 	 * g_type_from_name()) and know if the cache is still valid at a later
503 	 * time by comparing the current serial with the one at the type lookup.
504 	 *
505 	 * Return: An unsigned int, representing the state of type registrations
506 	 *
507 	 * Since: 2.36
508 	 */
509 	public static uint getTypeRegistrationSerial()
510 	{
511 		return g_type_get_type_registration_serial();
512 	}
513 
514 	/**
515 	 * This function used to initialise the type system.  Since GLib 2.36,
516 	 * the type system is initialised automatically and this function does
517 	 * nothing.
518 	 *
519 	 * Deprecated: the type system is now initialised automatically
520 	 */
521 	public static void init()
522 	{
523 		g_type_init();
524 	}
525 
526 	/**
527 	 * This function used to initialise the type system with debugging
528 	 * flags.  Since GLib 2.36, the type system is initialised automatically
529 	 * and this function does nothing.
530 	 *
531 	 * If you need to enable debugging features, use the GOBJECT_DEBUG
532 	 * environment variable.
533 	 *
534 	 * Deprecated: the type system is now initialised automatically
535 	 *
536 	 * Params:
537 	 *     debugFlags = bitwise combination of #GTypeDebugFlags values for
538 	 *         debugging purposes
539 	 */
540 	public static void initWithDebugFlags(GTypeDebugFlags debugFlags)
541 	{
542 		g_type_init_with_debug_flags(debugFlags);
543 	}
544 
545 	/**
546 	 * Return a newly allocated and 0-terminated array of type IDs, listing
547 	 * the interface types that @type conforms to.
548 	 *
549 	 * Params:
550 	 *     type = the type to list interface types for
551 	 *     nInterfaces = location to store the length of
552 	 *         the returned array, or %NULL
553 	 *
554 	 * Return: Newly allocated
555 	 *     and 0-terminated array of interface types, free with g_free()
556 	 */
557 	public static GType[] interfaces(GType type)
558 	{
559 		uint nInterfaces;
560 		
561 		auto p = g_type_interfaces(type, &nInterfaces);
562 		
563 		return p[0 .. nInterfaces];
564 	}
565 
566 	/**
567 	 * If @is_a_type is a derivable type, check whether @type is a
568 	 * descendant of @is_a_type. If @is_a_type is an interface, check
569 	 * whether @type conforms to it.
570 	 *
571 	 * Params:
572 	 *     type = type to check anchestry for
573 	 *     isAType = possible anchestor of @type or interface that @type
574 	 *         could conform to
575 	 *
576 	 * Return: %TRUE if @type is a @is_a_type
577 	 */
578 	public static bool isA(GType type, GType isAType)
579 	{
580 		return g_type_is_a(type, isAType) != 0;
581 	}
582 
583 	/**
584 	 * Get the unique name that is assigned to a type ID.  Note that this
585 	 * function (like all other GType API) cannot cope with invalid type
586 	 * IDs. %G_TYPE_INVALID may be passed to this function, as may be any
587 	 * other validly registered type ID, but randomized type IDs should
588 	 * not be passed in and will most likely lead to a crash.
589 	 *
590 	 * Params:
591 	 *     type = type to return name for
592 	 *
593 	 * Return: static type name or %NULL
594 	 */
595 	public static string name(GType type)
596 	{
597 		return Str.toString(g_type_name(type));
598 	}
599 
600 	public static string nameFromClass(TypeClass gClass)
601 	{
602 		return Str.toString(g_type_name_from_class((gClass is null) ? null : gClass.getTypeClassStruct()));
603 	}
604 
605 	public static string nameFromInstance(TypeInstance instanc)
606 	{
607 		return Str.toString(g_type_name_from_instance((instanc is null) ? null : instanc.getTypeInstanceStruct()));
608 	}
609 
610 	/**
611 	 * Given a @leaf_type and a @root_type which is contained in its
612 	 * anchestry, return the type that @root_type is the immediate parent
613 	 * of. In other words, this function determines the type that is
614 	 * derived directly from @root_type which is also a base class of
615 	 * @leaf_type.  Given a root type and a leaf type, this function can
616 	 * be used to determine the types and order in which the leaf type is
617 	 * descended from the root type.
618 	 *
619 	 * Params:
620 	 *     leafType = descendant of @root_type and the type to be returned
621 	 *     rootType = immediate parent of the returned type
622 	 *
623 	 * Return: immediate child of @root_type and anchestor of @leaf_type
624 	 */
625 	public static GType nextBase(GType leafType, GType rootType)
626 	{
627 		return g_type_next_base(leafType, rootType);
628 	}
629 
630 	/**
631 	 * Return the direct parent type of the passed in type. If the passed
632 	 * in type has no parent, i.e. is a fundamental type, 0 is returned.
633 	 *
634 	 * Params:
635 	 *     type = the derived type
636 	 *
637 	 * Return: the parent type
638 	 */
639 	public static GType parent(GType type)
640 	{
641 		return g_type_parent(type);
642 	}
643 
644 	/**
645 	 * Get the corresponding quark of the type IDs name.
646 	 *
647 	 * Params:
648 	 *     type = type to return quark of type name for
649 	 *
650 	 * Return: the type names quark or 0
651 	 */
652 	public static GQuark qname(GType type)
653 	{
654 		return g_type_qname(type);
655 	}
656 
657 	/**
658 	 * Queries the type system for information about a specific type.
659 	 * This function will fill in a user-provided structure to hold
660 	 * type-specific information. If an invalid #GType is passed in, the
661 	 * @type member of the #GTypeQuery is 0. All members filled into the
662 	 * #GTypeQuery structure should be considered constant and have to be
663 	 * left untouched.
664 	 *
665 	 * Params:
666 	 *     type = #GType of a static, classed type
667 	 *     query = a user provided structure that is
668 	 *         filled in with constant values upon success
669 	 */
670 	public static void query(GType type, out GTypeQuery query)
671 	{
672 		g_type_query(type, &query);
673 	}
674 
675 	/**
676 	 * Registers @type_name as the name of a new dynamic type derived from
677 	 * @parent_type.  The type system uses the information contained in the
678 	 * #GTypePlugin structure pointed to by @plugin to manage the type and its
679 	 * instances (if not abstract).  The value of @flags determines the nature
680 	 * (e.g. abstract or not) of the type.
681 	 *
682 	 * Params:
683 	 *     parentType = type from which this type will be derived
684 	 *     typeName = 0-terminated string used as the name of the new type
685 	 *     plugin = #GTypePlugin structure to retrieve the #GTypeInfo from
686 	 *     flags = bitwise combination of #GTypeFlags values
687 	 *
688 	 * Return: the new type identifier or #G_TYPE_INVALID if registration failed
689 	 */
690 	public static GType registerDynamic(GType parentType, string typeName, TypePluginIF plugin, GTypeFlags flags)
691 	{
692 		return g_type_register_dynamic(parentType, Str.toStringz(typeName), (plugin is null) ? null : plugin.getTypePluginStruct(), flags);
693 	}
694 
695 	/**
696 	 * Registers @type_id as the predefined identifier and @type_name as the
697 	 * name of a fundamental type. If @type_id is already registered, or a
698 	 * type named @type_name is already registered, the behaviour is undefined.
699 	 * The type system uses the information contained in the #GTypeInfo structure
700 	 * pointed to by @info and the #GTypeFundamentalInfo structure pointed to by
701 	 * @finfo to manage the type and its instances. The value of @flags determines
702 	 * additional characteristics of the fundamental type.
703 	 *
704 	 * Params:
705 	 *     typeId = a predefined type identifier
706 	 *     typeName = 0-terminated string used as the name of the new type
707 	 *     info = #GTypeInfo structure for this type
708 	 *     finfo = #GTypeFundamentalInfo structure for this type
709 	 *     flags = bitwise combination of #GTypeFlags values
710 	 *
711 	 * Return: the predefined type identifier
712 	 */
713 	public static GType registerFundamental(GType typeId, string typeName, GTypeInfo* info, GTypeFundamentalInfo* finfo, GTypeFlags flags)
714 	{
715 		return g_type_register_fundamental(typeId, Str.toStringz(typeName), info, finfo, flags);
716 	}
717 
718 	/**
719 	 * Registers @type_name as the name of a new static type derived from
720 	 * @parent_type. The type system uses the information contained in the
721 	 * #GTypeInfo structure pointed to by @info to manage the type and its
722 	 * instances (if not abstract). The value of @flags determines the nature
723 	 * (e.g. abstract or not) of the type.
724 	 *
725 	 * Params:
726 	 *     parentType = type from which this type will be derived
727 	 *     typeName = 0-terminated string used as the name of the new type
728 	 *     info = #GTypeInfo structure for this type
729 	 *     flags = bitwise combination of #GTypeFlags values
730 	 *
731 	 * Return: the new type identifier
732 	 */
733 	public static GType registerStatic(GType parentType, string typeName, GTypeInfo* info, GTypeFlags flags)
734 	{
735 		return g_type_register_static(parentType, Str.toStringz(typeName), info, flags);
736 	}
737 
738 	/**
739 	 * Registers @type_name as the name of a new static type derived from
740 	 * @parent_type.  The value of @flags determines the nature (e.g.
741 	 * abstract or not) of the type. It works by filling a #GTypeInfo
742 	 * struct and calling g_type_register_static().
743 	 *
744 	 * Params:
745 	 *     parentType = type from which this type will be derived
746 	 *     typeName = 0-terminated string used as the name of the new type
747 	 *     classSize = size of the class structure (see #GTypeInfo)
748 	 *     classInit = location of the class initialization function (see #GTypeInfo)
749 	 *     instanceSize = size of the instance structure (see #GTypeInfo)
750 	 *     instanceInit = location of the instance initialization function (see #GTypeInfo)
751 	 *     flags = bitwise combination of #GTypeFlags values
752 	 *
753 	 * Return: the new type identifier
754 	 *
755 	 * Since: 2.12
756 	 */
757 	public static GType registerStaticSimple(GType parentType, string typeName, uint classSize, GClassInitFunc classInit, uint instanceSize, GInstanceInitFunc instanceInit, GTypeFlags flags)
758 	{
759 		return g_type_register_static_simple(parentType, Str.toStringz(typeName), classSize, classInit, instanceSize, instanceInit, flags);
760 	}
761 
762 	/**
763 	 * Removes a previously installed #GTypeClassCacheFunc. The cache
764 	 * maintained by @cache_func has to be empty when calling
765 	 * g_type_remove_class_cache_func() to avoid leaks.
766 	 *
767 	 * Params:
768 	 *     cacheData = data that was given when adding @cache_func
769 	 *     cacheFunc = a #GTypeClassCacheFunc
770 	 */
771 	public static void removeClassCacheFunc(void* cacheData, GTypeClassCacheFunc cacheFunc)
772 	{
773 		g_type_remove_class_cache_func(cacheData, cacheFunc);
774 	}
775 
776 	/**
777 	 * Removes an interface check function added with
778 	 * g_type_add_interface_check().
779 	 *
780 	 * Params:
781 	 *     checkData = callback data passed to g_type_add_interface_check()
782 	 *     checkFunc = callback function passed to g_type_add_interface_check()
783 	 *
784 	 * Since: 2.4
785 	 */
786 	public static void removeInterfaceCheck(void* checkData, GTypeInterfaceCheckFunc checkFunc)
787 	{
788 		g_type_remove_interface_check(checkData, checkFunc);
789 	}
790 
791 	/**
792 	 * Attaches arbitrary data to a type.
793 	 *
794 	 * Params:
795 	 *     type = a #GType
796 	 *     quark = a #GQuark id to identify the data
797 	 *     data = the data
798 	 */
799 	public static void setQdata(GType type, GQuark quark, void* data)
800 	{
801 		g_type_set_qdata(type, quark, data);
802 	}
803 
804 	public static bool testFlags(GType type, uint flags)
805 	{
806 		return g_type_test_flags(type, flags) != 0;
807 	}
808 }