blob: 725bb1633d0074023f97e8eef93a8128b238987e [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GVariant: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-GVariantType.html" title="GVariantType">
<link rel="next" href="gvariant-format-strings.html" title="GVariant Format Strings">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#glib-GVariant.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="glib-GVariantType.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gvariant-format-strings.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-GVariant"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-GVariant.top_of_page"></a>GVariant</span></h2>
<p>GVariant — strongly typed value datatype</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="glib-GVariant.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()">g_variant_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-ref" title="g_variant_ref ()">g_variant_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()">g_variant_ref_sink</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-floating" title="g_variant_is_floating ()">g_variant_is_floating</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-take-ref" title="g_variant_take_ref ()">g_variant_take_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="returnvalue">GVariantType</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-type" title="g_variant_get_type ()">g_variant_get_type</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-type-string" title="g_variant_get_type_string ()">g_variant_get_type_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-of-type" title="g_variant_is_of_type ()">g_variant_is_of_type</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-container" title="g_variant_is_container ()">g_variant_is_container</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-compare" title="g_variant_compare ()">g_variant_compare</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass"><span class="returnvalue">GVariantClass</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-classify" title="g_variant_classify ()">g_variant_classify</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-check-format-string" title="g_variant_check_format_string ()">g_variant_check_format_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()">g_variant_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-va" title="g_variant_get_va ()">g_variant_get_va</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()">g_variant_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-va" title="g_variant_new_va ()">g_variant_new_va</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-boolean" title="g_variant_new_boolean ()">g_variant_new_boolean</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-byte" title="g_variant_new_byte ()">g_variant_new_byte</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-int16" title="g_variant_new_int16 ()">g_variant_new_int16</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-uint16" title="g_variant_new_uint16 ()">g_variant_new_uint16</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-int32" title="g_variant_new_int32 ()">g_variant_new_int32</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-uint32" title="g_variant_new_uint32 ()">g_variant_new_uint32</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-int64" title="g_variant_new_int64 ()">g_variant_new_int64</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-uint64" title="g_variant_new_uint64 ()">g_variant_new_uint64</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-handle" title="g_variant_new_handle ()">g_variant_new_handle</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-double" title="g_variant_new_double ()">g_variant_new_double</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-string" title="g_variant_new_string ()">g_variant_new_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-take-string" title="g_variant_new_take_string ()">g_variant_new_take_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-printf" title="g_variant_new_printf ()">g_variant_new_printf</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-object-path" title="g_variant_new_object_path ()">g_variant_new_object_path</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-object-path" title="g_variant_is_object_path ()">g_variant_is_object_path</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-signature" title="g_variant_new_signature ()">g_variant_new_signature</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-signature" title="g_variant_is_signature ()">g_variant_is_signature</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-variant" title="g_variant_new_variant ()">g_variant_new_variant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-strv" title="g_variant_new_strv ()">g_variant_new_strv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-objv" title="g_variant_new_objv ()">g_variant_new_objv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-bytestring" title="g_variant_new_bytestring ()">g_variant_new_bytestring</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-bytestring-array" title="g_variant_new_bytestring_array ()">g_variant_new_bytestring_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-boolean" title="g_variant_get_boolean ()">g_variant_get_boolean</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-byte" title="g_variant_get_byte ()">g_variant_get_byte</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="returnvalue">gint16</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-int16" title="g_variant_get_int16 ()">g_variant_get_int16</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="returnvalue">guint16</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-uint16" title="g_variant_get_uint16 ()">g_variant_get_uint16</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-int32" title="g_variant_get_int32 ()">g_variant_get_int32</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-uint32" title="g_variant_get_uint32 ()">g_variant_get_uint32</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-int64" title="g_variant_get_int64 ()">g_variant_get_int64</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-uint64" title="g_variant_get_uint64 ()">g_variant_get_uint64</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-handle" title="g_variant_get_handle ()">g_variant_get_handle</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-double" title="g_variant_get_double ()">g_variant_get_double</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-string" title="g_variant_get_string ()">g_variant_get_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dup-string" title="g_variant_dup_string ()">g_variant_dup_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-variant" title="g_variant_get_variant ()">g_variant_get_variant</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-strv" title="g_variant_get_strv ()">g_variant_get_strv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dup-strv" title="g_variant_dup_strv ()">g_variant_dup_strv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-objv" title="g_variant_get_objv ()">g_variant_get_objv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dup-objv" title="g_variant_dup_objv ()">g_variant_dup_objv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-bytestring" title="g_variant_get_bytestring ()">g_variant_get_bytestring</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dup-bytestring" title="g_variant_dup_bytestring ()">g_variant_dup_bytestring</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-bytestring-array" title="g_variant_get_bytestring_array ()">g_variant_get_bytestring_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dup-bytestring-array" title="g_variant_dup_bytestring_array ()">g_variant_dup_bytestring_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-maybe" title="g_variant_new_maybe ()">g_variant_new_maybe</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-array" title="g_variant_new_array ()">g_variant_new_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-tuple" title="g_variant_new_tuple ()">g_variant_new_tuple</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-dict-entry" title="g_variant_new_dict_entry ()">g_variant_new_dict_entry</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-fixed-array" title="g_variant_new_fixed_array ()">g_variant_new_fixed_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-maybe" title="g_variant_get_maybe ()">g_variant_get_maybe</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-n-children" title="g_variant_n_children ()">g_variant_n_children</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-child-value" title="g_variant_get_child_value ()">g_variant_get_child_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-child" title="g_variant_get_child ()">g_variant_get_child</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-lookup-value" title="g_variant_lookup_value ()">g_variant_lookup_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-lookup" title="g_variant_lookup ()">g_variant_lookup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-fixed-array" title="g_variant_get_fixed_array ()">g_variant_get_fixed_array</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-size" title="g_variant_get_size ()">g_variant_get_size</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-data" title="g_variant_get_data ()">g_variant_get_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="returnvalue">GBytes</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-data-as-bytes" title="g_variant_get_data_as_bytes ()">g_variant_get_data_as_bytes</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-store" title="g_variant_store ()">g_variant_store</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-from-data" title="g_variant_new_from_data ()">g_variant_new_from_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-from-bytes" title="g_variant_new_from_bytes ()">g_variant_new_from_bytes</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-byteswap" title="g_variant_byteswap ()">g_variant_byteswap</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-get-normal-form" title="g_variant_get_normal_form ()">g_variant_get_normal_form</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-is-normal-form" title="g_variant_is_normal_form ()">g_variant_is_normal_form</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-hash" title="g_variant_hash ()">g_variant_hash</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-equal" title="g_variant_equal ()">g_variant_equal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-print" title="g_variant_print ()">g_variant_print</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="returnvalue">GString</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-print-string" title="g_variant_print_string ()">g_variant_print_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="returnvalue">GVariantIter</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-copy" title="g_variant_iter_copy ()">g_variant_iter_copy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()">g_variant_iter_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-init" title="g_variant_iter_init ()">g_variant_iter_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-n-children" title="g_variant_iter_n_children ()">g_variant_iter_n_children</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="returnvalue">GVariantIter</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-new" title="g_variant_iter_new ()">g_variant_iter_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-next-value" title="g_variant_iter_next_value ()">g_variant_iter_next_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()">g_variant_iter_next</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-iter-loop" title="g_variant_iter_loop ()">g_variant_iter_loop</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS" title="G_VARIANT_BUILDER_INIT()">G_VARIANT_BUILDER_INIT</a><span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-unref" title="g_variant_builder_unref ()">g_variant_builder_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-ref" title="g_variant_builder_ref ()">g_variant_builder_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-new" title="g_variant_builder_new ()">g_variant_builder_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()">g_variant_builder_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-clear" title="g_variant_builder_clear ()">g_variant_builder_clear</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-add-value" title="g_variant_builder_add_value ()">g_variant_builder_add_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-add" title="g_variant_builder_add ()">g_variant_builder_add</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-add-parsed" title="g_variant_builder_add_parsed ()">g_variant_builder_add_parsed</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()">g_variant_builder_end</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-open" title="g_variant_builder_open ()">g_variant_builder_open</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-builder-close" title="g_variant_builder_close ()">g_variant_builder_close</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()">g_variant_dict_unref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="returnvalue">GVariantDict</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-ref" title="g_variant_dict_ref ()">g_variant_dict_ref</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="returnvalue">GVariantDict</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-new" title="g_variant_dict_new ()">g_variant_dict_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-init" title="g_variant_dict_init ()">g_variant_dict_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-clear" title="g_variant_dict_clear ()">g_variant_dict_clear</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-contains" title="g_variant_dict_contains ()">g_variant_dict_contains</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-lookup" title="g_variant_dict_lookup ()">g_variant_dict_lookup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-lookup-value" title="g_variant_dict_lookup_value ()">g_variant_dict_lookup_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-insert" title="g_variant_dict_insert ()">g_variant_dict_insert</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-insert-value" title="g_variant_dict_insert_value ()">g_variant_dict_insert_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-remove" title="g_variant_dict_remove ()">g_variant_dict_remove</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-dict-end" title="g_variant_dict_end ()">g_variant_dict_end</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()">g_variant_parse</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-parsed-va" title="g_variant_new_parsed_va ()">g_variant_new_parsed_va</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-new-parsed" title="g_variant_new_parsed ()">g_variant_new_parsed</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-GVariant.html#g-variant-parse-error-print-context" title="g_variant_parse_error_print_context ()">g_variant_parse_error_print_context</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-GVariant.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant">GVariant</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass">GVariantClass</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter">GVariantIter</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder">GVariantBuilder</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict">GVariantDict</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#GVariantParseError" title="enum GVariantParseError">GVariantParseError</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-GVariant.html#G-VARIANT-PARSE-ERROR:CAPS" title="G_VARIANT_PARSE_ERROR">G_VARIANT_PARSE_ERROR</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-GVariant.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glib.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="glib-GVariant.description"></a><h2>Description</h2>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a variant datatype; it can contain one or more values
along with information about the type of the values.</p>
<p>A <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is also immutable: once it's been created neither
its type nor its content can be modified further.</p>
<p>GVariant is useful whenever data needs to be serialized, for example when
sending method parameters in DBus, or when saving settings using GSettings.</p>
<p>When creating a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, 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.</p>
<p>For instance, if you want to create a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> holding an integer value you
can use:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">v </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">'u'</span><span class="symbol">,</span><span class="normal"> </span><span class="number">40</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>The string 'u' in the first argument tells <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> that the data passed to
the constructor (40) is going to be an unsigned integer.</p>
<p>More advanced examples of <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> in use can be found in documentation for
GVariant format strings.</p>
<p>The range of possible values is determined by the type.</p>
<p>The type system used by <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a>. </p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances always have a type and a value (which are given
at construction time). The type and value of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance
can never change other than by the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> itself being
destroyed. A <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> cannot contain a pointer.</p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is reference counted using <a class="link" href="glib-GVariant.html#g-variant-ref" title="g_variant_ref ()"><code class="function">g_variant_ref()</code></a> and
<a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a>. <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> also has floating reference counts --
see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>.</p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is completely threadsafe. A <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance can be
concurrently accessed in any way from any number of threads without
problems.</p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> data can also be sent over the network.</p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is largely compatible with D-Bus. Almost all types of
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances can be sent over D-Bus. See <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> for
exceptions. (However, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>'s serialisation format is not the same
as the serialisation format of a D-Bus message body: use <a href="https://developer.gnome.org/gio/unstable/GDBusMessage.html#GDBusMessage-struct"><span class="type">GDBusMessage</span></a>,
in the gio library, for those.)</p>
<p>For space-efficiency, the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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
<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-VARIANT:CAPS" title="G_VARIANT_TYPE_VARIANT"><code class="literal">G_VARIANT_TYPE_VARIANT</code></a> 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).</p>
<p>A <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>'s size is limited mainly by any lower level operating
system constraints, such as the number of bits in <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a>. For
example, it is reasonable to have a 2GB file mapped into memory
with <a class="link" href="glib-File-Utilities.html#GMappedFile" title="GMappedFile"><span class="type">GMappedFile</span></a>, and call <a class="link" href="glib-GVariant.html#g-variant-new-from-data" title="g_variant_new_from_data ()"><code class="function">g_variant_new_from_data()</code></a> on it.</p>
<p>For convenience to C programmers, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> features powerful
varargs-based value construction and destruction. This feature is
designed to be embedded in other libraries.</p>
<p>There is a Python-inspired text language for describing <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>
values. <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> includes a printer for this language and a parser
with type inferencing.</p>
<div class="refsect3">
<a name="id-1.6.19.6.22"></a><h4>Memory Use</h4>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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.</p>
<p>The memory allocated by <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> can be grouped into 4 broad
purposes: memory for serialised data, memory for the type
information cache, buffer management memory and memory for the
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> structure itself.</p>
</div>
<div class="refsect3">
<a name="id-1.6.19.6.23"></a><h4>Serialised Data Memory</h4>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
</div>
<div class="refsect3">
<a name="id-1.6.19.6.24"></a><h4>Type Information Cache</h4>
<p>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.</p>
<p>Continuing with the above example, if a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>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.</p>
<p>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).</p>
<p>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).</p>
<p>This means that in total, for our "a{sv}" example, 91 bytes of
type information would be allocated.</p>
<p>The type information cache, additionally, uses a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> 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.</p>
<p>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.</p>
</div>
<div class="refsect3">
<a name="id-1.6.19.6.25"></a><h4>Buffer Management Memory</h4>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This may involve a <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> or a <a class="link" href="glib-Memory-Slices.html#g-slice-free" title="g_slice_free()"><code class="function">g_slice_free()</code></a> or
even <a class="link" href="glib-File-Utilities.html#g-mapped-file-unref" title="g_mapped_file_unref ()"><code class="function">g_mapped_file_unref()</code></a>.</p>
<p>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.</p>
</div>
<div class="refsect3">
<a name="id-1.6.19.6.26"></a><h4>GVariant structure</h4>
<p>The size of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> structure is 6 * (void *). On 32-bit
systems, that's 24 bytes.</p>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> structures only exist if they are explicitly created
with API calls. For example, if a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance exists -- the one referring to the
dictionary.</p>
<p>If calls are made to start accessing the other values then
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances will exist for those values only for as long
as they are in use (ie: until you call <a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a>). The
type information is shared. The serialised data and the buffer
management structure for that serialised data is shared by the
child.</p>
</div>
<div class="refsect3">
<a name="id-1.6.19.6.27"></a><h4>Summary</h4>
<p>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 byes of memory
for the serialised data, 16 bytes for buffer management and 24
bytes for the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance, or a total of 160 bytes, plus
malloc overhead. If we were to use <a class="link" href="glib-GVariant.html#g-variant-get-child-value" title="g_variant_get_child_value ()"><code class="function">g_variant_get_child_value()</code></a> 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.</p>
</div>
</div>
<div class="refsect1">
<a name="glib-GVariant.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-variant-unref"></a><h3>g_variant_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_unref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Decreases the reference count of <em class="parameter"><code>value</code></em>
. When its reference count
drops to 0, the memory used by the variant is freed.</p>
<div class="refsect3">
<a name="g-variant-unref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-ref"></a><h3>g_variant_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_ref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Increases the reference count of <em class="parameter"><code>value</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-ref.returns"></a><h4>Returns</h4>
<p> the same <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-ref-sink"></a><h3>g_variant_ref_sink ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_ref_sink (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> uses a floating reference count system. All functions with
names starting with <code class="literal">g_variant_new_</code> return floating
references.</p>
<p>Calling <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> on a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with a floating reference
will convert the floating reference into a full reference. Calling
<a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> on a non-floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> results in an
additional normal reference being added.</p>
<p>In other words, if the <em class="parameter"><code>value</code></em>
is floating, then this call "assumes
ownership" of the floating reference, converting it to a normal
reference. If the <em class="parameter"><code>value</code></em>
is not floating, then this call adds a
new normal reference increasing the reference count by one.</p>
<p>All calls that result in a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance being inserted into a
container will call <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> 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.</p>
<div class="refsect3">
<a name="g-variant-ref-sink.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-ref-sink.returns"></a><h4>Returns</h4>
<p> the same <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-floating"></a><h3>g_variant_is_floating ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_floating (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Checks whether <em class="parameter"><code>value</code></em>
has a floating reference count.</p>
<p>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 <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>
or <a class="link" href="glib-GVariant.html#g-variant-take-ref" title="g_variant_take_ref ()"><code class="function">g_variant_take_ref()</code></a>.</p>
<p>See <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> for more information about floating reference
counts.</p>
<div class="refsect3">
<a name="g-variant-is-floating.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-floating.returns"></a><h4>Returns</h4>
<p> whether <em class="parameter"><code>value</code></em>
is floating</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-take-ref"></a><h3>g_variant_take_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_take_ref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>If <em class="parameter"><code>value</code></em>
is floating, sink it. Otherwise, do nothing.</p>
<p>Typically you want to use <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> 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.</p>
<p>The situation where this function is helpful is when creating an API
that allows the user to provide a callback function that returns a
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. 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).</p>
<p>At the same time, the style of the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> API makes it likely that
for newly-created <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances, the user can be saved some
typing if they are allowed to return a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with a floating
reference.</p>
<p>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.</p>
<p>This function has an odd interaction when combined with
<a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> running at the same time in another thread on
the same <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. If <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> runs first then
the result will be that the floating reference is converted to a hard
reference. If <a class="link" href="glib-GVariant.html#g-variant-take-ref" title="g_variant_take_ref ()"><code class="function">g_variant_take_ref()</code></a> 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.</p>
<div class="refsect3">
<a name="g-variant-take-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-take-ref.returns"></a><h4>Returns</h4>
<p> the same <em class="parameter"><code>value</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-type"></a><h3>g_variant_get_type ()</h3>
<pre class="programlisting">const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="returnvalue">GVariantType</span></a> *
g_variant_get_type (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Determines the type of <em class="parameter"><code>value</code></em>
.</p>
<p>The return value is valid for the lifetime of <em class="parameter"><code>value</code></em>
and must not
be freed.</p>
<div class="refsect3">
<a name="g-variant-get-type.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-type.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-type-string"></a><h3>g_variant_get_type_string ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_get_type_string (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the type string of <em class="parameter"><code>value</code></em>
. Unlike the result of calling
<a class="link" href="glib-GVariantType.html#g-variant-type-peek-string" title="g_variant_type_peek_string ()"><code class="function">g_variant_type_peek_string()</code></a>, this string is nul-terminated. This
string belongs to <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> and must not be freed.</p>
<div class="refsect3">
<a name="g-variant-get-type-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-type-string.returns"></a><h4>Returns</h4>
<p> the type string for the type of <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-of-type"></a><h3>g_variant_is_of_type ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_of_type (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>);</pre>
<p>Checks if a value has a type matching the provided type.</p>
<div class="refsect3">
<a name="g-variant-is-of-type.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-of-type.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the type of <em class="parameter"><code>value</code></em>
matches <em class="parameter"><code>type</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-container"></a><h3>g_variant_is_container ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_container (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Checks if <em class="parameter"><code>value</code></em>
is a container.</p>
<div class="refsect3">
<a name="g-variant-is-container.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-container.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>value</code></em>
is a container</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-compare"></a><h3>g_variant_compare ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_variant_compare (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> one</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> two</code></em>);</pre>
<p>Compares <em class="parameter"><code>one</code></em>
and <em class="parameter"><code>two</code></em>
.</p>
<p>The types of <em class="parameter"><code>one</code></em>
and <em class="parameter"><code>two</code></em>
are <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> only to allow use of
this function with <a class="link" href="glib-Balanced-Binary-Trees.html#GTree" title="GTree"><span class="type">GTree</span></a>, <a class="link" href="glib-Pointer-Arrays.html#GPtrArray" title="struct GPtrArray"><span class="type">GPtrArray</span></a>, etc. They must each be a
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>Comparison is only defined for basic types (ie: booleans, numbers,
strings). For booleans, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is less than <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. Numbers are
ordered in the usual way. Strings are in ASCII lexographical order.</p>
<p>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.</p>
<p>If you only require an equality comparison, <a class="link" href="glib-GVariant.html#g-variant-equal" title="g_variant_equal ()"><code class="function">g_variant_equal()</code></a> is more
general.</p>
<div class="refsect3">
<a name="g-variant-compare.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>one</p></td>
<td class="parameter_description"><p> a basic-typed <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GVariant]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>two</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance of the same type. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GVariant]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-compare.returns"></a><h4>Returns</h4>
<p> negative value if a &lt; b;
zero if a = b;
positive value if a &gt; b.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-classify"></a><h3>g_variant_classify ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass"><span class="returnvalue">GVariantClass</span></a>
g_variant_classify (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Classifies <em class="parameter"><code>value</code></em>
according to its top-level type.</p>
<div class="refsect3">
<a name="g-variant-classify.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-classify.returns"></a><h4>Returns</h4>
<p> the <a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass"><span class="type">GVariantClass</span></a> of <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-check-format-string"></a><h3>g_variant_check_format_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_check_format_string (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> copy_only</code></em>);</pre>
<p>Checks if calling <a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a> with <em class="parameter"><code>format_string</code></em>
on <em class="parameter"><code>value</code></em>
would
be valid from a type-compatibility standpoint. <em class="parameter"><code>format_string</code></em>
is
assumed to be a valid format string (from a syntactic standpoint).</p>
<p>If <em class="parameter"><code>copy_only</code></em>
is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> then this function additionally checks that it
would be safe to call <a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a> on <em class="parameter"><code>value</code></em>
immediately after
the call to <a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a> 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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance). If this
check fails then a <a class="link" href="glib-Message-Logging.html#g-critical" title="g_critical()"><code class="function">g_critical()</code></a> is printed and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is returned.</p>
<p>This function is meant to be used by functions that wish to provide
varargs accessors to <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> values of uncertain values (eg:
<a class="link" href="glib-GVariant.html#g-variant-lookup" title="g_variant_lookup ()"><code class="function">g_variant_lookup()</code></a> or <a href="https://developer.gnome.org/gio/unstable/GMenuModel.html#g-menu-model-get-item-attribute"><code class="function">g_menu_model_get_item_attribute()</code></a>).</p>
<div class="refsect3">
<a name="g-variant-check-format-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a valid <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>copy_only</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> to ensure the format string makes deep copies</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-check-format-string.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>format_string</code></em>
is safe to use</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-34.html#api-index-2.34">2.34</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get"></a><h3>g_variant_get ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_get (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Deconstructs a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<p>Think of this function as an analogue to <code class="function">scanf()</code>.</p>
<p>The arguments that are expected by this function are entirely
determined by <em class="parameter"><code>format_string</code></em>
. <em class="parameter"><code>format_string</code></em>
also restricts the
permissible types of <em class="parameter"><code>value</code></em>
. It is an error to give a value with
an incompatible type. See the section on
GVariant format strings.
Please note that the syntax of the format string is very likely to be
extended in the future.</p>
<p><em class="parameter"><code>format_string</code></em>
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
GVariant format strings.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-get.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments, as per <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-va"></a><h3>g_variant_get_va ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_get_va (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>,
<em class="parameter"><code><span class="type">va_list</span> *app</code></em>);</pre>
<p>This function is intended to be used by libraries based on <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>
that want to provide <a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a>-like functionality to their
users.</p>
<p>The API is more general than <a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a> to allow a wider range
of possible uses.</p>
<p><em class="parameter"><code>format_string</code></em>
must still point to a valid format string, but it only
need to be nul-terminated if <em class="parameter"><code>endptr</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <em class="parameter"><code>endptr</code></em>
is
non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is updated to point to the first character past the
end of the format string.</p>
<p><em class="parameter"><code>app</code></em>
is a pointer to a <span class="type">va_list</span>. The arguments, according to
<em class="parameter"><code>format_string</code></em>
, are collected from this <span class="type">va_list</span> and the list is left
pointing to the argument following the last.</p>
<p>These two generalisations allow mixing of multiple calls to
<a class="link" href="glib-GVariant.html#g-variant-new-va" title="g_variant_new_va ()"><code class="function">g_variant_new_va()</code></a> and <a class="link" href="glib-GVariant.html#g-variant-get-va" title="g_variant_get_va ()"><code class="function">g_variant_get_va()</code></a> within a single actual
varargs call by the user.</p>
<p><em class="parameter"><code>format_string</code></em>
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
GVariant format strings.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-get-va.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a string that is prefixed with a format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>endptr</p></td>
<td class="parameter_description"><p> location to store the end pointer,
or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Default parameter value (for in case the shadows-to function has less parameters)."><span class="acronym">default</span></acronym> NULL]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>app</p></td>
<td class="parameter_description"><p>a pointer to a <span class="type">va_list</span></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new"></a><h3>g_variant_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Creates a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<p>Think of this function as an analogue to <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a>.</p>
<p>The type of the created instance and the arguments that are expected
by this function are determined by <em class="parameter"><code>format_string</code></em>
. See the section on
GVariant format strings. Please note that
the syntax of the format string is very likely to be extended in the
future.</p>
<p>The first character of the format string must not be '*' '?' '@' or
'r'; in essence, a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> must always be constructed by this
function (and not merely passed through it unmodified).</p>
<p>Note that the arguments must be of the correct width for their types
specified in <em class="parameter"><code>format_string</code></em>
. This can be achieved by casting them. See
the GVariant varargs documentation.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">MyFlags</span><span class="normal"> some_flags </span><span class="symbol">=</span><span class="normal"> FLAG_ONE </span><span class="symbol">|</span><span class="normal"> FLAG_TWO</span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">some_strings</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span><span class="normal"> </span><span class="cbracket">{</span><span class="normal"> </span><span class="string">"a"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"b"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"c"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a> </span><span class="cbracket">}</span><span class="symbol">;</span>
<span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">new_variant</span><span class="symbol">;</span>
<span class="normal">new_variant </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(t^as)"</span><span class="symbol">,</span>
<span class="normal"> </span><span class="symbol">/&lt;!--</span><span class="normal"> </span><span class="symbol">--&gt;*</span><span class="normal"> This cast </span><span class="usertype">is</span><span class="normal"> required</span><span class="symbol">.</span><span class="normal"> </span><span class="symbol">*&lt;!--</span><span class="normal"> </span><span class="symbol">--&gt;/</span>
<span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="glib-Basic-Types.html#guint64">guint64</a></span><span class="symbol">)</span><span class="normal"> some_flags</span><span class="symbol">,</span>
<span class="normal"> some_strings</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments, as per <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-va"></a><h3>g_variant_new_va ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_va (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>,
<em class="parameter"><code><span class="type">va_list</span> *app</code></em>);</pre>
<p>This function is intended to be used by libraries based on
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> that want to provide <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a>-like functionality
to their users.</p>
<p>The API is more general than <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> to allow a wider range
of possible uses.</p>
<p><em class="parameter"><code>format_string</code></em>
must still point to a valid format string, but it only
needs to be nul-terminated if <em class="parameter"><code>endptr</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <em class="parameter"><code>endptr</code></em>
is
non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is updated to point to the first character past the
end of the format string.</p>
<p><em class="parameter"><code>app</code></em>
is a pointer to a <span class="type">va_list</span>. The arguments, according to
<em class="parameter"><code>format_string</code></em>
, are collected from this <span class="type">va_list</span> and the list is left
pointing to the argument following the last.</p>
<p>Note that the arguments in <em class="parameter"><code>app</code></em>
must be of the correct width for their
types specified in <em class="parameter"><code>format_string</code></em>
when collected into the <span class="type">va_list</span>.
See the [GVariant varargs documentation][gvariant-varargs.</p>
<p>These two generalisations allow mixing of multiple calls to
<a class="link" href="glib-GVariant.html#g-variant-new-va" title="g_variant_new_va ()"><code class="function">g_variant_new_va()</code></a> and <a class="link" href="glib-GVariant.html#g-variant-get-va" title="g_variant_get_va ()"><code class="function">g_variant_get_va()</code></a> within a single actual
varargs call by the user.</p>
<p>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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointer will be returned unmodified,
without adding any additional references.</p>
<p>In order to behave correctly in all cases it is necessary for the
calling function to <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> 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 <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> call.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new-va.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a string that is prefixed with a format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>endptr</p></td>
<td class="parameter_description"><p> location to store the end pointer,
or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Default parameter value (for in case the shadows-to function has less parameters)."><span class="acronym">default</span></acronym> NULL]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>app</p></td>
<td class="parameter_description"><p>a pointer to a <span class="type">va_list</span></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-va.returns"></a><h4>Returns</h4>
<p> a new, usually floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-boolean"></a><h3>g_variant_new_boolean ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_boolean (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> value</code></em>);</pre>
<p>Creates a new boolean <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance -- either <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> or <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>.</p>
<div class="refsect3">
<a name="g-variant-new-boolean.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-boolean.returns"></a><h4>Returns</h4>
<p> a floating reference to a new boolean <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-byte"></a><h3>g_variant_new_byte ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_byte (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> value</code></em>);</pre>
<p>Creates a new byte <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-byte.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="type">guint8</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-byte.returns"></a><h4>Returns</h4>
<p> a floating reference to a new byte <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-int16"></a><h3>g_variant_new_int16 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_int16 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> value</code></em>);</pre>
<p>Creates a new int16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-int16.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-int16.returns"></a><h4>Returns</h4>
<p> a floating reference to a new int16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-uint16"></a><h3>g_variant_new_uint16 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_uint16 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a> value</code></em>);</pre>
<p>Creates a new uint16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-uint16.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-uint16.returns"></a><h4>Returns</h4>
<p> a floating reference to a new uint16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-int32"></a><h3>g_variant_new_int32 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_int32 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value</code></em>);</pre>
<p>Creates a new int32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-int32.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-int32.returns"></a><h4>Returns</h4>
<p> a floating reference to a new int32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-uint32"></a><h3>g_variant_new_uint32 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_uint32 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> value</code></em>);</pre>
<p>Creates a new uint32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-uint32.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-uint32.returns"></a><h4>Returns</h4>
<p> a floating reference to a new uint32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-int64"></a><h3>g_variant_new_int64 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_int64 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> value</code></em>);</pre>
<p>Creates a new int64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-int64.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-int64.returns"></a><h4>Returns</h4>
<p> a floating reference to a new int64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-uint64"></a><h3>g_variant_new_uint64 ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_uint64 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> value</code></em>);</pre>
<p>Creates a new uint64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-uint64.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-uint64.returns"></a><h4>Returns</h4>
<p> a floating reference to a new uint64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-handle"></a><h3>g_variant_new_handle ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_handle (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value</code></em>);</pre>
<p>Creates a new handle <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<p>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.</p>
<div class="refsect3">
<a name="g-variant-new-handle.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-handle.returns"></a><h4>Returns</h4>
<p> a floating reference to a new handle <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-double"></a><h3>g_variant_new_double ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_double (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> value</code></em>);</pre>
<p>Creates a new double <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<div class="refsect3">
<a name="g-variant-new-double.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> floating point value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-double.returns"></a><h4>Returns</h4>
<p> a floating reference to a new double <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-string"></a><h3>g_variant_new_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_string (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>Creates a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with the contents of <em class="parameter"><code>string</code></em>
.</p>
<p><em class="parameter"><code>string</code></em>
must be valid UTF-8, and must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. To encode
potentially-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> strings, use <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> with <code class="literal">ms</code> as the
format string.</p>
<div class="refsect3">
<a name="g-variant-new-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a normal UTF-8 nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-string.returns"></a><h4>Returns</h4>
<p> a floating reference to a new string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-take-string"></a><h3>g_variant_new_take_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_take_string (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>Creates a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with the contents of <em class="parameter"><code>string</code></em>
.</p>
<p><em class="parameter"><code>string</code></em>
must be valid UTF-8, and must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. To encode
potentially-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> strings, use this with <a class="link" href="glib-GVariant.html#g-variant-new-maybe" title="g_variant_new_maybe ()"><code class="function">g_variant_new_maybe()</code></a>.</p>
<p>This function consumes <em class="parameter"><code>string</code></em>
. <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> will be called on <em class="parameter"><code>string</code></em>
when it is no longer required.</p>
<p>You must not modify or access <em class="parameter"><code>string</code></em>
in any other way after passing
it to this function. It is even possible that <em class="parameter"><code>string</code></em>
is immediately
freed.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new-take-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a normal UTF-8 nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-take-string.returns"></a><h4>Returns</h4>
<p> a floating reference to a new string
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-printf"></a><h3>g_variant_new_printf ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_printf (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Creates a string-type GVariant using printf formatting.</p>
<p>This is similar to calling <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a> and then
<a class="link" href="glib-GVariant.html#g-variant-new-string" title="g_variant_new_string ()"><code class="function">g_variant_new_string()</code></a> but it saves a temporary variable and an
unnecessary copy.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new-printf.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a printf-style format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments for <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-printf.returns"></a><h4>Returns</h4>
<p> a floating reference to a new string
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-38.html#api-index-2.38">2.38</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-object-path"></a><h3>g_variant_new_object_path ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_object_path (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *object_path</code></em>);</pre>
<p>Creates a D-Bus object path <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with the contents of <em class="parameter"><code>string</code></em>
.
<em class="parameter"><code>string</code></em>
must be a valid D-Bus object path. Use
<a class="link" href="glib-GVariant.html#g-variant-is-object-path" title="g_variant_is_object_path ()"><code class="function">g_variant_is_object_path()</code></a> if you're not sure.</p>
<div class="refsect3">
<a name="g-variant-new-object-path.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>object_path</p></td>
<td class="parameter_description"><p>a normal C nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-object-path.returns"></a><h4>Returns</h4>
<p> a floating reference to a new object path <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-object-path"></a><h3>g_variant_is_object_path ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_object_path (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>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 <a class="link" href="glib-GVariant.html#g-variant-new-object-path" title="g_variant_new_object_path ()"><code class="function">g_variant_new_object_path()</code></a>.</p>
<p>A valid object path starts with '/' followed by zero or more
sequences of characters separated by '/' characters. Each sequence
must contain only the characters "A-Z[0-9]_". No sequence
(including the one following the final '/' character) may be empty.</p>
<div class="refsect3">
<a name="g-variant-is-object-path.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a normal C nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-object-path.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>string</code></em>
is a D-Bus object path</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-signature"></a><h3>g_variant_new_signature ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_signature (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *signature</code></em>);</pre>
<p>Creates a D-Bus type signature <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with the contents of
<em class="parameter"><code>string</code></em>
. <em class="parameter"><code>string</code></em>
must be a valid D-Bus type signature. Use
<a class="link" href="glib-GVariant.html#g-variant-is-signature" title="g_variant_is_signature ()"><code class="function">g_variant_is_signature()</code></a> if you're not sure.</p>
<div class="refsect3">
<a name="g-variant-new-signature.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>signature</p></td>
<td class="parameter_description"><p>a normal C nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-signature.returns"></a><h4>Returns</h4>
<p> a floating reference to a new signature <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-signature"></a><h3>g_variant_is_signature ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_signature (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>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 <a class="link" href="glib-GVariant.html#g-variant-new-signature" title="g_variant_new_signature ()"><code class="function">g_variant_new_signature()</code></a>.</p>
<p>D-Bus type signatures consist of zero or more definite <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a>
strings in sequence.</p>
<div class="refsect3">
<a name="g-variant-is-signature.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a normal C nul-terminated string</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-signature.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>string</code></em>
is a D-Bus type signature</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-variant"></a><h3>g_variant_new_variant ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_variant (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Boxes <em class="parameter"><code>value</code></em>
. The result is a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance representing a
variant containing the original value.</p>
<p>If <em class="parameter"><code>child</code></em>
is a floating reference (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>), the new
instance takes ownership of <em class="parameter"><code>child</code></em>
.</p>
<p><span class="annotation">[<acronym title="This symbol is a constructor, not a static method."><span class="acronym">constructor</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new-variant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-variant.returns"></a><h4>Returns</h4>
<p> a floating reference to a new variant <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-strv"></a><h3>g_variant_new_strv ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_strv (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> * const *strv</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> length</code></em>);</pre>
<p>Constructs an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> from the given array of
strings.</p>
<p>If <em class="parameter"><code>length</code></em>
is -1 then <em class="parameter"><code>strv</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<div class="refsect3">
<a name="g-variant-new-strv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>strv</p></td>
<td class="parameter_description"><p> an array of strings. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>strv</code></em>
, or -1</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-strv.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-objv"></a><h3>g_variant_new_objv ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_objv (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> * const *strv</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> length</code></em>);</pre>
<p>Constructs an array of object paths <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> from the given array of
strings.</p>
<p>Each string must be a valid <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> object path; see
<a class="link" href="glib-GVariant.html#g-variant-is-object-path" title="g_variant_is_object_path ()"><code class="function">g_variant_is_object_path()</code></a>.</p>
<p>If <em class="parameter"><code>length</code></em>
is -1 then <em class="parameter"><code>strv</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<div class="refsect3">
<a name="g-variant-new-objv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>strv</p></td>
<td class="parameter_description"><p> an array of strings. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>strv</code></em>
, or -1</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-objv.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-bytestring"></a><h3>g_variant_new_bytestring ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_bytestring (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>Creates an array-of-bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with the contents of <em class="parameter"><code>string</code></em>
.
This function is just like <a class="link" href="glib-GVariant.html#g-variant-new-string" title="g_variant_new_string ()"><code class="function">g_variant_new_string()</code></a> except that the
string need not be valid UTF-8.</p>
<p>The nul terminator character at the end of the string is stored in
the array.</p>
<div class="refsect3">
<a name="g-variant-new-bytestring.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> a normal
nul-terminated string in no particular encoding. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-bytestring.returns"></a><h4>Returns</h4>
<p> a floating reference to a new bytestring <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-bytestring-array"></a><h3>g_variant_new_bytestring_array ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_bytestring_array (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> * const *strv</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> length</code></em>);</pre>
<p>Constructs an array of bytestring <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> from the given array of
strings.</p>
<p>If <em class="parameter"><code>length</code></em>
is -1 then <em class="parameter"><code>strv</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<div class="refsect3">
<a name="g-variant-new-bytestring-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>strv</p></td>
<td class="parameter_description"><p> an array of strings. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>strv</code></em>
, or -1</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-bytestring-array.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-boolean"></a><h3>g_variant_get_boolean ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_get_boolean (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the boolean value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-BOOLEAN:CAPS" title="G_VARIANT_TYPE_BOOLEAN"><code class="literal">G_VARIANT_TYPE_BOOLEAN</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-boolean.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a boolean <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-boolean.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> or <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-byte"></a><h3>g_variant_get_byte ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a>
g_variant_get_byte (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the byte value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-BYTE:CAPS" title="G_VARIANT_TYPE_BYTE"><code class="literal">G_VARIANT_TYPE_BYTE</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-byte.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a byte <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-byte.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-int16"></a><h3>g_variant_get_int16 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="returnvalue">gint16</span></a>
g_variant_get_int16 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 16-bit signed integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-INT16:CAPS" title="G_VARIANT_TYPE_INT16"><code class="literal">G_VARIANT_TYPE_INT16</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-int16.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a int16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-int16.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-uint16"></a><h3>g_variant_get_uint16 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="returnvalue">guint16</span></a>
g_variant_get_uint16 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 16-bit unsigned integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-UINT16:CAPS" title="G_VARIANT_TYPE_UINT16"><code class="literal">G_VARIANT_TYPE_UINT16</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-uint16.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a uint16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-uint16.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-int32"></a><h3>g_variant_get_int32 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
g_variant_get_int32 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 32-bit signed integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-INT32:CAPS" title="G_VARIANT_TYPE_INT32"><code class="literal">G_VARIANT_TYPE_INT32</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-int32.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a int32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-int32.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-uint32"></a><h3>g_variant_get_uint32 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a>
g_variant_get_uint32 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 32-bit unsigned integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-UINT32:CAPS" title="G_VARIANT_TYPE_UINT32"><code class="literal">G_VARIANT_TYPE_UINT32</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-uint32.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a uint32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-uint32.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-int64"></a><h3>g_variant_get_int64 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>
g_variant_get_int64 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 64-bit signed integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-INT64:CAPS" title="G_VARIANT_TYPE_INT64"><code class="literal">G_VARIANT_TYPE_INT64</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-int64.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a int64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-int64.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-uint64"></a><h3>g_variant_get_uint64 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a>
g_variant_get_uint64 (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 64-bit unsigned integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-UINT64:CAPS" title="G_VARIANT_TYPE_UINT64"><code class="literal">G_VARIANT_TYPE_UINT64</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-uint64.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a uint64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-uint64.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-handle"></a><h3>g_variant_get_handle ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a>
g_variant_get_handle (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the 32-bit signed integer value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type other
than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-HANDLE:CAPS" title="G_VARIANT_TYPE_HANDLE"><code class="literal">G_VARIANT_TYPE_HANDLE</code></a>.</p>
<p>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.</p>
<div class="refsect3">
<a name="g-variant-get-handle.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a handle <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-handle.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-double"></a><h3>g_variant_get_double ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a>
g_variant_get_double (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the double precision floating point value of <em class="parameter"><code>value</code></em>
.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-DOUBLE:CAPS" title="G_VARIANT_TYPE_DOUBLE"><code class="literal">G_VARIANT_TYPE_DOUBLE</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-double.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a double <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-double.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-string"></a><h3>g_variant_get_string ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_get_string (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Returns the string value of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance with a string
type. This includes the types <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-STRING:CAPS" title="G_VARIANT_TYPE_STRING"><code class="literal">G_VARIANT_TYPE_STRING</code></a>,
<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-OBJECT-PATH:CAPS" title="G_VARIANT_TYPE_OBJECT_PATH"><code class="literal">G_VARIANT_TYPE_OBJECT_PATH</code></a> and <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-SIGNATURE:CAPS" title="G_VARIANT_TYPE_SIGNATURE"><code class="literal">G_VARIANT_TYPE_SIGNATURE</code></a>.</p>
<p>The string will always be UTF-8 encoded, and will never be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the length of the string (in bytes) is
returned there. For trusted values, this information is already
known. For untrusted values, a <code class="function">strlen()</code> will be performed.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
of any type
other than those three.</p>
<p>The return value remains valid as long as <em class="parameter"><code>value</code></em>
exists.</p>
<div class="refsect3">
<a name="g-variant-get-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> a pointer to a <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a>,
to store the length. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Default parameter value (for in case the shadows-to function has less parameters)."><span class="acronym">default</span></acronym> 0][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-string.returns"></a><h4>Returns</h4>
<p> the constant string, UTF-8 encoded. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dup-string"></a><h3>g_variant_dup_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_dup_string (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Similar to <a class="link" href="glib-GVariant.html#g-variant-get-string" title="g_variant_get_string ()"><code class="function">g_variant_get_string()</code></a> except that instead of returning
a constant string, the string is duplicated.</p>
<p>The string will always be UTF-8 encoded.</p>
<p>The return value must be freed using <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-dup-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> a pointer to a <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a>, to store the length. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dup-string.returns"></a><h4>Returns</h4>
<p> a newly allocated string, UTF-8 encoded. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-variant"></a><h3>g_variant_get_variant ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_get_variant (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Unboxes <em class="parameter"><code>value</code></em>
. The result is the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance that was
contained in <em class="parameter"><code>value</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-get-variant.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a variant <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-variant.returns"></a><h4>Returns</h4>
<p> the item contained in the variant. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-strv"></a><h3>g_variant_get_strv ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_get_strv (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a shallow copy; the return result should be released with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>, but the individual strings must not be modified.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result
is stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-get-strv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-strv.returns"></a><h4>Returns</h4>
<p> an array of constant strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length zero-terminated=1][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dup-strv"></a><h3>g_variant_dup_strv ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_dup_strv (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a deep copy; the return result should be released with
<a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result
is stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-dup-strv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dup-strv.returns"></a><h4>Returns</h4>
<p> an array of strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-objv"></a><h3>g_variant_get_objv ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_get_objv (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of object paths <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a shallow copy; the return result should be released with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>, but the individual strings must not be modified.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result
is stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-get-objv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of object paths <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-objv.returns"></a><h4>Returns</h4>
<p> an array of constant strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length zero-terminated=1][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dup-objv"></a><h3>g_variant_dup_objv ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_dup_objv (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of object paths <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a deep copy; the return result should be released with
<a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result
is stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-dup-objv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of object paths <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dup-objv.returns"></a><h4>Returns</h4>
<p> an array of strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-bytestring"></a><h3>g_variant_get_bytestring ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_get_bytestring (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns the string value of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance with an
array-of-bytes type. The string has no particular encoding.</p>
<p>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-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> nul-terminated string will be returned by this function.</p>
<p>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.</p>
<p>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.</p>
<p>It is an error to call this function with a <em class="parameter"><code>value</code></em>
that is not an
array of bytes.</p>
<p>The return value remains valid as long as <em class="parameter"><code>value</code></em>
exists.</p>
<div class="refsect3">
<a name="g-variant-get-bytestring.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array-of-bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-bytestring.returns"></a><h4>Returns</h4>
<p> the constant string. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dup-bytestring"></a><h3>g_variant_dup_bytestring ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_dup_bytestring (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Similar to <a class="link" href="glib-GVariant.html#g-variant-get-bytestring" title="g_variant_get_bytestring ()"><code class="function">g_variant_get_bytestring()</code></a> except that instead of
returning a constant string, the string is duplicated.</p>
<p>The return value must be freed using <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-dup-bytestring.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array-of-bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> a pointer to a <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a>, to store
the length (not including the nul terminator). </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Default parameter value (for in case the shadows-to function has less parameters)."><span class="acronym">default</span></acronym> NULL]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dup-bytestring.returns"></a><h4>Returns</h4>
<p> a newly allocated string. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1 length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-bytestring-array"></a><h3>g_variant_get_bytestring_array ()</h3>
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_get_bytestring_array (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of array of bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a shallow copy; the return result should be released with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>, but the individual strings must not be modified.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result is
stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-get-bytestring-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of array of bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> ('aay')</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-bytestring-array.returns"></a><h4>Returns</h4>
<p> an array of constant strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dup-bytestring-array"></a><h3>g_variant_dup_bytestring_array ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **
g_variant_dup_bytestring_array (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *length</code></em>);</pre>
<p>Gets the contents of an array of array of bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. This call
makes a deep copy; the return result should be released with
<a class="link" href="glib-String-Utility-Functions.html#g-strfreev" title="g_strfreev ()"><code class="function">g_strfreev()</code></a>.</p>
<p>If <em class="parameter"><code>length</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then the number of elements in the result is
stored there. In any case, the resulting array will be
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated.</p>
<p>For an empty array, <em class="parameter"><code>length</code></em>
will be set to 0 and a pointer to a
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer will be returned.</p>
<div class="refsect3">
<a name="g-variant-dup-bytestring-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>an array of array of bytes <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> ('aay')</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description"><p> the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dup-bytestring-array.returns"></a><h4>Returns</h4>
<p> an array of strings. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-maybe"></a><h3>g_variant_new_maybe ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_maybe (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *child_type</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *child</code></em>);</pre>
<p>Depending on if <em class="parameter"><code>child</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, either wraps <em class="parameter"><code>child</code></em>
inside of a
maybe container or creates a Nothing instance for the given <em class="parameter"><code>type</code></em>
.</p>
<p>At least one of <em class="parameter"><code>child_type</code></em>
and <em class="parameter"><code>child</code></em>
must be non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
If <em class="parameter"><code>child_type</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it must be a definite type.
If they are both non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then <em class="parameter"><code>child_type</code></em>
must be the type
of <em class="parameter"><code>child</code></em>
.</p>
<p>If <em class="parameter"><code>child</code></em>
is a floating reference (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>), the new
instance takes ownership of <em class="parameter"><code>child</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-new-maybe.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>child_type</p></td>
<td class="parameter_description"><p> the <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> of the child, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>child</p></td>
<td class="parameter_description"><p> the child value, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-maybe.returns"></a><h4>Returns</h4>
<p> a floating reference to a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> maybe instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-array"></a><h3>g_variant_new_array ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_array (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *child_type</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> * const *children</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_children</code></em>);</pre>
<p>Creates a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> array from <em class="parameter"><code>children</code></em>
.</p>
<p><em class="parameter"><code>child_type</code></em>
must be non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>n_children</code></em>
is zero. Otherwise, the
child type is determined by inspecting the first element of the
<em class="parameter"><code>children</code></em>
array. If <em class="parameter"><code>child_type</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it must be a
definite type.</p>
<p>The items of the array are taken from the <em class="parameter"><code>children</code></em>
array. No entry
in the <em class="parameter"><code>children</code></em>
array may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<p>All items in the array must have the same type, which must be the
same as <em class="parameter"><code>child_type</code></em>
, if given.</p>
<p>If the <em class="parameter"><code>children</code></em>
are floating references (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>), the
new instance takes ownership of them as if via <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-new-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>child_type</p></td>
<td class="parameter_description"><p> the element type of the new array. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>children</p></td>
<td class="parameter_description"><p> an array of
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointers, the children. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_children]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>n_children</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>children</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-array.returns"></a><h4>Returns</h4>
<p> a floating reference to a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> array. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-tuple"></a><h3>g_variant_new_tuple ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_tuple (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> * const *children</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_children</code></em>);</pre>
<p>Creates a new tuple <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> out of the items in <em class="parameter"><code>children</code></em>
. The
type is determined from the types of <em class="parameter"><code>children</code></em>
. No entry in the
<em class="parameter"><code>children</code></em>
array may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<p>If <em class="parameter"><code>n_children</code></em>
is 0 then the unit tuple is constructed.</p>
<p>If the <em class="parameter"><code>children</code></em>
are floating references (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>), the
new instance takes ownership of them as if via <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-new-tuple.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>children</p></td>
<td class="parameter_description"><p> the items to make the tuple out of. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_children]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>n_children</p></td>
<td class="parameter_description"><p>the length of <em class="parameter"><code>children</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-tuple.returns"></a><h4>Returns</h4>
<p> a floating reference to a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> tuple. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-dict-entry"></a><h3>g_variant_new_dict_entry ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_dict_entry (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *key</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Creates a new dictionary entry <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. <em class="parameter"><code>key</code></em>
and <em class="parameter"><code>value</code></em>
must be
non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. <em class="parameter"><code>key</code></em>
must be a value of a basic type (ie: not a container).</p>
<p>If the <em class="parameter"><code>key</code></em>
or <em class="parameter"><code>value</code></em>
are floating references (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>),
the new instance takes ownership of them as if via <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>.</p>
<p><span class="annotation">[<acronym title="This symbol is a constructor, not a static method."><span class="acronym">constructor</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-new-dict-entry.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>a basic <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, the key</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, the value</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-dict-entry.returns"></a><h4>Returns</h4>
<p> a floating reference to a new dictionary entry <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-fixed-array"></a><h3>g_variant_new_fixed_array ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_fixed_array (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *element_type</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> elements</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n_elements</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> element_size</code></em>);</pre>
<p>Provides access to the serialised data for an array of fixed-sized
items.</p>
<p><em class="parameter"><code>value</code></em>
must be an array with fixed-sized elements. Numeric types are
fixed-size as are tuples containing only other fixed-sized types.</p>
<p><em class="parameter"><code>element_size</code></em>
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.</p>
<p><em class="parameter"><code>n_elements</code></em>
, which must be non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is set equal to the number of
items in the array.</p>
<div class="refsect3">
<a name="g-variant-new-fixed-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>element_type</p></td>
<td class="parameter_description"><p>the <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> of each element</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>elements</p></td>
<td class="parameter_description"><p>a pointer to the fixed array of contiguous elements</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n_elements</p></td>
<td class="parameter_description"><p>the number of elements</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>element_size</p></td>
<td class="parameter_description"><p>the size of each element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-fixed-array.returns"></a><h4>Returns</h4>
<p> a floating reference to a new array <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-maybe"></a><h3>g_variant_get_maybe ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_get_maybe (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Given a maybe-typed <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance, extract its value. If the
value is Nothing, then this function returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<div class="refsect3">
<a name="g-variant-get-maybe.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a maybe-typed value</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-maybe.returns"></a><h4>Returns</h4>
<p> the contents of <em class="parameter"><code>value</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-n-children"></a><h3>g_variant_n_children ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_variant_n_children (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Determines the number of children in a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.
This includes variants, maybes, arrays, tuples and dictionary
entries. It is an error to call this function on any other type of
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>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</p>
<p>This function is O(1).</p>
<div class="refsect3">
<a name="g-variant-n-children.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-n-children.returns"></a><h4>Returns</h4>
<p> the number of children in the container</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-child-value"></a><h3>g_variant_get_child_value ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_get_child_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> index_</code></em>);</pre>
<p>Reads a child item out of a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. This
includes variants, maybes, arrays, tuples and dictionary
entries. It is an error to call this function on any other type of
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>It is an error if <em class="parameter"><code>index_</code></em>
is greater than the number of child items
in the container. See <a class="link" href="glib-GVariant.html#g-variant-n-children" title="g_variant_n_children ()"><code class="function">g_variant_n_children()</code></a>.</p>
<p>The returned value is never floating. You should free it with
<a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a> when you're done with it.</p>
<p>This function is O(1).</p>
<div class="refsect3">
<a name="g-variant-get-child-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>index_</p></td>
<td class="parameter_description"><p>the index of the child to fetch</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-child-value.returns"></a><h4>Returns</h4>
<p> the child at the specified index. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-child"></a><h3>g_variant_get_child ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_get_child (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> index_</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Reads a child item out of a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance and
deconstructs it according to <em class="parameter"><code>format_string</code></em>
. This call is
essentially a combination of <a class="link" href="glib-GVariant.html#g-variant-get-child-value" title="g_variant_get_child_value ()"><code class="function">g_variant_get_child_value()</code></a> and
<a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a>.</p>
<p><em class="parameter"><code>format_string</code></em>
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
GVariant format strings.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-get-child.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>index_</p></td>
<td class="parameter_description"><p>the index of the child to deconstruct</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments, as per <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-lookup-value"></a><h3>g_variant_lookup_value ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_lookup_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *dictionary</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *expected_type</code></em>);</pre>
<p>Looks up a value in a dictionary <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>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).</p>
<p>In the event that <em class="parameter"><code>dictionary</code></em>
has the type a{sv}, the <em class="parameter"><code>expected_type</code></em>
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
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned. In the event that <em class="parameter"><code>dictionary</code></em>
has a value type other
than v then <em class="parameter"><code>expected_type</code></em>
must directly match the key type and it is
used to unpack the value directly or an error occurs.</p>
<p>In either case, if <em class="parameter"><code>key</code></em>
is not found in <em class="parameter"><code>dictionary</code></em>
, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.</p>
<p>If the key is found and the value has the correct type, it is
returned. If <em class="parameter"><code>expected_type</code></em>
was specified then any non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> return
value will have this type.</p>
<p>This function is currently implemented with a linear scan. If you
plan to do many lookups then <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> may be more efficient.</p>
<div class="refsect3">
<a name="g-variant-lookup-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dictionary</p></td>
<td class="parameter_description"><p>a dictionary <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to lookup in the dictionary</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>expected_type</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-lookup-value.returns"></a><h4>Returns</h4>
<p> the value of the dictionary key, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-lookup"></a><h3>g_variant_lookup ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_lookup (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *dictionary</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Looks up a value in a dictionary <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<p>This function is a wrapper around <a class="link" href="glib-GVariant.html#g-variant-lookup-value" title="g_variant_lookup_value ()"><code class="function">g_variant_lookup_value()</code></a> and
<a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a>. In the case that <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> would have been returned,
this function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise, it unpacks the returned
value and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p><em class="parameter"><code>format_string</code></em>
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
GVariant format strings.</p>
<p>This function is currently implemented with a linear scan. If you
plan to do many lookups then <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> may be more efficient.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-lookup.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dictionary</p></td>
<td class="parameter_description"><p>a dictionary <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to lookup in the dictionary</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a GVariant format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to unpack the value into</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-lookup.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a value was unpacked</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-fixed-array"></a><h3>g_variant_get_fixed_array ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a>
g_variant_get_fixed_array (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *n_elements</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> element_size</code></em>);</pre>
<p>Provides access to the serialised data for an array of fixed-sized
items.</p>
<p><em class="parameter"><code>value</code></em>
must be an array with fixed-sized elements. Numeric types are
fixed-size, as are tuples containing only other fixed-sized types.</p>
<p><em class="parameter"><code>element_size</code></em>
must be the size of a single element in the array,
as given by the section on
serialized data memory.</p>
<p>In particular, arrays of these fixed-sized types can be interpreted
as an array of the given C type, with <em class="parameter"><code>element_size</code></em>
set to the size
the appropriate type:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-INT16:CAPS" title="G_VARIANT_TYPE_INT16"><code class="literal">G_VARIANT_TYPE_INT16</code></a> (etc.): <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> (etc.)</p></li>
<li class="listitem"><p><a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-BOOLEAN:CAPS" title="G_VARIANT_TYPE_BOOLEAN"><code class="literal">G_VARIANT_TYPE_BOOLEAN</code></a>: <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> (not <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a>!)</p></li>
<li class="listitem"><p><a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-BYTE:CAPS" title="G_VARIANT_TYPE_BYTE"><code class="literal">G_VARIANT_TYPE_BYTE</code></a>: <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a></p></li>
<li class="listitem"><p><a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-HANDLE:CAPS" title="G_VARIANT_TYPE_HANDLE"><code class="literal">G_VARIANT_TYPE_HANDLE</code></a>: <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a></p></li>
<li class="listitem"><p><a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-DOUBLE:CAPS" title="G_VARIANT_TYPE_DOUBLE"><code class="literal">G_VARIANT_TYPE_DOUBLE</code></a>: <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a></p></li>
</ul></div>
<p>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.</p>
<p><em class="parameter"><code>n_elements</code></em>
, which must be non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is set equal to the number of
items in the array.</p>
<div class="refsect3">
<a name="g-variant-get-fixed-array.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> array with fixed-sized elements</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n_elements</p></td>
<td class="parameter_description"><p> a pointer to the location to store the number of items. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>element_size</p></td>
<td class="parameter_description"><p>the size of each element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-fixed-array.returns"></a><h4>Returns</h4>
<p> a pointer to
the fixed array. </p>
<p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_elements][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-size"></a><h3>g_variant_get_size ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_variant_get_size (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Determines the number of bytes that would be required to store <em class="parameter"><code>value</code></em>
with <a class="link" href="glib-GVariant.html#g-variant-store" title="g_variant_store ()"><code class="function">g_variant_store()</code></a>.</p>
<p>If <em class="parameter"><code>value</code></em>
has a fixed-sized type then this function always returned
that fixed size.</p>
<p>In the case that <em class="parameter"><code>value</code></em>
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.</p>
<div class="refsect3">
<a name="g-variant-get-size.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-size.returns"></a><h4>Returns</h4>
<p> the serialised size of <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-data"></a><h3>g_variant_get_data ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a>
g_variant_get_data (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns a pointer to the serialised form of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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 <em class="parameter"><code>value</code></em>
exists.</p>
<p>If <em class="parameter"><code>value</code></em>
is a fixed-sized value that was deserialised from a
corrupted serialised container then <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> may be returned. In this
case, the proper thing to do is typically to use the appropriate
number of nul bytes in place of <em class="parameter"><code>value</code></em>
. If <em class="parameter"><code>value</code></em>
is not fixed-sized
then <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is never returned.</p>
<p>In the case that <em class="parameter"><code>value</code></em>
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.</p>
<p>To deserialise the data returned by this function, in addition to the
serialised data, you must know the type of the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, 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 <a href="glib-GVariant.html#GVariant"><span class="type">GVariants</span></a> must include this information either
implicitly (for instance "the file always contains a
<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-VARIANT:CAPS" title="G_VARIANT_TYPE_VARIANT"><code class="literal">G_VARIANT_TYPE_VARIANT</code></a> and it is always in little-endian order") or
explicitly (by storing the type and/or endianness in addition to the
serialised data).</p>
<div class="refsect3">
<a name="g-variant-get-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-data.returns"></a><h4>Returns</h4>
<p> the serialised form of <em class="parameter"><code>value</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-data-as-bytes"></a><h3>g_variant_get_data_as_bytes ()</h3>
<pre class="programlisting"><a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="returnvalue">GBytes</span></a> *
g_variant_get_data_as_bytes (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Returns a pointer to the serialised form of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.
The semantics of this function are exactly the same as
<a class="link" href="glib-GVariant.html#g-variant-get-data" title="g_variant_get_data ()"><code class="function">g_variant_get_data()</code></a>, except that the returned <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> holds
a reference to the variant data.</p>
<div class="refsect3">
<a name="g-variant-get-data-as-bytes.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-data-as-bytes.returns"></a><h4>Returns</h4>
<p> A new <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> representing the variant data. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-store"></a><h3>g_variant_store ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_store (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Stores the serialised form of <em class="parameter"><code>value</code></em>
at <em class="parameter"><code>data</code></em>
. <em class="parameter"><code>data</code></em>
should be
large enough. See <a class="link" href="glib-GVariant.html#g-variant-get-size" title="g_variant_get_size ()"><code class="function">g_variant_get_size()</code></a>.</p>
<p>The stored data is in machine native byte order but may not be in
fully-normalised form if read from an untrusted source. See
<a class="link" href="glib-GVariant.html#g-variant-get-normal-form" title="g_variant_get_normal_form ()"><code class="function">g_variant_get_normal_form()</code></a> for a solution.</p>
<p>As with <a class="link" href="glib-GVariant.html#g-variant-get-data" title="g_variant_get_data ()"><code class="function">g_variant_get_data()</code></a>, 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.</p>
<p>This function is approximately O(n) in the size of <em class="parameter"><code>data</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-store.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> to store</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p> the location to store the serialised data at. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL must not be passed as the value in, out, in-out; or as a return value."><span class="acronym">not nullable</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-from-data"></a><h3>g_variant_new_from_data ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_from_data (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> size</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> trusted</code></em>,
<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Creates a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance from serialised data.</p>
<p><em class="parameter"><code>type</code></em>
is the type of <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance that will be constructed.
The interpretation of <em class="parameter"><code>data</code></em>
depends on knowing the type.</p>
<p><em class="parameter"><code>data</code></em>
is not modified by this function and must remain valid with an
unchanging value until such a time as <em class="parameter"><code>notify</code></em>
is called with
<em class="parameter"><code>user_data</code></em>
. If the contents of <em class="parameter"><code>data</code></em>
change before that time then
the result is undefined.</p>
<p>If <em class="parameter"><code>data</code></em>
is trusted to be serialised data in normal form then
<em class="parameter"><code>trusted</code></em>
should be <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. 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 <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if <em class="parameter"><code>data</code></em>
is read from the network, a
file in the user's home directory, etc.</p>
<p>If <em class="parameter"><code>data</code></em>
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. <a class="link" href="glib-GVariant.html#g-variant-byteswap" title="g_variant_byteswap ()"><code class="function">g_variant_byteswap()</code></a> can be used to recover the original values.</p>
<p><em class="parameter"><code>notify</code></em>
will be called with <em class="parameter"><code>user_data</code></em>
when <em class="parameter"><code>data</code></em>
is no longer
needed. The exact time of this call is unspecified and might even be
before this function returns.</p>
<div class="refsect3">
<a name="g-variant-new-from-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a definite <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p> the serialised data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>the size of <em class="parameter"><code>data</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trusted</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>data</code></em>
is definitely in normal form</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>notify</p></td>
<td class="parameter_description"><p> function to call when <em class="parameter"><code>data</code></em>
is no longer needed. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>data for <em class="parameter"><code>notify</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-from-data.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> of type <em class="parameter"><code>type</code></em>
. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-from-bytes"></a><h3>g_variant_new_from_bytes ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_from_bytes (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>,
<em class="parameter"><code><a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a> *bytes</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> trusted</code></em>);</pre>
<p>Constructs a new serialised-mode <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. This is the
inner interface for creation of new serialised values that gets
called from various functions in gvariant.c.</p>
<p>A reference is taken on <em class="parameter"><code>bytes</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-new-from-bytes.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bytes</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Byte-Arrays.html#GBytes" title="GBytes"><span class="type">GBytes</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trusted</p></td>
<td class="parameter_description"><p>if the contents of <em class="parameter"><code>bytes</code></em>
are trusted</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-from-bytes.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with a floating reference. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-byteswap"></a><h3>g_variant_byteswap ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_byteswap (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Performs a byteswapping operation on the contents of <em class="parameter"><code>value</code></em>
. The
result is that all multi-byte numeric data contained in <em class="parameter"><code>value</code></em>
is
byteswapped. That includes 16, 32, and 64bit signed and unsigned
integers as well as file handles and double precision floating point
values.</p>
<p>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).</p>
<p>The returned value is always in normal form and is marked as trusted.</p>
<div class="refsect3">
<a name="g-variant-byteswap.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-byteswap.returns"></a><h4>Returns</h4>
<p> the byteswapped form of <em class="parameter"><code>value</code></em>
. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-get-normal-form"></a><h3>g_variant_get_normal_form ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_get_normal_form (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Gets a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance that has the same value as <em class="parameter"><code>value</code></em>
and is
trusted to be in normal form.</p>
<p>If <em class="parameter"><code>value</code></em>
is already trusted to be in normal form then a new
reference to <em class="parameter"><code>value</code></em>
is returned.</p>
<p>If <em class="parameter"><code>value</code></em>
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.</p>
<p>If <em class="parameter"><code>value</code></em>
is found not to be in normal form then a new trusted
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is created with the same value as <em class="parameter"><code>value</code></em>
.</p>
<p>It makes sense to call this function if you've received <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>
data from untrusted sources and you want to ensure your serialised
output is definitely in normal form.</p>
<div class="refsect3">
<a name="g-variant-get-normal-form.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-get-normal-form.returns"></a><h4>Returns</h4>
<p> a trusted <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-is-normal-form"></a><h3>g_variant_is_normal_form ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_is_normal_form (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Checks if <em class="parameter"><code>value</code></em>
is in normal form.</p>
<p>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 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>
using <a class="link" href="glib-GVariant.html#g-variant-new-from-data" title="g_variant_new_from_data ()"><code class="function">g_variant_new_from_data()</code></a> and then use this function to
check.</p>
<p>If <em class="parameter"><code>value</code></em>
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 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<div class="refsect3">
<a name="g-variant-is-normal-form.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-is-normal-form.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>value</code></em>
is in normal form</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-hash"></a><h3>g_variant_hash ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
g_variant_hash (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> value</code></em>);</pre>
<p>Generates a hash value for a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance.</p>
<p>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.</p>
<p>The type of <em class="parameter"><code>value</code></em>
is <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> only to allow use of this
function with <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. <em class="parameter"><code>value</code></em>
must be a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<div class="refsect3">
<a name="g-variant-hash.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p> a basic <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> value as a <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GVariant]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-hash.returns"></a><h4>Returns</h4>
<p> a hash value corresponding to <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-equal"></a><h3>g_variant_equal ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_equal (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> one</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> two</code></em>);</pre>
<p>Checks if <em class="parameter"><code>one</code></em>
and <em class="parameter"><code>two</code></em>
have the same type and value.</p>
<p>The types of <em class="parameter"><code>one</code></em>
and <em class="parameter"><code>two</code></em>
are <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> only to allow use of
this function with <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. They must each be a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<div class="refsect3">
<a name="g-variant-equal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>one</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GVariant]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>two</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GVariant]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-equal.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>one</code></em>
and <em class="parameter"><code>two</code></em>
are equal</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-print"></a><h3>g_variant_print ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_print (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> type_annotate</code></em>);</pre>
<p>Pretty-prints <em class="parameter"><code>value</code></em>
in the format understood by <a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()"><code class="function">g_variant_parse()</code></a>.</p>
<p>The format is described here.</p>
<p>If <em class="parameter"><code>type_annotate</code></em>
is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, then type information is included in
the output.</p>
<div class="refsect3">
<a name="g-variant-print.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>type_annotate</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if type information should be included in
the output</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-print.returns"></a><h4>Returns</h4>
<p> a newly-allocated string holding the result. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-print-string"></a><h3>g_variant_print_string ()</h3>
<pre class="programlisting"><a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="returnvalue">GString</span></a> *
g_variant_print_string (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>,
<em class="parameter"><code><a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a> *string</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> type_annotate</code></em>);</pre>
<p>Behaves as <a class="link" href="glib-GVariant.html#g-variant-print" title="g_variant_print ()"><code class="function">g_variant_print()</code></a>, but operates on a <a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a>.</p>
<p>If <em class="parameter"><code>string</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then it is appended to and returned. Else,
a new empty <a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a> is allocated and it is returned.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-print-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Default parameter value (for in case the shadows-to function has less parameters)."><span class="acronym">default</span></acronym> NULL]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>type_annotate</p></td>
<td class="parameter_description"><p><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if type information should be included in
the output</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-print-string.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-Strings.html#GString" title="struct GString"><span class="type">GString</span></a> containing the string</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-copy"></a><h3>g_variant_iter_copy ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="returnvalue">GVariantIter</span></a> *
g_variant_iter_copy (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>);</pre>
<p>Creates a new heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> to iterate over the
container that was being iterated over by <em class="parameter"><code>iter</code></em>
. Iteration begins on
the new iterator from the current position of the old iterator but
the two copies are independent past that point.</p>
<p>Use <a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()"><code class="function">g_variant_iter_free()</code></a> to free the return value when you no longer
need it.</p>
<p>A reference is taken to the container that <em class="parameter"><code>iter</code></em>
is iterating over
and will be releated only when <a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()"><code class="function">g_variant_iter_free()</code></a> is called.</p>
<div class="refsect3">
<a name="g-variant-iter-copy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-copy.returns"></a><h4>Returns</h4>
<p> a new heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-free"></a><h3>g_variant_iter_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_iter_free (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>);</pre>
<p>Frees a heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a>. Only call this function on
iterators that were returned by <a class="link" href="glib-GVariant.html#g-variant-iter-new" title="g_variant_iter_new ()"><code class="function">g_variant_iter_new()</code></a> or
<a class="link" href="glib-GVariant.html#g-variant-iter-copy" title="g_variant_iter_copy ()"><code class="function">g_variant_iter_copy()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-iter-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p> a heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-init"></a><h3>g_variant_iter_init ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_variant_iter_init (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Initialises (without allocating) a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a>. <em class="parameter"><code>iter</code></em>
may be
completely uninitialised prior to this call; its old value is
ignored.</p>
<p>The iterator remains valid for as long as <em class="parameter"><code>value</code></em>
exists, and need not
be freed in any way.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-iter-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a pointer to a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-init.returns"></a><h4>Returns</h4>
<p> the number of items in <em class="parameter"><code>value</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-n-children"></a><h3>g_variant_iter_n_children ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>
g_variant_iter_n_children (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>);</pre>
<p>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.</p>
<p>This function might be useful for preallocation of arrays.</p>
<div class="refsect3">
<a name="g-variant-iter-n-children.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-n-children.returns"></a><h4>Returns</h4>
<p> the number of children in the container</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-new"></a><h3>g_variant_iter_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="returnvalue">GVariantIter</span></a> *
g_variant_iter_new (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Creates a heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> for iterating over the items
in <em class="parameter"><code>value</code></em>
.</p>
<p>Use <a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()"><code class="function">g_variant_iter_free()</code></a> to free the return value when you no longer
need it.</p>
<p>A reference is taken to <em class="parameter"><code>value</code></em>
and will be released only when
<a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()"><code class="function">g_variant_iter_free()</code></a> is called.</p>
<div class="refsect3">
<a name="g-variant-iter-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-new.returns"></a><h4>Returns</h4>
<p> a new heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-next-value"></a><h3>g_variant_iter_next_value ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_iter_next_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>);</pre>
<p>Gets the next item in the container. If no more items remain then
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.</p>
<p>Use <a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a> to drop your reference on the return value when
you no longer need it.</p>
<p>Here is an example for iterating with <a class="link" href="glib-GVariant.html#g-variant-iter-next-value" title="g_variant_iter_next_value ()"><code class="function">g_variant_iter_next_value()</code></a>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="comment">// recursively iterate a container</span>
<span class="type">void</span>
<span class="function">iterate_container_recursive</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">container</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantIter</span><span class="normal"> iter</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">child</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">,</span><span class="normal"> container</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">while</span><span class="normal"> </span><span class="symbol">((</span><span class="normal">child </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-iter-next-value">g_variant_iter_next_value</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">)))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"type '%s'</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child</span><span class="symbol">));</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariant.html#g-variant-is-container">g_variant_is_container</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child</span><span class="symbol">))</span>
<span class="normal"> </span><span class="function">iterate_container_recursive</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-unref">g_variant_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="g-variant-iter-next-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-next-value.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-next"></a><h3>g_variant_iter_next ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_iter_next (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Gets the next item in the container and unpacks it into the variable
argument list according to <em class="parameter"><code>format_string</code></em>
, returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p>If no more items remain then <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is returned.</p>
<p>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.</p>
<p>Here is an example for memory management with <a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()"><code class="function">g_variant_iter_next()</code></a>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="comment">// Iterates a dictionary of type 'a{sv}'</span>
<span class="type">void</span>
<span class="function">iterate_dictionary</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">dictionary</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantIter</span><span class="normal"> iter</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">key</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">,</span><span class="normal"> dictionary</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">while</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariant.html#g-variant-iter-next">g_variant_iter_next</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{sv}"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">key</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">value</span><span class="symbol">))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Item '%s' has type '%s'</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> key</span><span class="symbol">,</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">));</span>
<span class="normal"> </span><span class="comment">// must free data for ourselves</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-unref">g_variant_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">key</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>For a solution that is likely to be more convenient to C programmers
when dealing with loops, see <a class="link" href="glib-GVariant.html#g-variant-iter-loop" title="g_variant_iter_loop ()"><code class="function">g_variant_iter_loop()</code></a>.</p>
<p><em class="parameter"><code>format_string</code></em>
determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed.</p>
<p>See the section on
GVariant format strings.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-iter-next.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a GVariant format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to unpack the value into</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-next.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a value was unpacked, or <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if there as no value</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-iter-loop"></a><h3>g_variant_iter_loop ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_iter_loop (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Gets the next item in the container and unpacks it into the variable
argument list according to <em class="parameter"><code>format_string</code></em>
, returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p>If no more items remain then <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is returned.</p>
<p>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.</p>
<p>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 <a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()"><code class="function">g_variant_iter_next()</code></a> or <a class="link" href="glib-GVariant.html#g-variant-iter-next-value" title="g_variant_iter_next_value ()"><code class="function">g_variant_iter_next_value()</code></a> on
the same iterator causes undefined behavior.</p>
<p>If you break out of a such a while loop using <a class="link" href="glib-GVariant.html#g-variant-iter-loop" title="g_variant_iter_loop ()"><code class="function">g_variant_iter_loop()</code></a> then
you must free or unreference all the unpacked values as you would with
<a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a>. Failure to do so will cause a memory leak.</p>
<p>Here is an example for memory management with <a class="link" href="glib-GVariant.html#g-variant-iter-loop" title="g_variant_iter_loop ()"><code class="function">g_variant_iter_loop()</code></a>:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="comment">// Iterates a dictionary of type 'a{sv}'</span>
<span class="type">void</span>
<span class="function">iterate_dictionary</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">dictionary</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantIter</span><span class="normal"> iter</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">key</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-iter-init">g_variant_iter_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">,</span><span class="normal"> dictionary</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">while</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariant.html#g-variant-iter-loop">g_variant_iter_loop</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">iter</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{sv}"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">key</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">value</span><span class="symbol">))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Item '%s' has type '%s'</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> key</span><span class="symbol">,</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get-type-string">g_variant_get_type_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">));</span>
<span class="normal"> </span><span class="comment">// no need to free 'key' and 'value' here</span>
<span class="normal"> </span><span class="comment">// unless breaking out of this loop</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>For most cases you should use <a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()"><code class="function">g_variant_iter_next()</code></a>.</p>
<p>This function is really only useful when unpacking into <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> or
<a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> in order to allow you to skip the call to
<a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a> or <a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()"><code class="function">g_variant_iter_free()</code></a>.</p>
<p>For example, if you are only looping over simple integer and string
types, <a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()"><code class="function">g_variant_iter_next()</code></a> 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).</p>
<p><em class="parameter"><code>format_string</code></em>
determines the C types that are used for unpacking
the values and also determines if the values are copied or borrowed.</p>
<p>See the section on
GVariant format strings.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-iter-loop.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>iter</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a GVariant format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to unpack the value into</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-iter-loop.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a value was unpacked, or <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if there was no
value</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="G-VARIANT-BUILDER-INIT:CAPS"></a><h3>G_VARIANT_BUILDER_INIT()</h3>
<pre class="programlisting">#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } }
</pre>
<p>A stack-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> must be initialized if it is
used together with <a class="link" href="glib-Miscellaneous-Macros.html#g-auto" title="g_auto()"><code class="function">g_auto()</code></a> to avoid warnings or crashes if
function returns before <a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a> 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
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a>, but it cannot be assigned to a variable.</p>
<p>The passed <em class="parameter"><code>variant_type</code></em>
should be a static GVariantType to avoid
lifetime issues, as copying the <em class="parameter"><code>variant_type</code></em>
does not happen in
the <a class="link" href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS" title="G_VARIANT_BUILDER_INIT()"><code class="function">G_VARIANT_BUILDER_INIT()</code></a> call, but rather in functions that
make sure that <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> is valid.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-Miscellaneous-Macros.html#g-auto">g_auto</a></span><span class="symbol">(</span><span class="normal"><a href="glib-GVariant.html#GVariantBuilder">GVariantBuilder</a></span><span class="symbol">)</span><span class="normal"> builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#G-VARIANT-BUILDER-INIT:CAPS">G_VARIANT_BUILDER_INIT</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="glib-GVariantType.html#G-VARIANT-TYPE-BYTESTRING:CAPS">G_VARIANT_TYPE_BYTESTRING</a></span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="G-VARIANT-BUILDER-INIT.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>variant_type</p></td>
<td class="parameter_description"><p>a const GVariantType*</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-50.html#api-index-2.50">2.50</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-unref"></a><h3>g_variant_builder_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_unref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
<p>Decreases the reference count on <em class="parameter"><code>builder</code></em>
.</p>
<p>In the event that there are no more references, releases all memory
associated with the <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>.</p>
<p>Don't call this on stack-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> instances or bad
things will happen.</p>
<div class="refsect3">
<a name="g-variant-builder-unref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> allocated by <a class="link" href="glib-GVariant.html#g-variant-builder-new" title="g_variant_builder_new ()"><code class="function">g_variant_builder_new()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-ref"></a><h3>g_variant_builder_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> *
g_variant_builder_ref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
<p>Increases the reference count on <em class="parameter"><code>builder</code></em>
.</p>
<p>Don't call this on stack-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> instances or bad
things will happen.</p>
<div class="refsect3">
<a name="g-variant-builder-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> allocated by <a class="link" href="glib-GVariant.html#g-variant-builder-new" title="g_variant_builder_new ()"><code class="function">g_variant_builder_new()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-builder-ref.returns"></a><h4>Returns</h4>
<p> a new reference to <em class="parameter"><code>builder</code></em>
. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-new"></a><h3>g_variant_builder_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> *
g_variant_builder_new (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>);</pre>
<p>Allocates and initialises a new <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>.</p>
<p>You should call <a class="link" href="glib-GVariant.html#g-variant-builder-unref" title="g_variant_builder_unref ()"><code class="function">g_variant_builder_unref()</code></a> on the return value when it
is no longer needed. The memory will not be automatically freed by
any other call.</p>
<p>In most cases it is easier to place a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> directly on
the stack of the calling function and initialise it with
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-builder-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a container type</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-builder-new.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-init"></a><h3>g_variant_builder_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_init (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>);</pre>
<p>Initialises a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> structure.</p>
<p><em class="parameter"><code>type</code></em>
must be non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. It specifies the type of container to
construct. It can be an indefinite type such as
<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS" title="G_VARIANT_TYPE_ARRAY"><code class="literal">G_VARIANT_TYPE_ARRAY</code></a> or a definite type such as "as" or "(ii)".
Maybe, array, tuple, dictionary entry and variant-typed values may be
constructed.</p>
<p>After the builder is initialised, values are added using
<a class="link" href="glib-GVariant.html#g-variant-builder-add-value" title="g_variant_builder_add_value ()"><code class="function">g_variant_builder_add_value()</code></a> or <a class="link" href="glib-GVariant.html#g-variant-builder-add" title="g_variant_builder_add ()"><code class="function">g_variant_builder_add()</code></a>.</p>
<p>After all the child values are added, <a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()"><code class="function">g_variant_builder_end()</code></a> frees
the memory associated with the builder and returns the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> that
was created.</p>
<p>This function completely ignores the previous contents of <em class="parameter"><code>builder</code></em>
.
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 <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> you need to
first call <a class="link" href="glib-GVariant.html#g-variant-builder-clear" title="g_variant_builder_clear ()"><code class="function">g_variant_builder_clear()</code></a> in order to avoid leaking
memory.</p>
<p>You must not call <a class="link" href="glib-GVariant.html#g-variant-builder-ref" title="g_variant_builder_ref ()"><code class="function">g_variant_builder_ref()</code></a> or
<a class="link" href="glib-GVariant.html#g-variant-builder-unref" title="g_variant_builder_unref ()"><code class="function">g_variant_builder_unref()</code></a> on a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> that was initialised
with this function. If you ever pass a reference to a
<a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> 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 <a class="link" href="glib-GVariant.html#g-variant-builder-new" title="g_variant_builder_new ()"><code class="function">g_variant_builder_new()</code></a> instead of
this function.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-builder-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a container type</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-clear"></a><h3>g_variant_builder_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_clear (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
<p>Releases all memory associated with a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> without
freeing the <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> structure itself.</p>
<p>It typically only makes sense to do this on a stack-allocated
<a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> if you want to abort building the value part-way
through. This function need not be called if you call
<a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()"><code class="function">g_variant_builder_end()</code></a> and it also doesn't need to be called on
builders allocated with g_variant_builder_new (see
<a class="link" href="glib-GVariant.html#g-variant-builder-unref" title="g_variant_builder_unref ()"><code class="function">g_variant_builder_unref()</code></a> for that).</p>
<p>This function leaves the <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> structure set to all-zeros.
It is valid to call this function on either an initialised
<a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> or one that is set to all-zeros but it is not valid
to call this function on uninitialised memory.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-builder-clear.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-add-value"></a><h3>g_variant_builder_add_value ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_add_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Adds <em class="parameter"><code>value</code></em>
to <em class="parameter"><code>builder</code></em>
.</p>
<p>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.</p>
<p>If <em class="parameter"><code>value</code></em>
is a floating reference (see <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a>),
the <em class="parameter"><code>builder</code></em>
instance takes ownership of <em class="parameter"><code>value</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-builder-add-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-add"></a><h3>g_variant_builder_add ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_add (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Adds to a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>.</p>
<p>This call is a convenience wrapper that is exactly equivalent to
calling <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> followed by <a class="link" href="glib-GVariant.html#g-variant-builder-add-value" title="g_variant_builder_add_value ()"><code class="function">g_variant_builder_add_value()</code></a>.</p>
<p>Note that the arguments must be of the correct width for their types
specified in <em class="parameter"><code>format_string</code></em>
. This can be achieved by casting them. See
the GVariant varargs documentation.</p>
<p>This function might be used as follows:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">make_pointless_dictionary</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantBuilder</span><span class="normal"> builder</span><span class="symbol">;</span>
<span class="normal"> </span><span class="type">int</span><span class="normal"> i</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-init">g_variant_builder_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> <a href="glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS">G_VARIANT_TYPE_ARRAY</a></span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol">&lt;</span><span class="normal"> </span><span class="number">16</span><span class="symbol">;</span><span class="normal"> i</span><span class="symbol">++)</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> buf</span><span class="symbol">[</span><span class="number">3</span><span class="symbol">];</span>
<span class="normal"> </span><span class="function">sprintf</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">buf</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"%d"</span><span class="symbol">,</span><span class="normal"> i</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{is}"</span><span class="symbol">,</span><span class="normal"> i</span><span class="symbol">,</span><span class="normal"> buf</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-end">g_variant_builder_end</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">);</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-builder-add.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> varargs format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments, as per <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-add-parsed"></a><h3>g_variant_builder_add_parsed ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_add_parsed (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Adds to a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>.</p>
<p>This call is a convenience wrapper that is exactly equivalent to
calling <a class="link" href="glib-GVariant.html#g-variant-new-parsed" title="g_variant_new_parsed ()"><code class="function">g_variant_new_parsed()</code></a> followed by
<a class="link" href="glib-GVariant.html#g-variant-builder-add-value" title="g_variant_builder_add_value ()"><code class="function">g_variant_builder_add_value()</code></a>.</p>
<p>Note that the arguments must be of the correct width for their types
specified in <em class="parameter"><code>format_string</code></em>
. This can be achieved by casting them. See
the GVariant varargs documentation.</p>
<p>This function might be used as follows:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">make_pointless_dictionary</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantBuilder</span><span class="normal"> builder</span><span class="symbol">;</span>
<span class="normal"> </span><span class="type">int</span><span class="normal"> i</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-init">g_variant_builder_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> <a href="glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS">G_VARIANT_TYPE_ARRAY</a></span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{'width', &lt;%i&gt;}"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">600</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{'title', &lt;%s&gt;}"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"foo"</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-add-parsed">g_variant_builder_add_parsed</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{'transparency', &lt;0.5&gt;}"</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-end">g_variant_builder_end</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">builder</span><span class="symbol">);</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="g-variant-builder-add-parsed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments as per <em class="parameter"><code>format</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-end"></a><h3>g_variant_builder_end ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_builder_end (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
<p>Ends the builder process and returns the constructed value.</p>
<p>It is not permissible to use <em class="parameter"><code>builder</code></em>
in any way after this call
except for reference counting operations (in the case of a
heap-allocated <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a>) or by reinitialising it with
<a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()"><code class="function">g_variant_builder_init()</code></a> (in the case of stack-allocated). This
means that for the stack-allocated builders there is no need to
call <a class="link" href="glib-GVariant.html#g-variant-builder-clear" title="g_variant_builder_clear ()"><code class="function">g_variant_builder_clear()</code></a> after the call to
<a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()"><code class="function">g_variant_builder_end()</code></a>.</p>
<p>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.</p>
<div class="refsect3">
<a name="g-variant-builder-end.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-builder-end.returns"></a><h4>Returns</h4>
<p> a new, floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-open"></a><h3>g_variant_builder_open ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_open (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>);</pre>
<p>Opens a subcontainer inside the given <em class="parameter"><code>builder</code></em>
. When done adding
items to the subcontainer, <a class="link" href="glib-GVariant.html#g-variant-builder-close" title="g_variant_builder_close ()"><code class="function">g_variant_builder_close()</code></a> must be called.</p>
<p>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).</p>
<div class="refsect3">
<a name="g-variant-builder-open.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-builder-close"></a><h3>g_variant_builder_close ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_builder_close (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre>
<p>Closes the subcontainer inside the given <em class="parameter"><code>builder</code></em>
that was opened by
the most recent call to <a class="link" href="glib-GVariant.html#g-variant-builder-open" title="g_variant_builder_open ()"><code class="function">g_variant_builder_open()</code></a>.</p>
<p>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).</p>
<div class="refsect3">
<a name="g-variant-builder-close.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>builder</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-unref"></a><h3>g_variant_dict_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_dict_unref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>);</pre>
<p>Decreases the reference count on <em class="parameter"><code>dict</code></em>
.</p>
<p>In the event that there are no more references, releases all memory
associated with the <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p>Don't call this on stack-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> instances or bad
things will happen.</p>
<div class="refsect3">
<a name="g-variant-dict-unref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p> a heap-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-ref"></a><h3>g_variant_dict_ref ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="returnvalue">GVariantDict</span></a> *
g_variant_dict_ref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>);</pre>
<p>Increases the reference count on <em class="parameter"><code>dict</code></em>
.</p>
<p>Don't call this on stack-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> instances or bad
things will happen.</p>
<div class="refsect3">
<a name="g-variant-dict-ref.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a heap-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-ref.returns"></a><h4>Returns</h4>
<p> a new reference to <em class="parameter"><code>dict</code></em>
. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-new"></a><h3>g_variant_dict_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="returnvalue">GVariantDict</span></a> *
g_variant_dict_new (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *from_asv</code></em>);</pre>
<p>Allocates and initialises a new <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p>You should call <a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()"><code class="function">g_variant_dict_unref()</code></a> on the return value when it
is no longer needed. The memory will not be automatically freed by
any other call.</p>
<p>In some cases it may be easier to place a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> directly on
the stack of the calling function and initialise it with
<a class="link" href="glib-GVariant.html#g-variant-dict-init" title="g_variant_dict_init ()"><code class="function">g_variant_dict_init()</code></a>. This is particularly useful when you are
using <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> to construct a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<div class="refsect3">
<a name="g-variant-dict-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>from_asv</p></td>
<td class="parameter_description"><p> the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with which to initialise the
dictionary. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-new.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-init"></a><h3>g_variant_dict_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_dict_init (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *from_asv</code></em>);</pre>
<p>Initialises a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> structure.</p>
<p>If <em class="parameter"><code>from_asv</code></em>
is given, it is used to initialise the dictionary.</p>
<p>This function completely ignores the previous contents of <em class="parameter"><code>dict</code></em>
. 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 <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> you need to first
call <a class="link" href="glib-GVariant.html#g-variant-dict-clear" title="g_variant_dict_clear ()"><code class="function">g_variant_dict_clear()</code></a> in order to avoid leaking memory.</p>
<p>You must not call <a class="link" href="glib-GVariant.html#g-variant-dict-ref" title="g_variant_dict_ref ()"><code class="function">g_variant_dict_ref()</code></a> or <a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()"><code class="function">g_variant_dict_unref()</code></a> on a
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> that was initialised with this function. If you ever
pass a reference to a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> 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
<a class="link" href="glib-GVariant.html#g-variant-dict-new" title="g_variant_dict_new ()"><code class="function">g_variant_dict_new()</code></a> instead of this function.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-variant-dict-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>from_asv</p></td>
<td class="parameter_description"><p> the initial value for <em class="parameter"><code>dict</code></em>
. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-clear"></a><h3>g_variant_dict_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_dict_clear (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>);</pre>
<p>Releases all memory associated with a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> without freeing
the <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> structure itself.</p>
<p>It typically only makes sense to do this on a stack-allocated
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> if you want to abort building the value part-way
through. This function need not be called if you call
<a class="link" href="glib-GVariant.html#g-variant-dict-end" title="g_variant_dict_end ()"><code class="function">g_variant_dict_end()</code></a> and it also doesn't need to be called on dicts
allocated with g_variant_dict_new (see <a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()"><code class="function">g_variant_dict_unref()</code></a> for
that).</p>
<p>It is valid to call this function on either an initialised
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> or one that was previously cleared by an earlier call
to <a class="link" href="glib-GVariant.html#g-variant-dict-clear" title="g_variant_dict_clear ()"><code class="function">g_variant_dict_clear()</code></a> but it is not valid to call this function
on uninitialised memory.</p>
<div class="refsect3">
<a name="g-variant-dict-clear.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-contains"></a><h3>g_variant_dict_contains ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_dict_contains (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>);</pre>
<p>Checks if <em class="parameter"><code>key</code></em>
exists in <em class="parameter"><code>dict</code></em>
.</p>
<div class="refsect3">
<a name="g-variant-dict-contains.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to lookup in the dictionary</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-contains.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>key</code></em>
is in <em class="parameter"><code>dict</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-lookup"></a><h3>g_variant_dict_lookup ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_dict_lookup (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Looks up a value in a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p>This function is a wrapper around <a class="link" href="glib-GVariant.html#g-variant-dict-lookup-value" title="g_variant_dict_lookup_value ()"><code class="function">g_variant_dict_lookup_value()</code></a> and
<a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()"><code class="function">g_variant_get()</code></a>. In the case that <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> would have been returned,
this function returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise, it unpacks the returned
value and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p><em class="parameter"><code>format_string</code></em>
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 GVariant format strings.</p>
<div class="refsect3">
<a name="g-variant-dict-lookup.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to lookup in the dictionary</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a GVariant format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>the arguments to unpack the value into</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-lookup.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a value was unpacked</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-lookup-value"></a><h3>g_variant_dict_lookup_value ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_dict_lookup_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *expected_type</code></em>);</pre>
<p>Looks up a value in a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p>If <em class="parameter"><code>key</code></em>
is not found in <em class="parameter"><code>dictionary</code></em>
, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.</p>
<p>The <em class="parameter"><code>expected_type</code></em>
string specifies what type of value is expected.
If the value associated with <em class="parameter"><code>key</code></em>
has a different type then <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is
returned.</p>
<p>If the key is found and the value has the correct type, it is
returned. If <em class="parameter"><code>expected_type</code></em>
was specified then any non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> return
value will have this type.</p>
<div class="refsect3">
<a name="g-variant-dict-lookup-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to lookup in the dictionary</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>expected_type</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-lookup-value.returns"></a><h4>Returns</h4>
<p> the value of the dictionary key, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-insert"></a><h3>g_variant_dict_insert ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_dict_insert (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format_string</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Inserts a value into a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p>This call is a convenience wrapper that is exactly equivalent to
calling <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> followed by <a class="link" href="glib-GVariant.html#g-variant-dict-insert-value" title="g_variant_dict_insert_value ()"><code class="function">g_variant_dict_insert_value()</code></a>.</p>
<div class="refsect3">
<a name="g-variant-dict-insert.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to insert a value for</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format_string</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> varargs format string</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments, as per <em class="parameter"><code>format_string</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-insert-value"></a><h3>g_variant_dict_insert_value ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_variant_dict_insert_value (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>,
<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>);</pre>
<p>Inserts (or replaces) a key in a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<p><em class="parameter"><code>value</code></em>
is consumed if it is floating.</p>
<div class="refsect3">
<a name="g-variant-dict-insert-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to insert a value for</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p>the value to insert</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-remove"></a><h3>g_variant_dict_remove ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_variant_dict_remove (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *key</code></em>);</pre>
<p>Removes a key and its associated value from a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>.</p>
<div class="refsect3">
<a name="g-variant-dict-remove.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>the key to remove</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-remove.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key was found and removed</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-dict-end"></a><h3>g_variant_dict_end ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_dict_end (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> *dict</code></em>);</pre>
<p>Returns the current value of <em class="parameter"><code>dict</code></em>
as a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> of type
<a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-VARDICT:CAPS" title="G_VARIANT_TYPE_VARDICT"><code class="literal">G_VARIANT_TYPE_VARDICT</code></a>, clearing it in the process.</p>
<p>It is not permissible to use <em class="parameter"><code>dict</code></em>
in any way after this call except
for reference counting operations (in the case of a heap-allocated
<a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>) or by reinitialising it with <a class="link" href="glib-GVariant.html#g-variant-dict-init" title="g_variant_dict_init ()"><code class="function">g_variant_dict_init()</code></a> (in
the case of stack-allocated).</p>
<div class="refsect3">
<a name="g-variant-dict-end.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>dict</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-dict-end.returns"></a><h4>Returns</h4>
<p> a new, floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-parse"></a><h3>g_variant_parse ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_parse (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *text</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *limit</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **endptr</code></em>,
<em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Parses a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> from a text representation.</p>
<p>A single <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is parsed from the content of <em class="parameter"><code>text</code></em>
.</p>
<p>The format is described here.</p>
<p>The memory at <em class="parameter"><code>limit</code></em>
will never be accessed and the parser behaves as
if the character at <em class="parameter"><code>limit</code></em>
is the nul terminator. This has the
effect of bounding <em class="parameter"><code>text</code></em>
.</p>
<p>If <em class="parameter"><code>endptr</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> then <em class="parameter"><code>text</code></em>
is permitted to contain data
following the value that this function parses and <em class="parameter"><code>endptr</code></em>
will be
updated to point to the first character past the end of the text
parsed by this function. If <em class="parameter"><code>endptr</code></em>
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> and there is extra data
then an error is returned.</p>
<p>If <em class="parameter"><code>type</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> 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).</p>
<p>In the event that the parsing is successful, the resulting <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>
is returned. It is never floating, and must be freed with
<a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()"><code class="function">g_variant_unref()</code></a>.</p>
<p>In case of any error, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned. If <em class="parameter"><code>error</code></em>
is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
then it will be set to reflect the error that occurred.</p>
<p>Officially, the language understood by the parser is "any string
produced by <a class="link" href="glib-GVariant.html#g-variant-print" title="g_variant_print ()"><code class="function">g_variant_print()</code></a>".</p>
<div class="refsect3">
<a name="g-variant-parse.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>text</p></td>
<td class="parameter_description"><p>a string containing a GVariant in text form</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>limit</p></td>
<td class="parameter_description"><p> a pointer to the end of <em class="parameter"><code>text</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>endptr</p></td>
<td class="parameter_description"><p> a location to store the end pointer, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> a pointer to a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> pointer, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-parse.returns"></a><h4>Returns</h4>
<p> a non-floating reference to a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-parsed-va"></a><h3>g_variant_new_parsed_va ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_parsed_va (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code><span class="type">va_list</span> *app</code></em>);</pre>
<p>Parses <em class="parameter"><code>format</code></em>
and returns the result.</p>
<p>This is the version of <a class="link" href="glib-GVariant.html#g-variant-new-parsed" title="g_variant_new_parsed ()"><code class="function">g_variant_new_parsed()</code></a> intended to be used
from libraries.</p>
<p>The return value will be floating if it was a newly created GVariant
instance. In the case that <em class="parameter"><code>format</code></em>
simply specified the collection
of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointer (eg: <em class="parameter"><code>format</code></em>
was "%*") then the collected
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointer will be returned unmodified, without adding any
additional references.</p>
<p>Note that the arguments in <em class="parameter"><code>app</code></em>
must be of the correct width for their types
specified in <em class="parameter"><code>format</code></em>
when collected into the <span class="type">va_list</span>. See
the GVariant varargs documentation.</p>
<p>In order to behave correctly in all cases it is necessary for the
calling function to <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()"><code class="function">g_variant_ref_sink()</code></a> 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 <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> call.</p>
<div class="refsect3">
<a name="g-variant-new-parsed-va.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>app</p></td>
<td class="parameter_description"><p>a pointer to a <span class="type">va_list</span></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-parsed-va.returns"></a><h4>Returns</h4>
<p> a new, usually floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-new-parsed"></a><h3>g_variant_new_parsed ()</h3>
<pre class="programlisting"><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> *
g_variant_new_parsed (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Parses <em class="parameter"><code>format</code></em>
and returns the result.</p>
<p><em class="parameter"><code>format</code></em>
must be a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> with one extension: at any
point that a value may appear in the text, a '%' character followed
by a GVariant format string (as per <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a>) may appear. In
that case, the same arguments are collected from the argument list as
<a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()"><code class="function">g_variant_new()</code></a> would have collected.</p>
<p>Note that the arguments must be of the correct width for their types
specified in <em class="parameter"><code>format</code></em>
. This can be achieved by casting them. See
the GVariant varargs documentation.</p>
<p>Consider this simple example:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="function"><a href="glib-GVariant.html#g-variant-new-parsed">g_variant_new_parsed</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"[('one', 1), ('two', %i), (%s, 3)]"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"three"</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>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</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="symbol">[(</span><span class="string">'one'</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1</span><span class="symbol">),</span><span class="normal"> </span><span class="symbol">(</span><span class="string">'two'</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2</span><span class="symbol">),</span><span class="normal"> </span><span class="symbol">(</span><span class="string">'three'</span><span class="symbol">,</span><span class="normal"> </span><span class="number">3</span><span class="symbol">)]</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>This function is intended only to be used with <em class="parameter"><code>format</code></em>
as a string
literal. Any parse error is fatal to the calling process. If you
want to parse data from untrusted sources, use <a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()"><code class="function">g_variant_parse()</code></a>.</p>
<p>You may not use this function to return, unmodified, a single
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointer from the argument list. ie: <em class="parameter"><code>format</code></em>
may not solely
be anything along the lines of "%*", "%?", "%r", or anything starting
with "%@".</p>
<div class="refsect3">
<a name="g-variant-new-parsed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>arguments as per <em class="parameter"><code>format</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-new-parsed.returns"></a><h4>Returns</h4>
<p> a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-variant-parse-error-print-context"></a><h3>g_variant_parse_error_print_context ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *
g_variant_parse_error_print_context (<em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> *error</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *source_str</code></em>);</pre>
<p>Pretty-prints a message showing the context of a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> parse
error within the string for which parsing was attempted.</p>
<p>The resulting string is suitable for output to the console or other
monospace media where newlines are treated in the usual way.</p>
<p>The message will typically look something like one of the following:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal">unterminated </span><span class="usertype">string</span><span class="normal"> constant</span><span class="symbol">:</span>
<span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2</span><span class="symbol">,</span><span class="normal"> </span><span class="number">3</span><span class="symbol">,</span><span class="normal"> </span><span class="string">'abc</span>
<span class="string"> ^^^^</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>or</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal">unable to find a </span><span class="usertype">common</span><span class="normal"> type</span><span class="symbol">:</span>
<span class="normal"> </span><span class="symbol">[</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> </span><span class="number">2</span><span class="symbol">,</span><span class="normal"> </span><span class="number">3</span><span class="symbol">,</span><span class="normal"> </span><span class="string">'str'</span><span class="symbol">]</span>
<span class="normal"> </span><span class="symbol">^</span><span class="normal"> </span><span class="symbol">^^^^^</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>The format of the message may change in a future version.</p>
<p><em class="parameter"><code>error</code></em>
must have come from a failed attempt to <a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()"><code class="function">g_variant_parse()</code></a> and
<em class="parameter"><code>source_str</code></em>
must be exactly the same string that caused the error.
If <em class="parameter"><code>source_str</code></em>
was not nul-terminated when you passed it to
<a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()"><code class="function">g_variant_parse()</code></a> then you must add nul termination before using this
function.</p>
<div class="refsect3">
<a name="g-variant-parse-error-print-context.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> from the <a class="link" href="glib-GVariant.html#GVariantParseError" title="enum GVariantParseError"><span class="type">GVariantParseError</span></a> domain</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>source_str</p></td>
<td class="parameter_description"><p>the string that was given to the parser</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-variant-parse-error-print-context.returns"></a><h4>Returns</h4>
<p> the printed message. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
</div>
<div class="refsect1">
<a name="glib-GVariant.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GVariant"></a><h3>GVariant</h3>
<pre class="programlisting">typedef struct _GVariant GVariant;</pre>
<p><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an opaque data structure and can only be accessed
using the following functions.</p>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GVariantClass"></a><h3>enum GVariantClass</h3>
<p>The range of possible top-level types of <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances.</p>
<div class="refsect3">
<a name="GVariantClass.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-BOOLEAN:CAPS"></a>G_VARIANT_CLASS_BOOLEAN</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a boolean.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-BYTE:CAPS"></a>G_VARIANT_CLASS_BYTE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a byte.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-INT16:CAPS"></a>G_VARIANT_CLASS_INT16</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 16 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-UINT16:CAPS"></a>G_VARIANT_CLASS_UINT16</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 16 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-INT32:CAPS"></a>G_VARIANT_CLASS_INT32</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 32 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-UINT32:CAPS"></a>G_VARIANT_CLASS_UINT32</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 32 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-INT64:CAPS"></a>G_VARIANT_CLASS_INT64</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 64 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-UINT64:CAPS"></a>G_VARIANT_CLASS_UINT64</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 64 bit integer.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-HANDLE:CAPS"></a>G_VARIANT_CLASS_HANDLE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a file handle index.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-DOUBLE:CAPS"></a>G_VARIANT_CLASS_DOUBLE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a double precision floating
point value.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-STRING:CAPS"></a>G_VARIANT_CLASS_STRING</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a normal string.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-OBJECT-PATH:CAPS"></a>G_VARIANT_CLASS_OBJECT_PATH</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a D-Bus object path
string.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-SIGNATURE:CAPS"></a>G_VARIANT_CLASS_SIGNATURE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a D-Bus signature string.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-VARIANT:CAPS"></a>G_VARIANT_CLASS_VARIANT</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a variant.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-MAYBE:CAPS"></a>G_VARIANT_CLASS_MAYBE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a maybe-typed value.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-ARRAY:CAPS"></a>G_VARIANT_CLASS_ARRAY</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an array.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-TUPLE:CAPS"></a>G_VARIANT_CLASS_TUPLE</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a tuple.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-CLASS-DICT-ENTRY:CAPS"></a>G_VARIANT_CLASS_DICT_ENTRY</p></td>
<td class="enum_member_description">
<p>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a dictionary entry.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-24.html#api-index-2.24">2.24</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GVariantIter"></a><h3>struct GVariantIter</h3>
<pre class="programlisting">struct GVariantIter {
};
</pre>
<p><a class="link" href="glib-GVariant.html#GVariantIter" title="struct GVariantIter"><span class="type">GVariantIter</span></a> is an opaque data structure and can only be accessed
using the following functions.</p>
</div>
<hr>
<div class="refsect2">
<a name="GVariantBuilder"></a><h3>struct GVariantBuilder</h3>
<pre class="programlisting">struct GVariantBuilder {
};
</pre>
<p>A utility type for constructing container-type <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instances.</p>
<p>This is an opaque structure and may only be accessed using the
following functions.</p>
<p><a class="link" href="glib-GVariant.html#GVariantBuilder" title="struct GVariantBuilder"><span class="type">GVariantBuilder</span></a> is not threadsafe in any way. Do not attempt to
access it from more than one thread.</p>
</div>
<hr>
<div class="refsect2">
<a name="GVariantDict"></a><h3>struct GVariantDict</h3>
<pre class="programlisting">struct GVariantDict {
};
</pre>
<p><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> is a mutable interface to <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> dictionaries.</p>
<p>It can be used for doing a sequence of dictionary lookups in an
efficient way on an existing <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> 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.</p>
<p><a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> can only be used with <a class="link" href="glib-GVariantType.html#G-VARIANT-TYPE-VARDICT:CAPS" title="G_VARIANT_TYPE_VARDICT"><code class="literal">G_VARIANT_TYPE_VARDICT</code></a>
dictionaries.</p>
<p>It is possible to use <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> allocated on the stack or on the
heap. When using a stack-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a>, you begin with a
call to <a class="link" href="glib-GVariant.html#g-variant-dict-init" title="g_variant_dict_init ()"><code class="function">g_variant_dict_init()</code></a> and free the resources with a call to
<a class="link" href="glib-GVariant.html#g-variant-dict-clear" title="g_variant_dict_clear ()"><code class="function">g_variant_dict_clear()</code></a>.</p>
<p>Heap-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> follows normal refcounting rules: you
allocate it with <a class="link" href="glib-GVariant.html#g-variant-dict-new" title="g_variant_dict_new ()"><code class="function">g_variant_dict_new()</code></a> and use <a class="link" href="glib-GVariant.html#g-variant-dict-ref" title="g_variant_dict_ref ()"><code class="function">g_variant_dict_ref()</code></a>
and <a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()"><code class="function">g_variant_dict_unref()</code></a>.</p>
<p>g_variant_dict_end() is used to convert the <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> back into a
dictionary-type <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>. When used with stack-allocated instances,
this also implicitly frees all associated memory, but for
heap-allocated instances, you must still call <a class="link" href="glib-GVariant.html#g-variant-dict-unref" title="g_variant_dict_unref ()"><code class="function">g_variant_dict_unref()</code></a>
afterwards.</p>
<p>You will typically want to use a heap-allocated <a class="link" href="glib-GVariant.html#GVariantDict" title="struct GVariantDict"><span class="type">GVariantDict</span></a> when
you expose it as part of an API. For most other uses, the
stack-allocated form will be more convenient.</p>
<p>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
<a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>.</p>
<div class="refsect3">
<a name="id-1.6.19.8.6.12"></a><h4>Using a stack-allocated GVariantDict</h4>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">add_to_count</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">orig</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantDict</span><span class="normal"> dict</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">guint32</span><span class="normal"> count</span><span class="symbol">;</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-init">g_variant_dict_init</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">dict</span><span class="symbol">,</span><span class="normal"> orig</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="function"><a href="glib-GVariant.html#g-variant-dict-lookup">g_variant_dict_lookup</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">dict</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">count</span><span class="symbol">))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-Error-Reporting.html#g-set-error">g_set_error</a></span><span class="normal"> </span><span class="symbol">(...);</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-clear">g_variant_dict_clear</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">dict</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-insert">g_variant_dict_insert</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">dict</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> count </span><span class="symbol">+</span><span class="normal"> </span><span class="number">1</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-end">g_variant_dict_end</a></span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">dict</span><span class="symbol">);</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
</div>
<div class="refsect3">
<a name="id-1.6.19.8.6.13"></a><h4>Using heap-allocated GVariantDict</h4>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">add_to_count</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">orig</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GVariantDict</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">dict</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">guint32</span><span class="normal"> count</span><span class="symbol">;</span>
<span class="normal"> dict </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-new">g_variant_dict_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">orig</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariant.html#g-variant-dict-lookup">g_variant_dict_lookup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">dict</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">count</span><span class="symbol">))</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-insert">g_variant_dict_insert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">dict</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"u"</span><span class="symbol">,</span><span class="normal"> count </span><span class="symbol">+</span><span class="normal"> </span><span class="number">1</span><span class="symbol">);</span>
<span class="normal"> result </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-end">g_variant_dict_end</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">dict</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="keyword">else</span>
<span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="glib-Error-Reporting.html#g-set-error">g_set_error</a></span><span class="normal"> </span><span class="symbol">(...);</span>
<span class="normal"> result </span><span class="symbol">=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-dict-unref">g_variant_dict_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">dict</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> result</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GVariantParseError"></a><h3>enum GVariantParseError</h3>
<p>Error codes returned by parsing text-format GVariants.</p>
<div class="refsect3">
<a name="GVariantParseError.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-FAILED:CAPS"></a>G_VARIANT_PARSE_ERROR_FAILED</p></td>
<td class="enum_member_description">
<p>generic error (unused)</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-BASIC-TYPE-EXPECTED:CAPS"></a>G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED</p></td>
<td class="enum_member_description">
<p>a non-basic <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> was given where a basic type was expected</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-CANNOT-INFER-TYPE:CAPS"></a>G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE</p></td>
<td class="enum_member_description">
<p>cannot infer the <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a></p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-DEFINITE-TYPE-EXPECTED:CAPS"></a>G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED</p></td>
<td class="enum_member_description">
<p>an indefinite <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> was given where a definite type was expected</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INPUT-NOT-AT-END:CAPS"></a>G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END</p></td>
<td class="enum_member_description">
<p>extra data after parsing finished</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INVALID-CHARACTER:CAPS"></a>G_VARIANT_PARSE_ERROR_INVALID_CHARACTER</p></td>
<td class="enum_member_description">
<p>invalid character in number or unicode escape</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INVALID-FORMAT-STRING:CAPS"></a>G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING</p></td>
<td class="enum_member_description">
<p>not a valid <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INVALID-OBJECT-PATH:CAPS"></a>G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH</p></td>
<td class="enum_member_description">
<p>not a valid object path</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INVALID-SIGNATURE:CAPS"></a>G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE</p></td>
<td class="enum_member_description">
<p>not a valid type signature</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-INVALID-TYPE-STRING:CAPS"></a>G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING</p></td>
<td class="enum_member_description">
<p>not a valid <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> type string</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-NO-COMMON-TYPE:CAPS"></a>G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE</p></td>
<td class="enum_member_description">
<p>could not find a common type for array entries</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-NUMBER-OUT-OF-RANGE:CAPS"></a>G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE</p></td>
<td class="enum_member_description">
<p>the numerical value is out of range of the given type</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-NUMBER-TOO-BIG:CAPS"></a>G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG</p></td>
<td class="enum_member_description">
<p>the numerical value is out of range for any type</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-TYPE-ERROR:CAPS"></a>G_VARIANT_PARSE_ERROR_TYPE_ERROR</p></td>
<td class="enum_member_description">
<p>cannot parse as variant of the specified type</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-UNEXPECTED-TOKEN:CAPS"></a>G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN</p></td>
<td class="enum_member_description">
<p>an unexpected token was encountered</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-UNKNOWN-KEYWORD:CAPS"></a>G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD</p></td>
<td class="enum_member_description">
<p>an unknown keyword was encountered</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-UNTERMINATED-STRING-CONSTANT:CAPS"></a>G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT</p></td>
<td class="enum_member_description">
<p>unterminated string constant</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-VARIANT-PARSE-ERROR-VALUE-EXPECTED:CAPS"></a>G_VARIANT_PARSE_ERROR_VALUE_EXPECTED</p></td>
<td class="enum_member_description">
<p>no value given</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="G-VARIANT-PARSE-ERROR:CAPS"></a><h3>G_VARIANT_PARSE_ERROR</h3>
<pre class="programlisting">#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ())
</pre>
<p>Error domain for GVariant text format parsing. Specific error codes
are not currently defined for this domain. See <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> for
information on error domains.</p>
</div>
</div>
<div class="refsect1">
<a name="glib-GVariant.see-also"></a><h2>See Also</h2>
<p>GVariantType</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>