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-GVariant.html
27  * outPack = glib
28  * outFile = Variant
29  * strct   = GVariant
30  * realStrct=
31  * ctorStrct=
32  * clss    = Variant
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_variant_
41  * omit structs:
42  * omit prefixes:
43  * 	- g_variant_iter_
44  * 	- g_variant_builder_
45  * omit code:
46  * 	- g_variant_new_boolean
47  * 	- g_variant_new_bytestring_array
48  * 	- g_variant_new_object_path
49  * 	- g_variant_new_signature
50  * 	- g_variant_new_objv
51  * 	- g_variant_new_bytestring
52  * 	- g_variant_new_handle
53  * 	- g_variant_new_take_string
54  * omit signals:
55  * imports:
56  * 	- glib.Str
57  * 	- glib.ErrorG
58  * 	- glib.GException
59  * 	- glib.Bytes
60  * 	- glib.StringG
61  * 	- glib.VariantType
62  * structWrap:
63  * 	- GBytes* -> Bytes
64  * 	- GString* -> StringG
65  * 	- GVariant* -> Variant
66  * 	- GVariantType* -> VariantType
67  * module aliases:
68  * local aliases:
69  * 	- byte -> b
70  * overrides:
71  */
72 
73 module glib.Variant;
74 
75 public  import gtkc.glibtypes;
76 
77 private import gtkc.glib;
78 private import glib.ConstructionException;
79 
80 private import glib.Str;
81 private import glib.ErrorG;
82 private import glib.GException;
83 private import glib.Bytes;
84 private import glib.StringG;
85 private import glib.VariantType;
86 
87 
88 
89 /**
90  * GVariant is a variant datatype; it stores a value along with
91  * information about the type of that value. The range of possible
92  * values is determined by the type. The type system used by GVariant
93  * is GVariantType.
94  *
95  * GVariant instances always have a type and a value (which are given
96  * at construction time). The type and value of a GVariant instance
97  * can never change other than by the GVariant itself being
98  * destroyed. A GVariant cannot contain a pointer.
99  *
100  * GVariant is reference counted using g_variant_ref() and
101  * g_variant_unref(). GVariant also has floating reference counts --
102  * see g_variant_ref_sink().
103  *
104  * GVariant is completely threadsafe. A GVariant instance can be
105  * concurrently accessed in any way from any number of threads without
106  * problems.
107  *
108  * GVariant is heavily optimised for dealing with data in serialised
109  * form. It works particularly well with data located in memory-mapped
110  * files. It can perform nearly all deserialisation operations in a
111  * small constant time, usually touching only a single memory page.
112  * Serialised GVariant data can also be sent over the network.
113  *
114  * GVariant is largely compatible with D-Bus. Almost all types of
115  * GVariant instances can be sent over D-Bus. See GVariantType for
116  * exceptions. (However, GVariant's serialisation format is not the same
117  * as the serialisation format of a D-Bus message body: use GDBusMessage,
118  * in the gio library, for those.)
119  *
120  * For space-efficiency, the GVariant serialisation format does not
121  * automatically include the variant's type or endianness, which must
122  * either be implied from context (such as knowledge that a particular
123  * file format always contains a little-endian G_VARIANT_TYPE_VARIANT)
124  * or supplied out-of-band (for instance, a type and/or endianness
125  * indicator could be placed at the beginning of a file, network message
126  * or network stream).
127  *
128  * A GVariant's size is limited mainly by any lower level operating
129  * system constraints, such as the number of bits in gsize. For
130  * example, it is reasonable to have a 2GB file mapped into memory
131  * with GMappedFile, and call g_variant_new_from_data() on it.
132  *
133  * For convenience to C programmers, GVariant features powerful
134  * varargs-based value construction and destruction. This feature is
135  * designed to be embedded in other libraries.
136  *
137  * There is a Python-inspired text language for describing GVariant
138  * values. GVariant includes a printer for this language and a parser
139  * with type inferencing.
140  *
141  * Memory Use
142  *
143  *  GVariant tries to be quite efficient with respect to memory use.
144  *  This section gives a rough idea of how much memory is used by the
145  *  current implementation. The information here is subject to change
146  *  in the future.
147  *
148  *  The memory allocated by GVariant can be grouped into 4 broad
149  *  purposes: memory for serialised data, memory for the type
150  *  information cache, buffer management memory and memory for the
151  *  GVariant structure itself.
152  *
153  * Serialised Data Memory
154  *
155  *  This is the memory that is used for storing GVariant data in
156  *  serialised form. This is what would be sent over the network or
157  *  what would end up on disk.
158  *
159  *  The amount of memory required to store a boolean is 1 byte. 16,
160  *  32 and 64 bit integers and double precision floating point numbers
161  *  use their "natural" size. Strings (including object path and
162  *  signature strings) are stored with a nul terminator, and as such
163  *  use the length of the string plus 1 byte.
164  *
165  *  Maybe types use no space at all to represent the null value and
166  *  use the same amount of space (sometimes plus one byte) as the
167  *  equivalent non-maybe-typed value to represent the non-null case.
168  *
169  *  Arrays use the amount of space required to store each of their
170  *  members, concatenated. Additionally, if the items stored in an
171  *  array are not of a fixed-size (ie: strings, other arrays, etc)
172  *  then an additional framing offset is stored for each item. The
173  *  size of this offset is either 1, 2 or 4 bytes depending on the
174  *  overall size of the container. Additionally, extra padding bytes
175  *  are added as required for alignment of child values.
176  *
177  *  Tuples (including dictionary entries) use the amount of space
178  *  required to store each of their members, concatenated, plus one
179  *  framing offset (as per arrays) for each non-fixed-sized item in
180  *  the tuple, except for the last one. Additionally, extra padding
181  *  bytes are added as required for alignment of child values.
182  *
183  *  Variants use the same amount of space as the item inside of the
184  *  variant, plus 1 byte, plus the length of the type string for the
185  *  item inside the variant.
186  *
187  *  As an example, consider a dictionary mapping strings to variants.
188  *  In the case that the dictionary is empty, 0 bytes are required for
189  *  the serialisation.
190  *
191  *  If we add an item "width" that maps to the int32 value of 500 then
192  *  we will use 4 byte to store the int32 (so 6 for the variant
193  *  containing it) and 6 bytes for the string. The variant must be
194  *  aligned to 8 after the 6 bytes of the string, so that's 2 extra
195  *  bytes. 6 (string) + 2 (padding) + 6 (variant) is 14 bytes used
196  *  for the dictionary entry. An additional 1 byte is added to the
197  *  array as a framing offset making a total of 15 bytes.
198  *
199  *  If we add another entry, "title" that maps to a nullable string
200  *  that happens to have a value of null, then we use 0 bytes for the
201  *  null value (and 3 bytes for the variant to contain it along with
202  *  its type string) plus 6 bytes for the string. Again, we need 2
203  *  padding bytes. That makes a total of 6 + 2 + 3 = 11 bytes.
204  *
205  *  We now require extra padding between the two items in the array.
206  *  After the 14 bytes of the first item, that's 2 bytes required. We
207  *  now require 2 framing offsets for an extra two bytes. 14 + 2 + 11
208  *  + 2 = 29 bytes to encode the entire two-item dictionary.
209  *
210  * Type Information Cache
211  *
212  *  For each GVariant type that currently exists in the program a type
213  *  information structure is kept in the type information cache. The
214  *  type information structure is required for rapid deserialisation.
215  *
216  *  Continuing with the above example, if a GVariant exists with the
217  *  type "a{sv}" then a type information struct will exist for
218  *  "a{sv}", "{sv}", "s", and "v". Multiple uses of the same type
219  *  will share the same type information. Additionally, all
220  *  single-digit types are stored in read-only static memory and do
221  *  not contribute to the writable memory footprint of a program using
222  *  GVariant.
223  *
224  *  Aside from the type information structures stored in read-only
225  *  memory, there are two forms of type information. One is used for
226  *  container types where there is a single element type: arrays and
227  *  maybe types. The other is used for container types where there
228  *  are multiple element types: tuples and dictionary entries.
229  *
230  *  Array type info structures are 6 * sizeof (void *), plus the
231  *  memory required to store the type string itself. This means that
232  *  on 32bit systems, the cache entry for "a{sv}" would require 30
233  *  bytes of memory (plus malloc overhead).
234  *
235  *  Tuple type info structures are 6 * sizeof (void *), plus 4 *
236  *  sizeof (void *) for each item in the tuple, plus the memory
237  *  required to store the type string itself. A 2-item tuple, for
238  *  example, would have a type information structure that consumed
239  *  writable memory in the size of 14 * sizeof (void *) (plus type
240  *  string) This means that on 32bit systems, the cache entry for
241  *  "{sv}" would require 61 bytes of memory (plus malloc overhead).
242  *
243  *  This means that in total, for our "a{sv}" example, 91 bytes of
244  *  type information would be allocated.
245  *
246  *  The type information cache, additionally, uses a GHashTable to
247  *  store and lookup the cached items and stores a pointer to this
248  *  hash table in static storage. The hash table is freed when there
249  *  are zero items in the type cache.
250  *
251  *  Although these sizes may seem large it is important to remember
252  *  that a program will probably only have a very small number of
253  *  different types of values in it and that only one type information
254  *  structure is required for many different values of the same type.
255  *
256  * Buffer Management Memory
257  *
258  *  GVariant uses an internal buffer management structure to deal
259  *  with the various different possible sources of serialised data
260  *  that it uses. The buffer is responsible for ensuring that the
261  *  correct call is made when the data is no longer in use by
262  *  GVariant. This may involve a g_free() or a g_slice_free() or
263  *  even g_mapped_file_unref().
264  *
265  *  One buffer management structure is used for each chunk of
266  *  serialised data. The size of the buffer management structure is 4
267  *  * (void *). On 32bit systems, that's 16 bytes.
268  *
269  * GVariant structure
270  *
271  *  The size of a GVariant structure is 6 * (void *). On 32 bit
272  *  systems, that's 24 bytes.
273  *
274  *  GVariant structures only exist if they are explicitly created
275  *  with API calls. For example, if a GVariant is constructed out of
276  *  serialised data for the example given above (with the dictionary)
277  *  then although there are 9 individual values that comprise the
278  *  entire dictionary (two keys, two values, two variants containing
279  *  the values, two dictionary entries, plus the dictionary itself),
280  *  only 1 GVariant instance exists -- the one referring to the
281  *  dictionary.
282  *
283  *  If calls are made to start accessing the other values then
284  *  GVariant instances will exist for those values only for as long
285  *  as they are in use (ie: until you call g_variant_unref()). The
286  *  type information is shared. The serialised data and the buffer
287  *  management structure for that serialised data is shared by the
288  *  child.
289  *
290  * Summary
291  *
292  *  To put the entire example together, for our dictionary mapping
293  *  strings to variants (with two entries, as given above), we are
294  *  using 91 bytes of memory for type information, 29 byes of memory
295  *  for the serialised data, 16 bytes for buffer management and 24
296  *  bytes for the GVariant instance, or a total of 160 bytes, plus
297  *  malloc overhead. If we were to use g_variant_get_child_value() to
298  *  access the two dictionary entries, we would use an additional 48
299  *  bytes. If we were to have other dictionaries of the same type, we
300  *  would use more memory for the serialised data and buffer
301  *  management for those dictionaries, but the type information would
302  *  be shared.
303  */
304 public class Variant
305 {
306 	
307 	/** the main Gtk struct */
308 	protected GVariant* gVariant;
309 	
310 	
311 	/** Get the main Gtk struct */
312 	public GVariant* getVariantStruct()
313 	{
314 		return gVariant;
315 	}
316 	
317 	
318 	/** the main Gtk struct as a void* */
319 	protected void* getStruct()
320 	{
321 		return cast(void*)gVariant;
322 	}
323 	
324 	/**
325 	 * Sets our main struct and passes it to the parent class
326 	 */
327 	public this (GVariant* gVariant)
328 	{
329 		this.gVariant = gVariant;
330 	}
331 	
332 	/**
333 	 * Creates a new boolean GVariant instance -- either TRUE or FALSE.
334 	 * Since 2.24
335 	 * Params:
336 	 * boolean = a gboolean value
337 	 * Throws: ConstructionException GTK+ fails to create the object.
338 	 */
339 	public this (bool boolean)
340 	{
341 		// GVariant * g_variant_new_boolean (gboolean boolean);
342 		auto p = g_variant_new_boolean(boolean);
343 		if(p is null)
344 		{
345 			throw new ConstructionException("null returned by g_variant_new_boolean(boolean)");
346 		}
347 		this(cast(GVariant*) p);
348 	}
349 	
350 	/**
351 	 * Creates a DBus object path GVariant with the contents of string.
352 	 * string must be a valid DBus object path.
353 	 * Use Variant.isObjectPath() if you're not sure.
354 	 * Since 2.24
355 	 *
356 	 * Throws: ConstructionException GTK+ fails to create the object.
357 	 */
358 	public static Variant fromObjectPath(string path)
359 	{
360 		auto p = g_variant_new_object_path(Str.toStringz(path));
361 		if(p is null)
362 		{
363 			throw new ConstructionException("null returned by g_variant_new_object_path");
364 		}
365 		return new Variant(cast(GVariant*) p);
366 	}
367 	
368 	/**
369 	 * Creates a DBus type signature GVariant with the contents of string.
370 	 * string must be a valid DBus type signature.
371 	 * Use Variant.isSignature() if you're not sure.
372 	 * Since 2.24
373 	 *
374 	 * Throws: ConstructionException GTK+ fails to create the object.
375 	 */
376 	public static Variant fromSignature(string signature)
377 	{
378 		auto p = g_variant_new_signature(Str.toStringz(signature));
379 		if(p is null)
380 		{
381 			throw new ConstructionException("null returned by g_variant_new_signature");
382 		}
383 		return new Variant(cast(GVariant*) p);
384 	}
385 	
386 	/**
387 	 * Creates an array-of-bytes GVariant with the contents of string.
388 	 * This function is just like new Variant(string) except that the string
389 	 * need not be valid utf8.
390 	 *
391 	 * The nul terminator character at the end of the string is stored in
392 	 * the array.
393 	 *
394 	 * Throws: ConstructionException GTK+ fails to create the object.
395 	 */
396 	public static Variant fromByteString(string byteString)
397 	{
398 		auto p = g_variant_new_bytestring(Str.toStringz(byteString));
399 		if(p is null)
400 		{
401 			throw new ConstructionException("null returned by g_variant_new_bytestring");
402 		}
403 		return new Variant(cast(GVariant*) p);
404 	}
405 	
406 	/**
407 	 * Constructs an array of object paths Variant from the given array
408 	 * of strings.
409 	 *
410 	 * Each string must be a valid Variant object path.
411 	 *
412 	 * Since: 2.30
413 	 *
414 	 * Params:
415 	 *     strv   = an array of strings.
416 	 *
417 	 * Throws: ConstructionException GTK+ fails to create the object.
418 	 */
419 	public static Variant fromObjv(string[] strv)
420 	{
421 		// GVariant * g_variant_new_objv (const gchar * const *strv,  gssize length);
422 		auto p = g_variant_new_objv(Str.toStringzArray(strv), strv.length);
423 		if(p is null)
424 		{
425 			throw new ConstructionException("null returned by g_variant_new_objv(strv, length)");
426 		}
427 		return new Variant(cast(GVariant*) p);
428 	}
429 	
430 	/**
431 	 * Constructs an array of bytestring GVariant from the given array of
432 	 * strings. If length is -1 then strv is NULL-terminated.
433 	 * Since 2.26
434 	 *
435 	 * Params:
436 	 *     strv   = an array of strings.
437 	 *
438 	 * Throws: ConstructionException GTK+ fails to create the object.
439 	 */
440 	public static Variant fromByteStringArray(string[] strv)
441 	{
442 		// GVariant * g_variant_new_bytestring_array (const gchar * const *strv,  gssize length);
443 		auto p = g_variant_new_bytestring_array(Str.toStringzArray(strv), strv.length);
444 		if(p is null)
445 		{
446 			throw new ConstructionException("null returned by g_variant_new_bytestring_array(strv, length)");
447 		}
448 		return new Variant(cast(GVariant*) p);
449 	}
450 	
451 	/**
452 	 */
453 	
454 	/**
455 	 * Decreases the reference count of value. When its reference count
456 	 * drops to 0, the memory used by the variant is freed.
457 	 * Since 2.24
458 	 */
459 	public void unref()
460 	{
461 		// void g_variant_unref (GVariant *value);
462 		g_variant_unref(gVariant);
463 	}
464 	
465 	/**
466 	 * Increases the reference count of value.
467 	 * Since 2.24
468 	 * Returns: the same value
469 	 */
470 	public Variant doref()
471 	{
472 		// GVariant * g_variant_ref (GVariant *value);
473 		auto p = g_variant_ref(gVariant);
474 		
475 		if(p is null)
476 		{
477 			return null;
478 		}
479 		
480 		return new Variant(cast(GVariant*) p);
481 	}
482 	
483 	/**
484 	 * GVariant uses a floating reference count system. All functions with
485 	 * names starting with g_variant_new_ return floating
486 	 * references.
487 	 * Calling g_variant_ref_sink() on a GVariant with a floating reference
488 	 * will convert the floating reference into a full reference. Calling
489 	 * g_variant_ref_sink() on a non-floating GVariant results in an
490 	 * additional normal reference being added.
491 	 * In other words, if the value is floating, then this call "assumes
492 	 * ownership" of the floating reference, converting it to a normal
493 	 * reference. If the value is not floating, then this call adds a
494 	 * new normal reference increasing the reference count by one.
495 	 * All calls that result in a GVariant instance being inserted into a
496 	 * container will call g_variant_ref_sink() on the instance. This means
497 	 * that if the value was just created (and has only its floating
498 	 * reference) then the container will assume sole ownership of the value
499 	 * at that point and the caller will not need to unreference it. This
500 	 * makes certain common styles of programming much easier while still
501 	 * maintaining normal refcounting semantics in situations where values
502 	 * are not floating.
503 	 * Since 2.24
504 	 * Returns: the same value
505 	 */
506 	public Variant refSink()
507 	{
508 		// GVariant * g_variant_ref_sink (GVariant *value);
509 		auto p = g_variant_ref_sink(gVariant);
510 		
511 		if(p is null)
512 		{
513 			return null;
514 		}
515 		
516 		return new Variant(cast(GVariant*) p);
517 	}
518 	
519 	/**
520 	 * Checks whether value has a floating reference count.
521 	 * This function should only ever be used to assert that a given variant
522 	 * is or is not floating, or for debug purposes. To acquire a reference
523 	 * to a variant that might be floating, always use g_variant_ref_sink()
524 	 * or g_variant_take_ref().
525 	 * See g_variant_ref_sink() for more information about floating reference
526 	 * counts.
527 	 * Since 2.26
528 	 * Returns: whether value is floating
529 	 */
530 	public int isFloating()
531 	{
532 		// gboolean g_variant_is_floating (GVariant *value);
533 		return g_variant_is_floating(gVariant);
534 	}
535 	
536 	/**
537 	 * If value is floating, sink it. Otherwise, do nothing.
538 	 * Typically you want to use g_variant_ref_sink() in order to
539 	 * automatically do the correct thing with respect to floating or
540 	 * non-floating references, but there is one specific scenario where
541 	 * this function is helpful.
542 	 * The situation where this function is helpful is when creating an API
543 	 * that allows the user to provide a callback function that returns a
544 	 * GVariant. We certainly want to allow the user the flexibility to
545 	 * return a non-floating reference from this callback (for the case
546 	 * where the value that is being returned already exists).
547 	 * At the same time, the style of the GVariant API makes it likely that
548 	 * for newly-created GVariant instances, the user can be saved some
549 	 * typing if they are allowed to return a GVariant with a floating
550 	 * reference.
551 	 * Using this function on the return value of the user's callback allows
552 	 * the user to do whichever is more convenient for them. The caller
553 	 * will alway receives exactly one full reference to the value: either
554 	 * the one that was returned in the first place, or a floating reference
555 	 * that has been converted to a full reference.
556 	 * This function has an odd interaction when combined with
557 	 * g_variant_ref_sink() running at the same time in another thread on
558 	 * the same GVariant instance. If g_variant_ref_sink() runs first then
559 	 * the result will be that the floating reference is converted to a hard
560 	 * reference. If g_variant_take_ref() runs first then the result will
561 	 * be that the floating reference is converted to a hard reference and
562 	 * an additional reference on top of that one is added. It is best to
563 	 * avoid this situation.
564 	 * Returns: the same value
565 	 */
566 	public Variant takeRef()
567 	{
568 		// GVariant * g_variant_take_ref (GVariant *value);
569 		auto p = g_variant_take_ref(gVariant);
570 		
571 		if(p is null)
572 		{
573 			return null;
574 		}
575 		
576 		return new Variant(cast(GVariant*) p);
577 	}
578 	
579 	/**
580 	 * Determines the type of value.
581 	 * The return value is valid for the lifetime of value and must not
582 	 * be freed.
583 	 * Since 2.24
584 	 * Returns: a GVariantType
585 	 */
586 	public VariantType getType()
587 	{
588 		// const GVariantType * g_variant_get_type (GVariant *value);
589 		auto p = g_variant_get_type(gVariant);
590 		
591 		if(p is null)
592 		{
593 			return null;
594 		}
595 		
596 		return new VariantType(cast(GVariantType*) p);
597 	}
598 	
599 	/**
600 	 * Returns the type string of value. Unlike the result of calling
601 	 * g_variant_type_peek_string(), this string is nul-terminated. This
602 	 * string belongs to GVariant and must not be freed.
603 	 * Since 2.24
604 	 * Returns: the type string for the type of value
605 	 */
606 	public string getTypeString()
607 	{
608 		// const gchar * g_variant_get_type_string (GVariant *value);
609 		return Str.toString(g_variant_get_type_string(gVariant));
610 	}
611 	
612 	/**
613 	 * Checks if a value has a type matching the provided type.
614 	 * Since 2.24
615 	 * Params:
616 	 * type = a GVariantType
617 	 * Returns: TRUE if the type of value matches type
618 	 */
619 	public int isOfType(VariantType type)
620 	{
621 		// gboolean g_variant_is_of_type (GVariant *value,  const GVariantType *type);
622 		return g_variant_is_of_type(gVariant, (type is null) ? null : type.getVariantTypeStruct());
623 	}
624 	
625 	/**
626 	 * Checks if value is a container.
627 	 * Since 2.24
628 	 * Returns: TRUE if value is a container
629 	 */
630 	public int isContainer()
631 	{
632 		// gboolean g_variant_is_container (GVariant *value);
633 		return g_variant_is_container(gVariant);
634 	}
635 	
636 	/**
637 	 * Compares one and two.
638 	 * The types of one and two are gconstpointer only to allow use of
639 	 * this function with GTree, GPtrArray, etc. They must each be a
640 	 * GVariant.
641 	 * Comparison is only defined for basic types (ie: booleans, numbers,
642 	 * strings). For booleans, FALSE is less than TRUE. Numbers are
643 	 * ordered in the usual way. Strings are in ASCII lexographical order.
644 	 * It is a programmer error to attempt to compare container values or
645 	 * two values that have types that are not exactly equal. For example,
646 	 * you cannot compare a 32-bit signed integer with a 32-bit unsigned
647 	 * integer. Also note that this function is not particularly
648 	 * well-behaved when it comes to comparison of doubles; in particular,
649 	 * the handling of incomparable values (ie: NaN) is undefined.
650 	 * If you only require an equality comparison, g_variant_equal() is more
651 	 * general.
652 	 * Since 2.26
653 	 * Params:
654 	 * one = a basic-typed GVariant instance. [type GVariant]
655 	 * two = a GVariant instance of the same type. [type GVariant]
656 	 * Returns: negative value if a < b; zero if a = b; positive value if a > b.
657 	 */
658 	public static int compare(void* one, void* two)
659 	{
660 		// gint g_variant_compare (gconstpointer one,  gconstpointer two);
661 		return g_variant_compare(one, two);
662 	}
663 	
664 	/**
665 	 * Classifies value according to its top-level type.
666 	 * Since 2.24
667 	 * Returns: the GVariantClass of value
668 	 */
669 	public GVariantClass classify()
670 	{
671 		// GVariantClass g_variant_classify (GVariant *value);
672 		return g_variant_classify(gVariant);
673 	}
674 	
675 	/**
676 	 * Checks if calling g_variant_get() with format_string on value would
677 	 * be valid from a type-compatibility standpoint. format_string is
678 	 * assumed to be a valid format string (from a syntactic standpoint).
679 	 * If copy_only is TRUE then this function additionally checks that it
680 	 * would be safe to call g_variant_unref() on value immediately after
681 	 * the call to g_variant_get() without invalidating the result. This is
682 	 * only possible if deep copies are made (ie: there are no pointers to
683 	 * the data inside of the soon-to-be-freed GVariant instance). If this
684 	 * check fails then a g_critical() is printed and FALSE is returned.
685 	 * This function is meant to be used by functions that wish to provide
686 	 * Since 2.34
687 	 * Params:
688 	 * formatString = a valid GVariant format string
689 	 * copyOnly = TRUE to ensure the format string makes deep copies
690 	 * Returns: TRUE if format_string is safe to use
691 	 */
692 	public int checkFormatString(string formatString, int copyOnly)
693 	{
694 		// gboolean g_variant_check_format_string (GVariant *value,  const gchar *format_string,  gboolean copy_only);
695 		return g_variant_check_format_string(gVariant, Str.toStringz(formatString), copyOnly);
696 	}
697 	
698 	/**
699 	 * This function is intended to be used by libraries based on GVariant
700 	 * that want to provide g_variant_get()-like functionality to their
701 	 * users.
702 	 * The API is more general than g_variant_get() to allow a wider range
703 	 * of possible uses.
704 	 * format_string must still point to a valid format string, but it only
705 	 * need to be nul-terminated if endptr is NULL. If endptr is
706 	 * non-NULL then it is updated to point to the first character past the
707 	 * end of the format string.
708 	 * app is a pointer to a va_list. The arguments, according to
709 	 * format_string, are collected from this va_list and the list is left
710 	 * pointing to the argument following the last.
711 	 * These two generalisations allow mixing of multiple calls to
712 	 * g_variant_new_va() and g_variant_get_va() within a single actual
713 	 * varargs call by the user.
714 	 * format_string determines the C types that are used for unpacking
715 	 * the values and also determines if the values are copied or borrowed,
716 	 * see the section on
717 	 * GVariant Format Strings.
718 	 * Since 2.24
719 	 * Params:
720 	 * formatString = a string that is prefixed with a format string
721 	 * endptr = location to store the end pointer,
722 	 * or NULL. [allow-none][default NULL]
723 	 * app = a pointer to a va_list
724 	 */
725 	public void getVa(string formatString, out string endptr, void** app)
726 	{
727 		// void g_variant_get_va (GVariant *value,  const gchar *format_string,  const gchar **endptr,  va_list *app);
728 		char* outendptr = null;
729 		
730 		g_variant_get_va(gVariant, Str.toStringz(formatString), &outendptr, app);
731 		
732 		endptr = Str.toString(outendptr);
733 	}
734 	
735 	/**
736 	 * This function is intended to be used by libraries based on
737 	 * GVariant that want to provide g_variant_new()-like functionality
738 	 * to their users.
739 	 * The API is more general than g_variant_new() to allow a wider range
740 	 * of possible uses.
741 	 * format_string must still point to a valid format string, but it only
742 	 * needs to be nul-terminated if endptr is NULL. If endptr is
743 	 * non-NULL then it is updated to point to the first character past the
744 	 * end of the format string.
745 	 * app is a pointer to a va_list. The arguments, according to
746 	 * format_string, are collected from this va_list and the list is left
747 	 * pointing to the argument following the last.
748 	 * These two generalisations allow mixing of multiple calls to
749 	 * g_variant_new_va() and g_variant_get_va() within a single actual
750 	 * varargs call by the user.
751 	 * The return value will be floating if it was a newly created GVariant
752 	 * instance (for example, if the format string was "(ii)"). In the case
753 	 * that the format_string was '*', '?', 'r', or a format starting with
754 	 * '@' then the collected GVariant pointer will be returned unmodified,
755 	 * without adding any additional references.
756 	 * In order to behave correctly in all cases it is necessary for the
757 	 * calling function to g_variant_ref_sink() the return result before
758 	 * returning control to the user that originally provided the pointer.
759 	 * At this point, the caller will have their own full reference to the
760 	 * result. This can also be done by adding the result to a container,
761 	 * or by passing it to another g_variant_new() call.
762 	 * Since 2.24
763 	 * Params:
764 	 * formatString = a string that is prefixed with a format string
765 	 * endptr = location to store the end pointer,
766 	 * or NULL. [allow-none][default NULL]
767 	 * app = a pointer to a va_list
768 	 * Throws: ConstructionException GTK+ fails to create the object.
769 	 */
770 	public this (string formatString, out string endptr, void** app)
771 	{
772 		// GVariant * g_variant_new_va (const gchar *format_string,  const gchar **endptr,  va_list *app);
773 		char* outendptr = null;
774 		
775 		auto p = g_variant_new_va(Str.toStringz(formatString), &outendptr, app);
776 		if(p is null)
777 		{
778 			throw new ConstructionException("null returned by g_variant_new_va(Str.toStringz(formatString), &outendptr, app)");
779 		}
780 		
781 		endptr = Str.toString(outendptr);
782 		this(cast(GVariant*) p);
783 	}
784 	
785 	/**
786 	 * Creates a new byte GVariant instance.
787 	 * Since 2.24
788 	 * Params:
789 	 * value = a guint8 value
790 	 * Throws: ConstructionException GTK+ fails to create the object.
791 	 */
792 	public this (char value)
793 	{
794 		// GVariant * g_variant_new_byte (guchar value);
795 		auto p = g_variant_new_byte(value);
796 		if(p is null)
797 		{
798 			throw new ConstructionException("null returned by g_variant_new_byte(value)");
799 		}
800 		this(cast(GVariant*) p);
801 	}
802 	
803 	/**
804 	 * Creates a new int16 GVariant instance.
805 	 * Since 2.24
806 	 * Params:
807 	 * value = a gint16 value
808 	 * Throws: ConstructionException GTK+ fails to create the object.
809 	 */
810 	public this (short value)
811 	{
812 		// GVariant * g_variant_new_int16 (gint16 value);
813 		auto p = g_variant_new_int16(value);
814 		if(p is null)
815 		{
816 			throw new ConstructionException("null returned by g_variant_new_int16(value)");
817 		}
818 		this(cast(GVariant*) p);
819 	}
820 	
821 	/**
822 	 * Creates a new uint16 GVariant instance.
823 	 * Since 2.24
824 	 * Params:
825 	 * value = a guint16 value
826 	 * Throws: ConstructionException GTK+ fails to create the object.
827 	 */
828 	public this (ushort value)
829 	{
830 		// GVariant * g_variant_new_uint16 (guint16 value);
831 		auto p = g_variant_new_uint16(value);
832 		if(p is null)
833 		{
834 			throw new ConstructionException("null returned by g_variant_new_uint16(value)");
835 		}
836 		this(cast(GVariant*) p);
837 	}
838 	
839 	/**
840 	 * Creates a new int32 GVariant instance.
841 	 * Since 2.24
842 	 * Params:
843 	 * value = a gint32 value
844 	 * Throws: ConstructionException GTK+ fails to create the object.
845 	 */
846 	public this (int value)
847 	{
848 		// GVariant * g_variant_new_int32 (gint32 value);
849 		auto p = g_variant_new_int32(value);
850 		if(p is null)
851 		{
852 			throw new ConstructionException("null returned by g_variant_new_int32(value)");
853 		}
854 		this(cast(GVariant*) p);
855 	}
856 	
857 	/**
858 	 * Creates a new uint32 GVariant instance.
859 	 * Since 2.24
860 	 * Params:
861 	 * value = a guint32 value
862 	 * Throws: ConstructionException GTK+ fails to create the object.
863 	 */
864 	public this (uint value)
865 	{
866 		// GVariant * g_variant_new_uint32 (guint32 value);
867 		auto p = g_variant_new_uint32(value);
868 		if(p is null)
869 		{
870 			throw new ConstructionException("null returned by g_variant_new_uint32(value)");
871 		}
872 		this(cast(GVariant*) p);
873 	}
874 	
875 	/**
876 	 * Creates a new int64 GVariant instance.
877 	 * Since 2.24
878 	 * Params:
879 	 * value = a gint64 value
880 	 * Throws: ConstructionException GTK+ fails to create the object.
881 	 */
882 	public this (long value)
883 	{
884 		// GVariant * g_variant_new_int64 (gint64 value);
885 		auto p = g_variant_new_int64(value);
886 		if(p is null)
887 		{
888 			throw new ConstructionException("null returned by g_variant_new_int64(value)");
889 		}
890 		this(cast(GVariant*) p);
891 	}
892 	
893 	/**
894 	 * Creates a new uint64 GVariant instance.
895 	 * Since 2.24
896 	 * Params:
897 	 * value = a guint64 value
898 	 * Throws: ConstructionException GTK+ fails to create the object.
899 	 */
900 	public this (ulong value)
901 	{
902 		// GVariant * g_variant_new_uint64 (guint64 value);
903 		auto p = g_variant_new_uint64(value);
904 		if(p is null)
905 		{
906 			throw new ConstructionException("null returned by g_variant_new_uint64(value)");
907 		}
908 		this(cast(GVariant*) p);
909 	}
910 	
911 	/**
912 	 * Creates a new double GVariant instance.
913 	 * Since 2.24
914 	 * Params:
915 	 * value = a gdouble floating point value
916 	 * Throws: ConstructionException GTK+ fails to create the object.
917 	 */
918 	public this (double value)
919 	{
920 		// GVariant * g_variant_new_double (gdouble value);
921 		auto p = g_variant_new_double(value);
922 		if(p is null)
923 		{
924 			throw new ConstructionException("null returned by g_variant_new_double(value)");
925 		}
926 		this(cast(GVariant*) p);
927 	}
928 	
929 	/**
930 	 * Creates a string GVariant with the contents of string.
931 	 * string must be valid utf8.
932 	 * Since 2.24
933 	 * Params:
934 	 * string = a normal utf8 nul-terminated string
935 	 * Throws: ConstructionException GTK+ fails to create the object.
936 	 */
937 	public this (string string)
938 	{
939 		// GVariant * g_variant_new_string (const gchar *string);
940 		auto p = g_variant_new_string(Str.toStringz(string));
941 		if(p is null)
942 		{
943 			throw new ConstructionException("null returned by g_variant_new_string(Str.toStringz(string))");
944 		}
945 		this(cast(GVariant*) p);
946 	}
947 	
948 	/**
949 	 * Determines if a given string is a valid D-Bus object path. You
950 	 * should ensure that a string is a valid D-Bus object path before
951 	 * passing it to g_variant_new_object_path().
952 	 * A valid object path starts with '/' followed by zero or more
953 	 * sequences of characters separated by '/' characters. Each sequence
954 	 * must contain only the characters "[A-Z][a-z][0-9]_". No sequence
955 	 * (including the one following the final '/' character) may be empty.
956 	 * Since 2.24
957 	 * Params:
958 	 * string = a normal C nul-terminated string
959 	 * Returns: TRUE if string is a D-Bus object path
960 	 */
961 	public static int isObjectPath(string string)
962 	{
963 		// gboolean g_variant_is_object_path (const gchar *string);
964 		return g_variant_is_object_path(Str.toStringz(string));
965 	}
966 	
967 	/**
968 	 * Determines if a given string is a valid D-Bus type signature. You
969 	 * should ensure that a string is a valid D-Bus type signature before
970 	 * passing it to g_variant_new_signature().
971 	 * D-Bus type signatures consist of zero or more definite GVariantType
972 	 * strings in sequence.
973 	 * Since 2.24
974 	 * Params:
975 	 * string = a normal C nul-terminated string
976 	 * Returns: TRUE if string is a D-Bus type signature
977 	 */
978 	public static int isSignature(string string)
979 	{
980 		// gboolean g_variant_is_signature (const gchar *string);
981 		return g_variant_is_signature(Str.toStringz(string));
982 	}
983 	
984 	/**
985 	 * Boxes value. The result is a GVariant instance representing a
986 	 * variant containing the original value.
987 	 * If child is a floating reference (see g_variant_ref_sink()), the new
988 	 * instance takes ownership of child.
989 	 * Since 2.24
990 	 * Params:
991 	 * value = a GVariant instance
992 	 * Throws: ConstructionException GTK+ fails to create the object.
993 	 */
994 	public this (Variant value)
995 	{
996 		// GVariant * g_variant_new_variant (GVariant *value);
997 		auto p = g_variant_new_variant((value is null) ? null : value.getVariantStruct());
998 		if(p is null)
999 		{
1000 			throw new ConstructionException("null returned by g_variant_new_variant((value is null) ? null : value.getVariantStruct())");
1001 		}
1002 		this(cast(GVariant*) p);
1003 	}
1004 	
1005 	/**
1006 	 * Constructs an array of strings GVariant from the given array of
1007 	 * strings.
1008 	 * If length is -1 then strv is NULL-terminated.
1009 	 * Since 2.24
1010 	 * Params:
1011 	 * strv = an array of strings. [array length=length][element-type utf8]
1012 	 * Throws: ConstructionException GTK+ fails to create the object.
1013 	 */
1014 	public this (string[] strv)
1015 	{
1016 		// GVariant * g_variant_new_strv (const gchar * const *strv,  gssize length);
1017 		auto p = g_variant_new_strv(Str.toStringzArray(strv), cast(int) strv.length);
1018 		if(p is null)
1019 		{
1020 			throw new ConstructionException("null returned by g_variant_new_strv(Str.toStringzArray(strv), cast(int) strv.length)");
1021 		}
1022 		this(cast(GVariant*) p);
1023 	}
1024 	
1025 	/**
1026 	 * Returns the boolean value of value.
1027 	 * It is an error to call this function with a value of any type
1028 	 * other than G_VARIANT_TYPE_BOOLEAN.
1029 	 * Since 2.24
1030 	 * Returns: TRUE or FALSE
1031 	 */
1032 	public int getBoolean()
1033 	{
1034 		// gboolean g_variant_get_boolean (GVariant *value);
1035 		return g_variant_get_boolean(gVariant);
1036 	}
1037 	
1038 	/**
1039 	 * Returns the byte value of value.
1040 	 * It is an error to call this function with a value of any type
1041 	 * other than G_VARIANT_TYPE_BYTE.
1042 	 * Since 2.24
1043 	 * Returns: a guchar
1044 	 */
1045 	public char getByte()
1046 	{
1047 		// guchar g_variant_get_byte (GVariant *value);
1048 		return g_variant_get_byte(gVariant);
1049 	}
1050 	
1051 	/**
1052 	 * Returns the 16-bit signed integer value of value.
1053 	 * It is an error to call this function with a value of any type
1054 	 * other than G_VARIANT_TYPE_INT16.
1055 	 * Since 2.24
1056 	 * Returns: a gint16
1057 	 */
1058 	public short getInt16()
1059 	{
1060 		// gint16 g_variant_get_int16 (GVariant *value);
1061 		return g_variant_get_int16(gVariant);
1062 	}
1063 	
1064 	/**
1065 	 * Returns the 16-bit unsigned integer value of value.
1066 	 * It is an error to call this function with a value of any type
1067 	 * other than G_VARIANT_TYPE_UINT16.
1068 	 * Since 2.24
1069 	 * Returns: a guint16
1070 	 */
1071 	public ushort getUint16()
1072 	{
1073 		// guint16 g_variant_get_uint16 (GVariant *value);
1074 		return g_variant_get_uint16(gVariant);
1075 	}
1076 	
1077 	/**
1078 	 * Returns the 32-bit signed integer value of value.
1079 	 * It is an error to call this function with a value of any type
1080 	 * other than G_VARIANT_TYPE_INT32.
1081 	 * Since 2.24
1082 	 * Returns: a gint32
1083 	 */
1084 	public int getInt32()
1085 	{
1086 		// gint32 g_variant_get_int32 (GVariant *value);
1087 		return g_variant_get_int32(gVariant);
1088 	}
1089 	
1090 	/**
1091 	 * Returns the 32-bit unsigned integer value of value.
1092 	 * It is an error to call this function with a value of any type
1093 	 * other than G_VARIANT_TYPE_UINT32.
1094 	 * Since 2.24
1095 	 * Returns: a guint32
1096 	 */
1097 	public uint getUint32()
1098 	{
1099 		// guint32 g_variant_get_uint32 (GVariant *value);
1100 		return g_variant_get_uint32(gVariant);
1101 	}
1102 	
1103 	/**
1104 	 * Returns the 64-bit signed integer value of value.
1105 	 * It is an error to call this function with a value of any type
1106 	 * other than G_VARIANT_TYPE_INT64.
1107 	 * Since 2.24
1108 	 * Returns: a gint64
1109 	 */
1110 	public long getInt64()
1111 	{
1112 		// gint64 g_variant_get_int64 (GVariant *value);
1113 		return g_variant_get_int64(gVariant);
1114 	}
1115 	
1116 	/**
1117 	 * Returns the 64-bit unsigned integer value of value.
1118 	 * It is an error to call this function with a value of any type
1119 	 * other than G_VARIANT_TYPE_UINT64.
1120 	 * Since 2.24
1121 	 * Returns: a guint64
1122 	 */
1123 	public ulong getUint64()
1124 	{
1125 		// guint64 g_variant_get_uint64 (GVariant *value);
1126 		return g_variant_get_uint64(gVariant);
1127 	}
1128 	
1129 	/**
1130 	 * Returns the 32-bit signed integer value of value.
1131 	 * It is an error to call this function with a value of any type other
1132 	 * than G_VARIANT_TYPE_HANDLE.
1133 	 * By convention, handles are indexes into an array of file descriptors
1134 	 * that are sent alongside a D-Bus message. If you're not interacting
1135 	 * with D-Bus, you probably don't need them.
1136 	 * Since 2.24
1137 	 * Returns: a gint32
1138 	 */
1139 	public int getHandle()
1140 	{
1141 		// gint32 g_variant_get_handle (GVariant *value);
1142 		return g_variant_get_handle(gVariant);
1143 	}
1144 	
1145 	/**
1146 	 * Returns the double precision floating point value of value.
1147 	 * It is an error to call this function with a value of any type
1148 	 * other than G_VARIANT_TYPE_DOUBLE.
1149 	 * Since 2.24
1150 	 * Returns: a gdouble
1151 	 */
1152 	public double getDouble()
1153 	{
1154 		// gdouble g_variant_get_double (GVariant *value);
1155 		return g_variant_get_double(gVariant);
1156 	}
1157 	
1158 	/**
1159 	 * Returns the string value of a GVariant instance with a string
1160 	 * type. This includes the types G_VARIANT_TYPE_STRING,
1161 	 * G_VARIANT_TYPE_OBJECT_PATH and G_VARIANT_TYPE_SIGNATURE.
1162 	 * The string will always be utf8 encoded.
1163 	 * If length is non-NULL then the length of the string (in bytes) is
1164 	 * returned there. For trusted values, this information is already
1165 	 * known. For untrusted values, a strlen() will be performed.
1166 	 * It is an error to call this function with a value of any type
1167 	 * other than those three.
1168 	 * The return value remains valid as long as value exists.
1169 	 * Since 2.24
1170 	 * Params:
1171 	 * length = a pointer to a gsize,
1172 	 * to store the length. [allow-none][default 0][out]
1173 	 * Returns: the constant string, utf8 encoded. [transfer none]
1174 	 */
1175 	public string getString(out gsize length)
1176 	{
1177 		// const gchar * g_variant_get_string (GVariant *value,  gsize *length);
1178 		return Str.toString(g_variant_get_string(gVariant, &length));
1179 	}
1180 	
1181 	/**
1182 	 * Similar to g_variant_get_string() except that instead of returning
1183 	 * a constant string, the string is duplicated.
1184 	 * The string will always be utf8 encoded.
1185 	 * The return value must be freed using g_free().
1186 	 * Since 2.24
1187 	 * Returns: a newly allocated string, utf8 encoded. [transfer full]
1188 	 */
1189 	public string dupString()
1190 	{
1191 		// gchar * g_variant_dup_string (GVariant *value,  gsize *length);
1192 		gsize length;
1193 		auto p = g_variant_dup_string(gVariant, &length);
1194 		return Str.toString(p, length);
1195 	}
1196 	
1197 	/**
1198 	 * Unboxes value. The result is the GVariant instance that was
1199 	 * contained in value.
1200 	 * Since 2.24
1201 	 * Returns: the item contained in the variant. [transfer full]
1202 	 */
1203 	public Variant getVariant()
1204 	{
1205 		// GVariant * g_variant_get_variant (GVariant *value);
1206 		auto p = g_variant_get_variant(gVariant);
1207 		
1208 		if(p is null)
1209 		{
1210 			return null;
1211 		}
1212 		
1213 		return new Variant(cast(GVariant*) p);
1214 	}
1215 	
1216 	/**
1217 	 * Gets the contents of an array of strings GVariant. This call
1218 	 * makes a shallow copy; the return result should be released with
1219 	 * g_free(), but the individual strings must not be modified.
1220 	 * If length is non-NULL then the number of elements in the result
1221 	 * is stored there. In any case, the resulting array will be
1222 	 * NULL-terminated.
1223 	 * For an empty array, length will be set to 0 and a pointer to a
1224 	 * NULL pointer will be returned.
1225 	 * Since 2.24
1226 	 * Returns: an array of constant strings. [array length=length zero-terminated=1][transfer container]
1227 	 */
1228 	public string[] getStrv()
1229 	{
1230 		// const gchar ** g_variant_get_strv (GVariant *value,  gsize *length);
1231 		gsize length;
1232 		auto p = g_variant_get_strv(gVariant, &length);
1233 		
1234 		string[] strArray = null;
1235 		foreach ( cstr; p[0 .. length] )
1236 		{
1237 			strArray ~= Str.toString(cstr);
1238 		}
1239 		
1240 		return strArray;
1241 	}
1242 	
1243 	/**
1244 	 * Gets the contents of an array of strings GVariant. This call
1245 	 * makes a deep copy; the return result should be released with
1246 	 * g_strfreev().
1247 	 * If length is non-NULL then the number of elements in the result
1248 	 * is stored there. In any case, the resulting array will be
1249 	 * NULL-terminated.
1250 	 * For an empty array, length will be set to 0 and a pointer to a
1251 	 * NULL pointer will be returned.
1252 	 * Since 2.24
1253 	 * Returns: an array of strings. [array length=length zero-terminated=1][transfer full]
1254 	 */
1255 	public string[] dupStrv()
1256 	{
1257 		// gchar ** g_variant_dup_strv (GVariant *value,  gsize *length);
1258 		gsize length;
1259 		auto p = g_variant_dup_strv(gVariant, &length);
1260 		
1261 		string[] strArray = null;
1262 		foreach ( cstr; p[0 .. length] )
1263 		{
1264 			strArray ~= Str.toString(cstr);
1265 		}
1266 		
1267 		return strArray;
1268 	}
1269 	
1270 	/**
1271 	 * Gets the contents of an array of object paths GVariant. This call
1272 	 * makes a shallow copy; the return result should be released with
1273 	 * g_free(), but the individual strings must not be modified.
1274 	 * If length is non-NULL then the number of elements in the result
1275 	 * is stored there. In any case, the resulting array will be
1276 	 * NULL-terminated.
1277 	 * For an empty array, length will be set to 0 and a pointer to a
1278 	 * NULL pointer will be returned.
1279 	 * Since 2.30
1280 	 * Returns: an array of constant strings. [array length=length zero-terminated=1][transfer container]
1281 	 */
1282 	public string[] getObjv()
1283 	{
1284 		// const gchar ** g_variant_get_objv (GVariant *value,  gsize *length);
1285 		gsize length;
1286 		auto p = g_variant_get_objv(gVariant, &length);
1287 		
1288 		string[] strArray = null;
1289 		foreach ( cstr; p[0 .. length] )
1290 		{
1291 			strArray ~= Str.toString(cstr);
1292 		}
1293 		
1294 		return strArray;
1295 	}
1296 	
1297 	/**
1298 	 * Gets the contents of an array of object paths GVariant. This call
1299 	 * makes a deep copy; the return result should be released with
1300 	 * g_strfreev().
1301 	 * If length is non-NULL then the number of elements in the result
1302 	 * is stored there. In any case, the resulting array will be
1303 	 * NULL-terminated.
1304 	 * For an empty array, length will be set to 0 and a pointer to a
1305 	 * NULL pointer will be returned.
1306 	 * Since 2.30
1307 	 * Returns: an array of strings. [array length=length zero-terminated=1][transfer full]
1308 	 */
1309 	public string[] dupObjv()
1310 	{
1311 		// gchar ** g_variant_dup_objv (GVariant *value,  gsize *length);
1312 		gsize length;
1313 		auto p = g_variant_dup_objv(gVariant, &length);
1314 		
1315 		string[] strArray = null;
1316 		foreach ( cstr; p[0 .. length] )
1317 		{
1318 			strArray ~= Str.toString(cstr);
1319 		}
1320 		
1321 		return strArray;
1322 	}
1323 	
1324 	/**
1325 	 * Returns the string value of a GVariant instance with an
1326 	 * array-of-bytes type. The string has no particular encoding.
1327 	 * If the array does not end with a nul terminator character, the empty
1328 	 * string is returned. For this reason, you can always trust that a
1329 	 * non-NULL nul-terminated string will be returned by this function.
1330 	 * If the array contains a nul terminator character somewhere other than
1331 	 * the last byte then the returned string is the string, up to the first
1332 	 * such nul character.
1333 	 * It is an error to call this function with a value that is not an
1334 	 * array of bytes.
1335 	 * The return value remains valid as long as value exists.
1336 	 * Since 2.26
1337 	 * Returns: the constant string. [transfer none][array zero-terminated=1][element-type guint8]
1338 	 */
1339 	public string getBytestring()
1340 	{
1341 		// const gchar * g_variant_get_bytestring (GVariant *value);
1342 		return Str.toString(g_variant_get_bytestring(gVariant));
1343 	}
1344 	
1345 	/**
1346 	 * Similar to g_variant_get_bytestring() except that instead of
1347 	 * returning a constant string, the string is duplicated.
1348 	 * The return value must be freed using g_free().
1349 	 * Since 2.26
1350 	 * Returns: a newly allocated string. [transfer full][array zero-terminated=1 length=length][element-type guint8]
1351 	 */
1352 	public string dupBytestring()
1353 	{
1354 		// gchar * g_variant_dup_bytestring (GVariant *value,  gsize *length);
1355 		gsize length;
1356 		auto p = g_variant_dup_bytestring(gVariant, &length);
1357 		return Str.toString(p, length);
1358 	}
1359 	
1360 	/**
1361 	 * Gets the contents of an array of array of bytes GVariant. This call
1362 	 * makes a shallow copy; the return result should be released with
1363 	 * g_free(), but the individual strings must not be modified.
1364 	 * If length is non-NULL then the number of elements in the result is
1365 	 * stored there. In any case, the resulting array will be
1366 	 * NULL-terminated.
1367 	 * For an empty array, length will be set to 0 and a pointer to a
1368 	 * NULL pointer will be returned.
1369 	 * Since 2.26
1370 	 * Returns: an array of constant strings. [array length=length][transfer container]
1371 	 */
1372 	public string[] getBytestringArray()
1373 	{
1374 		// const gchar ** g_variant_get_bytestring_array (GVariant *value,  gsize *length);
1375 		gsize length;
1376 		auto p = g_variant_get_bytestring_array(gVariant, &length);
1377 		
1378 		string[] strArray = null;
1379 		foreach ( cstr; p[0 .. length] )
1380 		{
1381 			strArray ~= Str.toString(cstr);
1382 		}
1383 		
1384 		return strArray;
1385 	}
1386 	
1387 	/**
1388 	 * Gets the contents of an array of array of bytes GVariant. This call
1389 	 * makes a deep copy; the return result should be released with
1390 	 * g_strfreev().
1391 	 * If length is non-NULL then the number of elements in the result is
1392 	 * stored there. In any case, the resulting array will be
1393 	 * NULL-terminated.
1394 	 * For an empty array, length will be set to 0 and a pointer to a
1395 	 * NULL pointer will be returned.
1396 	 * Since 2.26
1397 	 * Returns: an array of strings. [array length=length][transfer full]
1398 	 */
1399 	public string[] dupBytestringArray()
1400 	{
1401 		// gchar ** g_variant_dup_bytestring_array (GVariant *value,  gsize *length);
1402 		gsize length;
1403 		auto p = g_variant_dup_bytestring_array(gVariant, &length);
1404 		
1405 		string[] strArray = null;
1406 		foreach ( cstr; p[0 .. length] )
1407 		{
1408 			strArray ~= Str.toString(cstr);
1409 		}
1410 		
1411 		return strArray;
1412 	}
1413 	
1414 	/**
1415 	 * Depending on if child is NULL, either wraps child inside of a
1416 	 * maybe container or creates a Nothing instance for the given type.
1417 	 * At least one of child_type and child must be non-NULL.
1418 	 * If child_type is non-NULL then it must be a definite type.
1419 	 * If they are both non-NULL then child_type must be the type
1420 	 * of child.
1421 	 * If child is a floating reference (see g_variant_ref_sink()), the new
1422 	 * instance takes ownership of child.
1423 	 * Since 2.24
1424 	 * Params:
1425 	 * childType = the GVariantType of the child, or NULL. [allow-none]
1426 	 * child = the child value, or NULL. [allow-none]
1427 	 * Throws: ConstructionException GTK+ fails to create the object.
1428 	 */
1429 	public this (VariantType childType, Variant child)
1430 	{
1431 		// GVariant * g_variant_new_maybe (const GVariantType *child_type,  GVariant *child);
1432 		auto p = g_variant_new_maybe((childType is null) ? null : childType.getVariantTypeStruct(), (child is null) ? null : child.getVariantStruct());
1433 		if(p is null)
1434 		{
1435 			throw new ConstructionException("null returned by g_variant_new_maybe((childType is null) ? null : childType.getVariantTypeStruct(), (child is null) ? null : child.getVariantStruct())");
1436 		}
1437 		this(cast(GVariant*) p);
1438 	}
1439 	
1440 	/**
1441 	 * Creates a new GVariant array from children.
1442 	 * child_type must be non-NULL if n_children is zero. Otherwise, the
1443 	 * child type is determined by inspecting the first element of the
1444 	 * children array. If child_type is non-NULL then it must be a
1445 	 * definite type.
1446 	 * The items of the array are taken from the children array. No entry
1447 	 * in the children array may be NULL.
1448 	 * All items in the array must have the same type, which must be the
1449 	 * same as child_type, if given.
1450 	 * If the children are floating references (see g_variant_ref_sink()), the
1451 	 * new instance takes ownership of them as if via g_variant_ref_sink().
1452 	 * Since 2.24
1453 	 * Params:
1454 	 * childType = the element type of the new array. [allow-none]
1455 	 * children = an array of
1456 	 * GVariant pointers, the children. [allow-none][array length=n_children]
1457 	 * Throws: ConstructionException GTK+ fails to create the object.
1458 	 */
1459 	public this (VariantType childType, Variant[] children)
1460 	{
1461 		// GVariant * g_variant_new_array (const GVariantType *child_type,  GVariant * const *children,  gsize n_children);
1462 		
1463 		GVariant*[] childrenArray = new GVariant*[children.length];
1464 		for ( int i = 0; i < children.length ; i++ )
1465 		{
1466 			childrenArray[i] = children[i].getVariantStruct();
1467 		}
1468 		
1469 		auto p = g_variant_new_array((childType is null) ? null : childType.getVariantTypeStruct(), childrenArray.ptr, cast(int) children.length);
1470 		if(p is null)
1471 		{
1472 			throw new ConstructionException("null returned by g_variant_new_array((childType is null) ? null : childType.getVariantTypeStruct(), childrenArray.ptr, cast(int) children.length)");
1473 		}
1474 		this(cast(GVariant*) p);
1475 	}
1476 	
1477 	/**
1478 	 * Creates a new tuple GVariant out of the items in children. The
1479 	 * type is determined from the types of children. No entry in the
1480 	 * children array may be NULL.
1481 	 * If n_children is 0 then the unit tuple is constructed.
1482 	 * If the children are floating references (see g_variant_ref_sink()), the
1483 	 * new instance takes ownership of them as if via g_variant_ref_sink().
1484 	 * Since 2.24
1485 	 * Params:
1486 	 * children = the items to make the tuple out of. [array length=n_children]
1487 	 * Throws: ConstructionException GTK+ fails to create the object.
1488 	 */
1489 	public this (Variant[] children)
1490 	{
1491 		// GVariant * g_variant_new_tuple (GVariant * const *children,  gsize n_children);
1492 		
1493 		GVariant*[] childrenArray = new GVariant*[children.length];
1494 		for ( int i = 0; i < children.length ; i++ )
1495 		{
1496 			childrenArray[i] = children[i].getVariantStruct();
1497 		}
1498 		
1499 		auto p = g_variant_new_tuple(childrenArray.ptr, cast(int) children.length);
1500 		if(p is null)
1501 		{
1502 			throw new ConstructionException("null returned by g_variant_new_tuple(childrenArray.ptr, cast(int) children.length)");
1503 		}
1504 		this(cast(GVariant*) p);
1505 	}
1506 	
1507 	/**
1508 	 * Creates a new dictionary entry GVariant. key and value must be
1509 	 * non-NULL. key must be a value of a basic type (ie: not a container).
1510 	 * If the key or value are floating references (see g_variant_ref_sink()),
1511 	 * the new instance takes ownership of them as if via g_variant_ref_sink().
1512 	 * Since 2.24
1513 	 * Params:
1514 	 * key = a basic GVariant, the key
1515 	 * value = a GVariant, the value
1516 	 * Throws: ConstructionException GTK+ fails to create the object.
1517 	 */
1518 	public this (Variant key, Variant value)
1519 	{
1520 		// GVariant * g_variant_new_dict_entry (GVariant *key,  GVariant *value);
1521 		auto p = g_variant_new_dict_entry((key is null) ? null : key.getVariantStruct(), (value is null) ? null : value.getVariantStruct());
1522 		if(p is null)
1523 		{
1524 			throw new ConstructionException("null returned by g_variant_new_dict_entry((key is null) ? null : key.getVariantStruct(), (value is null) ? null : value.getVariantStruct())");
1525 		}
1526 		this(cast(GVariant*) p);
1527 	}
1528 	
1529 	/**
1530 	 * Provides access to the serialised data for an array of fixed-sized
1531 	 * items.
1532 	 * value must be an array with fixed-sized elements. Numeric types are
1533 	 * fixed-size as are tuples containing only other fixed-sized types.
1534 	 * element_size must be the size of a single element in the array. For
1535 	 * example, if calling this function for an array of 32 bit integers,
1536 	 * you might say sizeof (gint32). This value isn't used
1537 	 * except for the purpose of a double-check that the form of the
1538 	 * serialised data matches the caller's expectation.
1539 	 * n_elements, which must be non-NULL is set equal to the number of
1540 	 * items in the array.
1541 	 * Since 2.32
1542 	 * Params:
1543 	 * elementType = the GVariantType of each element
1544 	 * elements = a pointer to the fixed array of contiguous elements
1545 	 * elementSize = the size of each element
1546 	 * Throws: ConstructionException GTK+ fails to create the object.
1547 	 */
1548 	public this (VariantType elementType, void[] elements, gsize elementSize)
1549 	{
1550 		// GVariant * g_variant_new_fixed_array (const GVariantType *element_type,  gconstpointer elements,  gsize n_elements,  gsize element_size);
1551 		auto p = g_variant_new_fixed_array((elementType is null) ? null : elementType.getVariantTypeStruct(), elements.ptr, cast(int) elements.length, elementSize);
1552 		if(p is null)
1553 		{
1554 			throw new ConstructionException("null returned by g_variant_new_fixed_array((elementType is null) ? null : elementType.getVariantTypeStruct(), elements.ptr, cast(int) elements.length, elementSize)");
1555 		}
1556 		this(cast(GVariant*) p);
1557 	}
1558 	
1559 	/**
1560 	 * Given a maybe-typed GVariant instance, extract its value. If the
1561 	 * value is Nothing, then this function returns NULL.
1562 	 * Since 2.24
1563 	 * Returns: the contents of value, or NULL. [allow-none][transfer full]
1564 	 */
1565 	public Variant getMaybe()
1566 	{
1567 		// GVariant * g_variant_get_maybe (GVariant *value);
1568 		auto p = g_variant_get_maybe(gVariant);
1569 		
1570 		if(p is null)
1571 		{
1572 			return null;
1573 		}
1574 		
1575 		return new Variant(cast(GVariant*) p);
1576 	}
1577 	
1578 	/**
1579 	 * Determines the number of children in a container GVariant instance.
1580 	 * This includes variants, maybes, arrays, tuples and dictionary
1581 	 * entries. It is an error to call this function on any other type of
1582 	 * GVariant.
1583 	 * For variants, the return value is always 1. For values with maybe
1584 	 * types, it is always zero or one. For arrays, it is the length of the
1585 	 * array. For tuples it is the number of tuple items (which depends
1586 	 * only on the type). For dictionary entries, it is always 2
1587 	 * This function is O(1).
1588 	 * Since 2.24
1589 	 * Returns: the number of children in the container
1590 	 */
1591 	public gsize nChildren()
1592 	{
1593 		// gsize g_variant_n_children (GVariant *value);
1594 		return g_variant_n_children(gVariant);
1595 	}
1596 	
1597 	/**
1598 	 * Reads a child item out of a container GVariant instance. This
1599 	 * includes variants, maybes, arrays, tuples and dictionary
1600 	 * entries. It is an error to call this function on any other type of
1601 	 * GVariant.
1602 	 * It is an error if index_ is greater than the number of child items
1603 	 * in the container. See g_variant_n_children().
1604 	 * The returned value is never floating. You should free it with
1605 	 * g_variant_unref() when you're done with it.
1606 	 * This function is O(1).
1607 	 * Since 2.24
1608 	 * Params:
1609 	 * index = the index of the child to fetch
1610 	 * Returns: the child at the specified index. [transfer full]
1611 	 */
1612 	public Variant getChildValue(gsize index)
1613 	{
1614 		// GVariant * g_variant_get_child_value (GVariant *value,  gsize index_);
1615 		auto p = g_variant_get_child_value(gVariant, index);
1616 		
1617 		if(p is null)
1618 		{
1619 			return null;
1620 		}
1621 		
1622 		return new Variant(cast(GVariant*) p);
1623 	}
1624 	
1625 	/**
1626 	 * Looks up a value in a dictionary GVariant.
1627 	 * This function works with dictionaries of the type
1628 	 * a{s*} (and equally well with type
1629 	 * a{o*}, but we only further discuss the string case
1630 	 * for sake of clarity).
1631 	 * In the event that dictionary has the type a{sv},
1632 	 * the expected_type string specifies what type of value is expected to
1633 	 * be inside of the variant. If the value inside the variant has a
1634 	 * different type then NULL is returned. In the event that dictionary
1635 	 * has a value type other than v then expected_type
1636 	 * must directly match the key type and it is used to unpack the value
1637 	 * directly or an error occurs.
1638 	 * In either case, if key is not found in dictionary, NULL is
1639 	 * returned.
1640 	 * If the key is found and the value has the correct type, it is
1641 	 * returned. If expected_type was specified then any non-NULL return
1642 	 * value will have this type.
1643 	 * Since 2.28
1644 	 * Params:
1645 	 * key = the key to lookup in the dictionary
1646 	 * expectedType = a GVariantType, or NULL. [allow-none]
1647 	 * Returns: the value of the dictionary key, or NULL. [transfer full]
1648 	 */
1649 	public Variant lookupValue(string key, VariantType expectedType)
1650 	{
1651 		// GVariant * g_variant_lookup_value (GVariant *dictionary,  const gchar *key,  const GVariantType *expected_type);
1652 		auto p = g_variant_lookup_value(gVariant, Str.toStringz(key), (expectedType is null) ? null : expectedType.getVariantTypeStruct());
1653 		
1654 		if(p is null)
1655 		{
1656 			return null;
1657 		}
1658 		
1659 		return new Variant(cast(GVariant*) p);
1660 	}
1661 	
1662 	/**
1663 	 * Provides access to the serialised data for an array of fixed-sized
1664 	 * items.
1665 	 * value must be an array with fixed-sized elements. Numeric types are
1666 	 * fixed-size, as are tuples containing only other fixed-sized types.
1667 	 * element_size must be the size of a single element in the array,
1668 	 * as given by the section on
1669 	 * Serialised Data
1670 	 * Memory.
1671 	 * In particular, arrays of these fixed-sized types can be interpreted
1672 	 * as an array of the given C type, with element_size set to
1673 	 * Since 2.24
1674 	 * Params:
1675 	 * nElements = a pointer to the location to store the number of items. [out]
1676 	 * elementSize = the size of each element
1677 	 * Returns: a pointer to the fixed array. [array length=n_elements][transfer none]
1678 	 */
1679 	public void* getFixedArray(gsize* nElements, gsize elementSize)
1680 	{
1681 		// gconstpointer g_variant_get_fixed_array (GVariant *value,  gsize *n_elements,  gsize element_size);
1682 		return g_variant_get_fixed_array(gVariant, nElements, elementSize);
1683 	}
1684 	
1685 	/**
1686 	 * Determines the number of bytes that would be required to store value
1687 	 * with g_variant_store().
1688 	 * If value has a fixed-sized type then this function always returned
1689 	 * that fixed size.
1690 	 * In the case that value is already in serialised form or the size has
1691 	 * already been calculated (ie: this function has been called before)
1692 	 * then this function is O(1). Otherwise, the size is calculated, an
1693 	 * operation which is approximately O(n) in the number of values
1694 	 * involved.
1695 	 * Since 2.24
1696 	 * Returns: the serialised size of value
1697 	 */
1698 	public gsize getSize()
1699 	{
1700 		// gsize g_variant_get_size (GVariant *value);
1701 		return g_variant_get_size(gVariant);
1702 	}
1703 	
1704 	/**
1705 	 * Returns a pointer to the serialised form of a GVariant instance.
1706 	 * The returned data may not be in fully-normalised form if read from an
1707 	 * untrusted source. The returned data must not be freed; it remains
1708 	 * valid for as long as value exists.
1709 	 * If value is a fixed-sized value that was deserialised from a
1710 	 * corrupted serialised container then NULL may be returned. In this
1711 	 * case, the proper thing to do is typically to use the appropriate
1712 	 * number of nul bytes in place of value. If value is not fixed-sized
1713 	 * then NULL is never returned.
1714 	 * In the case that value is already in serialised form, this function
1715 	 * is O(1). If the value is not already in serialised form,
1716 	 * serialisation occurs implicitly and is approximately O(n) in the size
1717 	 * of the result.
1718 	 * To deserialise the data returned by this function, in addition to the
1719 	 * serialised data, you must know the type of the GVariant, and (if the
1720 	 * machine might be different) the endianness of the machine that stored
1721 	 * it. As a result, file formats or network messages that incorporate
1722 	 * serialised GVariants must include this information either
1723 	 * implicitly (for instance "the file always contains a
1724 	 * G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or
1725 	 * explicitly (by storing the type and/or endianness in addition to the
1726 	 * serialised data).
1727 	 * Since 2.24
1728 	 * Returns: the serialised form of value, or NULL. [transfer none]
1729 	 */
1730 	public void* getData()
1731 	{
1732 		// gconstpointer g_variant_get_data (GVariant *value);
1733 		return g_variant_get_data(gVariant);
1734 	}
1735 	
1736 	/**
1737 	 * Returns a pointer to the serialised form of a GVariant instance.
1738 	 * The semantics of this function are exactly the same as
1739 	 * g_variant_get_data(), except that the returned GBytes holds
1740 	 * a reference to the variant data.
1741 	 * Since 2.36
1742 	 * Returns: A new GBytes representing the variant data. [transfer full]
1743 	 */
1744 	public Bytes getDataAsBytes()
1745 	{
1746 		// GBytes * g_variant_get_data_as_bytes (GVariant *value);
1747 		auto p = g_variant_get_data_as_bytes(gVariant);
1748 		
1749 		if(p is null)
1750 		{
1751 			return null;
1752 		}
1753 		
1754 		return new Bytes(cast(GBytes*) p);
1755 	}
1756 	
1757 	/**
1758 	 * Stores the serialised form of value at data. data should be
1759 	 * large enough. See g_variant_get_size().
1760 	 * The stored data is in machine native byte order but may not be in
1761 	 * fully-normalised form if read from an untrusted source. See
1762 	 * g_variant_get_normal_form() for a solution.
1763 	 * As with g_variant_get_data(), to be able to deserialise the
1764 	 * serialised variant successfully, its type and (if the destination
1765 	 * machine might be different) its endianness must also be available.
1766 	 * This function is approximately O(n) in the size of data.
1767 	 * Since 2.24
1768 	 * Params:
1769 	 * data = the location to store the serialised data at
1770 	 */
1771 	public void store(void* data)
1772 	{
1773 		// void g_variant_store (GVariant *value,  gpointer data);
1774 		g_variant_store(gVariant, data);
1775 	}
1776 	
1777 	/**
1778 	 * Creates a new GVariant instance from serialised data.
1779 	 * type is the type of GVariant instance that will be constructed.
1780 	 * The interpretation of data depends on knowing the type.
1781 	 * data is not modified by this function and must remain valid with an
1782 	 * unchanging value until such a time as notify is called with
1783 	 * user_data. If the contents of data change before that time then
1784 	 * the result is undefined.
1785 	 * If data is trusted to be serialised data in normal form then
1786 	 * trusted should be TRUE. This applies to serialised data created
1787 	 * within this process or read from a trusted location on the disk (such
1788 	 * as a file installed in /usr/lib alongside your application). You
1789 	 * should set trusted to FALSE if data is read from the network, a
1790 	 * file in the user's home directory, etc.
1791 	 * If data was not stored in this machine's native endianness, any multi-byte
1792 	 * numeric values in the returned variant will also be in non-native
1793 	 * endianness. g_variant_byteswap() can be used to recover the original values.
1794 	 * notify will be called with user_data when data is no longer
1795 	 * needed. The exact time of this call is unspecified and might even be
1796 	 * before this function returns.
1797 	 * Since 2.24
1798 	 * Params:
1799 	 * type = a definite GVariantType
1800 	 * data = the serialised data. [array length=size][element-type guint8]
1801 	 * size = the size of data
1802 	 * trusted = TRUE if data is definitely in normal form
1803 	 * notify = function to call when data is no longer needed. [scope async]
1804 	 * userData = data for notify
1805 	 * Throws: ConstructionException GTK+ fails to create the object.
1806 	 */
1807 	public this (VariantType type, void* data, gsize size, int trusted, GDestroyNotify notify, void* userData)
1808 	{
1809 		// GVariant * g_variant_new_from_data (const GVariantType *type,  gconstpointer data,  gsize size,  gboolean trusted,  GDestroyNotify notify,  gpointer user_data);
1810 		auto p = g_variant_new_from_data((type is null) ? null : type.getVariantTypeStruct(), data, size, trusted, notify, userData);
1811 		if(p is null)
1812 		{
1813 			throw new ConstructionException("null returned by g_variant_new_from_data((type is null) ? null : type.getVariantTypeStruct(), data, size, trusted, notify, userData)");
1814 		}
1815 		this(cast(GVariant*) p);
1816 	}
1817 	
1818 	/**
1819 	 * Constructs a new serialised-mode GVariant instance. This is the
1820 	 * inner interface for creation of new serialised values that gets
1821 	 * called from various functions in gvariant.c.
1822 	 * A reference is taken on bytes.
1823 	 * Since 2.36
1824 	 * Params:
1825 	 * type = a GVariantType
1826 	 * bytes = a GBytes
1827 	 * trusted = if the contents of bytes are trusted
1828 	 * Throws: ConstructionException GTK+ fails to create the object.
1829 	 */
1830 	public this (VariantType type, Bytes bytes, int trusted)
1831 	{
1832 		// GVariant * g_variant_new_from_bytes (const GVariantType *type,  GBytes *bytes,  gboolean trusted);
1833 		auto p = g_variant_new_from_bytes((type is null) ? null : type.getVariantTypeStruct(), (bytes is null) ? null : bytes.getBytesStruct(), trusted);
1834 		if(p is null)
1835 		{
1836 			throw new ConstructionException("null returned by g_variant_new_from_bytes((type is null) ? null : type.getVariantTypeStruct(), (bytes is null) ? null : bytes.getBytesStruct(), trusted)");
1837 		}
1838 		this(cast(GVariant*) p);
1839 	}
1840 	
1841 	/**
1842 	 * Performs a byteswapping operation on the contents of value. The
1843 	 * result is that all multi-byte numeric data contained in value is
1844 	 * byteswapped. That includes 16, 32, and 64bit signed and unsigned
1845 	 * integers as well as file handles and double precision floating point
1846 	 * values.
1847 	 * This function is an identity mapping on any value that does not
1848 	 * contain multi-byte numeric data. That include strings, booleans,
1849 	 * bytes and containers containing only these things (recursively).
1850 	 * The returned value is always in normal form and is marked as trusted.
1851 	 * Since 2.24
1852 	 * Returns: the byteswapped form of value. [transfer full]
1853 	 */
1854 	public Variant byteswap()
1855 	{
1856 		// GVariant * g_variant_byteswap (GVariant *value);
1857 		auto p = g_variant_byteswap(gVariant);
1858 		
1859 		if(p is null)
1860 		{
1861 			return null;
1862 		}
1863 		
1864 		return new Variant(cast(GVariant*) p);
1865 	}
1866 	
1867 	/**
1868 	 * Gets a GVariant instance that has the same value as value and is
1869 	 * trusted to be in normal form.
1870 	 * If value is already trusted to be in normal form then a new
1871 	 * reference to value is returned.
1872 	 * If value is not already trusted, then it is scanned to check if it
1873 	 * is in normal form. If it is found to be in normal form then it is
1874 	 * marked as trusted and a new reference to it is returned.
1875 	 * If value is found not to be in normal form then a new trusted
1876 	 * GVariant is created with the same value as value.
1877 	 * It makes sense to call this function if you've received GVariant
1878 	 * data from untrusted sources and you want to ensure your serialised
1879 	 * output is definitely in normal form.
1880 	 * Since 2.24
1881 	 * Returns: a trusted GVariant. [transfer full]
1882 	 */
1883 	public Variant getNormalForm()
1884 	{
1885 		// GVariant * g_variant_get_normal_form (GVariant *value);
1886 		auto p = g_variant_get_normal_form(gVariant);
1887 		
1888 		if(p is null)
1889 		{
1890 			return null;
1891 		}
1892 		
1893 		return new Variant(cast(GVariant*) p);
1894 	}
1895 	
1896 	/**
1897 	 * Checks if value is in normal form.
1898 	 * The main reason to do this is to detect if a given chunk of
1899 	 * serialised data is in normal form: load the data into a GVariant
1900 	 * using g_variant_new_from_data() and then use this function to
1901 	 * check.
1902 	 * If value is found to be in normal form then it will be marked as
1903 	 * being trusted. If the value was already marked as being trusted then
1904 	 * this function will immediately return TRUE.
1905 	 * Since 2.24
1906 	 * Returns: TRUE if value is in normal form
1907 	 */
1908 	public int isNormalForm()
1909 	{
1910 		// gboolean g_variant_is_normal_form (GVariant *value);
1911 		return g_variant_is_normal_form(gVariant);
1912 	}
1913 	
1914 	/**
1915 	 * Generates a hash value for a GVariant instance.
1916 	 * The output of this function is guaranteed to be the same for a given
1917 	 * value only per-process. It may change between different processor
1918 	 * architectures or even different versions of GLib. Do not use this
1919 	 * function as a basis for building protocols or file formats.
1920 	 * The type of value is gconstpointer only to allow use of this
1921 	 * function with GHashTable. value must be a GVariant.
1922 	 * Since 2.24
1923 	 * Params:
1924 	 * value = a basic GVariant value as a gconstpointer. [type GVariant]
1925 	 * Returns: a hash value corresponding to value
1926 	 */
1927 	public static uint hash(void* value)
1928 	{
1929 		// guint g_variant_hash (gconstpointer value);
1930 		return g_variant_hash(value);
1931 	}
1932 	
1933 	/**
1934 	 * Checks if one and two have the same type and value.
1935 	 * The types of one and two are gconstpointer only to allow use of
1936 	 * this function with GHashTable. They must each be a GVariant.
1937 	 * Since 2.24
1938 	 * Params:
1939 	 * one = a GVariant instance. [type GVariant]
1940 	 * two = a GVariant instance. [type GVariant]
1941 	 * Returns: TRUE if one and two are equal
1942 	 */
1943 	public static int equal(void* one, void* two)
1944 	{
1945 		// gboolean g_variant_equal (gconstpointer one,  gconstpointer two);
1946 		return g_variant_equal(one, two);
1947 	}
1948 	
1949 	/**
1950 	 * Pretty-prints value in the format understood by g_variant_parse().
1951 	 * The format is described here.
1952 	 * If type_annotate is TRUE, then type information is included in
1953 	 * the output.
1954 	 * Since 2.24
1955 	 * Params:
1956 	 * typeAnnotate = TRUE if type information should be included in
1957 	 * the output
1958 	 * Returns: a newly-allocated string holding the result. [transfer full]
1959 	 */
1960 	public string print(int typeAnnotate)
1961 	{
1962 		// gchar * g_variant_print (GVariant *value,  gboolean type_annotate);
1963 		return Str.toString(g_variant_print(gVariant, typeAnnotate));
1964 	}
1965 	
1966 	/**
1967 	 * Behaves as g_variant_print(), but operates on a GString.
1968 	 * If string is non-NULL then it is appended to and returned. Else,
1969 	 * a new empty GString is allocated and it is returned.
1970 	 * Since 2.24
1971 	 * Params:
1972 	 * string = a GString, or NULL. [allow-none][default NULL]
1973 	 * typeAnnotate = TRUE if type information should be included in
1974 	 * the output
1975 	 * Returns: a GString containing the string
1976 	 */
1977 	public StringG printString(StringG string, int typeAnnotate)
1978 	{
1979 		// GString * g_variant_print_string (GVariant *value,  GString *string,  gboolean type_annotate);
1980 		auto p = g_variant_print_string(gVariant, (string is null) ? null : string.getStringGStruct(), typeAnnotate);
1981 		
1982 		if(p is null)
1983 		{
1984 			return null;
1985 		}
1986 		
1987 		return new StringG(cast(GString*) p);
1988 	}
1989 	
1990 	/**
1991 	 * Parses a GVariant from a text representation.
1992 	 * A single GVariant is parsed from the content of text.
1993 	 * The format is described here.
1994 	 * The memory at limit will never be accessed and the parser behaves as
1995 	 * if the character at limit is the nul terminator. This has the
1996 	 * effect of bounding text.
1997 	 * If endptr is non-NULL then text is permitted to contain data
1998 	 * following the value that this function parses and endptr will be
1999 	 * updated to point to the first character past the end of the text
2000 	 * parsed by this function. If endptr is NULL and there is extra data
2001 	 * then an error is returned.
2002 	 * If type is non-NULL then the value will be parsed to have that
2003 	 * type. This may result in additional parse errors (in the case that
2004 	 * the parsed value doesn't fit the type) but may also result in fewer
2005 	 * errors (in the case that the type would have been ambiguous, such as
2006 	 * with empty arrays).
2007 	 * In the event that the parsing is successful, the resulting GVariant
2008 	 * is returned.
2009 	 * In case of any error, NULL will be returned. If error is non-NULL
2010 	 * then it will be set to reflect the error that occurred.
2011 	 * Officially, the language understood by the parser is "any string
2012 	 * produced by g_variant_print()".
2013 	 * Params:
2014 	 * type = a GVariantType, or NULL. [allow-none]
2015 	 * text = a string containing a GVariant in text form
2016 	 * limit = a pointer to the end of text, or NULL. [allow-none]
2017 	 * endptr = a location to store the end pointer, or NULL. [allow-none]
2018 	 * Returns: a reference to a GVariant, or NULL
2019 	 * Throws: GException on failure.
2020 	 */
2021 	public static Variant parse(VariantType type, string text, string limit, out string endptr)
2022 	{
2023 		// GVariant * g_variant_parse (const GVariantType *type,  const gchar *text,  const gchar *limit,  const gchar **endptr,  GError **error);
2024 		char* outendptr = null;
2025 		GError* err = null;
2026 		
2027 		auto p = g_variant_parse((type is null) ? null : type.getVariantTypeStruct(), Str.toStringz(text), Str.toStringz(limit), &outendptr, &err);
2028 		
2029 		if (err !is null)
2030 		{
2031 			throw new GException( new ErrorG(err) );
2032 		}
2033 		
2034 		endptr = Str.toString(outendptr);
2035 		
2036 		if(p is null)
2037 		{
2038 			return null;
2039 		}
2040 		
2041 		return new Variant(cast(GVariant*) p);
2042 	}
2043 	
2044 	/**
2045 	 * Parses format and returns the result.
2046 	 * This is the version of g_variant_new_parsed() intended to be used
2047 	 * from libraries.
2048 	 * The return value will be floating if it was a newly created GVariant
2049 	 * instance. In the case that format simply specified the collection
2050 	 * of a GVariant pointer (eg: format was "%*") then the collected
2051 	 * GVariant pointer will be returned unmodified, without adding any
2052 	 * additional references.
2053 	 * In order to behave correctly in all cases it is necessary for the
2054 	 * calling function to g_variant_ref_sink() the return result before
2055 	 * returning control to the user that originally provided the pointer.
2056 	 * At this point, the caller will have their own full reference to the
2057 	 * result. This can also be done by adding the result to a container,
2058 	 * or by passing it to another g_variant_new() call.
2059 	 * Params:
2060 	 * format = a text format GVariant
2061 	 * app = a pointer to a va_list
2062 	 * Throws: ConstructionException GTK+ fails to create the object.
2063 	 */
2064 	public this (string format, void** app)
2065 	{
2066 		// GVariant * g_variant_new_parsed_va (const gchar *format,  va_list *app);
2067 		auto p = g_variant_new_parsed_va(Str.toStringz(format), app);
2068 		if(p is null)
2069 		{
2070 			throw new ConstructionException("null returned by g_variant_new_parsed_va(Str.toStringz(format), app)");
2071 		}
2072 		this(cast(GVariant*) p);
2073 	}
2074 }