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