<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-GVariant">
<refmeta>
<refentrytitle role="top_of_page" id="glib-GVariant.top_of_page">GVariant</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GVariant</refname>
<refpurpose>strongly typed value datatype</refpurpose>
</refnamediv>

<refsect1 id="glib-GVariant.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-unref">g_variant_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-ref">g_variant_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-ref-sink">g_variant_ref_sink</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-floating">g_variant_is_floating</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-take-ref">g_variant_take_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="GVariantType"><returnvalue>GVariantType</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-type">g_variant_get_type</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-type-string">g_variant_get_type_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-of-type">g_variant_is_of_type</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-container">g_variant_is_container</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-compare">g_variant_compare</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariantClass"><returnvalue>GVariantClass</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-classify">g_variant_classify</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-check-format-string">g_variant_check_format_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get">g_variant_get</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-va">g_variant_get_va</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new">g_variant_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-va">g_variant_new_va</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-boolean">g_variant_new_boolean</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-byte">g_variant_new_byte</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-int16">g_variant_new_int16</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-uint16">g_variant_new_uint16</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-int32">g_variant_new_int32</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-uint32">g_variant_new_uint32</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-int64">g_variant_new_int64</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-uint64">g_variant_new_uint64</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-handle">g_variant_new_handle</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-double">g_variant_new_double</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-string">g_variant_new_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-take-string">g_variant_new_take_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-printf">g_variant_new_printf</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-object-path">g_variant_new_object_path</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-object-path">g_variant_is_object_path</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-signature">g_variant_new_signature</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-signature">g_variant_is_signature</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-variant">g_variant_new_variant</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-strv">g_variant_new_strv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-objv">g_variant_new_objv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-bytestring">g_variant_new_bytestring</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-bytestring-array">g_variant_new_bytestring_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-boolean">g_variant_get_boolean</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint8"><returnvalue>guint8</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-byte">g_variant_get_byte</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint16"><returnvalue>gint16</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-int16">g_variant_get_int16</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint16"><returnvalue>guint16</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-uint16">g_variant_get_uint16</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint32"><returnvalue>gint32</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-int32">g_variant_get_int32</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint32"><returnvalue>guint32</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-uint32">g_variant_get_uint32</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint64"><returnvalue>gint64</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-int64">g_variant_get_int64</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint64"><returnvalue>guint64</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-uint64">g_variant_get_uint64</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint32"><returnvalue>gint32</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-handle">g_variant_get_handle</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gdouble"><returnvalue>gdouble</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-double">g_variant_get_double</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-string">g_variant_get_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dup-string">g_variant_dup_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-variant">g_variant_get_variant</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-get-strv">g_variant_get_strv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-dup-strv">g_variant_dup_strv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-get-objv">g_variant_get_objv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-dup-objv">g_variant_dup_objv</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-bytestring">g_variant_get_bytestring</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dup-bytestring">g_variant_dup_bytestring</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-get-bytestring-array">g_variant_get_bytestring_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
</entry><entry role="function_name"><link linkend="g-variant-dup-bytestring-array">g_variant_dup_bytestring_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-maybe">g_variant_new_maybe</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-array">g_variant_new_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-tuple">g_variant_new_tuple</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-dict-entry">g_variant_new_dict_entry</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-fixed-array">g_variant_new_fixed_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-maybe">g_variant_get_maybe</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-n-children">g_variant_n_children</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-child-value">g_variant_get_child_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-child">g_variant_get_child</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-lookup-value">g_variant_lookup_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-lookup">g_variant_lookup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gconstpointer"><returnvalue>gconstpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-fixed-array">g_variant_get_fixed_array</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-size">g_variant_get_size</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gconstpointer"><returnvalue>gconstpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-get-data">g_variant_get_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GBytes"><returnvalue>GBytes</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-data-as-bytes">g_variant_get_data_as_bytes</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-store">g_variant_store</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-from-data">g_variant_new_from_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-from-bytes">g_variant_new_from_bytes</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-byteswap">g_variant_byteswap</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-get-normal-form">g_variant_get_normal_form</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-is-normal-form">g_variant_is_normal_form</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-hash">g_variant_hash</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-equal">g_variant_equal</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-print">g_variant_print</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GString"><returnvalue>GString</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-print-string">g_variant_print_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariantIter"><returnvalue>GVariantIter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-iter-copy">g_variant_iter_copy</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-iter-free">g_variant_iter_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-iter-init">g_variant_iter_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-iter-n-children">g_variant_iter_n_children</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariantIter"><returnvalue>GVariantIter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-iter-new">g_variant_iter_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-iter-next-value">g_variant_iter_next_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-iter-next">g_variant_iter_next</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-iter-loop">g_variant_iter_loop</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-VARIANT-BUILDER-INIT:CAPS">G_VARIANT_BUILDER_INIT</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-unref">g_variant_builder_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariantBuilder"><returnvalue>GVariantBuilder</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-builder-ref">g_variant_builder_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariantBuilder"><returnvalue>GVariantBuilder</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-builder-new">g_variant_builder_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-init">g_variant_builder_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-clear">g_variant_builder_clear</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-add-value">g_variant_builder_add_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-add">g_variant_builder_add</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-add-parsed">g_variant_builder_add_parsed</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-builder-end">g_variant_builder_end</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-open">g_variant_builder_open</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-builder-close">g_variant_builder_close</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-VARIANT-DICT-INIT:CAPS">G_VARIANT_DICT_INIT</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-unref">g_variant_dict_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariantDict"><returnvalue>GVariantDict</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dict-ref">g_variant_dict_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariantDict"><returnvalue>GVariantDict</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dict-new">g_variant_dict_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-init">g_variant_dict_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-clear">g_variant_dict_clear</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-contains">g_variant_dict_contains</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-lookup">g_variant_dict_lookup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dict-lookup-value">g_variant_dict_lookup_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-insert">g_variant_dict_insert</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-insert-value">g_variant_dict_insert_value</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-variant-dict-remove">g_variant_dict_remove</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-dict-end">g_variant_dict_end</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-parse">g_variant_parse</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-parsed-va">g_variant_new_parsed_va</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-new-parsed">g_variant_new_parsed</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-variant-parse-error-print-context">g_variant_parse_error_print_context</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-GVariant.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="name" colwidth="150px"/>
<colspec colname="description"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GVariant">GVariant</link></entry></row>

<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GVariantClass">GVariantClass</link></entry></row>









<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GVariantIter">GVariantIter</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GVariantBuilder">GVariantBuilder</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GVariantDict">GVariantDict</link></entry></row>

<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GVariantParseError">GVariantParseError</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-VARIANT-PARSE-ERROR:CAPS">G_VARIANT_PARSE_ERROR</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-GVariant.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
#include &lt;glib/gi18n.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-GVariant.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GVariant"><type>GVariant</type></link> is a variant datatype; it can contain one or more values
along with information about the type of the values.</para>
<para>A <link linkend="GVariant"><type>GVariant</type></link> may contain simple types, like an integer, or a boolean value;
or complex types, like an array of two strings, or a dictionary of key
value pairs. A <link linkend="GVariant"><type>GVariant</type></link> is also immutable: once it's been created neither
its type nor its content can be modified further.</para>
<para>GVariant is useful whenever data needs to be serialized, for example when
sending method parameters in DBus, or when saving settings using GSettings.</para>
<para>When creating a new <link linkend="GVariant"><type>GVariant</type></link>, you pass the data you want to store in it
along with a string representing the type of data you wish to pass to it.</para>
<para>For instance, if you want to create a <link linkend="GVariant"><type>GVariant</type></link> holding an integer value you
can use:</para>
<informalexample><programlisting role="example"><![CDATA[
  GVariant *v = g_variant_new ("u", 40);
]]></programlisting></informalexample>
<para></para>
<para>The string "u" in the first argument tells <link linkend="GVariant"><type>GVariant</type></link> that the data passed to
the constructor (40) is going to be an unsigned integer.</para>
<para>More advanced examples of <link linkend="GVariant"><type>GVariant</type></link> in use can be found in documentation for
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>
<para>The range of possible values is determined by the type.</para>
<para>The type system used by <link linkend="GVariant"><type>GVariant</type></link> is <link linkend="GVariantType"><type>GVariantType</type></link>. </para>
<para><link linkend="GVariant"><type>GVariant</type></link> instances always have a type and a value (which are given
at construction time).  The type and value of a <link linkend="GVariant"><type>GVariant</type></link> instance
can never change other than by the <link linkend="GVariant"><type>GVariant</type></link> itself being
destroyed.  A <link linkend="GVariant"><type>GVariant</type></link> cannot contain a pointer.</para>
<para><link linkend="GVariant"><type>GVariant</type></link> is reference counted using <link linkend="g-variant-ref"><function>g_variant_ref()</function></link> and
<link linkend="g-variant-unref"><function>g_variant_unref()</function></link>.  <link linkend="GVariant"><type>GVariant</type></link> also has floating reference counts --
see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>.</para>
<para><link linkend="GVariant"><type>GVariant</type></link> is completely threadsafe.  A <link linkend="GVariant"><type>GVariant</type></link> instance can be
concurrently accessed in any way from any number of threads without
problems.</para>
<para><link linkend="GVariant"><type>GVariant</type></link> is heavily optimised for dealing with data in serialised
form.  It works particularly well with data located in memory-mapped
files.  It can perform nearly all deserialisation operations in a
small constant time, usually touching only a single memory page.
Serialised <link linkend="GVariant"><type>GVariant</type></link> data can also be sent over the network.</para>
<para><link linkend="GVariant"><type>GVariant</type></link> is largely compatible with D-Bus.  Almost all types of
<link linkend="GVariant"><type>GVariant</type></link> instances can be sent over D-Bus.  See <link linkend="GVariantType"><type>GVariantType</type></link> for
exceptions.  (However, <link linkend="GVariant"><type>GVariant</type></link>'s serialisation format is not the same
as the serialisation format of a D-Bus message body: use <link linkend="GDBusMessage"><type>GDBusMessage</type></link>,
in the gio library, for those.)</para>
<para>For space-efficiency, the <link linkend="GVariant"><type>GVariant</type></link> serialisation format does not
automatically include the variant's length, type or endianness,
which must either be implied from context (such as knowledge that a
particular file format always contains a little-endian
<link linkend="G-VARIANT-TYPE-VARIANT:CAPS"><literal>G_VARIANT_TYPE_VARIANT</literal></link> which occupies the whole length of the file)
or supplied out-of-band (for instance, a length, type and/or endianness
indicator could be placed at the beginning of a file, network message
or network stream).</para>
<para>A <link linkend="GVariant"><type>GVariant</type></link>'s size is limited mainly by any lower level operating
system constraints, such as the number of bits in <link linkend="gsize"><type>gsize</type></link>.  For
example, it is reasonable to have a 2GB file mapped into memory
with <link linkend="GMappedFile"><type>GMappedFile</type></link>, and call <link linkend="g-variant-new-from-data"><function>g_variant_new_from_data()</function></link> on it.</para>
<para>For convenience to C programmers, <link linkend="GVariant"><type>GVariant</type></link> features powerful
varargs-based value construction and destruction.  This feature is
designed to be embedded in other libraries.</para>
<para>There is a Python-inspired text language for describing <link linkend="GVariant"><type>GVariant</type></link>
values.  <link linkend="GVariant"><type>GVariant</type></link> includes a printer for this language and a parser
with type inferencing.</para>
<refsect3><title>Memory Use</title><para><link linkend="GVariant"><type>GVariant</type></link> tries to be quite efficient with respect to memory use.
This section gives a rough idea of how much memory is used by the
current implementation.  The information here is subject to change
in the future.</para>
<para>The memory allocated by <link linkend="GVariant"><type>GVariant</type></link> can be grouped into 4 broad
purposes: memory for serialised data, memory for the type
information cache, buffer management memory and memory for the
<link linkend="GVariant"><type>GVariant</type></link> structure itself.</para>
</refsect3>
<refsect3><title>Serialised Data Memory</title><para>This is the memory that is used for storing GVariant data in
serialised form.  This is what would be sent over the network or
what would end up on disk, not counting any indicator of the
endianness, or of the length or type of the top-level variant.</para>
<para>The amount of memory required to store a boolean is 1 byte. 16,
32 and 64 bit integers and double precision floating point numbers
use their "natural" size.  Strings (including object path and
signature strings) are stored with a nul terminator, and as such
use the length of the string plus 1 byte.</para>
<para>Maybe types use no space at all to represent the null value and
use the same amount of space (sometimes plus one byte) as the
equivalent non-maybe-typed value to represent the non-null case.</para>
<para>Arrays use the amount of space required to store each of their
members, concatenated.  Additionally, if the items stored in an
array are not of a fixed-size (ie: strings, other arrays, etc)
then an additional framing offset is stored for each item.  The
size of this offset is either 1, 2 or 4 bytes depending on the
overall size of the container.  Additionally, extra padding bytes
are added as required for alignment of child values.</para>
<para>Tuples (including dictionary entries) use the amount of space
required to store each of their members, concatenated, plus one
framing offset (as per arrays) for each non-fixed-sized item in
the tuple, except for the last one.  Additionally, extra padding
bytes are added as required for alignment of child values.</para>
<para>Variants use the same amount of space as the item inside of the
variant, plus 1 byte, plus the length of the type string for the
item inside the variant.</para>
<para>As an example, consider a dictionary mapping strings to variants.
In the case that the dictionary is empty, 0 bytes are required for
the serialisation.</para>
<para>If we add an item "width" that maps to the int32 value of 500 then
we will use 4 byte to store the int32 (so 6 for the variant
containing it) and 6 bytes for the string.  The variant must be
aligned to 8 after the 6 bytes of the string, so that's 2 extra
bytes.  6 (string) + 2 (padding) + 6 (variant) is 14 bytes used
for the dictionary entry.  An additional 1 byte is added to the
array as a framing offset making a total of 15 bytes.</para>
<para>If we add another entry, "title" that maps to a nullable string
that happens to have a value of null, then we use 0 bytes for the
null value (and 3 bytes for the variant to contain it along with
its type string) plus 6 bytes for the string.  Again, we need 2
padding bytes.  That makes a total of 6 + 2 + 3 = 11 bytes.</para>
<para>We now require extra padding between the two items in the array.
After the 14 bytes of the first item, that's 2 bytes required.
We now require 2 framing offsets for an extra two
bytes. 14 + 2 + 11 + 2 = 29 bytes to encode the entire two-item
dictionary.</para>
</refsect3>
<refsect3><title>Type Information Cache</title><para>For each GVariant type that currently exists in the program a type
information structure is kept in the type information cache.  The
type information structure is required for rapid deserialisation.</para>
<para>Continuing with the above example, if a <link linkend="GVariant"><type>GVariant</type></link> exists with the
type "a{sv}" then a type information struct will exist for
"a{sv}", "{sv}", "s", and "v".  Multiple uses of the same type
will share the same type information.  Additionally, all
single-digit types are stored in read-only static memory and do
not contribute to the writable memory footprint of a program using
<link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>Aside from the type information structures stored in read-only
memory, there are two forms of type information.  One is used for
container types where there is a single element type: arrays and
maybe types.  The other is used for container types where there
are multiple element types: tuples and dictionary entries.</para>
<para>Array type info structures are 6 * sizeof (void *), plus the
memory required to store the type string itself.  This means that
on 32-bit systems, the cache entry for "a{sv}" would require 30
bytes of memory (plus malloc overhead).</para>
<para>Tuple type info structures are 6 * sizeof (void *), plus 4 *
sizeof (void *) for each item in the tuple, plus the memory
required to store the type string itself.  A 2-item tuple, for
example, would have a type information structure that consumed
writable memory in the size of 14 * sizeof (void *) (plus type
string)  This means that on 32-bit systems, the cache entry for
"{sv}" would require 61 bytes of memory (plus malloc overhead).</para>
<para>This means that in total, for our "a{sv}" example, 91 bytes of
type information would be allocated.</para>
<para>The type information cache, additionally, uses a <link linkend="GHashTable"><type>GHashTable</type></link> to
store and lookup the cached items and stores a pointer to this
hash table in static storage.  The hash table is freed when there
are zero items in the type cache.</para>
<para>Although these sizes may seem large it is important to remember
that a program will probably only have a very small number of
different types of values in it and that only one type information
structure is required for many different values of the same type.</para>
</refsect3>
<refsect3><title>Buffer Management Memory</title><para><link linkend="GVariant"><type>GVariant</type></link> uses an internal buffer management structure to deal
with the various different possible sources of serialised data
that it uses.  The buffer is responsible for ensuring that the
correct call is made when the data is no longer in use by
<link linkend="GVariant"><type>GVariant</type></link>.  This may involve a <link linkend="g-free"><function>g_free()</function></link> or a <link linkend="g-slice-free"><function>g_slice_free()</function></link> or
even <link linkend="g-mapped-file-unref"><function>g_mapped_file_unref()</function></link>.</para>
<para>One buffer management structure is used for each chunk of
serialised data.  The size of the buffer management structure
is 4 * (void *).  On 32-bit systems, that's 16 bytes.</para>
</refsect3>
<refsect3><title>GVariant structure</title><para>The size of a <link linkend="GVariant"><type>GVariant</type></link> structure is 6 * (void *).  On 32-bit
systems, that's 24 bytes.</para>
<para><link linkend="GVariant"><type>GVariant</type></link> structures only exist if they are explicitly created
with API calls.  For example, if a <link linkend="GVariant"><type>GVariant</type></link> is constructed out of
serialised data for the example given above (with the dictionary)
then although there are 9 individual values that comprise the
entire dictionary (two keys, two values, two variants containing
the values, two dictionary entries, plus the dictionary itself),
only 1 <link linkend="GVariant"><type>GVariant</type></link> instance exists -- the one referring to the
dictionary.</para>
<para>If calls are made to start accessing the other values then
<link linkend="GVariant"><type>GVariant</type></link> instances will exist for those values only for as long
as they are in use (ie: until you call <link linkend="g-variant-unref"><function>g_variant_unref()</function></link>).  The
type information is shared.  The serialised data and the buffer
management structure for that serialised data is shared by the
child.</para>
</refsect3>
<refsect3><title>Summary</title><para>To put the entire example together, for our dictionary mapping
strings to variants (with two entries, as given above), we are
using 91 bytes of memory for type information, 29 bytes of memory
for the serialised data, 16 bytes for buffer management and 24
bytes for the <link linkend="GVariant"><type>GVariant</type></link> instance, or a total of 160 bytes, plus
malloc overhead.  If we were to use <link linkend="g-variant-get-child-value"><function>g_variant_get_child_value()</function></link> to
access the two dictionary entries, we would use an additional 48
bytes.  If we were to have other dictionaries of the same type, we
would use more memory for the serialised data and buffer
management for those dictionaries, but the type information would
be shared.</para>
</refsect3>

