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  = glib-GVariantType.html
27  * outPack = glib
28  * outFile = VariantType
29  * strct   = GVariantType
30  * realStrct=
31  * ctorStrct=
32  * clss    = VariantType
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_variant_type_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- g_variant_type_new_maybe
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtkc.paths
49  * 	- gtkc.Loader
50  * structWrap:
51  * 	- GVariantType* -> VariantType
52  * module aliases:
53  * local aliases:
54  * 	- string -> str
55  * overrides:
56  */
57 
58 module glib.VariantType;
59 
60 public  import gtkc.glibtypes;
61 
62 private import gtkc.glib;
63 private import glib.ConstructionException;
64 
65 
66 private import glib.Str;
67 private import gtkc.paths;
68 private import gtkc.Loader;
69 
70 
71 
72 
73 /**
74  * This section introduces the GVariant type system. It is based, in
75  * large part, on the D-Bus type system, with two major changes and some minor
76  * lifting of restrictions. The DBus
77  * specification, therefore, provides a significant amount of
78  * information that is useful when working with GVariant.
79  *
80  * The first major change with respect to the D-Bus type system is the
81  * introduction of maybe (or "nullable") types. Any type in GVariant can be
82  * converted to a maybe type, in which case, "nothing" (or "null") becomes a
83  * valid value. Maybe types have been added by introducing the
84  * character "m" to type strings.
85  *
86  * The second major change is that the GVariant type system supports the
87  * concept of "indefinite types" -- types that are less specific than
88  * the normal types found in D-Bus. For example, it is possible to speak
89  * of "an array of any type" in GVariant, where the D-Bus type system
90  * would require you to speak of "an array of integers" or "an array of
91  * strings". Indefinite types have been added by introducing the
92  * characters "*", "?" and
93  * "r" to type strings.
94  *
95  * Finally, all arbitrary restrictions relating to the complexity of
96  * types are lifted along with the restriction that dictionary entries
97  * may only appear nested inside of arrays.
98  *
99  * Just as in D-Bus, GVariant types are described with strings ("type
100  * strings"). Subject to the differences mentioned above, these strings
101  * are of the same form as those found in DBus. Note, however: D-Bus
102  * always works in terms of messages and therefore individual type
103  * strings appear nowhere in its interface. Instead, "signatures"
104  * are a concatenation of the strings of the type of each argument in a
105  * message. GVariant deals with single values directly so GVariant type
106  * strings always describe the type of exactly one value. This means
107  * that a D-Bus signature string is generally not a valid GVariant type
108  * string -- except in the case that it is the signature of a message
109  * containing exactly one argument.
110  *
111  * An indefinite type is similar in spirit to what may be called an
112  * abstract type in other type systems. No value can exist that has an
113  * indefinite type as its type, but values can exist that have types
114  * that are subtypes of indefinite types. That is to say,
115  * g_variant_get_type() will never return an indefinite type, but
116  * calling g_variant_is_of_type() with an indefinite type may return
117  * TRUE. For example, you cannot have a value that represents "an
118  * array of no particular type", but you can have an "array of integers"
119  * which certainly matches the type of "an array of no particular type",
120  * since "array of integers" is a subtype of "array of no particular
121  * type".
122  *
123  * This is similar to how instances of abstract classes may not
124  * directly exist in other type systems, but instances of their
125  * non-abstract subtypes may. For example, in GTK, no object that has
126  * the type of GtkBin can exist (since GtkBin is an abstract class),
127  * but a GtkWindow can certainly be instantiated, and you would say
128  * that the GtkWindow is a GtkBin (since GtkWindow is a subclass of
129  * GtkBin).
130  *
131  * A detailed description of GVariant type strings is given here:
132  *
133  * GVariant Type Strings
134  *
135  *  A GVariant type string can be any of the following:
136  *
137  *  any basic type string (listed below)
138  *
139  *  "v", "r" or
140  *  "*"
141  *
142  *  one of the characters 'a' or
143  *  'm', followed by another type string
144  *
145  *  the character '(', followed by a concatenation
146  *  of zero or more other type strings, followed by the character
147  *  ')'
148  *
149  *  the character '{', followed by a basic type
150  *  string (see below), followed by another type string, followed by
151  *  the character '}'
152  *
153  *  A basic type string describes a basic type (as per
154  *  g_variant_type_is_basic()) and is always a single
155  *  character in length. The valid basic type strings are
156  *  "b", "y",
157  *  "n", "q",
158  *  "i", "u",
159  *  "x", "t",
160  *  "h", "d",
161  *  "s", "o",
162  *  "g" and "?".
163  *
164  *  The above definition is recursive to arbitrary depth.
165  *  "aaaaai" and "(ui(nq((y)))s)"
166  *  are both valid type strings, as is
167  *  "a(aa(ui)(qna{ya(yd)}))".
168  *
169  *  The meaning of each of the characters is as follows:
170  *
171  *  Character
172  *
173  *  Meaning
174  *
175  *  b
176  *
177  *  the type string of G_VARIANT_TYPE_BOOLEAN; a boolean value.
178  *
179  *  y
180  *
181  *  the type string of G_VARIANT_TYPE_BYTE; a byte.
182  *
183  *  n
184  *
185  *  the type string of G_VARIANT_TYPE_INT16; a signed 16 bit
186  *  integer.
187  *
188  *  q
189  *
190  *  the type string of G_VARIANT_TYPE_UINT16; an unsigned 16 bit
191  *  integer.
192  *
193  *  i
194  *
195  *  the type string of G_VARIANT_TYPE_INT32; a signed 32 bit
196  *  integer.
197  *
198  *  u
199  *
200  *  the type string of G_VARIANT_TYPE_UINT32; an unsigned 32 bit
201  *  integer.
202  *
203  *  x
204  *
205  *  the type string of G_VARIANT_TYPE_INT64; a signed 64 bit
206  *  integer.
207  *
208  *  t
209  *
210  *  the type string of G_VARIANT_TYPE_UINT64; an unsigned 64 bit
211  *  integer.
212  *
213  *  h
214  *
215  *  the type string of G_VARIANT_TYPE_HANDLE; a signed 32 bit
216  *  value that, by convention, is used as an index into an array
217  *  of file descriptors that are sent alongside a D-Bus message.
218  *
219  *  d
220  *
221  *  the type string of G_VARIANT_TYPE_DOUBLE; a double precision
222  *  floating point value.
223  *
224  *  s
225  *
226  *  the type string of G_VARIANT_TYPE_STRING; a string.
227  *
228  *  o
229  *
230  *  the type string of G_VARIANT_TYPE_OBJECT_PATH; a string in
231  *  the form of a D-Bus object path.
232  *
233  *  g
234  *
235  *  the type string of G_VARIANT_TYPE_STRING; a string in the
236  *  form of a D-Bus type signature.
237  *
238  *  ?
239  *
240  *  the type string of G_VARIANT_TYPE_BASIC; an indefinite type
241  *  that is a supertype of any of the basic types.
242  *
243  *  v
244  *
245  *  the type string of G_VARIANT_TYPE_VARIANT; a container type
246  *  that contain any other type of value.
247  *
248  *  a
249  *
250  *  used as a prefix on another type string to mean an array of
251  *  that type; the type string "ai", for
252  *  example, is the type of an array of 32 bit signed integers.
253  *
254  *  m
255  *
256  *  used as a prefix on another type string to mean a "maybe", or
257  *  "nullable", version of that type; the type string
258  *  "ms", for example, is the type of a value
259  *  that maybe contains a string, or maybe contains nothing.
260  *
261  *  ()
262  *
263  *  used to enclose zero or more other concatenated type strings
264  *  to create a tuple type; the type string
265  *  "(is)", for example, is the type of a pair
266  *  of an integer and a string.
267  *
268  *  r
269  *
270  *  the type string of G_VARIANT_TYPE_TUPLE; an indefinite type
271  *  that is a supertype of any tuple type, regardless of the
272  *  number of items.
273  *
274  *  {}
275  *
276  *  used to enclose a basic type string concatenated with another
277  *  type string to create a dictionary entry type, which usually
278  *  appears inside of an array to form a dictionary; the type
279  *  string "a{sd}", for example, is the type of
280  *  a dictionary that maps strings to double precision floating
281  *  point values.
282  *
283  *  The first type (the basic type) is the key type and the second
284  *  type is the value type. The reason that the first type is
285  *  restricted to being a basic type is so that it can easily be
286  *  hashed.
287  *
288  *  *
289  *
290  *  the type string of G_VARIANT_TYPE_ANY; the indefinite type
291  *  that is a supertype of all types. Note that, as with all type
292  *  strings, this character represents exactly one type. It
293  *  cannot be used inside of tuples to mean "any number of items".
294  *
295  *  Any type string of a container that contains an indefinite type is,
296  *  itself, an indefinite type. For example, the type string
297  *  "a*" (corresponding to G_VARIANT_TYPE_ARRAY) is
298  *  an indefinite type that is a supertype of every array type.
299  *  "(*s)" is a supertype of all tuples that
300  *  contain exactly two items where the second item is a string.
301  *
302  *  "a{?*}" is an indefinite type that is a
303  *  supertype of all arrays containing dictionary entries where the key
304  *  is any basic type and the value is any type at all. This is, by
305  *  definition, a dictionary, so this type string corresponds to
306  *  G_VARIANT_TYPE_DICTIONARY. Note that, due to the restriction that
307  *  the key of a dictionary entry must be a basic type,
308  *  "{**}" is not a valid type string.
309  */
310 public class VariantType
311 {
312 	
313 	/** the main Gtk struct */
314 	protected GVariantType* gVariantType;
315 	
316 	
317 	public GVariantType* getVariantTypeStruct()
318 	{
319 		return gVariantType;
320 	}
321 	
322 	
323 	/** the main Gtk struct as a void* */
324 	protected void* getStruct()
325 	{
326 		return cast(void*)gVariantType;
327 	}
328 	
329 	/**
330 	 * Sets our main struct and passes it to the parent class
331 	 */
332 	public this (GVariantType* gVariantType)
333 	{
334 		this.gVariantType = gVariantType;
335 	}
336 	
337 	~this ()
338 	{
339 		if (  Linker.isLoaded(LIBRARY.GLIB) && gVariantType !is null )
340 		{
341 			g_variant_type_free(gVariantType);
342 		}
343 	}
344 	
345 	/**
346 	 * Constructs the type corresponding to a maybe instance containing
347 	 * type type or Nothing.
348 	 * It is appropriate to call g_variant_type_free() on the return value.
349 	 * Since 2.24
350 	 * Params:
351 	 * element = a GVariantType
352 	 * Throws: ConstructionException GTK+ fails to create the object.
353 	 */
354 	public static VariantType newMaybe(VariantType element)
355 	{
356 		// GVariantType * g_variant_type_new_maybe (const GVariantType *element);
357 		auto p = g_variant_type_new_maybe((element is null) ? null : element.getVariantTypeStruct());
358 		if(p is null)
359 		{
360 			throw new ConstructionException("null returned by g_variant_type_new_maybe((element is null) ? null : element.getVariantTypeStruct())");
361 		}
362 		return new VariantType(cast(GVariantType*) p);
363 	}
364 	
365 	/**
366 	 */
367 	
368 	/**
369 	 * Frees a GVariantType that was allocated with
370 	 * g_variant_type_copy(), g_variant_type_new() or one of the container
371 	 * type constructor functions.
372 	 * In the case that type is NULL, this function does nothing.
373 	 * Since 2.24
374 	 */
375 	public void free()
376 	{
377 		// void g_variant_type_free (GVariantType *type);
378 		g_variant_type_free(gVariantType);
379 	}
380 	
381 	/**
382 	 * Makes a copy of a GVariantType. It is appropriate to call
383 	 * g_variant_type_free() on the return value. type may not be NULL.
384 	 * Since 2.24. [transfer full]
385 	 * Returns: a new GVariantType
386 	 */
387 	public VariantType copy()
388 	{
389 		// GVariantType * g_variant_type_copy (const GVariantType *type);
390 		auto p = g_variant_type_copy(gVariantType);
391 		
392 		if(p is null)
393 		{
394 			return null;
395 		}
396 		
397 		return new VariantType(cast(GVariantType*) p);
398 	}
399 	
400 	/**
401 	 * Creates a new GVariantType corresponding to the type string given
402 	 * by type_string. It is appropriate to call g_variant_type_free() on
403 	 * the return value.
404 	 * It is a programmer error to call this function with an invalid type
405 	 * string. Use g_variant_type_string_is_valid() if you are unsure.
406 	 * Since 2.24
407 	 * Params:
408 	 * typeString = a valid GVariant type string
409 	 * Throws: ConstructionException GTK+ fails to create the object.
410 	 */
411 	public this (string typeString)
412 	{
413 		// GVariantType * g_variant_type_new (const gchar *type_string);
414 		auto p = g_variant_type_new(Str.toStringz(typeString));
415 		if(p is null)
416 		{
417 			throw new ConstructionException("null returned by g_variant_type_new(Str.toStringz(typeString))");
418 		}
419 		this(cast(GVariantType*) p);
420 	}
421 	
422 	/**
423 	 * Checks if type_string is a valid GVariant type string. This call is
424 	 * equivalent to calling g_variant_type_string_scan() and confirming
425 	 * that the following character is a nul terminator.
426 	 * Since 2.24
427 	 * Params:
428 	 * typeString = a pointer to any string
429 	 * Returns: TRUE if type_string is exactly one valid type string
430 	 */
431 	public static int stringIsValid(string typeString)
432 	{
433 		// gboolean g_variant_type_string_is_valid (const gchar *type_string);
434 		return g_variant_type_string_is_valid(Str.toStringz(typeString));
435 	}
436 	
437 	/**
438 	 * Scan for a single complete and valid GVariant type string in string.
439 	 * The memory pointed to by limit (or bytes beyond it) is never
440 	 * accessed.
441 	 * If a valid type string is found, endptr is updated to point to the
442 	 * first character past the end of the string that was found and TRUE
443 	 * is returned.
444 	 * If there is no valid type string starting at string, or if the type
445 	 * string does not end before limit then FALSE is returned.
446 	 * For the simple case of checking if a string is a valid type string,
447 	 * see g_variant_type_string_is_valid().
448 	 * Since 2.24
449 	 * Params:
450 	 * string = a pointer to any string
451 	 * limit = the end of string, or NULL. [allow-none]
452 	 * endptr = location to store the end pointer, or NULL. [out][allow-none]
453 	 * Returns: TRUE if a valid type string was found
454 	 */
455 	public static int stringScan(string str, string limit, out string endptr)
456 	{
457 		// gboolean g_variant_type_string_scan (const gchar *string,  const gchar *limit,  const gchar **endptr);
458 		char* outendptr = null;
459 		
460 		auto p = g_variant_type_string_scan(Str.toStringz(str), Str.toStringz(limit), &outendptr);
461 		
462 		endptr = Str.toString(outendptr);
463 		return p;
464 	}
465 	
466 	/**
467 	 * Returns the length of the type string corresponding to the given
468 	 * type. This function must be used to determine the valid extent of
469 	 * the memory region returned by g_variant_type_peek_string().
470 	 * Since 2.24
471 	 * Returns: the length of the corresponding type string
472 	 */
473 	public gsize getStringLength()
474 	{
475 		// gsize g_variant_type_get_string_length (const GVariantType *type);
476 		return g_variant_type_get_string_length(gVariantType);
477 	}
478 	
479 	/**
480 	 * Returns the type string corresponding to the given type. The
481 	 * result is not nul-terminated; in order to determine its length you
482 	 * must call g_variant_type_get_string_length().
483 	 * To get a nul-terminated string, see g_variant_type_dup_string().
484 	 * Since 2.24
485 	 * Returns: the corresponding type string (not nul-terminated)
486 	 */
487 	public string peekString()
488 	{
489 		// const gchar * g_variant_type_peek_string (const GVariantType *type);
490 		return Str.toString(g_variant_type_peek_string(gVariantType));
491 	}
492 	
493 	/**
494 	 * Returns a newly-allocated copy of the type string corresponding to
495 	 * type. The returned string is nul-terminated. It is appropriate to
496 	 * call g_free() on the return value.
497 	 * Since 2.24. [transfer full]
498 	 * Returns: the corresponding type string
499 	 */
500 	public string dupString()
501 	{
502 		// gchar * g_variant_type_dup_string (const GVariantType *type);
503 		return Str.toString(g_variant_type_dup_string(gVariantType));
504 	}
505 	
506 	/**
507 	 * Determines if the given type is definite (ie: not indefinite).
508 	 * A type is definite if its type string does not contain any indefinite
509 	 * type characters ('*', '?', or 'r').
510 	 * A GVariant instance may not have an indefinite type, so calling
511 	 * this function on the result of g_variant_get_type() will always
512 	 * result in TRUE being returned. Calling this function on an
513 	 * indefinite type like G_VARIANT_TYPE_ARRAY, however, will result in
514 	 * FALSE being returned.
515 	 * Since 2.24
516 	 * Returns: TRUE if type is definite
517 	 */
518 	public int isDefinite()
519 	{
520 		// gboolean g_variant_type_is_definite (const GVariantType *type);
521 		return g_variant_type_is_definite(gVariantType);
522 	}
523 	
524 	/**
525 	 * Determines if the given type is a container type.
526 	 * Container types are any array, maybe, tuple, or dictionary
527 	 * entry types plus the variant type.
528 	 * This function returns TRUE for any indefinite type for which every
529 	 * definite subtype is a container -- G_VARIANT_TYPE_ARRAY, for
530 	 * example.
531 	 * Since 2.24
532 	 * Returns: TRUE if type is a container type
533 	 */
534 	public int isContainer()
535 	{
536 		// gboolean g_variant_type_is_container (const GVariantType *type);
537 		return g_variant_type_is_container(gVariantType);
538 	}
539 	
540 	/**
541 	 * Determines if the given type is a basic type.
542 	 * Basic types are booleans, bytes, integers, doubles, strings, object
543 	 * paths and signatures.
544 	 * Only a basic type may be used as the key of a dictionary entry.
545 	 * This function returns FALSE for all indefinite types except
546 	 * G_VARIANT_TYPE_BASIC.
547 	 * Since 2.24
548 	 * Returns: TRUE if type is a basic type
549 	 */
550 	public int isBasic()
551 	{
552 		// gboolean g_variant_type_is_basic (const GVariantType *type);
553 		return g_variant_type_is_basic(gVariantType);
554 	}
555 	
556 	/**
557 	 * Determines if the given type is a maybe type. This is true if the
558 	 * type string for type starts with an 'm'.
559 	 * This function returns TRUE for any indefinite type for which every
560 	 * definite subtype is a maybe type -- G_VARIANT_TYPE_MAYBE, for
561 	 * example.
562 	 * Since 2.24
563 	 * Returns: TRUE if type is a maybe type
564 	 */
565 	public int isMaybe()
566 	{
567 		// gboolean g_variant_type_is_maybe (const GVariantType *type);
568 		return g_variant_type_is_maybe(gVariantType);
569 	}
570 	
571 	/**
572 	 * Determines if the given type is an array type. This is true if the
573 	 * type string for type starts with an 'a'.
574 	 * This function returns TRUE for any indefinite type for which every
575 	 * definite subtype is an array type -- G_VARIANT_TYPE_ARRAY, for
576 	 * example.
577 	 * Since 2.24
578 	 * Returns: TRUE if type is an array type
579 	 */
580 	public int isArray()
581 	{
582 		// gboolean g_variant_type_is_array (const GVariantType *type);
583 		return g_variant_type_is_array(gVariantType);
584 	}
585 	
586 	/**
587 	 * Determines if the given type is a tuple type. This is true if the
588 	 * type string for type starts with a '(' or if type is
589 	 * G_VARIANT_TYPE_TUPLE.
590 	 * This function returns TRUE for any indefinite type for which every
591 	 * definite subtype is a tuple type -- G_VARIANT_TYPE_TUPLE, for
592 	 * example.
593 	 * Since 2.24
594 	 * Returns: TRUE if type is a tuple type
595 	 */
596 	public int isTuple()
597 	{
598 		// gboolean g_variant_type_is_tuple (const GVariantType *type);
599 		return g_variant_type_is_tuple(gVariantType);
600 	}
601 	
602 	/**
603 	 * Determines if the given type is a dictionary entry type. This is
604 	 * true if the type string for type starts with a '{'.
605 	 * This function returns TRUE for any indefinite type for which every
606 	 * definite subtype is a dictionary entry type --
607 	 * G_VARIANT_TYPE_DICT_ENTRY, for example.
608 	 * Since 2.24
609 	 * Returns: TRUE if type is a dictionary entry type
610 	 */
611 	public int isDictEntry()
612 	{
613 		// gboolean g_variant_type_is_dict_entry (const GVariantType *type);
614 		return g_variant_type_is_dict_entry(gVariantType);
615 	}
616 	
617 	/**
618 	 * Determines if the given type is the variant type.
619 	 * Since 2.24
620 	 * Returns: TRUE if type is the variant type
621 	 */
622 	public int isVariant()
623 	{
624 		// gboolean g_variant_type_is_variant (const GVariantType *type);
625 		return g_variant_type_is_variant(gVariantType);
626 	}
627 	
628 	/**
629 	 * Hashes type.
630 	 * The argument type of type is only gconstpointer to allow use with
631 	 * GHashTable without function pointer casting. A valid
632 	 * GVariantType must be provided.
633 	 * Since 2.24
634 	 * Params:
635 	 * type = a GVariantType. [type GVariantType]
636 	 * Returns: the hash value
637 	 */
638 	public static uint hash(void* type)
639 	{
640 		// guint g_variant_type_hash (gconstpointer type);
641 		return g_variant_type_hash(type);
642 	}
643 	
644 	/**
645 	 * Compares type1 and type2 for equality.
646 	 * Only returns TRUE if the types are exactly equal. Even if one type
647 	 * is an indefinite type and the other is a subtype of it, FALSE will
648 	 * be returned if they are not exactly equal. If you want to check for
649 	 * subtypes, use g_variant_type_is_subtype_of().
650 	 * The argument types of type1 and type2 are only gconstpointer to
651 	 * allow use with GHashTable without function pointer casting. For
652 	 * both arguments, a valid GVariantType must be provided.
653 	 * Since 2.24
654 	 * Params:
655 	 * type1 = a GVariantType. [type GVariantType]
656 	 * type2 = a GVariantType. [type GVariantType]
657 	 * Returns: TRUE if type1 and type2 are exactly equal
658 	 */
659 	public static int equal(void* type1, void* type2)
660 	{
661 		// gboolean g_variant_type_equal (gconstpointer type1,  gconstpointer type2);
662 		return g_variant_type_equal(type1, type2);
663 	}
664 	
665 	/**
666 	 * Checks if type is a subtype of supertype.
667 	 * This function returns TRUE if type is a subtype of supertype. All
668 	 * types are considered to be subtypes of themselves. Aside from that,
669 	 * only indefinite types can have subtypes.
670 	 * Since 2.24
671 	 * Params:
672 	 * type = a GVariantType
673 	 * supertype = a GVariantType
674 	 * Returns: TRUE if type is a subtype of supertype
675 	 */
676 	public int isSubtypeOf(VariantType supertype)
677 	{
678 		// gboolean g_variant_type_is_subtype_of (const GVariantType *type,  const GVariantType *supertype);
679 		return g_variant_type_is_subtype_of(gVariantType, (supertype is null) ? null : supertype.getVariantTypeStruct());
680 	}
681 	
682 	/**
683 	 * Constructs the type corresponding to an array of elements of the
684 	 * type type.
685 	 * It is appropriate to call g_variant_type_free() on the return value.
686 	 * Since 2.24. [transfer full]
687 	 * Params:
688 	 * element = a GVariantType
689 	 * Throws: ConstructionException GTK+ fails to create the object.
690 	 */
691 	public this (VariantType element)
692 	{
693 		// GVariantType * g_variant_type_new_array (const GVariantType *element);
694 		auto p = g_variant_type_new_array((element is null) ? null : element.getVariantTypeStruct());
695 		if(p is null)
696 		{
697 			throw new ConstructionException("null returned by g_variant_type_new_array((element is null) ? null : element.getVariantTypeStruct())");
698 		}
699 		this(cast(GVariantType*) p);
700 	}
701 	
702 	/**
703 	 * Constructs a new tuple type, from items.
704 	 * length is the number of items in items, or -1 to indicate that
705 	 * items is NULL-terminated.
706 	 * It is appropriate to call g_variant_type_free() on the return value.
707 	 * Since 2.24. [transfer full]
708 	 * Params:
709 	 * items = an array of GVariantTypes, one for each item. [array length=length]
710 	 * Throws: ConstructionException GTK+ fails to create the object.
711 	 */
712 	public this (VariantType[] items)
713 	{
714 		// GVariantType * g_variant_type_new_tuple (const GVariantType * const *items,  gint length);
715 		
716 		GVariantType*[] itemsArray = new GVariantType*[items.length];
717 		for ( int i = 0; i < items.length ; i++ )
718 		{
719 			itemsArray[i] = items[i].getVariantTypeStruct();
720 		}
721 		
722 		auto p = g_variant_type_new_tuple(itemsArray.ptr, cast(int) items.length);
723 		if(p is null)
724 		{
725 			throw new ConstructionException("null returned by g_variant_type_new_tuple(itemsArray.ptr, cast(int) items.length)");
726 		}
727 		this(cast(GVariantType*) p);
728 	}
729 	
730 	/**
731 	 * Constructs the type corresponding to a dictionary entry with a key
732 	 * of type key and a value of type value.
733 	 * It is appropriate to call g_variant_type_free() on the return value.
734 	 * Since 2.24. [transfer full]
735 	 * Params:
736 	 * key = a basic GVariantType
737 	 * value = a GVariantType
738 	 * Throws: ConstructionException GTK+ fails to create the object.
739 	 */
740 	public this (VariantType key, VariantType value)
741 	{
742 		// GVariantType * g_variant_type_new_dict_entry (const GVariantType *key,  const GVariantType *value);
743 		auto p = g_variant_type_new_dict_entry((key is null) ? null : key.getVariantTypeStruct(), (value is null) ? null : value.getVariantTypeStruct());
744 		if(p is null)
745 		{
746 			throw new ConstructionException("null returned by g_variant_type_new_dict_entry((key is null) ? null : key.getVariantTypeStruct(), (value is null) ? null : value.getVariantTypeStruct())");
747 		}
748 		this(cast(GVariantType*) p);
749 	}
750 	
751 	/**
752 	 * Determines the element type of an array or maybe type.
753 	 * This function may only be used with array or maybe types.
754 	 * Since 2.24. [transfer none]
755 	 * Returns: the element type of type
756 	 */
757 	public VariantType element()
758 	{
759 		// const GVariantType * g_variant_type_element (const GVariantType *type);
760 		auto p = g_variant_type_element(gVariantType);
761 		
762 		if(p is null)
763 		{
764 			return null;
765 		}
766 		
767 		return new VariantType(cast(GVariantType*) p);
768 	}
769 	
770 	/**
771 	 * Determines the number of items contained in a tuple or
772 	 * dictionary entry type.
773 	 * This function may only be used with tuple or dictionary entry types,
774 	 * but must not be used with the generic tuple type
775 	 * G_VARIANT_TYPE_TUPLE.
776 	 * In the case of a dictionary entry type, this function will always
777 	 * return 2.
778 	 * Since 2.24
779 	 * Returns: the number of items in type
780 	 */
781 	public gsize nItems()
782 	{
783 		// gsize g_variant_type_n_items (const GVariantType *type);
784 		return g_variant_type_n_items(gVariantType);
785 	}
786 	
787 	/**
788 	 * Determines the first item type of a tuple or dictionary entry
789 	 * type.
790 	 * This function may only be used with tuple or dictionary entry types,
791 	 * but must not be used with the generic tuple type
792 	 * G_VARIANT_TYPE_TUPLE.
793 	 * In the case of a dictionary entry type, this returns the type of
794 	 * the key.
795 	 * NULL is returned in case of type being G_VARIANT_TYPE_UNIT.
796 	 * This call, together with g_variant_type_next() provides an iterator
797 	 * interface over tuple and dictionary entry types.
798 	 * Since 2.24. [transfer none]
799 	 * Returns: the first item type of type, or NULL
800 	 */
801 	public VariantType first()
802 	{
803 		// const GVariantType * g_variant_type_first (const GVariantType *type);
804 		auto p = g_variant_type_first(gVariantType);
805 		
806 		if(p is null)
807 		{
808 			return null;
809 		}
810 		
811 		return new VariantType(cast(GVariantType*) p);
812 	}
813 	
814 	/**
815 	 * Determines the next item type of a tuple or dictionary entry
816 	 * type.
817 	 * type must be the result of a previous call to
818 	 * g_variant_type_first() or g_variant_type_next().
819 	 * If called on the key type of a dictionary entry then this call
820 	 * returns the value type. If called on the value type of a dictionary
821 	 * entry then this call returns NULL.
822 	 * For tuples, NULL is returned when type is the last item in a tuple.
823 	 * Since 2.24. [transfer none]
824 	 * Returns: the next GVariantType after type, or NULL
825 	 */
826 	public VariantType next()
827 	{
828 		// const GVariantType * g_variant_type_next (const GVariantType *type);
829 		auto p = g_variant_type_next(gVariantType);
830 		
831 		if(p is null)
832 		{
833 			return null;
834 		}
835 		
836 		return new VariantType(cast(GVariantType*) p);
837 	}
838 	
839 	/**
840 	 * Determines the key type of a dictionary entry type.
841 	 * This function may only be used with a dictionary entry type. Other
842 	 * than the additional restriction, this call is equivalent to
843 	 * g_variant_type_first().
844 	 * Since 2.24. [transfer none]
845 	 * Returns: the key type of the dictionary entry
846 	 */
847 	public VariantType key()
848 	{
849 		// const GVariantType * g_variant_type_key (const GVariantType *type);
850 		auto p = g_variant_type_key(gVariantType);
851 		
852 		if(p is null)
853 		{
854 			return null;
855 		}
856 		
857 		return new VariantType(cast(GVariantType*) p);
858 	}
859 	
860 	/**
861 	 * Determines the value type of a dictionary entry type.
862 	 * This function may only be used with a dictionary entry type.
863 	 * Since 2.24. [transfer none]
864 	 * Returns: the value type of the dictionary entry
865 	 */
866 	public VariantType value()
867 	{
868 		// const GVariantType * g_variant_type_value (const GVariantType *type);
869 		auto p = g_variant_type_value(gVariantType);
870 		
871 		if(p is null)
872 		{
873 			return null;
874 		}
875 		
876 		return new VariantType(cast(GVariantType*) p);
877 	}
878 }