</refsect1>
<refsect1 id="glib-GVariant.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-variant-unref" role="function" condition="since:2.24">
<title>g_variant_unref&#160;()</title>
<indexterm zone="g-variant-unref" role="2.24"><primary sortas="variant_unref">g_variant_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_unref (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Decreases the reference count of <parameter>value</parameter>
.  When its reference count
drops to 0, the memory used by the variant is freed.</para>
<refsect3 id="g-variant-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-ref" role="function" condition="since:2.24">
<title>g_variant_ref&#160;()</title>
<indexterm zone="g-variant-ref" role="2.24"><primary sortas="variant_ref">g_variant_ref</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_ref (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Increases the reference count of <parameter>value</parameter>
.</para>
<refsect3 id="g-variant-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-ref.returns" role="returns">
<title>Returns</title>
<para> the same <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-ref-sink" role="function" condition="since:2.24">
<title>g_variant_ref_sink&#160;()</title>
<indexterm zone="g-variant-ref-sink" role="2.24"><primary sortas="variant_ref_sink">g_variant_ref_sink</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_ref_sink (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para><link linkend="GVariant"><type>GVariant</type></link> uses a floating reference count system.  All functions with
names starting with <literal>g_variant_new_</literal> return floating
references.</para>
<para>Calling <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> on a <link linkend="GVariant"><type>GVariant</type></link> with a floating reference
will convert the floating reference into a full reference.  Calling
<link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> on a non-floating <link linkend="GVariant"><type>GVariant</type></link> results in an
additional normal reference being added.</para>
<para>In other words, if the <parameter>value</parameter>
 is floating, then this call "assumes
ownership" of the floating reference, converting it to a normal
reference.  If the <parameter>value</parameter>
 is not floating, then this call adds a
new normal reference increasing the reference count by one.</para>
<para>All calls that result in a <link linkend="GVariant"><type>GVariant</type></link> instance being inserted into a
container will call <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> on the instance.  This means
that if the value was just created (and has only its floating
reference) then the container will assume sole ownership of the value
at that point and the caller will not need to unreference it.  This
makes certain common styles of programming much easier while still
maintaining normal refcounting semantics in situations where values
are not floating.</para>
<refsect3 id="g-variant-ref-sink.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-ref-sink.returns" role="returns">
<title>Returns</title>
<para> the same <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-floating" role="function" condition="since:2.26">
<title>g_variant_is_floating&#160;()</title>
<indexterm zone="g-variant-is-floating" role="2.26"><primary sortas="variant_is_floating">g_variant_is_floating</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_floating (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Checks whether <parameter>value</parameter>
 has a floating reference count.</para>
<para>This function should only ever be used to assert that a given variant
is or is not floating, or for debug purposes. To acquire a reference
to a variant that might be floating, always use <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>
or <link linkend="g-variant-take-ref"><function>g_variant_take_ref()</function></link>.</para>
<para>See <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> for more information about floating reference
counts.</para>
<refsect3 id="g-variant-is-floating.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-floating.returns" role="returns">
<title>Returns</title>
<para> whether <parameter>value</parameter>
is floating</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-take-ref" role="function">
<title>g_variant_take_ref&#160;()</title>
<indexterm zone="g-variant-take-ref"><primary sortas="variant_take_ref">g_variant_take_ref</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_take_ref (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>If <parameter>value</parameter>
 is floating, sink it.  Otherwise, do nothing.</para>
<para>Typically you want to use <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> in order to
automatically do the correct thing with respect to floating or
non-floating references, but there is one specific scenario where
this function is helpful.</para>
<para>The situation where this function is helpful is when creating an API
that allows the user to provide a callback function that returns a
<link linkend="GVariant"><type>GVariant</type></link>.  We certainly want to allow the user the flexibility to
return a non-floating reference from this callback (for the case
where the value that is being returned already exists).</para>
<para>At the same time, the style of the <link linkend="GVariant"><type>GVariant</type></link> API makes it likely that
for newly-created <link linkend="GVariant"><type>GVariant</type></link> instances, the user can be saved some
typing if they are allowed to return a <link linkend="GVariant"><type>GVariant</type></link> with a floating
reference.</para>
<para>Using this function on the return value of the user's callback allows
the user to do whichever is more convenient for them.  The caller
will alway receives exactly one full reference to the value: either
the one that was returned in the first place, or a floating reference
that has been converted to a full reference.</para>
<para>This function has an odd interaction when combined with
<link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> running at the same time in another thread on
the same <link linkend="GVariant"><type>GVariant</type></link> instance.  If <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> runs first then
the result will be that the floating reference is converted to a hard
reference.  If <link linkend="g-variant-take-ref"><function>g_variant_take_ref()</function></link> runs first then the result will
be that the floating reference is converted to a hard reference and
an additional reference on top of that one is added.  It is best to
avoid this situation.</para>
<refsect3 id="g-variant-take-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-take-ref.returns" role="returns">
<title>Returns</title>
<para> the same <parameter>value</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="g-variant-get-type" role="function" condition="since:2.24">
<title>g_variant_get_type&#160;()</title>
<indexterm zone="g-variant-get-type" role="2.24"><primary sortas="variant_get_type">g_variant_get_type</primary></indexterm>
<programlisting language="C">const <link linkend="GVariantType"><returnvalue>GVariantType</returnvalue></link>&#160;*
g_variant_get_type (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Determines the type of <parameter>value</parameter>
.</para>
<para>The return value is valid for the lifetime of <parameter>value</parameter>
 and must not
be freed.</para>
<refsect3 id="g-variant-get-type.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-type.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GVariantType"><type>GVariantType</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-type-string" role="function" condition="since:2.24">
<title>g_variant_get_type_string&#160;()</title>
<indexterm zone="g-variant-get-type-string" role="2.24"><primary sortas="variant_get_type_string">g_variant_get_type_string</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_get_type_string (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the type string of <parameter>value</parameter>
.  Unlike the result of calling
<link linkend="g-variant-type-peek-string"><function>g_variant_type_peek_string()</function></link>, this string is nul-terminated.  This
string belongs to <link linkend="GVariant"><type>GVariant</type></link> and must not be freed.</para>
<refsect3 id="g-variant-get-type-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-type-string.returns" role="returns">
<title>Returns</title>
<para> the type string for the type of <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-of-type" role="function" condition="since:2.24">
<title>g_variant_is_of_type&#160;()</title>
<indexterm zone="g-variant-is-of-type" role="2.24"><primary sortas="variant_is_of_type">g_variant_is_of_type</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_of_type (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                      <parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>);</programlisting>
<para>Checks if a value has a type matching the provided type.</para>
<refsect3 id="g-variant-is-of-type.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantType"><type>GVariantType</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-of-type.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the type of <parameter>value</parameter>
matches <parameter>type</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-container" role="function" condition="since:2.24">
<title>g_variant_is_container&#160;()</title>
<indexterm zone="g-variant-is-container" role="2.24"><primary sortas="variant_is_container">g_variant_is_container</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_container (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Checks if <parameter>value</parameter>
 is a container.</para>
<refsect3 id="g-variant-is-container.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-container.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>value</parameter>
is a container</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-compare" role="function" condition="since:2.26">
<title>g_variant_compare&#160;()</title>
<indexterm zone="g-variant-compare" role="2.26"><primary sortas="variant_compare">g_variant_compare</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_variant_compare (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> one</parameter>,
                   <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> two</parameter>);</programlisting>
<para>Compares <parameter>one</parameter>
 and <parameter>two</parameter>
.</para>
<para>The types of <parameter>one</parameter>
 and <parameter>two</parameter>
 are <link linkend="gconstpointer"><type>gconstpointer</type></link> only to allow use of
this function with <link linkend="GTree"><type>GTree</type></link>, <link linkend="GPtrArray"><type>GPtrArray</type></link>, etc.  They must each be a
<link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>Comparison is only defined for basic types (ie: booleans, numbers,
strings).  For booleans, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> is less than <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.  Numbers are
ordered in the usual way.  Strings are in ASCII lexographical order.</para>
<para>It is a programmer error to attempt to compare container values or
two values that have types that are not exactly equal.  For example,
you cannot compare a 32-bit signed integer with a 32-bit unsigned
integer.  Also note that this function is not particularly
well-behaved when it comes to comparison of doubles; in particular,
the handling of incomparable values (ie: NaN) is undefined.</para>
<para>If you only require an equality comparison, <link linkend="g-variant-equal"><function>g_variant_equal()</function></link> is more
general.</para>
<refsect3 id="g-variant-compare.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>one</para></entry>
<entry role="parameter_description"><para>a basic-typed <link linkend="GVariant"><type>GVariant</type></link> instance. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GVariant]</emphasis></entry></row>
<row><entry role="parameter_name"><para>two</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance of the same type. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GVariant]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-compare.returns" role="returns">
<title>Returns</title>
<para> negative value if a &lt; b;
zero if a = b;
positive value if a &gt; b.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-classify" role="function" condition="since:2.24">
<title>g_variant_classify&#160;()</title>
<indexterm zone="g-variant-classify" role="2.24"><primary sortas="variant_classify">g_variant_classify</primary></indexterm>
<programlisting language="C"><link linkend="GVariantClass"><returnvalue>GVariantClass</returnvalue></link>
g_variant_classify (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Classifies <parameter>value</parameter>
 according to its top-level type.</para>
<refsect3 id="g-variant-classify.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-classify.returns" role="returns">
<title>Returns</title>
<para> the <link linkend="GVariantClass"><type>GVariantClass</type></link> of <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-check-format-string" role="function" condition="since:2.34">
<title>g_variant_check_format_string&#160;()</title>
<indexterm zone="g-variant-check-format-string" role="2.34"><primary sortas="variant_check_format_string">g_variant_check_format_string</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_check_format_string (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                               <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                               <parameter><link linkend="gboolean"><type>gboolean</type></link> copy_only</parameter>);</programlisting>
<para>Checks if calling <link linkend="g-variant-get"><function>g_variant_get()</function></link> with <parameter>format_string</parameter>
 on <parameter>value</parameter>
 would
be valid from a type-compatibility standpoint.  <parameter>format_string</parameter>
 is
assumed to be a valid format string (from a syntactic standpoint).</para>
<para>If <parameter>copy_only</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> then this function additionally checks that it
would be safe to call <link linkend="g-variant-unref"><function>g_variant_unref()</function></link> on <parameter>value</parameter>
 immediately after
the call to <link linkend="g-variant-get"><function>g_variant_get()</function></link> without invalidating the result.  This is
only possible if deep copies are made (ie: there are no pointers to
the data inside of the soon-to-be-freed <link linkend="GVariant"><type>GVariant</type></link> instance).  If this
check fails then a <link linkend="g-critical"><function>g_critical()</function></link> is printed and <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> is returned.</para>
<para>This function is meant to be used by functions that wish to provide
varargs accessors to <link linkend="GVariant"><type>GVariant</type></link> values of uncertain values (eg:
<link linkend="g-variant-lookup"><function>g_variant_lookup()</function></link> or <link linkend="g-menu-model-get-item-attribute"><function>g_menu_model_get_item_attribute()</function></link>).</para>
<refsect3 id="g-variant-check-format-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a valid <link linkend="GVariant"><type>GVariant</type></link> format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>copy_only</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to ensure the format string makes deep copies</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-check-format-string.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>format_string</parameter>
is safe to use</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.34">2.34</link></para></refsect2>
<refsect2 id="g-variant-get" role="function" condition="since:2.24">
<title>g_variant_get&#160;()</title>
<indexterm zone="g-variant-get" role="2.24"><primary sortas="variant_get">g_variant_get</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_get (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
               <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
               <parameter>...</parameter>);</programlisting>
<para>Deconstructs a <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<para>Think of this function as an analogue to <link linkend="scanf"><function>scanf()</function></link>.</para>
<para>The arguments that are expected by this function are entirely
determined by <parameter>format_string</parameter>
.  <parameter>format_string</parameter>
 also restricts the
permissible types of <parameter>value</parameter>
.  It is an error to give a value with
an incompatible type.  See the section on
<link linkend="gvariant-format-strings">GVariant format strings</link>.
Please note that the syntax of the format string is very likely to be
extended in the future.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed,
see the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-get.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments, as per <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-va" role="function" condition="since:2.24">
<title>g_variant_get_va&#160;()</title>
<indexterm zone="g-variant-get-va" role="2.24"><primary sortas="variant_get_va">g_variant_get_va</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_get_va (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> **endptr</parameter>,
                  <parameter><link linkend="va-list"><type>va_list</type></link> *app</parameter>);</programlisting>
<para>This function is intended to be used by libraries based on <link linkend="GVariant"><type>GVariant</type></link>
that want to provide <link linkend="g-variant-get"><function>g_variant_get()</function></link>-like functionality to their
users.</para>
<para>The API is more general than <link linkend="g-variant-get"><function>g_variant_get()</function></link> to allow a wider range
of possible uses.</para>
<para><parameter>format_string</parameter>
 must still point to a valid format string, but it only
need to be nul-terminated if <parameter>endptr</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.  If <parameter>endptr</parameter>
 is
non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then it is updated to point to the first character past the
end of the format string.</para>
<para><parameter>app</parameter>
 is a pointer to a <link linkend="va-list"><type>va_list</type></link>.  The arguments, according to
<parameter>format_string</parameter>
, are collected from this <link linkend="va-list"><type>va_list</type></link> and the list is left
pointing to the argument following the last.</para>
<para>These two generalisations allow mixing of multiple calls to
<link linkend="g-variant-new-va"><function>g_variant_new_va()</function></link> and <link linkend="g-variant-get-va"><function>g_variant_get_va()</function></link> within a single actual
varargs call by the user.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed,
see the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-get-va.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a string that is prefixed with a format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>endptr</para></entry>
<entry role="parameter_description"><para>location to store the end pointer,
or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>default</acronym> NULL]</emphasis></entry></row>
<row><entry role="parameter_name"><para>app</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="va-list"><type>va_list</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new" role="function" condition="since:2.24">
<title>g_variant_new&#160;()</title>
<indexterm zone="g-variant-new" role="2.24"><primary sortas="variant_new">g_variant_new</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new (<parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
               <parameter>...</parameter>);</programlisting>
<para>Creates a new <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<para>Think of this function as an analogue to <link linkend="g-strdup-printf"><function>g_strdup_printf()</function></link>.</para>
<para>The type of the created instance and the arguments that are expected
by this function are determined by <parameter>format_string</parameter>
. See the section on
<link linkend="gvariant-format-strings">GVariant format strings</link>. Please note that
the syntax of the format string is very likely to be extended in the
future.</para>
<para>The first character of the format string must not be '*' '?' '@' or
'r'; in essence, a new <link linkend="GVariant"><type>GVariant</type></link> must always be constructed by this
function (and not merely passed through it unmodified).</para>
<para>Note that the arguments must be of the correct width for their types
specified in <parameter>format_string</parameter>
. This can be achieved by casting them. See
the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<informalexample><programlisting role="example"><![CDATA[
MyFlags some_flags = FLAG_ONE | FLAG_TWO;
const gchar *some_strings[] = { "a", "b", "c", NULL };
GVariant *new_variant;

new_variant = g_variant_new ("(t^as)",
                             // This cast is required.
                             (guint64) some_flags,
                             some_strings);
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments, as per <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new.returns" role="returns">
<title>Returns</title>
<para> a new floating <link linkend="GVariant"><type>GVariant</type></link> instance</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-va" role="function" condition="since:2.24">
<title>g_variant_new_va&#160;()</title>
<indexterm zone="g-variant-new-va" role="2.24"><primary sortas="variant_new_va">g_variant_new_va</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_va (<parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> **endptr</parameter>,
                  <parameter><link linkend="va-list"><type>va_list</type></link> *app</parameter>);</programlisting>
<para>This function is intended to be used by libraries based on
<link linkend="GVariant"><type>GVariant</type></link> that want to provide <link linkend="g-variant-new"><function>g_variant_new()</function></link>-like functionality
to their users.</para>
<para>The API is more general than <link linkend="g-variant-new"><function>g_variant_new()</function></link> to allow a wider range
of possible uses.</para>
<para><parameter>format_string</parameter>
 must still point to a valid format string, but it only
needs to be nul-terminated if <parameter>endptr</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.  If <parameter>endptr</parameter>
 is
non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then it is updated to point to the first character past the
end of the format string.</para>
<para><parameter>app</parameter>
 is a pointer to a <link linkend="va-list"><type>va_list</type></link>.  The arguments, according to
<parameter>format_string</parameter>
, are collected from this <link linkend="va-list"><type>va_list</type></link> and the list is left
pointing to the argument following the last.</para>
<para>Note that the arguments in <parameter>app</parameter>
 must be of the correct width for their
types specified in <parameter>format_string</parameter>
 when collected into the <link linkend="va-list"><type>va_list</type></link>.
See the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<para>These two generalisations allow mixing of multiple calls to
<link linkend="g-variant-new-va"><function>g_variant_new_va()</function></link> and <link linkend="g-variant-get-va"><function>g_variant_get_va()</function></link> within a single actual
varargs call by the user.</para>
<para>The return value will be floating if it was a newly created GVariant
instance (for example, if the format string was "(ii)").  In the case
that the format_string was '*', '?', 'r', or a format starting with
'@' then the collected <link linkend="GVariant"><type>GVariant</type></link> pointer will be returned unmodified,
without adding any additional references.</para>
<para>In order to behave correctly in all cases it is necessary for the
calling function to <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> the return result before
returning control to the user that originally provided the pointer.
At this point, the caller will have their own full reference to the
result.  This can also be done by adding the result to a container,
or by passing it to another <link linkend="g-variant-new"><function>g_variant_new()</function></link> call.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-new-va.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a string that is prefixed with a format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>endptr</para></entry>
<entry role="parameter_description"><para>location to store the end pointer,
or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>default</acronym> NULL]</emphasis></entry></row>
<row><entry role="parameter_name"><para>app</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="va-list"><type>va_list</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-va.returns" role="returns">
<title>Returns</title>
<para> a new, usually floating, <link linkend="GVariant"><type>GVariant</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-boolean" role="function" condition="since:2.24">
<title>g_variant_new_boolean&#160;()</title>
<indexterm zone="g-variant-new-boolean" role="2.24"><primary sortas="variant_new_boolean">g_variant_new_boolean</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_boolean (<parameter><link linkend="gboolean"><type>gboolean</type></link> value</parameter>);</programlisting>
<para>Creates a new boolean <link linkend="GVariant"><type>GVariant</type></link> instance -- either <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>.</para>
<refsect3 id="g-variant-new-boolean.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gboolean"><type>gboolean</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-boolean.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new boolean <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-byte" role="function" condition="since:2.24">
<title>g_variant_new_byte&#160;()</title>
<indexterm zone="g-variant-new-byte" role="2.24"><primary sortas="variant_new_byte">g_variant_new_byte</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_byte (<parameter><link linkend="guint8"><type>guint8</type></link> value</parameter>);</programlisting>
<para>Creates a new byte <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-byte.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="guint8"><type>guint8</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-byte.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new byte <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-int16" role="function" condition="since:2.24">
<title>g_variant_new_int16&#160;()</title>
<indexterm zone="g-variant-new-int16" role="2.24"><primary sortas="variant_new_int16">g_variant_new_int16</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_int16 (<parameter><link linkend="gint16"><type>gint16</type></link> value</parameter>);</programlisting>
<para>Creates a new int16 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-int16.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gint16"><type>gint16</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-int16.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new int16 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-uint16" role="function" condition="since:2.24">
<title>g_variant_new_uint16&#160;()</title>
<indexterm zone="g-variant-new-uint16" role="2.24"><primary sortas="variant_new_uint16">g_variant_new_uint16</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_uint16 (<parameter><link linkend="guint16"><type>guint16</type></link> value</parameter>);</programlisting>
<para>Creates a new uint16 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-uint16.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="guint16"><type>guint16</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-uint16.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new uint16 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-int32" role="function" condition="since:2.24">
<title>g_variant_new_int32&#160;()</title>
<indexterm zone="g-variant-new-int32" role="2.24"><primary sortas="variant_new_int32">g_variant_new_int32</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_int32 (<parameter><link linkend="gint32"><type>gint32</type></link> value</parameter>);</programlisting>
<para>Creates a new int32 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-int32.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gint32"><type>gint32</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-int32.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new int32 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-uint32" role="function" condition="since:2.24">
<title>g_variant_new_uint32&#160;()</title>
<indexterm zone="g-variant-new-uint32" role="2.24"><primary sortas="variant_new_uint32">g_variant_new_uint32</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_uint32 (<parameter><link linkend="guint32"><type>guint32</type></link> value</parameter>);</programlisting>
<para>Creates a new uint32 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-uint32.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="guint32"><type>guint32</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-uint32.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new uint32 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-int64" role="function" condition="since:2.24">
<title>g_variant_new_int64&#160;()</title>
<indexterm zone="g-variant-new-int64" role="2.24"><primary sortas="variant_new_int64">g_variant_new_int64</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_int64 (<parameter><link linkend="gint64"><type>gint64</type></link> value</parameter>);</programlisting>
<para>Creates a new int64 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-int64.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gint64"><type>gint64</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-int64.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new int64 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-uint64" role="function" condition="since:2.24">
<title>g_variant_new_uint64&#160;()</title>
<indexterm zone="g-variant-new-uint64" role="2.24"><primary sortas="variant_new_uint64">g_variant_new_uint64</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_uint64 (<parameter><link linkend="guint64"><type>guint64</type></link> value</parameter>);</programlisting>
<para>Creates a new uint64 <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-uint64.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="guint64"><type>guint64</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-uint64.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new uint64 <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-handle" role="function" condition="since:2.24">
<title>g_variant_new_handle&#160;()</title>
<indexterm zone="g-variant-new-handle" role="2.24"><primary sortas="variant_new_handle">g_variant_new_handle</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_handle (<parameter><link linkend="gint32"><type>gint32</type></link> value</parameter>);</programlisting>
<para>Creates a new handle <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<para>By convention, handles are indexes into an array of file descriptors
that are sent alongside a D-Bus message.  If you're not interacting
with D-Bus, you probably don't need them.</para>
<refsect3 id="g-variant-new-handle.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gint32"><type>gint32</type></link> value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-handle.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new handle <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-double" role="function" condition="since:2.24">
<title>g_variant_new_double&#160;()</title>
<indexterm zone="g-variant-new-double" role="2.24"><primary sortas="variant_new_double">g_variant_new_double</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_double (<parameter><link linkend="gdouble"><type>gdouble</type></link> value</parameter>);</programlisting>
<para>Creates a new double <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<refsect3 id="g-variant-new-double.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="gdouble"><type>gdouble</type></link> floating point value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-double.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new double <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-string" role="function" condition="since:2.24">
<title>g_variant_new_string&#160;()</title>
<indexterm zone="g-variant-new-string" role="2.24"><primary sortas="variant_new_string">g_variant_new_string</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_string (<parameter>const <link linkend="gchar"><type>gchar</type></link> *string</parameter>);</programlisting>
<para>Creates a string <link linkend="GVariant"><type>GVariant</type></link> with the contents of <parameter>string</parameter>
.</para>
<para><parameter>string</parameter>
 must be valid UTF-8, and must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>. To encode
potentially-<link linkend="NULL:CAPS"><literal>NULL</literal></link> strings, use <link linkend="g-variant-new"><function>g_variant_new()</function></link> with <literal>ms</literal> as the
<link linkend="gvariant-format-strings-maybe-types">format string</link>.</para>
<refsect3 id="g-variant-new-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a normal UTF-8 nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-string.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new string <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-take-string" role="function" condition="since:2.38">
<title>g_variant_new_take_string&#160;()</title>
<indexterm zone="g-variant-new-take-string" role="2.38"><primary sortas="variant_new_take_string">g_variant_new_take_string</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_take_string (<parameter><link linkend="gchar"><type>gchar</type></link> *string</parameter>);</programlisting>
<para>Creates a string <link linkend="GVariant"><type>GVariant</type></link> with the contents of <parameter>string</parameter>
.</para>
<para><parameter>string</parameter>
 must be valid UTF-8, and must not be <link linkend="NULL:CAPS"><literal>NULL</literal></link>. To encode
potentially-<link linkend="NULL:CAPS"><literal>NULL</literal></link> strings, use this with <link linkend="g-variant-new-maybe"><function>g_variant_new_maybe()</function></link>.</para>
<para>This function consumes <parameter>string</parameter>
.  <link linkend="g-free"><function>g_free()</function></link> will be called on <parameter>string</parameter>

when it is no longer required.</para>
<para>You must not modify or access <parameter>string</parameter>
 in any other way after passing
it to this function.  It is even possible that <parameter>string</parameter>
 is immediately
freed.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-new-take-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a normal UTF-8 nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-take-string.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new string
<link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.38">2.38</link></para></refsect2>
<refsect2 id="g-variant-new-printf" role="function" condition="since:2.38">
<title>g_variant_new_printf&#160;()</title>
<indexterm zone="g-variant-new-printf" role="2.38"><primary sortas="variant_new_printf">g_variant_new_printf</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_printf (<parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                      <parameter>...</parameter>);</programlisting>
<para>Creates a string-type GVariant using printf formatting.</para>
<para>This is similar to calling <link linkend="g-strdup-printf"><function>g_strdup_printf()</function></link> and then
<link linkend="g-variant-new-string"><function>g_variant_new_string()</function></link> but it saves a temporary variable and an
unnecessary copy.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-new-printf.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a printf-style format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments for <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-printf.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new string
<link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.38">2.38</link></para></refsect2>
<refsect2 id="g-variant-new-object-path" role="function" condition="since:2.24">
<title>g_variant_new_object_path&#160;()</title>
<indexterm zone="g-variant-new-object-path" role="2.24"><primary sortas="variant_new_object_path">g_variant_new_object_path</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_object_path (<parameter>const <link linkend="gchar"><type>gchar</type></link> *object_path</parameter>);</programlisting>
<para>Creates a D-Bus object path <link linkend="GVariant"><type>GVariant</type></link> with the contents of <parameter>string</parameter>
.
<parameter>string</parameter>
 must be a valid D-Bus object path.  Use
<link linkend="g-variant-is-object-path"><function>g_variant_is_object_path()</function></link> if you're not sure.</para>
<refsect3 id="g-variant-new-object-path.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>object_path</para></entry>
<entry role="parameter_description"><para>a normal C nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-object-path.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new object path <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-object-path" role="function" condition="since:2.24">
<title>g_variant_is_object_path&#160;()</title>
<indexterm zone="g-variant-is-object-path" role="2.24"><primary sortas="variant_is_object_path">g_variant_is_object_path</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_object_path (<parameter>const <link linkend="gchar"><type>gchar</type></link> *string</parameter>);</programlisting>
<para>Determines if a given string is a valid D-Bus object path.  You
should ensure that a string is a valid D-Bus object path before
passing it to <link linkend="g-variant-new-object-path"><function>g_variant_new_object_path()</function></link>.</para>
<para>A valid object path starts with <literal>/</literal> followed by zero or more
sequences of characters separated by <literal>/</literal> characters.  Each sequence
must contain only the characters <literal>[A-Z][a-z][0-9]_</literal>.  No sequence
(including the one following the final <literal>/</literal> character) may be empty.</para>
<refsect3 id="g-variant-is-object-path.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a normal C nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-object-path.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>string</parameter>
is a D-Bus object path</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-signature" role="function" condition="since:2.24">
<title>g_variant_new_signature&#160;()</title>
<indexterm zone="g-variant-new-signature" role="2.24"><primary sortas="variant_new_signature">g_variant_new_signature</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_signature (<parameter>const <link linkend="gchar"><type>gchar</type></link> *signature</parameter>);</programlisting>
<para>Creates a D-Bus type signature <link linkend="GVariant"><type>GVariant</type></link> with the contents of
<parameter>string</parameter>
.  <parameter>string</parameter>
 must be a valid D-Bus type signature.  Use
<link linkend="g-variant-is-signature"><function>g_variant_is_signature()</function></link> if you're not sure.</para>
<refsect3 id="g-variant-new-signature.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>signature</para></entry>
<entry role="parameter_description"><para>a normal C nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-signature.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new signature <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-signature" role="function" condition="since:2.24">
<title>g_variant_is_signature&#160;()</title>
<indexterm zone="g-variant-is-signature" role="2.24"><primary sortas="variant_is_signature">g_variant_is_signature</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_signature (<parameter>const <link linkend="gchar"><type>gchar</type></link> *string</parameter>);</programlisting>
<para>Determines if a given string is a valid D-Bus type signature.  You
should ensure that a string is a valid D-Bus type signature before
passing it to <link linkend="g-variant-new-signature"><function>g_variant_new_signature()</function></link>.</para>
<para>D-Bus type signatures consist of zero or more definite <link linkend="GVariantType"><type>GVariantType</type></link>
strings in sequence.</para>
<refsect3 id="g-variant-is-signature.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a normal C nul-terminated string</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-signature.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>string</parameter>
is a D-Bus type signature</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-variant" role="function" condition="since:2.24">
<title>g_variant_new_variant&#160;()</title>
<indexterm zone="g-variant-new-variant" role="2.24"><primary sortas="variant_new_variant">g_variant_new_variant</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_variant (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Boxes <parameter>value</parameter>
.  The result is a <link linkend="GVariant"><type>GVariant</type></link> instance representing a
variant containing the original value.</para>
<para>If <parameter>child</parameter>
 is a floating reference (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>), the new
instance takes ownership of <parameter>child</parameter>
.</para>

<para><emphasis role="annotation">[<acronym>constructor</acronym>]</emphasis></para><refsect3 id="g-variant-new-variant.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-variant.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new variant <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-strv" role="function" condition="since:2.24">
<title>g_variant_new_strv&#160;()</title>
<indexterm zone="g-variant-new-strv" role="2.24"><primary sortas="variant_new_strv">g_variant_new_strv</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_strv (<parameter>const <link linkend="gchar"><type>gchar</type></link> * const *strv</parameter>,
                    <parameter><link linkend="gssize"><type>gssize</type></link> length</parameter>);</programlisting>
<para>Constructs an array of strings <link linkend="GVariant"><type>GVariant</type></link> from the given array of
strings.</para>
<para>If <parameter>length</parameter>
 is -1 then <parameter>strv</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<refsect3 id="g-variant-new-strv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>strv</para></entry>
<entry role="parameter_description"><para>an array of strings. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=length][<acronym>element-type</acronym> utf8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of <parameter>strv</parameter>
, or -1</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-strv.returns" role="returns">
<title>Returns</title>
<para>a new floating <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-objv" role="function" condition="since:2.30">
<title>g_variant_new_objv&#160;()</title>
<indexterm zone="g-variant-new-objv" role="2.30"><primary sortas="variant_new_objv">g_variant_new_objv</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_objv (<parameter>const <link linkend="gchar"><type>gchar</type></link> * const *strv</parameter>,
                    <parameter><link linkend="gssize"><type>gssize</type></link> length</parameter>);</programlisting>
<para>Constructs an array of object paths <link linkend="GVariant"><type>GVariant</type></link> from the given array of
strings.</para>
<para>Each string must be a valid <link linkend="GVariant"><type>GVariant</type></link> object path; see
<link linkend="g-variant-is-object-path"><function>g_variant_is_object_path()</function></link>.</para>
<para>If <parameter>length</parameter>
 is -1 then <parameter>strv</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<refsect3 id="g-variant-new-objv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>strv</para></entry>
<entry role="parameter_description"><para>an array of strings. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=length][<acronym>element-type</acronym> utf8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of <parameter>strv</parameter>
, or -1</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-objv.returns" role="returns">
<title>Returns</title>
<para>a new floating <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-variant-new-bytestring" role="function" condition="since:2.26">
<title>g_variant_new_bytestring&#160;()</title>
<indexterm zone="g-variant-new-bytestring" role="2.26"><primary sortas="variant_new_bytestring">g_variant_new_bytestring</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_bytestring (<parameter>const <link linkend="gchar"><type>gchar</type></link> *string</parameter>);</programlisting>
<para>Creates an array-of-bytes <link linkend="GVariant"><type>GVariant</type></link> with the contents of <parameter>string</parameter>
.
This function is just like <link linkend="g-variant-new-string"><function>g_variant_new_string()</function></link> except that the
string need not be valid UTF-8.</para>
<para>The nul terminator character at the end of the string is stored in
the array.</para>
<refsect3 id="g-variant-new-bytestring.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a normal
nul-terminated string in no particular encoding. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> zero-terminated=1][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-bytestring.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new bytestring <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-new-bytestring-array" role="function" condition="since:2.26">
<title>g_variant_new_bytestring_array&#160;()</title>
<indexterm zone="g-variant-new-bytestring-array" role="2.26"><primary sortas="variant_new_bytestring_array">g_variant_new_bytestring_array</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_bytestring_array (<parameter>const <link linkend="gchar"><type>gchar</type></link> * const *strv</parameter>,
                                <parameter><link linkend="gssize"><type>gssize</type></link> length</parameter>);</programlisting>
<para>Constructs an array of bytestring <link linkend="GVariant"><type>GVariant</type></link> from the given array of
strings.</para>
<para>If <parameter>length</parameter>
 is -1 then <parameter>strv</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<refsect3 id="g-variant-new-bytestring-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>strv</para></entry>
<entry role="parameter_description"><para>an array of strings. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=length]</emphasis></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of <parameter>strv</parameter>
, or -1</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-bytestring-array.returns" role="returns">
<title>Returns</title>
<para>a new floating <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-get-boolean" role="function" condition="since:2.24">
<title>g_variant_get_boolean&#160;()</title>
<indexterm zone="g-variant-get-boolean" role="2.24"><primary sortas="variant_get_boolean">g_variant_get_boolean</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_get_boolean (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the boolean value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-BOOLEAN:CAPS"><literal>G_VARIANT_TYPE_BOOLEAN</literal></link>.</para>
<refsect3 id="g-variant-get-boolean.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a boolean <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-boolean.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-byte" role="function" condition="since:2.24">
<title>g_variant_get_byte&#160;()</title>
<indexterm zone="g-variant-get-byte" role="2.24"><primary sortas="variant_get_byte">g_variant_get_byte</primary></indexterm>
<programlisting language="C"><link linkend="guint8"><returnvalue>guint8</returnvalue></link>
g_variant_get_byte (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the byte value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-BYTE:CAPS"><literal>G_VARIANT_TYPE_BYTE</literal></link>.</para>
<refsect3 id="g-variant-get-byte.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a byte <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-byte.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="guint8"><type>guint8</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-int16" role="function" condition="since:2.24">
<title>g_variant_get_int16&#160;()</title>
<indexterm zone="g-variant-get-int16" role="2.24"><primary sortas="variant_get_int16">g_variant_get_int16</primary></indexterm>
<programlisting language="C"><link linkend="gint16"><returnvalue>gint16</returnvalue></link>
g_variant_get_int16 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 16-bit signed integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-INT16:CAPS"><literal>G_VARIANT_TYPE_INT16</literal></link>.</para>
<refsect3 id="g-variant-get-int16.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a int16 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-int16.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="gint16"><type>gint16</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-uint16" role="function" condition="since:2.24">
<title>g_variant_get_uint16&#160;()</title>
<indexterm zone="g-variant-get-uint16" role="2.24"><primary sortas="variant_get_uint16">g_variant_get_uint16</primary></indexterm>
<programlisting language="C"><link linkend="guint16"><returnvalue>guint16</returnvalue></link>
g_variant_get_uint16 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 16-bit unsigned integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-UINT16:CAPS"><literal>G_VARIANT_TYPE_UINT16</literal></link>.</para>
<refsect3 id="g-variant-get-uint16.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a uint16 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-uint16.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="guint16"><type>guint16</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-int32" role="function" condition="since:2.24">
<title>g_variant_get_int32&#160;()</title>
<indexterm zone="g-variant-get-int32" role="2.24"><primary sortas="variant_get_int32">g_variant_get_int32</primary></indexterm>
<programlisting language="C"><link linkend="gint32"><returnvalue>gint32</returnvalue></link>
g_variant_get_int32 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 32-bit signed integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-INT32:CAPS"><literal>G_VARIANT_TYPE_INT32</literal></link>.</para>
<refsect3 id="g-variant-get-int32.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a int32 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-int32.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="gint32"><type>gint32</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-uint32" role="function" condition="since:2.24">
<title>g_variant_get_uint32&#160;()</title>
<indexterm zone="g-variant-get-uint32" role="2.24"><primary sortas="variant_get_uint32">g_variant_get_uint32</primary></indexterm>
<programlisting language="C"><link linkend="guint32"><returnvalue>guint32</returnvalue></link>
g_variant_get_uint32 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 32-bit unsigned integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-UINT32:CAPS"><literal>G_VARIANT_TYPE_UINT32</literal></link>.</para>
<refsect3 id="g-variant-get-uint32.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a uint32 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-uint32.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="guint32"><type>guint32</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-int64" role="function" condition="since:2.24">
<title>g_variant_get_int64&#160;()</title>
<indexterm zone="g-variant-get-int64" role="2.24"><primary sortas="variant_get_int64">g_variant_get_int64</primary></indexterm>
<programlisting language="C"><link linkend="gint64"><returnvalue>gint64</returnvalue></link>
g_variant_get_int64 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 64-bit signed integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-INT64:CAPS"><literal>G_VARIANT_TYPE_INT64</literal></link>.</para>
<refsect3 id="g-variant-get-int64.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a int64 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-int64.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="gint64"><type>gint64</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-uint64" role="function" condition="since:2.24">
<title>g_variant_get_uint64&#160;()</title>
<indexterm zone="g-variant-get-uint64" role="2.24"><primary sortas="variant_get_uint64">g_variant_get_uint64</primary></indexterm>
<programlisting language="C"><link linkend="guint64"><returnvalue>guint64</returnvalue></link>
g_variant_get_uint64 (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 64-bit unsigned integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-UINT64:CAPS"><literal>G_VARIANT_TYPE_UINT64</literal></link>.</para>
<refsect3 id="g-variant-get-uint64.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a uint64 <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-uint64.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="guint64"><type>guint64</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-handle" role="function" condition="since:2.24">
<title>g_variant_get_handle&#160;()</title>
<indexterm zone="g-variant-get-handle" role="2.24"><primary sortas="variant_get_handle">g_variant_get_handle</primary></indexterm>
<programlisting language="C"><link linkend="gint32"><returnvalue>gint32</returnvalue></link>
g_variant_get_handle (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the 32-bit signed integer value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type other
than <link linkend="G-VARIANT-TYPE-HANDLE:CAPS"><literal>G_VARIANT_TYPE_HANDLE</literal></link>.</para>
<para>By convention, handles are indexes into an array of file descriptors
that are sent alongside a D-Bus message.  If you're not interacting
with D-Bus, you probably don't need them.</para>
<refsect3 id="g-variant-get-handle.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a handle <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-handle.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="gint32"><type>gint32</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-double" role="function" condition="since:2.24">
<title>g_variant_get_double&#160;()</title>
<indexterm zone="g-variant-get-double" role="2.24"><primary sortas="variant_get_double">g_variant_get_double</primary></indexterm>
<programlisting language="C"><link linkend="gdouble"><returnvalue>gdouble</returnvalue></link>
g_variant_get_double (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the double precision floating point value of <parameter>value</parameter>
.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than <link linkend="G-VARIANT-TYPE-DOUBLE:CAPS"><literal>G_VARIANT_TYPE_DOUBLE</literal></link>.</para>
<refsect3 id="g-variant-get-double.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a double <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-double.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="gdouble"><type>gdouble</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-string" role="function" condition="since:2.24">
<title>g_variant_get_string&#160;()</title>
<indexterm zone="g-variant-get-string" role="2.24"><primary sortas="variant_get_string">g_variant_get_string</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_get_string (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                      <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Returns the string value of a <link linkend="GVariant"><type>GVariant</type></link> instance with a string
type.  This includes the types <link linkend="G-VARIANT-TYPE-STRING:CAPS"><literal>G_VARIANT_TYPE_STRING</literal></link>,
<link linkend="G-VARIANT-TYPE-OBJECT-PATH:CAPS"><literal>G_VARIANT_TYPE_OBJECT_PATH</literal></link> and <link linkend="G-VARIANT-TYPE-SIGNATURE:CAPS"><literal>G_VARIANT_TYPE_SIGNATURE</literal></link>.</para>
<para>The string will always be UTF-8 encoded, and will never be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the length of the string (in bytes) is
returned there.  For trusted values, this information is already
known.  For untrusted values, a <link linkend="strlen"><function>strlen()</function></link> will be performed.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 of any type
other than those three.</para>
<para>The return value remains valid as long as <parameter>value</parameter>
 exists.</para>
<refsect3 id="g-variant-get-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a string <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="gsize"><type>gsize</type></link>,
to store the length. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>optional</acronym>][<acronym>default</acronym> 0][<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-string.returns" role="returns">
<title>Returns</title>
<para>the constant string, UTF-8 encoded. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-dup-string" role="function" condition="since:2.24">
<title>g_variant_dup_string&#160;()</title>
<indexterm zone="g-variant-dup-string" role="2.24"><primary sortas="variant_dup_string">g_variant_dup_string</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_dup_string (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                      <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Similar to <link linkend="g-variant-get-string"><function>g_variant_get_string()</function></link> except that instead of returning
a constant string, the string is duplicated.</para>
<para>The string will always be UTF-8 encoded.</para>
<para>The return value must be freed using <link linkend="g-free"><function>g_free()</function></link>.</para>
<refsect3 id="g-variant-dup-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a string <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="gsize"><type>gsize</type></link>, to store the length. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dup-string.returns" role="returns">
<title>Returns</title>
<para>a newly allocated string, UTF-8 encoded. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-variant" role="function" condition="since:2.24">
<title>g_variant_get_variant&#160;()</title>
<indexterm zone="g-variant-get-variant" role="2.24"><primary sortas="variant_get_variant">g_variant_get_variant</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_get_variant (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Unboxes <parameter>value</parameter>
.  The result is the <link linkend="GVariant"><type>GVariant</type></link> instance that was
contained in <parameter>value</parameter>
.</para>
<refsect3 id="g-variant-get-variant.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a variant <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-variant.returns" role="returns">
<title>Returns</title>
<para>the item contained in the variant. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-strv" role="function" condition="since:2.24">
<title>g_variant_get_strv&#160;()</title>
<indexterm zone="g-variant-get-strv" role="2.24"><primary sortas="variant_get_strv">g_variant_get_strv</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_get_strv (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of strings <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a shallow copy; the return result should be released with
<link linkend="g-free"><function>g_free()</function></link>, but the individual strings must not be modified.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result
is stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-get-strv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of strings <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-strv.returns" role="returns">
<title>Returns</title>
<para>an array of constant strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length zero-terminated=1][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-dup-strv" role="function" condition="since:2.24">
<title>g_variant_dup_strv&#160;()</title>
<indexterm zone="g-variant-dup-strv" role="2.24"><primary sortas="variant_dup_strv">g_variant_dup_strv</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_dup_strv (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of strings <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a deep copy; the return result should be released with
<link linkend="g-strfreev"><function>g_strfreev()</function></link>.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result
is stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-dup-strv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of strings <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dup-strv.returns" role="returns">
<title>Returns</title>
<para>an array of strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length zero-terminated=1][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-objv" role="function" condition="since:2.30">
<title>g_variant_get_objv&#160;()</title>
<indexterm zone="g-variant-get-objv" role="2.30"><primary sortas="variant_get_objv">g_variant_get_objv</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_get_objv (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of object paths <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a shallow copy; the return result should be released with
<link linkend="g-free"><function>g_free()</function></link>, but the individual strings must not be modified.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result
is stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-get-objv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of object paths <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-objv.returns" role="returns">
<title>Returns</title>
<para>an array of constant strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length zero-terminated=1][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-variant-dup-objv" role="function" condition="since:2.30">
<title>g_variant_dup_objv&#160;()</title>
<indexterm zone="g-variant-dup-objv" role="2.30"><primary sortas="variant_dup_objv">g_variant_dup_objv</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_dup_objv (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                    <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of object paths <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a deep copy; the return result should be released with
<link linkend="g-strfreev"><function>g_strfreev()</function></link>.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result
is stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-dup-objv.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of object paths <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dup-objv.returns" role="returns">
<title>Returns</title>
<para>an array of strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length zero-terminated=1][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.30">2.30</link></para></refsect2>
<refsect2 id="g-variant-get-bytestring" role="function" condition="since:2.26">
<title>g_variant_get_bytestring&#160;()</title>
<indexterm zone="g-variant-get-bytestring" role="2.26"><primary sortas="variant_get_bytestring">g_variant_get_bytestring</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_get_bytestring (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns the string value of a <link linkend="GVariant"><type>GVariant</type></link> instance with an
array-of-bytes type.  The string has no particular encoding.</para>
<para>If the array does not end with a nul terminator character, the empty
string is returned.  For this reason, you can always trust that a
non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> nul-terminated string will be returned by this function.</para>
<para>If the array contains a nul terminator character somewhere other than
the last byte then the returned string is the string, up to the first
such nul character.</para>
<para>g_variant_get_fixed_array() should be used instead if the array contains
arbitrary data that could not be nul-terminated or could contain nul bytes.</para>
<para>It is an error to call this function with a <parameter>value</parameter>
 that is not an
array of bytes.</para>
<para>The return value remains valid as long as <parameter>value</parameter>
 exists.</para>
<refsect3 id="g-variant-get-bytestring.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array-of-bytes <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-bytestring.returns" role="returns">
<title>Returns</title>
<para>the constant string. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>][<acronym>array</acronym> zero-terminated=1][<acronym>element-type</acronym> guint8]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-dup-bytestring" role="function" condition="since:2.26">
<title>g_variant_dup_bytestring&#160;()</title>
<indexterm zone="g-variant-dup-bytestring" role="2.26"><primary sortas="variant_dup_bytestring">g_variant_dup_bytestring</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_dup_bytestring (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                          <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Similar to <link linkend="g-variant-get-bytestring"><function>g_variant_get_bytestring()</function></link> except that instead of
returning a constant string, the string is duplicated.</para>
<para>The return value must be freed using <link linkend="g-free"><function>g_free()</function></link>.</para>
<refsect3 id="g-variant-dup-bytestring.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array-of-bytes <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="gsize"><type>gsize</type></link>, to store
the length (not including the nul terminator). </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>][<acronym>default</acronym> NULL]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dup-bytestring.returns" role="returns">
<title>Returns</title>
<para>a newly allocated string. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>array</acronym> zero-terminated=1 length=length][<acronym>element-type</acronym> guint8]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-get-bytestring-array" role="function" condition="since:2.26">
<title>g_variant_get_bytestring_array&#160;()</title>
<indexterm zone="g-variant-get-bytestring-array" role="2.26"><primary sortas="variant_get_bytestring_array">g_variant_get_bytestring_array</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_get_bytestring_array (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                                <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of array of bytes <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a shallow copy; the return result should be released with
<link linkend="g-free"><function>g_free()</function></link>, but the individual strings must not be modified.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result is
stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-get-bytestring-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of array of bytes <link linkend="GVariant"><type>GVariant</type></link> ('aay')</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-bytestring-array.returns" role="returns">
<title>Returns</title>
<para>an array of constant strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-dup-bytestring-array" role="function" condition="since:2.26">
<title>g_variant_dup_bytestring_array&#160;()</title>
<indexterm zone="g-variant-dup-bytestring-array" role="2.26"><primary sortas="variant_dup_bytestring_array">g_variant_dup_bytestring_array</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;**
g_variant_dup_bytestring_array (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                                <parameter><link linkend="gsize"><type>gsize</type></link> *length</parameter>);</programlisting>
<para>Gets the contents of an array of array of bytes <link linkend="GVariant"><type>GVariant</type></link>.  This call
makes a deep copy; the return result should be released with
<link linkend="g-strfreev"><function>g_strfreev()</function></link>.</para>
<para>If <parameter>length</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the number of elements in the result is
stored there.  In any case, the resulting array will be
<link linkend="NULL:CAPS"><literal>NULL</literal></link>-terminated.</para>
<para>For an empty array, <parameter>length</parameter>
 will be set to 0 and a pointer to a
<link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer will be returned.</para>
<refsect3 id="g-variant-dup-bytestring-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>an array of array of bytes <link linkend="GVariant"><type>GVariant</type></link> ('aay')</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>length</para></entry>
<entry role="parameter_description"><para>the length of the result, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dup-bytestring-array.returns" role="returns">
<title>Returns</title>
<para>an array of strings. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=length][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-new-maybe" role="function" condition="since:2.24">
<title>g_variant_new_maybe&#160;()</title>
<indexterm zone="g-variant-new-maybe" role="2.24"><primary sortas="variant_new_maybe">g_variant_new_maybe</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_maybe (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *child_type</parameter>,
                     <parameter><link linkend="GVariant"><type>GVariant</type></link> *child</parameter>);</programlisting>
<para>Depending on if <parameter>child</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, either wraps <parameter>child</parameter>
 inside of a
maybe container or creates a Nothing instance for the given <parameter>type</parameter>
.</para>
<para>At least one of <parameter>child_type</parameter>
 and <parameter>child</parameter>
 must be non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>.
If <parameter>child_type</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then it must be a definite type.
If they are both non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then <parameter>child_type</parameter>
 must be the type
of <parameter>child</parameter>
.</para>
<para>If <parameter>child</parameter>
 is a floating reference (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>), the new
instance takes ownership of <parameter>child</parameter>
.</para>
<refsect3 id="g-variant-new-maybe.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>child_type</para></entry>
<entry role="parameter_description"><para>the <link linkend="GVariantType"><type>GVariantType</type></link> of the child, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>child</para></entry>
<entry role="parameter_description"><para>the child value, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-maybe.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new <link linkend="GVariant"><type>GVariant</type></link> maybe instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-array" role="function" condition="since:2.24">
<title>g_variant_new_array&#160;()</title>
<indexterm zone="g-variant-new-array" role="2.24"><primary sortas="variant_new_array">g_variant_new_array</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_array (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *child_type</parameter>,
                     <parameter><link linkend="GVariant"><type>GVariant</type></link> * const *children</parameter>,
                     <parameter><link linkend="gsize"><type>gsize</type></link> n_children</parameter>);</programlisting>
<para>Creates a new <link linkend="GVariant"><type>GVariant</type></link> array from <parameter>children</parameter>
.</para>
<para><parameter>child_type</parameter>
 must be non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>n_children</parameter>
 is zero.  Otherwise, the
child type is determined by inspecting the first element of the
<parameter>children</parameter>
 array.  If <parameter>child_type</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then it must be a
definite type.</para>
<para>The items of the array are taken from the <parameter>children</parameter>
 array.  No entry
in the <parameter>children</parameter>
 array may be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>All items in the array must have the same type, which must be the
same as <parameter>child_type</parameter>
, if given.</para>
<para>If the <parameter>children</parameter>
 are floating references (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>), the
new instance takes ownership of them as if via <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>.</para>
<refsect3 id="g-variant-new-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>child_type</para></entry>
<entry role="parameter_description"><para>the element type of the new array. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>children</para></entry>
<entry role="parameter_description"><para>an array of
<link linkend="GVariant"><type>GVariant</type></link> pointers, the children. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>array</acronym> length=n_children]</emphasis></entry></row>
<row><entry role="parameter_name"><para>n_children</para></entry>
<entry role="parameter_description"><para>the length of <parameter>children</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-array.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new <link linkend="GVariant"><type>GVariant</type></link> array. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-tuple" role="function" condition="since:2.24">
<title>g_variant_new_tuple&#160;()</title>
<indexterm zone="g-variant-new-tuple" role="2.24"><primary sortas="variant_new_tuple">g_variant_new_tuple</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_tuple (<parameter><link linkend="GVariant"><type>GVariant</type></link> * const *children</parameter>,
                     <parameter><link linkend="gsize"><type>gsize</type></link> n_children</parameter>);</programlisting>
<para>Creates a new tuple <link linkend="GVariant"><type>GVariant</type></link> out of the items in <parameter>children</parameter>
.  The
type is determined from the types of <parameter>children</parameter>
.  No entry in the
<parameter>children</parameter>
 array may be <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>If <parameter>n_children</parameter>
 is 0 then the unit tuple is constructed.</para>
<para>If the <parameter>children</parameter>
 are floating references (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>), the
new instance takes ownership of them as if via <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>.</para>
<refsect3 id="g-variant-new-tuple.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>children</para></entry>
<entry role="parameter_description"><para>the items to make the tuple out of. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=n_children]</emphasis></entry></row>
<row><entry role="parameter_name"><para>n_children</para></entry>
<entry role="parameter_description"><para>the length of <parameter>children</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-tuple.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new <link linkend="GVariant"><type>GVariant</type></link> tuple. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-dict-entry" role="function" condition="since:2.24">
<title>g_variant_new_dict_entry&#160;()</title>
<indexterm zone="g-variant-new-dict-entry" role="2.24"><primary sortas="variant_new_dict_entry">g_variant_new_dict_entry</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_dict_entry (<parameter><link linkend="GVariant"><type>GVariant</type></link> *key</parameter>,
                          <parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Creates a new dictionary entry <link linkend="GVariant"><type>GVariant</type></link>. <parameter>key</parameter>
 and <parameter>value</parameter>
 must be
non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>. <parameter>key</parameter>
 must be a value of a basic type (ie: not a container).</para>
<para>If the <parameter>key</parameter>
 or <parameter>value</parameter>
 are floating references (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>),
the new instance takes ownership of them as if via <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>constructor</acronym>]</emphasis></para><refsect3 id="g-variant-new-dict-entry.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>a basic <link linkend="GVariant"><type>GVariant</type></link>, the key</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link>, the value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-dict-entry.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new dictionary entry <link linkend="GVariant"><type>GVariant</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-fixed-array" role="function" condition="since:2.32">
<title>g_variant_new_fixed_array&#160;()</title>
<indexterm zone="g-variant-new-fixed-array" role="2.32"><primary sortas="variant_new_fixed_array">g_variant_new_fixed_array</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_fixed_array (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *element_type</parameter>,
                           <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> elements</parameter>,
                           <parameter><link linkend="gsize"><type>gsize</type></link> n_elements</parameter>,
                           <parameter><link linkend="gsize"><type>gsize</type></link> element_size</parameter>);</programlisting>
<para>Constructs a new array <link linkend="GVariant"><type>GVariant</type></link> instance, where the elements are
of <parameter>element_type</parameter>
 type.</para>
<para><parameter>elements</parameter>
 must be an array with fixed-sized elements.  Numeric types are
fixed-size as are tuples containing only other fixed-sized types.</para>
<para><parameter>element_size</parameter>
 must be the size of a single element in the array.
For example, if calling this function for an array of 32-bit integers,
you might say sizeof(gint32). This value isn't used except for the purpose
of a double-check that the form of the serialised data matches the caller's
expectation.</para>
<para><parameter>n_elements</parameter>
 must be the length of the <parameter>elements</parameter>
 array.</para>
<refsect3 id="g-variant-new-fixed-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>element_type</para></entry>
<entry role="parameter_description"><para>the <link linkend="GVariantType"><type>GVariantType</type></link> of each element</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>elements</para></entry>
<entry role="parameter_description"><para>a pointer to the fixed array of contiguous elements</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_elements</para></entry>
<entry role="parameter_description"><para>the number of elements</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>element_size</para></entry>
<entry role="parameter_description"><para>the size of each element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-fixed-array.returns" role="returns">
<title>Returns</title>
<para>a floating reference to a new array <link linkend="GVariant"><type>GVariant</type></link> instance. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-variant-get-maybe" role="function" condition="since:2.24">
<title>g_variant_get_maybe&#160;()</title>
<indexterm zone="g-variant-get-maybe" role="2.24"><primary sortas="variant_get_maybe">g_variant_get_maybe</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_get_maybe (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Given a maybe-typed <link linkend="GVariant"><type>GVariant</type></link> instance, extract its value.  If the
value is Nothing, then this function returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<refsect3 id="g-variant-get-maybe.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a maybe-typed value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-maybe.returns" role="returns">
<title>Returns</title>
<para>the contents of <parameter>value</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-n-children" role="function" condition="since:2.24">
<title>g_variant_n_children&#160;()</title>
<indexterm zone="g-variant-n-children" role="2.24"><primary sortas="variant_n_children">g_variant_n_children</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_variant_n_children (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Determines the number of children in a container <link linkend="GVariant"><type>GVariant</type></link> instance.
This includes variants, maybes, arrays, tuples and dictionary
entries.  It is an error to call this function on any other type of
<link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>For variants, the return value is always 1.  For values with maybe
types, it is always zero or one.  For arrays, it is the length of the
array.  For tuples it is the number of tuple items (which depends
only on the type).  For dictionary entries, it is always 2</para>
<para>This function is O(1).</para>
<refsect3 id="g-variant-n-children.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a container <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-n-children.returns" role="returns">
<title>Returns</title>
<para> the number of children in the container</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-child-value" role="function" condition="since:2.24">
<title>g_variant_get_child_value&#160;()</title>
<indexterm zone="g-variant-get-child-value" role="2.24"><primary sortas="variant_get_child_value">g_variant_get_child_value</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_get_child_value (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                           <parameter><link linkend="gsize"><type>gsize</type></link> index_</parameter>);</programlisting>
<para>Reads a child item out of a container <link linkend="GVariant"><type>GVariant</type></link> instance.  This
includes variants, maybes, arrays, tuples and dictionary
entries.  It is an error to call this function on any other type of
<link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>It is an error if <parameter>index_</parameter>
 is greater than the number of child items
in the container.  See <link linkend="g-variant-n-children"><function>g_variant_n_children()</function></link>.</para>
<para>The returned value is never floating.  You should free it with
<link linkend="g-variant-unref"><function>g_variant_unref()</function></link> when you're done with it.</para>
<para>There may be implementation specific restrictions on deeply nested values,
which would result in the unit tuple being returned as the child value,
instead of further nested children. <link linkend="GVariant"><type>GVariant</type></link> is guaranteed to handle
nesting up to at least 64 levels.</para>
<para>This function is O(1).</para>
<refsect3 id="g-variant-get-child-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a container <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>index_</para></entry>
<entry role="parameter_description"><para>the index of the child to fetch</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-child-value.returns" role="returns">
<title>Returns</title>
<para>the child at the specified index. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-child" role="function" condition="since:2.24">
<title>g_variant_get_child&#160;()</title>
<indexterm zone="g-variant-get-child" role="2.24"><primary sortas="variant_get_child">g_variant_get_child</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_get_child (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                     <parameter><link linkend="gsize"><type>gsize</type></link> index_</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                     <parameter>...</parameter>);</programlisting>
<para>Reads a child item out of a container <link linkend="GVariant"><type>GVariant</type></link> instance and
deconstructs it according to <parameter>format_string</parameter>
.  This call is
essentially a combination of <link linkend="g-variant-get-child-value"><function>g_variant_get_child_value()</function></link> and
<link linkend="g-variant-get"><function>g_variant_get()</function></link>.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed,
see the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-get-child.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a container <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>index_</para></entry>
<entry role="parameter_description"><para>the index of the child to deconstruct</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments, as per <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-lookup-value" role="function" condition="since:2.28">
<title>g_variant_lookup_value&#160;()</title>
<indexterm zone="g-variant-lookup-value" role="2.28"><primary sortas="variant_lookup_value">g_variant_lookup_value</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_lookup_value (<parameter><link linkend="GVariant"><type>GVariant</type></link> *dictionary</parameter>,
                        <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                        <parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *expected_type</parameter>);</programlisting>
<para>Looks up a value in a dictionary <link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>This function works with dictionaries of the type a{s*} (and equally
well with type a{o*}, but we only further discuss the string case
for sake of clarity).</para>
<para>In the event that <parameter>dictionary</parameter>
 has the type a{sv}, the <parameter>expected_type</parameter>

string specifies what type of value is expected to be inside of the
variant. If the value inside the variant has a different type then
<link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned. In the event that <parameter>dictionary</parameter>
 has a value type other
than v then <parameter>expected_type</parameter>
 must directly match the value type and it is
used to unpack the value directly or an error occurs.</para>
<para>In either case, if <parameter>key</parameter>
 is not found in <parameter>dictionary</parameter>
, <link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned.</para>
<para>If the key is found and the value has the correct type, it is
returned.  If <parameter>expected_type</parameter>
 was specified then any non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> return
value will have this type.</para>
<para>This function is currently implemented with a linear scan.  If you
plan to do many lookups then <link linkend="GVariantDict"><type>GVariantDict</type></link> may be more efficient.</para>
<refsect3 id="g-variant-lookup-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dictionary</para></entry>
<entry role="parameter_description"><para>a dictionary <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to lookup in the dictionary</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>expected_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantType"><type>GVariantType</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-lookup-value.returns" role="returns">
<title>Returns</title>
<para>the value of the dictionary key, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.28">2.28</link></para></refsect2>
<refsect2 id="g-variant-lookup" role="function" condition="since:2.28">
<title>g_variant_lookup&#160;()</title>
<indexterm zone="g-variant-lookup" role="2.28"><primary sortas="variant_lookup">g_variant_lookup</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_lookup (<parameter><link linkend="GVariant"><type>GVariant</type></link> *dictionary</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                  <parameter>...</parameter>);</programlisting>
<para>Looks up a value in a dictionary <link linkend="GVariant"><type>GVariant</type></link>.</para>
<para>This function is a wrapper around <link linkend="g-variant-lookup-value"><function>g_variant_lookup_value()</function></link> and
<link linkend="g-variant-get"><function>g_variant_get()</function></link>.  In the case that <link linkend="NULL:CAPS"><literal>NULL</literal></link> would have been returned,
this function returns <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>.  Otherwise, it unpacks the returned
value and returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed,
see the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>
<para>This function is currently implemented with a linear scan.  If you
plan to do many lookups then <link linkend="GVariantDict"><type>GVariantDict</type></link> may be more efficient.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-lookup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dictionary</para></entry>
<entry role="parameter_description"><para>a dictionary <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to lookup in the dictionary</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a GVariant format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>the arguments to unpack the value into</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-lookup.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if a value was unpacked</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.28">2.28</link></para></refsect2>
<refsect2 id="g-variant-get-fixed-array" role="function" condition="since:2.24">
<title>g_variant_get_fixed_array&#160;()</title>
<indexterm zone="g-variant-get-fixed-array" role="2.24"><primary sortas="variant_get_fixed_array">g_variant_get_fixed_array</primary></indexterm>
<programlisting language="C"><link linkend="gconstpointer"><returnvalue>gconstpointer</returnvalue></link>
g_variant_get_fixed_array (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                           <parameter><link linkend="gsize"><type>gsize</type></link> *n_elements</parameter>,
                           <parameter><link linkend="gsize"><type>gsize</type></link> element_size</parameter>);</programlisting>
<para>Provides access to the serialised data for an array of fixed-sized
items.</para>
<para><parameter>value</parameter>
 must be an array with fixed-sized elements.  Numeric types are
fixed-size, as are tuples containing only other fixed-sized types.</para>
<para><parameter>element_size</parameter>
 must be the size of a single element in the array,
as given by the section on
<link linkend="gvariant-serialised-data-memory">serialized data memory</link>.</para>
<para>In particular, arrays of these fixed-sized types can be interpreted
as an array of the given C type, with <parameter>element_size</parameter>
 set to the size
the appropriate type:</para>
<itemizedlist>
<listitem><para><link linkend="G-VARIANT-TYPE-INT16:CAPS"><literal>G_VARIANT_TYPE_INT16</literal></link> (etc.): <link linkend="gint16"><type>gint16</type></link> (etc.)</para></listitem>
<listitem><para><link linkend="G-VARIANT-TYPE-BOOLEAN:CAPS"><literal>G_VARIANT_TYPE_BOOLEAN</literal></link>: <link linkend="guchar"><type>guchar</type></link> (not <link linkend="gboolean"><type>gboolean</type></link>!)</para></listitem>
<listitem><para><link linkend="G-VARIANT-TYPE-BYTE:CAPS"><literal>G_VARIANT_TYPE_BYTE</literal></link>: <link linkend="guint8"><type>guint8</type></link></para></listitem>
<listitem><para><link linkend="G-VARIANT-TYPE-HANDLE:CAPS"><literal>G_VARIANT_TYPE_HANDLE</literal></link>: <link linkend="guint32"><type>guint32</type></link></para></listitem>
<listitem>
<para><link linkend="G-VARIANT-TYPE-DOUBLE:CAPS"><literal>G_VARIANT_TYPE_DOUBLE</literal></link>: <link linkend="gdouble"><type>gdouble</type></link></para>
</listitem>
</itemizedlist>
<para>For example, if calling this function for an array of 32-bit integers,
you might say <literal>sizeof(gint32)</literal>. This value isn't used except for the purpose
of a double-check that the form of the serialised data matches the caller's
expectation.</para>
<para><parameter>n_elements</parameter>
, which must be non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>, is set equal to the number of
items in the array.</para>
<refsect3 id="g-variant-get-fixed-array.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> array with fixed-sized elements</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_elements</para></entry>
<entry role="parameter_description"><para>a pointer to the location to store the number of items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>element_size</para></entry>
<entry role="parameter_description"><para>the size of each element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-fixed-array.returns" role="returns">
<title>Returns</title>
<para>a pointer to
the fixed array. </para>
<para><emphasis role="annotation">[<acronym>array</acronym> length=n_elements][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-size" role="function" condition="since:2.24">
<title>g_variant_get_size&#160;()</title>
<indexterm zone="g-variant-get-size" role="2.24"><primary sortas="variant_get_size">g_variant_get_size</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_variant_get_size (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Determines the number of bytes that would be required to store <parameter>value</parameter>

with <link linkend="g-variant-store"><function>g_variant_store()</function></link>.</para>
<para>If <parameter>value</parameter>
 has a fixed-sized type then this function always returned
that fixed size.</para>
<para>In the case that <parameter>value</parameter>
 is already in serialised form or the size has
already been calculated (ie: this function has been called before)
then this function is O(1).  Otherwise, the size is calculated, an
operation which is approximately O(n) in the number of values
involved.</para>
<refsect3 id="g-variant-get-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-size.returns" role="returns">
<title>Returns</title>
<para> the serialised size of <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-data" role="function" condition="since:2.24">
<title>g_variant_get_data&#160;()</title>
<indexterm zone="g-variant-get-data" role="2.24"><primary sortas="variant_get_data">g_variant_get_data</primary></indexterm>
<programlisting language="C"><link linkend="gconstpointer"><returnvalue>gconstpointer</returnvalue></link>
g_variant_get_data (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns a pointer to the serialised form of a <link linkend="GVariant"><type>GVariant</type></link> instance.
The returned data may not be in fully-normalised form if read from an
untrusted source.  The returned data must not be freed; it remains
valid for as long as <parameter>value</parameter>
 exists.</para>
<para>If <parameter>value</parameter>
 is a fixed-sized value that was deserialised from a
corrupted serialised container then <link linkend="NULL:CAPS"><literal>NULL</literal></link> may be returned.  In this
case, the proper thing to do is typically to use the appropriate
number of nul bytes in place of <parameter>value</parameter>
.  If <parameter>value</parameter>
 is not fixed-sized
then <link linkend="NULL:CAPS"><literal>NULL</literal></link> is never returned.</para>
<para>In the case that <parameter>value</parameter>
 is already in serialised form, this function
is O(1).  If the value is not already in serialised form,
serialisation occurs implicitly and is approximately O(n) in the size
of the result.</para>
<para>To deserialise the data returned by this function, in addition to the
serialised data, you must know the type of the <link linkend="GVariant"><type>GVariant</type></link>, and (if the
machine might be different) the endianness of the machine that stored
it. As a result, file formats or network messages that incorporate
serialised <link linkend="GVariants"><type>GVariants</type></link> must include this information either
implicitly (for instance "the file always contains a
<link linkend="G-VARIANT-TYPE-VARIANT:CAPS"><literal>G_VARIANT_TYPE_VARIANT</literal></link> and it is always in little-endian order") or
explicitly (by storing the type and/or endianness in addition to the
serialised data).</para>
<refsect3 id="g-variant-get-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-data.returns" role="returns">
<title>Returns</title>
<para>the serialised form of <parameter>value</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-data-as-bytes" role="function" condition="since:2.36">
<title>g_variant_get_data_as_bytes&#160;()</title>
<indexterm zone="g-variant-get-data-as-bytes" role="2.36"><primary sortas="variant_get_data_as_bytes">g_variant_get_data_as_bytes</primary></indexterm>
<programlisting language="C"><link linkend="GBytes"><returnvalue>GBytes</returnvalue></link>&#160;*
g_variant_get_data_as_bytes (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Returns a pointer to the serialised form of a <link linkend="GVariant"><type>GVariant</type></link> instance.
The semantics of this function are exactly the same as
<link linkend="g-variant-get-data"><function>g_variant_get_data()</function></link>, except that the returned <link linkend="GBytes"><type>GBytes</type></link> holds
a reference to the variant data.</para>
<refsect3 id="g-variant-get-data-as-bytes.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-data-as-bytes.returns" role="returns">
<title>Returns</title>
<para>A new <link linkend="GBytes"><type>GBytes</type></link> representing the variant data. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.36">2.36</link></para></refsect2>
<refsect2 id="g-variant-store" role="function" condition="since:2.24">
<title>g_variant_store&#160;()</title>
<indexterm zone="g-variant-store" role="2.24"><primary sortas="variant_store">g_variant_store</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_store (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                 <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Stores the serialised form of <parameter>value</parameter>
 at <parameter>data</parameter>
.  <parameter>data</parameter>
 should be
large enough.  See <link linkend="g-variant-get-size"><function>g_variant_get_size()</function></link>.</para>
<para>The stored data is in machine native byte order but may not be in
fully-normalised form if read from an untrusted source.  See
<link linkend="g-variant-get-normal-form"><function>g_variant_get_normal_form()</function></link> for a solution.</para>
<para>As with <link linkend="g-variant-get-data"><function>g_variant_get_data()</function></link>, to be able to deserialise the
serialised variant successfully, its type and (if the destination
machine might be different) its endianness must also be available.</para>
<para>This function is approximately O(n) in the size of <parameter>data</parameter>
.</para>
<refsect3 id="g-variant-store.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>the <link linkend="GVariant"><type>GVariant</type></link> to store</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the location to store the serialised data at. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-from-data" role="function" condition="since:2.24">
<title>g_variant_new_from_data&#160;()</title>
<indexterm zone="g-variant-new-from-data" role="2.24"><primary sortas="variant_new_from_data">g_variant_new_from_data</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_from_data (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>,
                         <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>,
                         <parameter><link linkend="gsize"><type>gsize</type></link> size</parameter>,
                         <parameter><link linkend="gboolean"><type>gboolean</type></link> trusted</parameter>,
                         <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> notify</parameter>,
                         <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Creates a new <link linkend="GVariant"><type>GVariant</type></link> instance from serialised data.</para>
<para><parameter>type</parameter>
 is the type of <link linkend="GVariant"><type>GVariant</type></link> instance that will be constructed.
The interpretation of <parameter>data</parameter>
 depends on knowing the type.</para>
<para><parameter>data</parameter>
 is not modified by this function and must remain valid with an
unchanging value until such a time as <parameter>notify</parameter>
 is called with
<parameter>user_data</parameter>
.  If the contents of <parameter>data</parameter>
 change before that time then
the result is undefined.</para>
<para>If <parameter>data</parameter>
 is trusted to be serialised data in normal form then
<parameter>trusted</parameter>
 should be <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.  This applies to serialised data created
within this process or read from a trusted location on the disk (such
as a file installed in /usr/lib alongside your application).  You
should set trusted to <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if <parameter>data</parameter>
 is read from the network, a
file in the user's home directory, etc.</para>
<para>If <parameter>data</parameter>
 was not stored in this machine's native endianness, any multi-byte
numeric values in the returned variant will also be in non-native
endianness. <link linkend="g-variant-byteswap"><function>g_variant_byteswap()</function></link> can be used to recover the original values.</para>
<para><parameter>notify</parameter>
 will be called with <parameter>user_data</parameter>
 when <parameter>data</parameter>
 is no longer
needed.  The exact time of this call is unspecified and might even be
before this function returns.</para>
<para>Note: <parameter>data</parameter>
 must be backed by memory that is aligned appropriately for the
<parameter>type</parameter>
 being loaded. Otherwise this function will internally create a copy of
the memory (since GLib 2.60) or (in older versions) fail and exit the
process.</para>
<refsect3 id="g-variant-new-from-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a definite <link linkend="GVariantType"><type>GVariantType</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the serialised data. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> length=size][<acronym>element-type</acronym> guint8]</emphasis></entry></row>
<row><entry role="parameter_name"><para>size</para></entry>
<entry role="parameter_description"><para>the size of <parameter>data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>trusted</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>data</parameter>
is definitely in normal form</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>function to call when <parameter>data</parameter>
is no longer needed. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope async</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>data for <parameter>notify</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-from-data.returns" role="returns">
<title>Returns</title>
<para>a new floating <link linkend="GVariant"><type>GVariant</type></link> of type <parameter>type</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-new-from-bytes" role="function" condition="since:2.36">
<title>g_variant_new_from_bytes&#160;()</title>
<indexterm zone="g-variant-new-from-bytes" role="2.36"><primary sortas="variant_new_from_bytes">g_variant_new_from_bytes</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_from_bytes (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>,
                          <parameter><link linkend="GBytes"><type>GBytes</type></link> *bytes</parameter>,
                          <parameter><link linkend="gboolean"><type>gboolean</type></link> trusted</parameter>);</programlisting>
<para>Constructs a new serialised-mode <link linkend="GVariant"><type>GVariant</type></link> instance.  This is the
inner interface for creation of new serialised values that gets
called from various functions in gvariant.c.</para>
<para>A reference is taken on <parameter>bytes</parameter>
.</para>
<para>The data in <parameter>bytes</parameter>
 must be aligned appropriately for the <parameter>type</parameter>
 being loaded.
Otherwise this function will internally create a copy of the memory (since
GLib 2.60) or (in older versions) fail and exit the process.</para>
<refsect3 id="g-variant-new-from-bytes.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantType"><type>GVariantType</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>bytes</para></entry>
<entry role="parameter_description"><para>a <link linkend="GBytes"><type>GBytes</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>trusted</para></entry>
<entry role="parameter_description"><para>if the contents of <parameter>bytes</parameter>
are trusted</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-from-bytes.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GVariant"><type>GVariant</type></link> with a floating reference. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.36">2.36</link></para></refsect2>
<refsect2 id="g-variant-byteswap" role="function" condition="since:2.24">
<title>g_variant_byteswap&#160;()</title>
<indexterm zone="g-variant-byteswap" role="2.24"><primary sortas="variant_byteswap">g_variant_byteswap</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_byteswap (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Performs a byteswapping operation on the contents of <parameter>value</parameter>
.  The
result is that all multi-byte numeric data contained in <parameter>value</parameter>
 is
byteswapped.  That includes 16, 32, and 64bit signed and unsigned
integers as well as file handles and double precision floating point
values.</para>
<para>This function is an identity mapping on any value that does not
contain multi-byte numeric data.  That include strings, booleans,
bytes and containers containing only these things (recursively).</para>
<para>The returned value is always in normal form and is marked as trusted.</para>
<refsect3 id="g-variant-byteswap.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-byteswap.returns" role="returns">
<title>Returns</title>
<para>the byteswapped form of <parameter>value</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-get-normal-form" role="function" condition="since:2.24">
<title>g_variant_get_normal_form&#160;()</title>
<indexterm zone="g-variant-get-normal-form" role="2.24"><primary sortas="variant_get_normal_form">g_variant_get_normal_form</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_get_normal_form (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Gets a <link linkend="GVariant"><type>GVariant</type></link> instance that has the same value as <parameter>value</parameter>
 and is
trusted to be in normal form.</para>
<para>If <parameter>value</parameter>
 is already trusted to be in normal form then a new
reference to <parameter>value</parameter>
 is returned.</para>
<para>If <parameter>value</parameter>
 is not already trusted, then it is scanned to check if it
is in normal form.  If it is found to be in normal form then it is
marked as trusted and a new reference to it is returned.</para>
<para>If <parameter>value</parameter>
 is found not to be in normal form then a new trusted
<link linkend="GVariant"><type>GVariant</type></link> is created with the same value as <parameter>value</parameter>
.</para>
<para>It makes sense to call this function if you've received <link linkend="GVariant"><type>GVariant</type></link>
data from untrusted sources and you want to ensure your serialised
output is definitely in normal form.</para>
<para>If <parameter>value</parameter>
 is already in normal form, a new reference will be returned
(which will be floating if <parameter>value</parameter>
 is floating). If it is not in normal form,
the newly created <link linkend="GVariant"><type>GVariant</type></link> will be returned with a single non-floating
reference. Typically, <link linkend="g-variant-take-ref"><function>g_variant_take_ref()</function></link> should be called on the return
value from this function to guarantee ownership of a single non-floating
reference to it.</para>
<refsect3 id="g-variant-get-normal-form.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-get-normal-form.returns" role="returns">
<title>Returns</title>
<para>a trusted <link linkend="GVariant"><type>GVariant</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-is-normal-form" role="function" condition="since:2.24">
<title>g_variant_is_normal_form&#160;()</title>
<indexterm zone="g-variant-is-normal-form" role="2.24"><primary sortas="variant_is_normal_form">g_variant_is_normal_form</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_is_normal_form (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Checks if <parameter>value</parameter>
 is in normal form.</para>
<para>The main reason to do this is to detect if a given chunk of
serialised data is in normal form: load the data into a <link linkend="GVariant"><type>GVariant</type></link>
using <link linkend="g-variant-new-from-data"><function>g_variant_new_from_data()</function></link> and then use this function to
check.</para>
<para>If <parameter>value</parameter>
 is found to be in normal form then it will be marked as
being trusted.  If the value was already marked as being trusted then
this function will immediately return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>There may be implementation specific restrictions on deeply nested values.
GVariant is guaranteed to handle nesting up to at least 64 levels.</para>
<refsect3 id="g-variant-is-normal-form.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-is-normal-form.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>value</parameter>
is in normal form</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-hash" role="function" condition="since:2.24">
<title>g_variant_hash&#160;()</title>
<indexterm zone="g-variant-hash" role="2.24"><primary sortas="variant_hash">g_variant_hash</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_variant_hash (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> value</parameter>);</programlisting>
<para>Generates a hash value for a <link linkend="GVariant"><type>GVariant</type></link> instance.</para>
<para>The output of this function is guaranteed to be the same for a given
value only per-process.  It may change between different processor
architectures or even different versions of GLib.  Do not use this
function as a basis for building protocols or file formats.</para>
<para>The type of <parameter>value</parameter>
 is <link linkend="gconstpointer"><type>gconstpointer</type></link> only to allow use of this
function with <link linkend="GHashTable"><type>GHashTable</type></link>.  <parameter>value</parameter>
 must be a <link linkend="GVariant"><type>GVariant</type></link>.</para>
<refsect3 id="g-variant-hash.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a basic <link linkend="GVariant"><type>GVariant</type></link> value as a <link linkend="gconstpointer"><type>gconstpointer</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GVariant]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-hash.returns" role="returns">
<title>Returns</title>
<para> a hash value corresponding to <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-equal" role="function" condition="since:2.24">
<title>g_variant_equal&#160;()</title>
<indexterm zone="g-variant-equal" role="2.24"><primary sortas="variant_equal">g_variant_equal</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_equal (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> one</parameter>,
                 <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> two</parameter>);</programlisting>
<para>Checks if <parameter>one</parameter>
 and <parameter>two</parameter>
 have the same type and value.</para>
<para>The types of <parameter>one</parameter>
 and <parameter>two</parameter>
 are <link linkend="gconstpointer"><type>gconstpointer</type></link> only to allow use of
this function with <link linkend="GHashTable"><type>GHashTable</type></link>.  They must each be a <link linkend="GVariant"><type>GVariant</type></link>.</para>
<refsect3 id="g-variant-equal.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>one</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GVariant]</emphasis></entry></row>
<row><entry role="parameter_name"><para>two</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> instance. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GVariant]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-equal.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>one</parameter>
and <parameter>two</parameter>
are equal</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-print" role="function" condition="since:2.24">
<title>g_variant_print&#160;()</title>
<indexterm zone="g-variant-print" role="2.24"><primary sortas="variant_print">g_variant_print</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_print (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                 <parameter><link linkend="gboolean"><type>gboolean</type></link> type_annotate</parameter>);</programlisting>
<para>Pretty-prints <parameter>value</parameter>
 in the format understood by <link linkend="g-variant-parse"><function>g_variant_parse()</function></link>.</para>
<para>The format is described <link linkend="gvariant-text">here</link>.</para>
<para>If <parameter>type_annotate</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, then type information is included in
the output.</para>
<refsect3 id="g-variant-print.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type_annotate</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if type information should be included in
the output</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-print.returns" role="returns">
<title>Returns</title>
<para>a newly-allocated string holding the result. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-print-string" role="function" condition="since:2.24">
<title>g_variant_print_string&#160;()</title>
<indexterm zone="g-variant-print-string" role="2.24"><primary sortas="variant_print_string">g_variant_print_string</primary></indexterm>
<programlisting language="C"><link linkend="GString"><returnvalue>GString</returnvalue></link>&#160;*
g_variant_print_string (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>,
                        <parameter><link linkend="GString"><type>GString</type></link> *string</parameter>,
                        <parameter><link linkend="gboolean"><type>gboolean</type></link> type_annotate</parameter>);</programlisting>
<para>Behaves as <link linkend="g-variant-print"><function>g_variant_print()</function></link>, but operates on a <link linkend="GString"><type>GString</type></link>.</para>
<para>If <parameter>string</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then it is appended to and returned.  Else,
a new empty <link linkend="GString"><type>GString</type></link> is allocated and it is returned.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-print-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GString"><type>GString</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>default</acronym> NULL]</emphasis></entry></row>
<row><entry role="parameter_name"><para>type_annotate</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if type information should be included in
the output</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-print-string.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GString"><type>GString</type></link> containing the string</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-copy" role="function" condition="since:2.24">
<title>g_variant_iter_copy&#160;()</title>
<indexterm zone="g-variant-iter-copy" role="2.24"><primary sortas="variant_iter_copy">g_variant_iter_copy</primary></indexterm>
<programlisting language="C"><link linkend="GVariantIter"><returnvalue>GVariantIter</returnvalue></link>&#160;*
g_variant_iter_copy (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>);</programlisting>
<para>Creates a new heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link> to iterate over the
container that was being iterated over by <parameter>iter</parameter>
.  Iteration begins on
the new iterator from the current position of the old iterator but
the two copies are independent past that point.</para>
<para>Use <link linkend="g-variant-iter-free"><function>g_variant_iter_free()</function></link> to free the return value when you no longer
need it.</para>
<para>A reference is taken to the container that <parameter>iter</parameter>
 is iterating over
and will be releated only when <link linkend="g-variant-iter-free"><function>g_variant_iter_free()</function></link> is called.</para>
<refsect3 id="g-variant-iter-copy.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-copy.returns" role="returns">
<title>Returns</title>
<para>a new heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-free" role="function" condition="since:2.24">
<title>g_variant_iter_free&#160;()</title>
<indexterm zone="g-variant-iter-free" role="2.24"><primary sortas="variant_iter_free">g_variant_iter_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_iter_free (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>);</programlisting>
<para>Frees a heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link>.  Only call this function on
iterators that were returned by <link linkend="g-variant-iter-new"><function>g_variant_iter_new()</function></link> or
<link linkend="g-variant-iter-copy"><function>g_variant_iter_copy()</function></link>.</para>
<refsect3 id="g-variant-iter-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-init" role="function" condition="since:2.24">
<title>g_variant_iter_init&#160;()</title>
<indexterm zone="g-variant-iter-init" role="2.24"><primary sortas="variant_iter_init">g_variant_iter_init</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_variant_iter_init (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>,
                     <parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Initialises (without allocating) a <link linkend="GVariantIter"><type>GVariantIter</type></link>.  <parameter>iter</parameter>
 may be
completely uninitialised prior to this call; its old value is
ignored.</para>
<para>The iterator remains valid for as long as <parameter>value</parameter>
 exists, and need not
be freed in any way.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-iter-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a container <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-init.returns" role="returns">
<title>Returns</title>
<para> the number of items in <parameter>value</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-n-children" role="function" condition="since:2.24">
<title>g_variant_iter_n_children&#160;()</title>
<indexterm zone="g-variant-iter-n-children" role="2.24"><primary sortas="variant_iter_n_children">g_variant_iter_n_children</primary></indexterm>
<programlisting language="C"><link linkend="gsize"><returnvalue>gsize</returnvalue></link>
g_variant_iter_n_children (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>);</programlisting>
<para>Queries the number of child items in the container that we are
iterating over.  This is the total number of items -- not the number
of items remaining.</para>
<para>This function might be useful for preallocation of arrays.</para>
<refsect3 id="g-variant-iter-n-children.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-n-children.returns" role="returns">
<title>Returns</title>
<para> the number of children in the container</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-new" role="function" condition="since:2.24">
<title>g_variant_iter_new&#160;()</title>
<indexterm zone="g-variant-iter-new" role="2.24"><primary sortas="variant_iter_new">g_variant_iter_new</primary></indexterm>
<programlisting language="C"><link linkend="GVariantIter"><returnvalue>GVariantIter</returnvalue></link>&#160;*
g_variant_iter_new (<parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Creates a heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link> for iterating over the items
in <parameter>value</parameter>
.</para>
<para>Use <link linkend="g-variant-iter-free"><function>g_variant_iter_free()</function></link> to free the return value when you no longer
need it.</para>
<para>A reference is taken to <parameter>value</parameter>
 and will be released only when
<link linkend="g-variant-iter-free"><function>g_variant_iter_free()</function></link> is called.</para>
<refsect3 id="g-variant-iter-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a container <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-new.returns" role="returns">
<title>Returns</title>
<para>a new heap-allocated <link linkend="GVariantIter"><type>GVariantIter</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-next-value" role="function" condition="since:2.24">
<title>g_variant_iter_next_value&#160;()</title>
<indexterm zone="g-variant-iter-next-value" role="2.24"><primary sortas="variant_iter_next_value">g_variant_iter_next_value</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_iter_next_value (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>);</programlisting>
<para>Gets the next item in the container.  If no more items remain then
<link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned.</para>
<para>Use <link linkend="g-variant-unref"><function>g_variant_unref()</function></link> to drop your reference on the return value when
you no longer need it.</para>
<para>Here is an example for iterating with <link linkend="g-variant-iter-next-value"><function>g_variant_iter_next_value()</function></link>:</para>
<informalexample><programlisting role="example"><![CDATA[
  // recursively iterate a container
  void
  iterate_container_recursive (GVariant *container)
  {
    GVariantIter iter;
    GVariant *child;

    g_variant_iter_init (&iter, container);
    while ((child = g_variant_iter_next_value (&iter)))
      {
        g_print ("type '%s'\n", g_variant_get_type_string (child));

        if (g_variant_is_container (child))
          iterate_container_recursive (child);

        g_variant_unref (child);
      }
  }
]]></programlisting></informalexample>
<para></para>
<refsect3 id="g-variant-iter-next-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-next-value.returns" role="returns">
<title>Returns</title>
<para>a <link linkend="GVariant"><type>GVariant</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-next" role="function" condition="since:2.24">
<title>g_variant_iter_next&#160;()</title>
<indexterm zone="g-variant-iter-next" role="2.24"><primary sortas="variant_iter_next">g_variant_iter_next</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_iter_next (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                     <parameter>...</parameter>);</programlisting>
<para>Gets the next item in the container and unpacks it into the variable
argument list according to <parameter>format_string</parameter>
, returning <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>If no more items remain then <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> is returned.</para>
<para>All of the pointers given on the variable arguments list of this
function are assumed to point at uninitialised memory.  It is the
responsibility of the caller to free all of the values returned by
the unpacking process.</para>
<para>Here is an example for memory management with <link linkend="g-variant-iter-next"><function>g_variant_iter_next()</function></link>:</para>
<informalexample><programlisting role="example"><![CDATA[
  // Iterates a dictionary of type 'a{sv}'
  void
  iterate_dictionary (GVariant *dictionary)
  {
    GVariantIter iter;
    GVariant *value;
    gchar *key;

    g_variant_iter_init (&iter, dictionary);
    while (g_variant_iter_next (&iter, "{sv}", &key, &value))
      {
        g_print ("Item '%s' has type '%s'\n", key,
                 g_variant_get_type_string (value));

        // must free data for ourselves
        g_variant_unref (value);
        g_free (key);
      }
  }
]]></programlisting></informalexample>
<para></para>
<para>For a solution that is likely to be more convenient to C programmers
when dealing with loops, see <link linkend="g-variant-iter-loop"><function>g_variant_iter_loop()</function></link>.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed.</para>
<para>See the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-iter-next.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a GVariant format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>the arguments to unpack the value into</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-next.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if a value was unpacked, or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if there as no value</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-iter-loop" role="function" condition="since:2.24">
<title>g_variant_iter_loop&#160;()</title>
<indexterm zone="g-variant-iter-loop" role="2.24"><primary sortas="variant_iter_loop">g_variant_iter_loop</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_iter_loop (<parameter><link linkend="GVariantIter"><type>GVariantIter</type></link> *iter</parameter>,
                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                     <parameter>...</parameter>);</programlisting>
<para>Gets the next item in the container and unpacks it into the variable
argument list according to <parameter>format_string</parameter>
, returning <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>If no more items remain then <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> is returned.</para>
<para>On the first call to this function, the pointers appearing on the
variable argument list are assumed to point at uninitialised memory.
On the second and later calls, it is assumed that the same pointers
will be given and that they will point to the memory as set by the
previous call to this function.  This allows the previous values to
be freed, as appropriate.</para>
<para>This function is intended to be used with a while loop as
demonstrated in the following example.  This function can only be
used when iterating over an array.  It is only valid to call this
function with a string constant for the format string and the same
string constant must be used each time.  Mixing calls to this
function and <link linkend="g-variant-iter-next"><function>g_variant_iter_next()</function></link> or <link linkend="g-variant-iter-next-value"><function>g_variant_iter_next_value()</function></link> on
the same iterator causes undefined behavior.</para>
<para>If you break out of a such a while loop using <link linkend="g-variant-iter-loop"><function>g_variant_iter_loop()</function></link> then
you must free or unreference all the unpacked values as you would with
<link linkend="g-variant-get"><function>g_variant_get()</function></link>. Failure to do so will cause a memory leak.</para>
<para>Here is an example for memory management with <link linkend="g-variant-iter-loop"><function>g_variant_iter_loop()</function></link>:</para>
<informalexample><programlisting role="example"><![CDATA[
  // Iterates a dictionary of type 'a{sv}'
  void
  iterate_dictionary (GVariant *dictionary)
  {
    GVariantIter iter;
    GVariant *value;
    gchar *key;

    g_variant_iter_init (&iter, dictionary);
    while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
      {
        g_print ("Item '%s' has type '%s'\n", key,
                 g_variant_get_type_string (value));

        // no need to free 'key' and 'value' here
        // unless breaking out of this loop
      }
  }
]]></programlisting></informalexample>
<para></para>
<para>For most cases you should use <link linkend="g-variant-iter-next"><function>g_variant_iter_next()</function></link>.</para>
<para>This function is really only useful when unpacking into <link linkend="GVariant"><type>GVariant</type></link> or
<link linkend="GVariantIter"><type>GVariantIter</type></link> in order to allow you to skip the call to
<link linkend="g-variant-unref"><function>g_variant_unref()</function></link> or <link linkend="g-variant-iter-free"><function>g_variant_iter_free()</function></link>.</para>
<para>For example, if you are only looping over simple integer and string
types, <link linkend="g-variant-iter-next"><function>g_variant_iter_next()</function></link> is definitely preferred.  For string
types, use the '&amp;' prefix to avoid allocating any memory at all (and
thereby avoiding the need to free anything as well).</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed.</para>
<para>See the section on
<link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-iter-loop.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>iter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantIter"><type>GVariantIter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a GVariant format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>the arguments to unpack the value into</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-iter-loop.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if a value was unpacked, or <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if there was no
value</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="G-VARIANT-BUILDER-INIT:CAPS" role="macro" condition="since:2.50">
<title>G_VARIANT_BUILDER_INIT()</title>
<indexterm zone="G-VARIANT-BUILDER-INIT:CAPS" role="2.50"><primary sortas="VARIANT_BUILDER_INIT">G_VARIANT_BUILDER_INIT</primary></indexterm>
<programlisting language="C">#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } }
</programlisting>
<para>A stack-allocated <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> must be initialized if it is
used together with <link linkend="g-auto"><function>g_auto()</function></link> to avoid warnings or crashes if
function returns before <link linkend="g-variant-builder-init"><function>g_variant_builder_init()</function></link> is called on the
builder.  This macro can be used as initializer instead of an
explicit zeroing a variable when declaring it and a following
<link linkend="g-variant-builder-init"><function>g_variant_builder_init()</function></link>, but it cannot be assigned to a variable.</para>
<para>The passed <parameter>variant_type</parameter>
 should be a static GVariantType to avoid
lifetime issues, as copying the <parameter>variant_type</parameter>
 does not happen in
the <link linkend="G-VARIANT-BUILDER-INIT:CAPS"><function>G_VARIANT_BUILDER_INIT()</function></link> call, but rather in functions that
make sure that <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> is valid.</para>
<informalexample><programlisting role="example"><![CDATA[
  g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING);
]]></programlisting></informalexample>
<para></para>
<refsect3 id="G-VARIANT-BUILDER-INIT.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>variant_type</para></entry>
<entry role="parameter_description"><para>a const GVariantType*</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.50">2.50</link></para></refsect2>
<refsect2 id="g-variant-builder-unref" role="function" condition="since:2.24">
<title>g_variant_builder_unref&#160;()</title>
<indexterm zone="g-variant-builder-unref" role="2.24"><primary sortas="variant_builder_unref">g_variant_builder_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_unref (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>);</programlisting>
<para>Decreases the reference count on <parameter>builder</parameter>
.</para>
<para>In the event that there are no more references, releases all memory
associated with the <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>.</para>
<para>Don't call this on stack-allocated <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> instances or bad
things will happen.</para>
<refsect3 id="g-variant-builder-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> allocated by <link linkend="g-variant-builder-new"><function>g_variant_builder_new()</function></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-ref" role="function" condition="since:2.24">
<title>g_variant_builder_ref&#160;()</title>
<indexterm zone="g-variant-builder-ref" role="2.24"><primary sortas="variant_builder_ref">g_variant_builder_ref</primary></indexterm>
<programlisting language="C"><link linkend="GVariantBuilder"><returnvalue>GVariantBuilder</returnvalue></link>&#160;*
g_variant_builder_ref (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>);</programlisting>
<para>Increases the reference count on <parameter>builder</parameter>
.</para>
<para>Don't call this on stack-allocated <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> instances or bad
things will happen.</para>
<refsect3 id="g-variant-builder-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> allocated by <link linkend="g-variant-builder-new"><function>g_variant_builder_new()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-builder-ref.returns" role="returns">
<title>Returns</title>
<para>a new reference to <parameter>builder</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-new" role="function" condition="since:2.24">
<title>g_variant_builder_new&#160;()</title>
<indexterm zone="g-variant-builder-new" role="2.24"><primary sortas="variant_builder_new">g_variant_builder_new</primary></indexterm>
<programlisting language="C"><link linkend="GVariantBuilder"><returnvalue>GVariantBuilder</returnvalue></link>&#160;*
g_variant_builder_new (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>);</programlisting>
<para>Allocates and initialises a new <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>.</para>
<para>You should call <link linkend="g-variant-builder-unref"><function>g_variant_builder_unref()</function></link> on the return value when it
is no longer needed.  The memory will not be automatically freed by
any other call.</para>
<para>In most cases it is easier to place a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> directly on
the stack of the calling function and initialise it with
<link linkend="g-variant-builder-init"><function>g_variant_builder_init()</function></link>.</para>
<refsect3 id="g-variant-builder-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a container type</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-builder-new.returns" role="returns">
<title>Returns</title>
<para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-init" role="function" condition="since:2.24">
<title>g_variant_builder_init&#160;()</title>
<indexterm zone="g-variant-builder-init" role="2.24"><primary sortas="variant_builder_init">g_variant_builder_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_init (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>,
                        <parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>);</programlisting>
<para>Initialises a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> structure.</para>
<para><parameter>type</parameter>
 must be non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>.  It specifies the type of container to
construct.  It can be an indefinite type such as
<link linkend="G-VARIANT-TYPE-ARRAY:CAPS"><literal>G_VARIANT_TYPE_ARRAY</literal></link> or a definite type such as "as" or "(ii)".
Maybe, array, tuple, dictionary entry and variant-typed values may be
constructed.</para>
<para>After the builder is initialised, values are added using
<link linkend="g-variant-builder-add-value"><function>g_variant_builder_add_value()</function></link> or <link linkend="g-variant-builder-add"><function>g_variant_builder_add()</function></link>.</para>
<para>After all the child values are added, <link linkend="g-variant-builder-end"><function>g_variant_builder_end()</function></link> frees
the memory associated with the builder and returns the <link linkend="GVariant"><type>GVariant</type></link> that
was created.</para>
<para>This function completely ignores the previous contents of <parameter>builder</parameter>
.
On one hand this means that it is valid to pass in completely
uninitialised memory.  On the other hand, this means that if you are
initialising over top of an existing <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> you need to
first call <link linkend="g-variant-builder-clear"><function>g_variant_builder_clear()</function></link> in order to avoid leaking
memory.</para>
<para>You must not call <link linkend="g-variant-builder-ref"><function>g_variant_builder_ref()</function></link> or
<link linkend="g-variant-builder-unref"><function>g_variant_builder_unref()</function></link> on a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> that was initialised
with this function.  If you ever pass a reference to a
<link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> outside of the control of your own code then you
should assume that the person receiving that reference may try to use
reference counting; you should use <link linkend="g-variant-builder-new"><function>g_variant_builder_new()</function></link> instead of
this function.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-builder-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a container type</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-clear" role="function" condition="since:2.24">
<title>g_variant_builder_clear&#160;()</title>
<indexterm zone="g-variant-builder-clear" role="2.24"><primary sortas="variant_builder_clear">g_variant_builder_clear</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_clear (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>);</programlisting>
<para>Releases all memory associated with a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> without
freeing the <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> structure itself.</para>
<para>It typically only makes sense to do this on a stack-allocated
<link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> if you want to abort building the value part-way
through.  This function need not be called if you call
<link linkend="g-variant-builder-end"><function>g_variant_builder_end()</function></link> and it also doesn't need to be called on
builders allocated with <link linkend="g-variant-builder-new"><function>g_variant_builder_new()</function></link> (see
<link linkend="g-variant-builder-unref"><function>g_variant_builder_unref()</function></link> for that).</para>
<para>This function leaves the <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> structure set to all-zeros.
It is valid to call this function on either an initialised
<link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> or one that is set to all-zeros but it is not valid
to call this function on uninitialised memory.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-builder-clear.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-add-value" role="function" condition="since:2.24">
<title>g_variant_builder_add_value&#160;()</title>
<indexterm zone="g-variant-builder-add-value" role="2.24"><primary sortas="variant_builder_add_value">g_variant_builder_add_value</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_add_value (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>,
                             <parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Adds <parameter>value</parameter>
 to <parameter>builder</parameter>
.</para>
<para>It is an error to call this function in any way that would create an
inconsistent value to be constructed.  Some examples of this are
putting different types of items into an array, putting the wrong
types or number of items in a tuple, putting more than one value into
a variant, etc.</para>
<para>If <parameter>value</parameter>
 is a floating reference (see <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link>),
the <parameter>builder</parameter>
 instance takes ownership of <parameter>value</parameter>
.</para>
<refsect3 id="g-variant-builder-add-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-add" role="function" condition="since:2.24">
<title>g_variant_builder_add&#160;()</title>
<indexterm zone="g-variant-builder-add" role="2.24"><primary sortas="variant_builder_add">g_variant_builder_add</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_add (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                       <parameter>...</parameter>);</programlisting>
<para>Adds to a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>.</para>
<para>This call is a convenience wrapper that is exactly equivalent to
calling <link linkend="g-variant-new"><function>g_variant_new()</function></link> followed by <link linkend="g-variant-builder-add-value"><function>g_variant_builder_add_value()</function></link>.</para>
<para>Note that the arguments must be of the correct width for their types
specified in <parameter>format_string</parameter>
. This can be achieved by casting them. See
the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<para>This function might be used as follows:</para>
<informalexample><programlisting role="example"><![CDATA[
GVariant *
make_pointless_dictionary (void)
{
  GVariantBuilder builder;
  int i;

  g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
  for (i = 0; i < 16; i++)
    {
      gchar buf[3];

      sprintf (buf, "%d", i);
      g_variant_builder_add (&builder, "{is}", i, buf);
    }

  return g_variant_builder_end (&builder);
}
]]></programlisting></informalexample>
<para></para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-builder-add.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> varargs format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments, as per <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-add-parsed" role="function" condition="since:2.26">
<title>g_variant_builder_add_parsed&#160;()</title>
<indexterm zone="g-variant-builder-add-parsed" role="2.26"><primary sortas="variant_builder_add_parsed">g_variant_builder_add_parsed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_add_parsed (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>,
                              <parameter>const <link linkend="gchar"><type>gchar</type></link> *format</parameter>,
                              <parameter>...</parameter>);</programlisting>
<para>Adds to a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>.</para>
<para>This call is a convenience wrapper that is exactly equivalent to
calling <link linkend="g-variant-new-parsed"><function>g_variant_new_parsed()</function></link> followed by
<link linkend="g-variant-builder-add-value"><function>g_variant_builder_add_value()</function></link>.</para>
<para>Note that the arguments must be of the correct width for their types
specified in <parameter>format_string</parameter>
. This can be achieved by casting them. See
the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<para>This function might be used as follows:</para>
<informalexample><programlisting role="example"><![CDATA[
GVariant *
make_pointless_dictionary (void)
{
  GVariantBuilder builder;
  int i;

  g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
  g_variant_builder_add_parsed (&builder, "{'width', <%i>}", 600);
  g_variant_builder_add_parsed (&builder, "{'title', <%s>}", "foo");
  g_variant_builder_add_parsed (&builder, "{'transparency', <0.5>}");
  return g_variant_builder_end (&builder);
}
]]></programlisting></informalexample>
<para></para>
<refsect3 id="g-variant-builder-add-parsed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format</para></entry>
<entry role="parameter_description"><para>a text format <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments as per <parameter>format</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-variant-builder-end" role="function" condition="since:2.24">
<title>g_variant_builder_end&#160;()</title>
<indexterm zone="g-variant-builder-end" role="2.24"><primary sortas="variant_builder_end">g_variant_builder_end</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_builder_end (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>);</programlisting>
<para>Ends the builder process and returns the constructed value.</para>
<para>It is not permissible to use <parameter>builder</parameter>
 in any way after this call
except for reference counting operations (in the case of a
heap-allocated <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link>) or by reinitialising it with
<link linkend="g-variant-builder-init"><function>g_variant_builder_init()</function></link> (in the case of stack-allocated). This
means that for the stack-allocated builders there is no need to
call <link linkend="g-variant-builder-clear"><function>g_variant_builder_clear()</function></link> after the call to
<link linkend="g-variant-builder-end"><function>g_variant_builder_end()</function></link>.</para>
<para>It is an error to call this function in any way that would create an
inconsistent value to be constructed (ie: insufficient number of
items added to a container with a specific number of children
required).  It is also an error to call this function if the builder
was created with an indefinite array or maybe type and no children
have been added; in this case it is impossible to infer the type of
the empty array.</para>
<refsect3 id="g-variant-builder-end.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-builder-end.returns" role="returns">
<title>Returns</title>
<para>a new, floating, <link linkend="GVariant"><type>GVariant</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-open" role="function" condition="since:2.24">
<title>g_variant_builder_open&#160;()</title>
<indexterm zone="g-variant-builder-open" role="2.24"><primary sortas="variant_builder_open">g_variant_builder_open</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_open (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>,
                        <parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>);</programlisting>
<para>Opens a subcontainer inside the given <parameter>builder</parameter>
.  When done adding
items to the subcontainer, <link linkend="g-variant-builder-close"><function>g_variant_builder_close()</function></link> must be called. <parameter>type</parameter>

is the type of the container: so to build a tuple of several values, <parameter>type</parameter>

must include the tuple itself.</para>
<para>It is an error to call this function in any way that would cause an
inconsistent value to be constructed (ie: adding too many values or
a value of an incorrect type).</para>
<para>Example of building a nested variant:</para>
<informalexample><programlisting role="example"><![CDATA[
GVariantBuilder builder;
guint32 some_number = get_number ();
g_autoptr (GHashTable) some_dict = get_dict ();
GHashTableIter iter;
const gchar *key;
const GVariant *value;
g_autoptr (GVariant) output = NULL;

g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ua{sv})"));
g_variant_builder_add (&builder, "u", some_number);
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));

g_hash_table_iter_init (&iter, some_dict);
while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value))
  {
    g_variant_builder_open (&builder, G_VARIANT_TYPE ("{sv}"));
    g_variant_builder_add (&builder, "s", key);
    g_variant_builder_add (&builder, "v", value);
    g_variant_builder_close (&builder);
  }

g_variant_builder_close (&builder);

output = g_variant_builder_end (&builder);
]]></programlisting></informalexample>
<para></para>
<refsect3 id="g-variant-builder-open.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>the <link linkend="GVariantType"><type>GVariantType</type></link> of the container</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="g-variant-builder-close" role="function" condition="since:2.24">
<title>g_variant_builder_close&#160;()</title>
<indexterm zone="g-variant-builder-close" role="2.24"><primary sortas="variant_builder_close">g_variant_builder_close</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_builder_close (<parameter><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> *builder</parameter>);</programlisting>
<para>Closes the subcontainer inside the given <parameter>builder</parameter>
 that was opened by
the most recent call to <link linkend="g-variant-builder-open"><function>g_variant_builder_open()</function></link>.</para>
<para>It is an error to call this function in any way that would create an
inconsistent value to be constructed (ie: too few values added to the
subcontainer).</para>
<refsect3 id="g-variant-builder-close.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>builder</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantBuilder"><type>GVariantBuilder</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="G-VARIANT-DICT-INIT:CAPS" role="macro" condition="since:2.50">
<title>G_VARIANT_DICT_INIT()</title>
<indexterm zone="G-VARIANT-DICT-INIT:CAPS" role="2.50"><primary sortas="VARIANT_DICT_INIT">G_VARIANT_DICT_INIT</primary></indexterm>
<programlisting language="C">#define G_VARIANT_DICT_INIT(asv) { { { asv, 3488698669u, { 0, } } } }
</programlisting>
<para>A stack-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link> must be initialized if it is used
together with <link linkend="g-auto"><function>g_auto()</function></link> to avoid warnings or crashes if function
returns before <link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link> is called on the builder.
This macro can be used as initializer instead of an explicit
zeroing a variable when declaring it and a following
<link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link>, but it cannot be assigned to a variable.</para>
<para>The passed <parameter>asv</parameter>
 has to live long enough for <link linkend="GVariantDict"><type>GVariantDict</type></link> to gather
the entries from, as the gathering does not happen in the
<link linkend="G-VARIANT-DICT-INIT:CAPS"><function>G_VARIANT_DICT_INIT()</function></link> call, but rather in functions that make sure
that <link linkend="GVariantDict"><type>GVariantDict</type></link> is valid.  In context where the initialization
value has to be a constant expression, the only possible value of
<parameter>asv</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>.  It is still possible to call <link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link>
safely with a different <parameter>asv</parameter>
 right after the variable was
initialized with <link linkend="G-VARIANT-DICT-INIT:CAPS"><function>G_VARIANT_DICT_INIT()</function></link>.</para>
<informalexample><programlisting role="example"><![CDATA[
  g_autoptr(GVariant) variant = get_asv_variant ();
  g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT (variant);
]]></programlisting></informalexample>
<para></para>
<refsect3 id="G-VARIANT-DICT-INIT.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>asv</para></entry>
<entry role="parameter_description"><para>a GVariant*. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.50">2.50</link></para></refsect2>
<refsect2 id="g-variant-dict-unref" role="function" condition="since:2.40">
<title>g_variant_dict_unref&#160;()</title>
<indexterm zone="g-variant-dict-unref" role="2.40"><primary sortas="variant_dict_unref">g_variant_dict_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_dict_unref (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>);</programlisting>
<para>Decreases the reference count on <parameter>dict</parameter>
.</para>
<para>In the event that there are no more references, releases all memory
associated with the <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para>Don't call this on stack-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link> instances or bad
things will happen.</para>
<refsect3 id="g-variant-dict-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a heap-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-ref" role="function" condition="since:2.40">
<title>g_variant_dict_ref&#160;()</title>
<indexterm zone="g-variant-dict-ref" role="2.40"><primary sortas="variant_dict_ref">g_variant_dict_ref</primary></indexterm>
<programlisting language="C"><link linkend="GVariantDict"><returnvalue>GVariantDict</returnvalue></link>&#160;*
g_variant_dict_ref (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>);</programlisting>
<para>Increases the reference count on <parameter>dict</parameter>
.</para>
<para>Don't call this on stack-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link> instances or bad
things will happen.</para>
<refsect3 id="g-variant-dict-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a heap-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-ref.returns" role="returns">
<title>Returns</title>
<para>a new reference to <parameter>dict</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-new" role="function" condition="since:2.40">
<title>g_variant_dict_new&#160;()</title>
<indexterm zone="g-variant-dict-new" role="2.40"><primary sortas="variant_dict_new">g_variant_dict_new</primary></indexterm>
<programlisting language="C"><link linkend="GVariantDict"><returnvalue>GVariantDict</returnvalue></link>&#160;*
g_variant_dict_new (<parameter><link linkend="GVariant"><type>GVariant</type></link> *from_asv</parameter>);</programlisting>
<para>Allocates and initialises a new <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para>You should call <link linkend="g-variant-dict-unref"><function>g_variant_dict_unref()</function></link> on the return value when it
is no longer needed.  The memory will not be automatically freed by
any other call.</para>
<para>In some cases it may be easier to place a <link linkend="GVariantDict"><type>GVariantDict</type></link> directly on
the stack of the calling function and initialise it with
<link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link>.  This is particularly useful when you are
using <link linkend="GVariantDict"><type>GVariantDict</type></link> to construct a <link linkend="GVariant"><type>GVariant</type></link>.</para>
<refsect3 id="g-variant-dict-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>from_asv</para></entry>
<entry role="parameter_description"><para>the <link linkend="GVariant"><type>GVariant</type></link> with which to initialise the
dictionary. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-new.returns" role="returns">
<title>Returns</title>
<para>a <link linkend="GVariantDict"><type>GVariantDict</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-init" role="function" condition="since:2.40">
<title>g_variant_dict_init&#160;()</title>
<indexterm zone="g-variant-dict-init" role="2.40"><primary sortas="variant_dict_init">g_variant_dict_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_dict_init (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                     <parameter><link linkend="GVariant"><type>GVariant</type></link> *from_asv</parameter>);</programlisting>
<para>Initialises a <link linkend="GVariantDict"><type>GVariantDict</type></link> structure.</para>
<para>If <parameter>from_asv</parameter>
 is given, it is used to initialise the dictionary.</para>
<para>This function completely ignores the previous contents of <parameter>dict</parameter>
.  On
one hand this means that it is valid to pass in completely
uninitialised memory.  On the other hand, this means that if you are
initialising over top of an existing <link linkend="GVariantDict"><type>GVariantDict</type></link> you need to first
call <link linkend="g-variant-dict-clear"><function>g_variant_dict_clear()</function></link> in order to avoid leaking memory.</para>
<para>You must not call <link linkend="g-variant-dict-ref"><function>g_variant_dict_ref()</function></link> or <link linkend="g-variant-dict-unref"><function>g_variant_dict_unref()</function></link> on a
<link linkend="GVariantDict"><type>GVariantDict</type></link> that was initialised with this function.  If you ever
pass a reference to a <link linkend="GVariantDict"><type>GVariantDict</type></link> outside of the control of your
own code then you should assume that the person receiving that
reference may try to use reference counting; you should use
<link linkend="g-variant-dict-new"><function>g_variant_dict_new()</function></link> instead of this function.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-variant-dict-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>from_asv</para></entry>
<entry role="parameter_description"><para>the initial value for <parameter>dict</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-clear" role="function" condition="since:2.40">
<title>g_variant_dict_clear&#160;()</title>
<indexterm zone="g-variant-dict-clear" role="2.40"><primary sortas="variant_dict_clear">g_variant_dict_clear</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_dict_clear (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>);</programlisting>
<para>Releases all memory associated with a <link linkend="GVariantDict"><type>GVariantDict</type></link> without freeing
the <link linkend="GVariantDict"><type>GVariantDict</type></link> structure itself.</para>
<para>It typically only makes sense to do this on a stack-allocated
<link linkend="GVariantDict"><type>GVariantDict</type></link> if you want to abort building the value part-way
through.  This function need not be called if you call
<link linkend="g-variant-dict-end"><function>g_variant_dict_end()</function></link> and it also doesn't need to be called on dicts
allocated with g_variant_dict_new (see <link linkend="g-variant-dict-unref"><function>g_variant_dict_unref()</function></link> for
that).</para>
<para>It is valid to call this function on either an initialised
<link linkend="GVariantDict"><type>GVariantDict</type></link> or one that was previously cleared by an earlier call
to <link linkend="g-variant-dict-clear"><function>g_variant_dict_clear()</function></link> but it is not valid to call this function
on uninitialised memory.</para>
<refsect3 id="g-variant-dict-clear.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-contains" role="function" condition="since:2.40">
<title>g_variant_dict_contains&#160;()</title>
<indexterm zone="g-variant-dict-contains" role="2.40"><primary sortas="variant_dict_contains">g_variant_dict_contains</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_dict_contains (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>);</programlisting>
<para>Checks if <parameter>key</parameter>
 exists in <parameter>dict</parameter>
.</para>
<refsect3 id="g-variant-dict-contains.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to lookup in the dictionary</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-contains.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>key</parameter>
is in <parameter>dict</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-lookup" role="function" condition="since:2.40">
<title>g_variant_dict_lookup&#160;()</title>
<indexterm zone="g-variant-dict-lookup" role="2.40"><primary sortas="variant_dict_lookup">g_variant_dict_lookup</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_dict_lookup (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                       <parameter>...</parameter>);</programlisting>
<para>Looks up a value in a <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para>This function is a wrapper around <link linkend="g-variant-dict-lookup-value"><function>g_variant_dict_lookup_value()</function></link> and
<link linkend="g-variant-get"><function>g_variant_get()</function></link>.  In the case that <link linkend="NULL:CAPS"><literal>NULL</literal></link> would have been returned,
this function returns <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>.  Otherwise, it unpacks the returned
value and returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para><parameter>format_string</parameter>
 determines the C types that are used for unpacking the
values and also determines if the values are copied or borrowed, see the
section on <link linkend="gvariant-format-strings-pointers">GVariant format strings</link>.</para>
<refsect3 id="g-variant-dict-lookup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to lookup in the dictionary</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a GVariant format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>the arguments to unpack the value into</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-lookup.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if a value was unpacked</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-lookup-value" role="function" condition="since:2.40">
<title>g_variant_dict_lookup_value&#160;()</title>
<indexterm zone="g-variant-dict-lookup-value" role="2.40"><primary sortas="variant_dict_lookup_value">g_variant_dict_lookup_value</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_dict_lookup_value (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                             <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                             <parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *expected_type</parameter>);</programlisting>
<para>Looks up a value in a <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para>If <parameter>key</parameter>
 is not found in <parameter>dictionary</parameter>
, <link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned.</para>
<para>The <parameter>expected_type</parameter>
 string specifies what type of value is expected.
If the value associated with <parameter>key</parameter>
 has a different type then <link linkend="NULL:CAPS"><literal>NULL</literal></link> is
returned.</para>
<para>If the key is found and the value has the correct type, it is
returned.  If <parameter>expected_type</parameter>
 was specified then any non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> return
value will have this type.</para>
<refsect3 id="g-variant-dict-lookup-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to lookup in the dictionary</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>expected_type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantType"><type>GVariantType</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-lookup-value.returns" role="returns">
<title>Returns</title>
<para>the value of the dictionary key, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-insert" role="function" condition="since:2.40">
<title>g_variant_dict_insert&#160;()</title>
<indexterm zone="g-variant-dict-insert" role="2.40"><primary sortas="variant_dict_insert">g_variant_dict_insert</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_dict_insert (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *format_string</parameter>,
                       <parameter>...</parameter>);</programlisting>
<para>Inserts a value into a <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para>This call is a convenience wrapper that is exactly equivalent to
calling <link linkend="g-variant-new"><function>g_variant_new()</function></link> followed by <link linkend="g-variant-dict-insert-value"><function>g_variant_dict_insert_value()</function></link>.</para>
<refsect3 id="g-variant-dict-insert.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to insert a value for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format_string</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariant"><type>GVariant</type></link> varargs format string</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments, as per <parameter>format_string</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-insert-value" role="function" condition="since:2.40">
<title>g_variant_dict_insert_value&#160;()</title>
<indexterm zone="g-variant-dict-insert-value" role="2.40"><primary sortas="variant_dict_insert_value">g_variant_dict_insert_value</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_variant_dict_insert_value (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                             <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>,
                             <parameter><link linkend="GVariant"><type>GVariant</type></link> *value</parameter>);</programlisting>
<para>Inserts (or replaces) a key in a <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<para><parameter>value</parameter>
 is consumed if it is floating.</para>
<refsect3 id="g-variant-dict-insert-value.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to insert a value for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para>the value to insert</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-remove" role="function" condition="since:2.40">
<title>g_variant_dict_remove&#160;()</title>
<indexterm zone="g-variant-dict-remove" role="2.40"><primary sortas="variant_dict_remove">g_variant_dict_remove</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_variant_dict_remove (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>,
                       <parameter>const <link linkend="gchar"><type>gchar</type></link> *key</parameter>);</programlisting>
<para>Removes a key and its associated value from a <link linkend="GVariantDict"><type>GVariantDict</type></link>.</para>
<refsect3 id="g-variant-dict-remove.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>the key to remove</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-remove.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the key was found and removed</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-dict-end" role="function" condition="since:2.40">
<title>g_variant_dict_end&#160;()</title>
<indexterm zone="g-variant-dict-end" role="2.40"><primary sortas="variant_dict_end">g_variant_dict_end</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_dict_end (<parameter><link linkend="GVariantDict"><type>GVariantDict</type></link> *dict</parameter>);</programlisting>
<para>Returns the current value of <parameter>dict</parameter>
 as a <link linkend="GVariant"><type>GVariant</type></link> of type
<link linkend="G-VARIANT-TYPE-VARDICT:CAPS"><literal>G_VARIANT_TYPE_VARDICT</literal></link>, clearing it in the process.</para>
<para>It is not permissible to use <parameter>dict</parameter>
 in any way after this call except
for reference counting operations (in the case of a heap-allocated
<link linkend="GVariantDict"><type>GVariantDict</type></link>) or by reinitialising it with <link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link> (in
the case of stack-allocated).</para>
<refsect3 id="g-variant-dict-end.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dict</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantDict"><type>GVariantDict</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-dict-end.returns" role="returns">
<title>Returns</title>
<para>a new, floating, <link linkend="GVariant"><type>GVariant</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="g-variant-parse" role="function">
<title>g_variant_parse&#160;()</title>
<indexterm zone="g-variant-parse"><primary sortas="variant_parse">g_variant_parse</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_parse (<parameter>const <link linkend="GVariantType"><type>GVariantType</type></link> *type</parameter>,
                 <parameter>const <link linkend="gchar"><type>gchar</type></link> *text</parameter>,
                 <parameter>const <link linkend="gchar"><type>gchar</type></link> *limit</parameter>,
                 <parameter>const <link linkend="gchar"><type>gchar</type></link> **endptr</parameter>,
                 <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Parses a <link linkend="GVariant"><type>GVariant</type></link> from a text representation.</para>
<para>A single <link linkend="GVariant"><type>GVariant</type></link> is parsed from the content of <parameter>text</parameter>
.</para>
<para>The format is described <link linkend="gvariant-text">here</link>.</para>
<para>The memory at <parameter>limit</parameter>
 will never be accessed and the parser behaves as
if the character at <parameter>limit</parameter>
 is the nul terminator.  This has the
effect of bounding <parameter>text</parameter>
.</para>
<para>If <parameter>endptr</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then <parameter>text</parameter>
 is permitted to contain data
following the value that this function parses and <parameter>endptr</parameter>
 will be
updated to point to the first character past the end of the text
parsed by this function.  If <parameter>endptr</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link> and there is extra data
then an error is returned.</para>
<para>If <parameter>type</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> then the value will be parsed to have that
type.  This may result in additional parse errors (in the case that
the parsed value doesn't fit the type) but may also result in fewer
errors (in the case that the type would have been ambiguous, such as
with empty arrays).</para>
<para>In the event that the parsing is successful, the resulting <link linkend="GVariant"><type>GVariant</type></link>
is returned. It is never floating, and must be freed with
<link linkend="g-variant-unref"><function>g_variant_unref()</function></link>.</para>
<para>In case of any error, <link linkend="NULL:CAPS"><literal>NULL</literal></link> will be returned.  If <parameter>error</parameter>
 is non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>
then it will be set to reflect the error that occurred.</para>
<para>Officially, the language understood by the parser is "any string
produced by <link linkend="g-variant-print"><function>g_variant_print()</function></link>".</para>
<refsect3 id="g-variant-parse.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a <link linkend="GVariantType"><type>GVariantType</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>text</para></entry>
<entry role="parameter_description"><para>a string containing a GVariant in text form</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>limit</para></entry>
<entry role="parameter_description"><para>a pointer to the end of <parameter>text</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>endptr</para></entry>
<entry role="parameter_description"><para>a location to store the end pointer, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="NULL:CAPS"><literal>NULL</literal></link> <link linkend="GError"><type>GError</type></link> pointer, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-parse.returns" role="returns">
<title>Returns</title>
<para> a non-floating reference to a <link linkend="GVariant"><type>GVariant</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3></refsect2>
<refsect2 id="g-variant-new-parsed-va" role="function">
<title>g_variant_new_parsed_va&#160;()</title>
<indexterm zone="g-variant-new-parsed-va"><primary sortas="variant_new_parsed_va">g_variant_new_parsed_va</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_parsed_va (<parameter>const <link linkend="gchar"><type>gchar</type></link> *format</parameter>,
                         <parameter><link linkend="va-list"><type>va_list</type></link> *app</parameter>);</programlisting>
<para>Parses <parameter>format</parameter>
 and returns the result.</para>
<para>This is the version of <link linkend="g-variant-new-parsed"><function>g_variant_new_parsed()</function></link> intended to be used
from libraries.</para>
<para>The return value will be floating if it was a newly created GVariant
instance.  In the case that <parameter>format</parameter>
 simply specified the collection
of a <link linkend="GVariant"><type>GVariant</type></link> pointer (eg: <parameter>format</parameter>
 was "%*") then the collected
<link linkend="GVariant"><type>GVariant</type></link> pointer will be returned unmodified, without adding any
additional references.</para>
<para>Note that the arguments in <parameter>app</parameter>
 must be of the correct width for their types
specified in <parameter>format</parameter>
 when collected into the <link linkend="va-list"><type>va_list</type></link>. See
the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<para>In order to behave correctly in all cases it is necessary for the
calling function to <link linkend="g-variant-ref-sink"><function>g_variant_ref_sink()</function></link> the return result before
returning control to the user that originally provided the pointer.
At this point, the caller will have their own full reference to the
result.  This can also be done by adding the result to a container,
or by passing it to another <link linkend="g-variant-new"><function>g_variant_new()</function></link> call.</para>
<refsect3 id="g-variant-new-parsed-va.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>format</para></entry>
<entry role="parameter_description"><para>a text format <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>app</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="va-list"><type>va_list</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-parsed-va.returns" role="returns">
<title>Returns</title>
<para> a new, usually floating, <link linkend="GVariant"><type>GVariant</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-variant-new-parsed" role="function">
<title>g_variant_new_parsed&#160;()</title>
<indexterm zone="g-variant-new-parsed"><primary sortas="variant_new_parsed">g_variant_new_parsed</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
g_variant_new_parsed (<parameter>const <link linkend="gchar"><type>gchar</type></link> *format</parameter>,
                      <parameter>...</parameter>);</programlisting>
<para>Parses <parameter>format</parameter>
 and returns the result.</para>
<para><parameter>format</parameter>
 must be a text format <link linkend="GVariant"><type>GVariant</type></link> with one extension: at any
point that a value may appear in the text, a '%' character followed
by a GVariant format string (as per <link linkend="g-variant-new"><function>g_variant_new()</function></link>) may appear.  In
that case, the same arguments are collected from the argument list as
<link linkend="g-variant-new"><function>g_variant_new()</function></link> would have collected.</para>
<para>Note that the arguments must be of the correct width for their types
specified in <parameter>format</parameter>
. This can be achieved by casting them. See
the <link linkend="gvariant-varargs">GVariant varargs documentation</link>.</para>
<para>Consider this simple example:</para>
<informalexample><programlisting role="example"><![CDATA[
 g_variant_new_parsed ("[('one', 1), ('two', %i), (%s, 3)]", 2, "three");
]]></programlisting></informalexample>
<para></para>
<para>In the example, the variable argument parameters are collected and
filled in as if they were part of the original string to produce the
result of</para>
<informalexample><programlisting role="example"><![CDATA[
[('one', 1), ('two', 2), ('three', 3)]
]]></programlisting></informalexample>
<para></para>
<para>This function is intended only to be used with <parameter>format</parameter>
 as a string
literal.  Any parse error is fatal to the calling process.  If you
want to parse data from untrusted sources, use <link linkend="g-variant-parse"><function>g_variant_parse()</function></link>.</para>
<para>You may not use this function to return, unmodified, a single
<link linkend="GVariant"><type>GVariant</type></link> pointer from the argument list.  ie: <parameter>format</parameter>
 may not solely
be anything along the lines of "%*", "%?", "%r", or anything starting
with "%@".</para>
<refsect3 id="g-variant-new-parsed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>format</para></entry>
<entry role="parameter_description"><para>a text format <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>arguments as per <parameter>format</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-new-parsed.returns" role="returns">
<title>Returns</title>
<para> a new floating <link linkend="GVariant"><type>GVariant</type></link> instance</para>
</refsect3></refsect2>
<refsect2 id="g-variant-parse-error-print-context" role="function" condition="since:2.40">
<title>g_variant_parse_error_print_context&#160;()</title>
<indexterm zone="g-variant-parse-error-print-context" role="2.40"><primary sortas="variant_parse_error_print_context">g_variant_parse_error_print_context</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_variant_parse_error_print_context (<parameter><link linkend="GError"><type>GError</type></link> *error</parameter>,
                                     <parameter>const <link linkend="gchar"><type>gchar</type></link> *source_str</parameter>);</programlisting>
<para>Pretty-prints a message showing the context of a <link linkend="GVariant"><type>GVariant</type></link> parse
error within the string for which parsing was attempted.</para>
<para>The resulting string is suitable for output to the console or other
monospace media where newlines are treated in the usual way.</para>
<para>The message will typically look something like one of the following:</para>
<informalexample><programlisting role="example"><![CDATA[
unterminated string constant:
  (1, 2, 3, 'abc
            ^^^^
]]></programlisting></informalexample>
<para></para>
<para>or</para>
<informalexample><programlisting role="example"><![CDATA[
unable to find a common type:
  [1, 2, 3, 'str']
   ^        ^^^^^
]]></programlisting></informalexample>
<para></para>
<para>The format of the message may change in a future version.</para>
<para><parameter>error</parameter>
 must have come from a failed attempt to <link linkend="g-variant-parse"><function>g_variant_parse()</function></link> and
<parameter>source_str</parameter>
 must be exactly the same string that caused the error.
If <parameter>source_str</parameter>
 was not nul-terminated when you passed it to
<link linkend="g-variant-parse"><function>g_variant_parse()</function></link> then you must add nul termination before using this
function.</para>
<refsect3 id="g-variant-parse-error-print-context.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>a <link linkend="GError"><type>GError</type></link> from the <link linkend="GVariantParseError"><type>GVariantParseError</type></link> domain</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>source_str</para></entry>
<entry role="parameter_description"><para>the string that was given to the parser</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-variant-parse-error-print-context.returns" role="returns">
<title>Returns</title>
<para>the printed message. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>

</refsect1>
<refsect1 id="glib-GVariant.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GVariant" role="struct" condition="since:2.24">
<title>GVariant</title>
<indexterm zone="GVariant" role="2.24"><primary sortas="Variant">GVariant</primary></indexterm>
<programlisting language="C">typedef struct _GVariant GVariant;</programlisting>
<para><link linkend="GVariant"><type>GVariant</type></link> is an opaque data structure and can only be accessed
using the following functions.</para>
<para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="GVariantClass" role="enum" condition="since:2.24">
<title>enum GVariantClass</title>
<indexterm zone="GVariantClass" role="2.24"><primary sortas="VariantClass">GVariantClass</primary></indexterm>
<para>The range of possible top-level types of <link linkend="GVariant"><type>GVariant</type></link> instances.</para>
<refsect3 id="GVariantClass.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-BOOLEAN:CAPS">G_VARIANT_CLASS_BOOLEAN</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a boolean.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-BYTE:CAPS">G_VARIANT_CLASS_BYTE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a byte.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-INT16:CAPS">G_VARIANT_CLASS_INT16</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a signed 16 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-UINT16:CAPS">G_VARIANT_CLASS_UINT16</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is an unsigned 16 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-INT32:CAPS">G_VARIANT_CLASS_INT32</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a signed 32 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-UINT32:CAPS">G_VARIANT_CLASS_UINT32</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is an unsigned 32 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-INT64:CAPS">G_VARIANT_CLASS_INT64</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a signed 64 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-UINT64:CAPS">G_VARIANT_CLASS_UINT64</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is an unsigned 64 bit integer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-HANDLE:CAPS">G_VARIANT_CLASS_HANDLE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a file handle index.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-DOUBLE:CAPS">G_VARIANT_CLASS_DOUBLE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a double precision floating 
                         point value.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-STRING:CAPS">G_VARIANT_CLASS_STRING</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a normal string.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-OBJECT-PATH:CAPS">G_VARIANT_CLASS_OBJECT_PATH</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a D-Bus object path 
                              string.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-SIGNATURE:CAPS">G_VARIANT_CLASS_SIGNATURE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a D-Bus signature string.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-VARIANT:CAPS">G_VARIANT_CLASS_VARIANT</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a variant.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-MAYBE:CAPS">G_VARIANT_CLASS_MAYBE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a maybe-typed value.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-ARRAY:CAPS">G_VARIANT_CLASS_ARRAY</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is an array.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-TUPLE:CAPS">G_VARIANT_CLASS_TUPLE</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a tuple.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-CLASS-DICT-ENTRY:CAPS">G_VARIANT_CLASS_DICT_ENTRY</para></entry>
<entry role="enum_member_description"><para>The <link linkend="GVariant"><type>GVariant</type></link> is a dictionary entry.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.24">2.24</link></para></refsect2>
<refsect2 id="GVariantIter" role="struct">
<title>struct GVariantIter</title>
<indexterm zone="GVariantIter"><primary sortas="VariantIter">GVariantIter</primary></indexterm>
<programlisting language="C">struct GVariantIter {
};
</programlisting>
<para><link linkend="GVariantIter"><type>GVariantIter</type></link> is an opaque data structure and can only be accessed
using the following functions.</para>
</refsect2>
<refsect2 id="GVariantBuilder" role="struct">
<title>struct GVariantBuilder</title>
<indexterm zone="GVariantBuilder"><primary sortas="VariantBuilder">GVariantBuilder</primary></indexterm>
<programlisting language="C">struct GVariantBuilder {
};
</programlisting>
<para>A utility type for constructing container-type <link linkend="GVariant"><type>GVariant</type></link> instances.</para>
<para>This is an opaque structure and may only be accessed using the
following functions.</para>
<para><link linkend="GVariantBuilder"><type>GVariantBuilder</type></link> is not threadsafe in any way.  Do not attempt to
access it from more than one thread.</para>
</refsect2>
<refsect2 id="GVariantDict" role="struct" condition="since:2.40">
<title>struct GVariantDict</title>
<indexterm zone="GVariantDict" role="2.40"><primary sortas="VariantDict">GVariantDict</primary></indexterm>
<programlisting language="C">struct GVariantDict {
};
</programlisting>
<para><link linkend="GVariantDict"><type>GVariantDict</type></link> is a mutable interface to <link linkend="GVariant"><type>GVariant</type></link> dictionaries.</para>
<para>It can be used for doing a sequence of dictionary lookups in an
efficient way on an existing <link linkend="GVariant"><type>GVariant</type></link> dictionary or it can be used
to construct new dictionaries with a hashtable-like interface.  It
can also be used for taking existing dictionaries and modifying them
in order to create new ones.</para>
<para><link linkend="GVariantDict"><type>GVariantDict</type></link> can only be used with <link linkend="G-VARIANT-TYPE-VARDICT:CAPS"><literal>G_VARIANT_TYPE_VARDICT</literal></link>
dictionaries.</para>
<para>It is possible to use <link linkend="GVariantDict"><type>GVariantDict</type></link> allocated on the stack or on the
heap.  When using a stack-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link>, you begin with a
call to <link linkend="g-variant-dict-init"><function>g_variant_dict_init()</function></link> and free the resources with a call to
<link linkend="g-variant-dict-clear"><function>g_variant_dict_clear()</function></link>.</para>
<para>Heap-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link> follows normal refcounting rules: you
allocate it with <link linkend="g-variant-dict-new"><function>g_variant_dict_new()</function></link> and use <link linkend="g-variant-dict-ref"><function>g_variant_dict_ref()</function></link>
and <link linkend="g-variant-dict-unref"><function>g_variant_dict_unref()</function></link>.</para>
<para>g_variant_dict_end() is used to convert the <link linkend="GVariantDict"><type>GVariantDict</type></link> back into a
dictionary-type <link linkend="GVariant"><type>GVariant</type></link>.  When used with stack-allocated instances,
this also implicitly frees all associated memory, but for
heap-allocated instances, you must still call <link linkend="g-variant-dict-unref"><function>g_variant_dict_unref()</function></link>
afterwards.</para>
<para>You will typically want to use a heap-allocated <link linkend="GVariantDict"><type>GVariantDict</type></link> when
you expose it as part of an API.  For most other uses, the
stack-allocated form will be more convenient.</para>
<para>Consider the following two examples that do the same thing in each
style: take an existing dictionary and look up the "count" uint32
key, adding 1 to it if it is found, or returning an error if the
key is not found.  Each returns the new dictionary as a floating
<link linkend="GVariant"><type>GVariant</type></link>.</para>
<refsect3><title>Using a stack-allocated GVariantDict</title><informalexample><programlisting role="example"><![CDATA[
  GVariant *
  add_to_count (GVariant  *orig,
                GError   **error)
  {
    GVariantDict dict;
    guint32 count;

    g_variant_dict_init (&dict, orig);
    if (!g_variant_dict_lookup (&dict, "count", "u", &count))
      {
        g_set_error (...);
        g_variant_dict_clear (&dict);
        return NULL;
      }

    g_variant_dict_insert (&dict, "count", "u", count + 1);

    return g_variant_dict_end (&dict);
  }
]]></programlisting></informalexample>
<para></para>
</refsect3>
<refsect3><title>Using heap-allocated GVariantDict</title><informalexample><programlisting role="example"><![CDATA[
  GVariant *
  add_to_count (GVariant  *orig,
                GError   **error)
  {
    GVariantDict *dict;
    GVariant *result;
    guint32 count;

    dict = g_variant_dict_new (orig);

    if (g_variant_dict_lookup (dict, "count", "u", &count))
      {
        g_variant_dict_insert (dict, "count", "u", count + 1);
        result = g_variant_dict_end (dict);
      }
    else
      {
        g_set_error (...);
        result = NULL;
      }

    g_variant_dict_unref (dict);

    return result;
  }
]]></programlisting></informalexample>
<para></para>
</refsect3>
<para role="since">Since: <link linkend="api-index-2.40">2.40</link></para></refsect2>
<refsect2 id="GVariantParseError" role="enum">
<title>enum GVariantParseError</title>
<indexterm zone="GVariantParseError"><primary sortas="VariantParseError">GVariantParseError</primary></indexterm>
<para>Error codes returned by parsing text-format GVariants.</para>
<refsect3 id="GVariantParseError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-FAILED:CAPS">G_VARIANT_PARSE_ERROR_FAILED</para></entry>
<entry role="enum_member_description"><para>generic error (unused)</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-BASIC-TYPE-EXPECTED:CAPS">G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED</para></entry>
<entry role="enum_member_description"><para>a non-basic <link linkend="GVariantType"><type>GVariantType</type></link> was given where a basic type was expected</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-CANNOT-INFER-TYPE:CAPS">G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE</para></entry>
<entry role="enum_member_description"><para>cannot infer the <link linkend="GVariantType"><type>GVariantType</type></link></para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-DEFINITE-TYPE-EXPECTED:CAPS">G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED</para></entry>
<entry role="enum_member_description"><para>an indefinite <link linkend="GVariantType"><type>GVariantType</type></link> was given where a definite type was expected</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INPUT-NOT-AT-END:CAPS">G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END</para></entry>
<entry role="enum_member_description"><para>extra data after parsing finished</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INVALID-CHARACTER:CAPS">G_VARIANT_PARSE_ERROR_INVALID_CHARACTER</para></entry>
<entry role="enum_member_description"><para>invalid character in number or unicode escape</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INVALID-FORMAT-STRING:CAPS">G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING</para></entry>
<entry role="enum_member_description"><para>not a valid <link linkend="GVariant"><type>GVariant</type></link> format string</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INVALID-OBJECT-PATH:CAPS">G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH</para></entry>
<entry role="enum_member_description"><para>not a valid object path</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INVALID-SIGNATURE:CAPS">G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE</para></entry>
<entry role="enum_member_description"><para>not a valid type signature</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-INVALID-TYPE-STRING:CAPS">G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING</para></entry>
<entry role="enum_member_description"><para>not a valid <link linkend="GVariant"><type>GVariant</type></link> type string</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-NO-COMMON-TYPE:CAPS">G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE</para></entry>
<entry role="enum_member_description"><para>could not find a common type for array entries</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-NUMBER-OUT-OF-RANGE:CAPS">G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE</para></entry>
<entry role="enum_member_description"><para>the numerical value is out of range of the given type</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-NUMBER-TOO-BIG:CAPS">G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG</para></entry>
<entry role="enum_member_description"><para>the numerical value is out of range for any type</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-TYPE-ERROR:CAPS">G_VARIANT_PARSE_ERROR_TYPE_ERROR</para></entry>
<entry role="enum_member_description"><para>cannot parse as variant of the specified type</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-UNEXPECTED-TOKEN:CAPS">G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN</para></entry>
<entry role="enum_member_description"><para>an unexpected token was encountered</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-UNKNOWN-KEYWORD:CAPS">G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD</para></entry>
<entry role="enum_member_description"><para>an unknown keyword was encountered</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-UNTERMINATED-STRING-CONSTANT:CAPS">G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT</para></entry>
<entry role="enum_member_description"><para>unterminated string constant</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-VARIANT-PARSE-ERROR-VALUE-EXPECTED:CAPS">G_VARIANT_PARSE_ERROR_VALUE_EXPECTED</para></entry>
<entry role="enum_member_description"><para>no value given</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="G-VARIANT-PARSE-ERROR:CAPS" role="macro">
<title>G_VARIANT_PARSE_ERROR</title>
<indexterm zone="G-VARIANT-PARSE-ERROR:CAPS"><primary sortas="VARIANT_PARSE_ERROR">G_VARIANT_PARSE_ERROR</primary></indexterm>
<programlisting language="C">#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ())
</programlisting>
<para>Error domain for GVariant text format parsing.  Specific error codes
are not currently defined for this domain.  See <link linkend="GError"><type>GError</type></link> for
information on error domains.</para>
</refsect2>

</refsect1>
<refsect1 id="glib-GVariant.see-also">
<title>See Also</title>
<para>GVariantType</para>

</refsect1>

</refentry>
