| <!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</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> |
| <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.14 (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="2"> |
| <tr valign="middle"> |
| <td><a accesskey="p" href="glib-GVariantType.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| <td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| <th width="100%" align="center">GLib Reference Manual</th> |
| <td><a accesskey="n" href="gvariant-format-strings.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| </tr> |
| <tr><td colspan="5" class="shortcuts"> |
| <a href="#glib-GVariant.synopsis" class="shortcut">Top</a> |
| | |
| <a href="#glib-GVariant.description" class="shortcut">Description</a> |
| </td></tr> |
| </table> |
| <div class="refentry" title="GVariant"> |
| <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 valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsynopsisdiv" title="Synopsis"> |
| <a name="glib-GVariant.synopsis"></a><h2>Synopsis</h2> |
| <pre class="synopsis"> |
| #include <glib.h> |
| |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant">GVariant</a>; |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-unref" title="g_variant_unref ()">g_variant_unref</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-ref" title="g_variant_ref ()">g_variant_ref</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-ref-sink" title="g_variant_ref_sink ()">g_variant_ref_sink</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="returnvalue">GVariantType</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-type" title="g_variant_get_type ()">g_variant_get_type</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-type-string" title="g_variant_get_type_string ()">g_variant_get_type_string</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-is-of-type" title="g_variant_is_of_type ()">g_variant_is_of_type</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-is-container" title="g_variant_is_container ()">g_variant_is_container</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| |
| <a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass"><span class="returnvalue">GVariantClass</span></a> <a class="link" href="glib-GVariant.html#g-variant-classify" title="g_variant_classify ()">g_variant_classify</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| enum <a class="link" href="glib-GVariant.html#GVariantClass" title="enum GVariantClass">GVariantClass</a>; |
| |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-get" title="g_variant_get ()">g_variant_get</a> (<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>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-get-va" title="g_variant_get_va ()">g_variant_get_va</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new" title="g_variant_new ()">g_variant_new</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-va" title="g_variant_new_va ()">g_variant_new_va</a> (<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>); |
| |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-boolean" title="g_variant_new_boolean ()">g_variant_new_boolean</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> boolean</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-byte" title="g_variant_new_byte ()">g_variant_new_byte</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> byte</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-int16" title="g_variant_new_int16 ()">g_variant_new_int16</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> int16</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-uint16" title="g_variant_new_uint16 ()">g_variant_new_uint16</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a> uint16</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-int32" title="g_variant_new_int32 ()">g_variant_new_int32</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> int32</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-uint32" title="g_variant_new_uint32 ()">g_variant_new_uint32</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> uint32</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-int64" title="g_variant_new_int64 ()">g_variant_new_int64</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> int64</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-uint64" title="g_variant_new_uint64 ()">g_variant_new_uint64</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> uint64</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-handle" title="g_variant_new_handle ()">g_variant_new_handle</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> handle</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-double" title="g_variant_new_double ()">g_variant_new_double</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> floating</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-string" title="g_variant_new_string ()">g_variant_new_string</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-object-path" title="g_variant_new_object_path ()">g_variant_new_object_path</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-is-object-path" title="g_variant_is_object_path ()">g_variant_is_object_path</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-signature" title="g_variant_new_signature ()">g_variant_new_signature</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-is-signature" title="g_variant_is_signature ()">g_variant_is_signature</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-variant" title="g_variant_new_variant ()">g_variant_new_variant</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-strv" title="g_variant_new_strv ()">g_variant_new_strv</a> (<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>); |
| |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-boolean" title="g_variant_get_boolean ()">g_variant_get_boolean</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="returnvalue">guchar</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-byte" title="g_variant_get_byte ()">g_variant_get_byte</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="returnvalue">gint16</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-int16" title="g_variant_get_int16 ()">g_variant_get_int16</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="returnvalue">guint16</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-uint16" title="g_variant_get_uint16 ()">g_variant_get_uint16</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-int32" title="g_variant_get_int32 ()">g_variant_get_int32</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-uint32" title="g_variant_get_uint32 ()">g_variant_get_uint32</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-int64" title="g_variant_get_int64 ()">g_variant_get_int64</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="returnvalue">guint64</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-uint64" title="g_variant_get_uint64 ()">g_variant_get_uint64</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="returnvalue">gint32</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-handle" title="g_variant_get_handle ()">g_variant_get_handle</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="returnvalue">gdouble</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-double" title="g_variant_get_double ()">g_variant_get_double</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-string" title="g_variant_get_string ()">g_variant_get_string</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-GVariant.html#g-variant-dup-string" title="g_variant_dup_string ()">g_variant_dup_string</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-variant" title="g_variant_get_variant ()">g_variant_get_variant</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> ** <a class="link" href="glib-GVariant.html#g-variant-get-strv" title="g_variant_get_strv ()">g_variant_get_strv</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> ** <a class="link" href="glib-GVariant.html#g-variant-dup-strv" title="g_variant_dup_strv ()">g_variant_dup_strv</a> (<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>); |
| |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-maybe" title="g_variant_new_maybe ()">g_variant_new_maybe</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-array" title="g_variant_new_array ()">g_variant_new_array</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-tuple" title="g_variant_new_tuple ()">g_variant_new_tuple</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-dict-entry" title="g_variant_new_dict_entry ()">g_variant_new_dict_entry</a> (<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>); |
| |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-maybe" title="g_variant_get_maybe ()">g_variant_get_maybe</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-GVariant.html#g-variant-n-children" title="g_variant_n_children ()">g_variant_n_children</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-child-value" title="g_variant_get_child_value ()">g_variant_get_child_value</a> (<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>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-get-child" title="g_variant_get_child ()">g_variant_get_child</a> (<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>); |
| <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-fixed-array" title="g_variant_get_fixed_array ()">g_variant_get_fixed_array</a> (<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>); |
| |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-size" title="g_variant_get_size ()">g_variant_get_size</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> <a class="link" href="glib-GVariant.html#g-variant-get-data" title="g_variant_get_data ()">g_variant_get_data</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-store" title="g_variant_store ()">g_variant_store</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-from-data" title="g_variant_new_from_data ()">g_variant_new_from_data</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-byteswap" title="g_variant_byteswap ()">g_variant_byteswap</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-get-normal-form" title="g_variant_get_normal_form ()">g_variant_get_normal_form</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-is-normal-form" title="g_variant_is_normal_form ()">g_variant_is_normal_form</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| |
| <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> <a class="link" href="glib-GVariant.html#g-variant-hash" title="g_variant_hash ()">g_variant_hash</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> value</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-equal" title="g_variant_equal ()">g_variant_equal</a> (<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>); |
| |
| <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="glib-GVariant.html#g-variant-print" title="g_variant_print ()">g_variant_print</a> (<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>); |
| <a class="link" href="glib-Strings.html#GString" title="GString"><span class="returnvalue">GString</span></a> * <a class="link" href="glib-GVariant.html#g-variant-print-string" title="g_variant_print_string ()">g_variant_print_string</a> (<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="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>); |
| |
| <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter">GVariantIter</a>; |
| <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="returnvalue">GVariantIter</span></a> * <a class="link" href="glib-GVariant.html#g-variant-iter-copy" title="g_variant_iter_copy ()">g_variant_iter_copy</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-iter-free" title="g_variant_iter_free ()">g_variant_iter_free</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-GVariant.html#g-variant-iter-init" title="g_variant_iter_init ()">g_variant_iter_init</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="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>); |
| <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> <a class="link" href="glib-GVariant.html#g-variant-iter-n-children" title="g_variant_iter_n_children ()">g_variant_iter_n_children</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="returnvalue">GVariantIter</span></a> * <a class="link" href="glib-GVariant.html#g-variant-iter-new" title="g_variant_iter_new ()">g_variant_iter_new</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> *value</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-iter-next-value" title="g_variant_iter_next_value ()">g_variant_iter_next_value</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> *iter</code></em>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-iter-next" title="g_variant_iter_next ()">g_variant_iter_next</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="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>); |
| <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="glib-GVariant.html#g-variant-iter-loop" title="g_variant_iter_loop ()">g_variant_iter_loop</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="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>); |
| |
| <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder">GVariantBuilder</a>; |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-unref" title="g_variant_builder_unref ()">g_variant_builder_unref</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> * <a class="link" href="glib-GVariant.html#g-variant-builder-ref" title="g_variant_builder_ref ()">g_variant_builder_ref</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> * <a class="link" href="glib-GVariant.html#g-variant-builder-new" title="g_variant_builder_new ()">g_variant_builder_new</a> (<em class="parameter"><code>const <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> *type</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-init" title="g_variant_builder_init ()">g_variant_builder_init</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="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>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-clear" title="g_variant_builder_clear ()">g_variant_builder_clear</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-add-value" title="g_variant_builder_add_value ()">g_variant_builder_add_value</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="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>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-add" title="g_variant_builder_add ()">g_variant_builder_add</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-builder-end" title="g_variant_builder_end ()">g_variant_builder_end</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-open" title="g_variant_builder_open ()">g_variant_builder_open</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="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>); |
| <span class="returnvalue">void</span> <a class="link" href="glib-GVariant.html#g-variant-builder-close" title="g_variant_builder_close ()">g_variant_builder_close</a> (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>); |
| |
| #define <a class="link" href="glib-GVariant.html#G-VARIANT-PARSE-ERROR:CAPS" title="G_VARIANT_PARSE_ERROR">G_VARIANT_PARSE_ERROR</a> |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-parse" title="g_variant_parse ()">g_variant_parse</a> (<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="GError"><span class="type">GError</span></a> **error</code></em>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-parsed-va" title="g_variant_new_parsed_va ()">g_variant_new_parsed_va</a> (<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>); |
| <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="returnvalue">GVariant</span></a> * <a class="link" href="glib-GVariant.html#g-variant-new-parsed" title="g_variant_new_parsed ()">g_variant_new_parsed</a> (<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> |
| </div> |
| <div class="refsect1" title="Description"> |
| <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 stores a value along with |
| information about the type of that value. The range of possible |
| values is determined by the type. 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> can not 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 DBus. 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 DBus. See <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> for |
| exceptions. |
| </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="refsect2" title="Memory Use"> |
| <a name="id849579"></a><h3>Memory Use</h3> |
| <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 class="refsect3" title="Serialised Data Memory"> |
| <a name="id872880"></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. |
| </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" title="Type Information Cache"> |
| <a name="id872944"></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 32bit 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 32bit 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" title="Buffer Management Memory"> |
| <a name="id873014"></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 32bit systems, that's 16 bytes. |
| </p> |
| </div> |
| <div class="refsect3" title="GVariant structure"> |
| <a name="id873068"></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 refering 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" title="Summary"> |
| <a name="id873129"></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> |
| <div class="refsect1" title="Details"> |
| <a name="glib-GVariant.details"></a><h2>Details</h2> |
| <div class="refsect2" title="GVariant"> |
| <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 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_unref ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr></tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_ref ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the same <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_ref_sink ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the same <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_type ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_type_string ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the type string for the type of <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_is_of_type ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_is_container ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_classify ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="enum GVariantClass"> |
| <a name="GVariantClass"></a><h3>enum GVariantClass</h3> |
| <pre class="programlisting">typedef enum |
| { |
| G_VARIANT_CLASS_BOOLEAN = 'b', |
| G_VARIANT_CLASS_BYTE = 'y', |
| G_VARIANT_CLASS_INT16 = 'n', |
| G_VARIANT_CLASS_UINT16 = 'q', |
| G_VARIANT_CLASS_INT32 = 'i', |
| G_VARIANT_CLASS_UINT32 = 'u', |
| G_VARIANT_CLASS_INT64 = 'x', |
| G_VARIANT_CLASS_UINT64 = 't', |
| G_VARIANT_CLASS_HANDLE = 'h', |
| G_VARIANT_CLASS_DOUBLE = 'd', |
| G_VARIANT_CLASS_STRING = 's', |
| G_VARIANT_CLASS_OBJECT_PATH = 'o', |
| G_VARIANT_CLASS_SIGNATURE = 'g', |
| G_VARIANT_CLASS_VARIANT = 'v', |
| G_VARIANT_CLASS_MAYBE = 'm', |
| G_VARIANT_CLASS_ARRAY = 'a', |
| G_VARIANT_CLASS_TUPLE = '(', |
| G_VARIANT_CLASS_DICT_ENTRY = '{' |
| } GVariantClass; |
| </pre> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-BOOLEAN:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_BOOLEAN</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a boolean. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-BYTE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_BYTE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a byte. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-INT16:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_INT16</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 16 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-UINT16:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_UINT16</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 16 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-INT32:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_INT32</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 32 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-UINT32:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_UINT32</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 32 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-INT64:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_INT64</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a signed 64 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-UINT64:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_UINT64</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an unsigned 64 bit integer. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-HANDLE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_HANDLE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a file handle index. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-DOUBLE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_DOUBLE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a double precision floating |
| point value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-STRING:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_STRING</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a normal string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-OBJECT-PATH:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_OBJECT_PATH</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a DBus object path |
| string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-SIGNATURE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_SIGNATURE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a DBus signature string. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-VARIANT:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_VARIANT</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a variant. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-MAYBE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_MAYBE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a maybe-typed value. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-ARRAY:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_ARRAY</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is an array. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-TUPLE:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_TUPLE</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a tuple. |
| </td> |
| </tr> |
| <tr> |
| <td><p><a name="G-VARIANT-CLASS-DICT-ENTRY:CAPS"></a><span class="term"><code class="literal">G_VARIANT_CLASS_DICT_ENTRY</code></span></p></td> |
| <td>The <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> is a dictionary entry. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get ()"> |
| <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 <a href="gvariant-format-strings.html">GVariant Format Strings</a>. |
| Please note that the syntax of the format string is very likely to be |
| extended in the future. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>arguments, as per <em class="parameter"><code>format_string</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_va ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a string that is prefixed with a format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td> |
| <td>a pointer to a <span class="type">va_list</span> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new ()"> |
| <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 <GTKDOCLINK HREF="gvariant-format-strings">GVariant Format |
| Strings</GTKDOCLINK>. 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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>arguments, as per <em class="parameter"><code>format_string</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_va ()"> |
| <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> |
| 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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a string that is prefixed with a format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td> |
| <td>a pointer to a <span class="type">va_list</span> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new, usually floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_boolean ()"> |
| <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> boolean</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>boolean</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new boolean <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_byte ()"> |
| <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> byte</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>byte</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="type">guint8</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new byte <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_int16 ()"> |
| <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> int16</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>int16</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new int16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_uint16 ()"> |
| <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> uint16</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>uint16</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new uint16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_int32 ()"> |
| <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> int32</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>int32</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new int32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_uint32 ()"> |
| <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> uint32</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>uint32</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new uint32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_int64 ()"> |
| <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> int64</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>int64</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new int64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_uint64 ()"> |
| <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> uint64</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>uint64</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new uint64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_handle ()"> |
| <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> handle</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 DBus message. If you're not interacting |
| with DBus, you probably don't need them. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new handle <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_double ()"> |
| <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> floating</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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>floating</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> floating point value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new double <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_string ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a normal C nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_object_path ()"> |
| <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 DBus 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 DBus 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td> |
| <td>a normal C nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new object path <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_is_object_path ()"> |
| <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 DBus object path. You |
| should ensure that a string is a valid DBus 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][a-z][0-9]_". No sequence |
| (including the one following the final '/' character) may be empty. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a normal C nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 DBus object path |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_signature ()"> |
| <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 DBus 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 DBus 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>signature</code></em> :</span></p></td> |
| <td>a normal C nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new signature <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_is_signature ()"> |
| <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 DBus type signature. You |
| should ensure that a string is a valid DBus object path 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> |
| DBus 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a normal C nul-terminated string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 DBus type signature |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_variant ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <span class="type">GVariance</span> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new variant <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_strv ()"> |
| <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 not -1 then it gives the maximum length of <em class="parameter"><code>strv</code></em>. In |
| any case, a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer in <em class="parameter"><code>strv</code></em> is taken as a terminator. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>strv</code></em> :</span></p></td> |
| <td>an array of strings |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>the length of <em class="parameter"><code>strv</code></em>, or -1 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_boolean ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a boolean <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_byte ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a byte <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guchar" title="guchar"><span class="type">guchar</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_int16 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a int16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint16" title="gint16"><span class="type">gint16</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_uint16 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a uint16 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint16" title="guint16"><span class="type">guint16</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_int32 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a int32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_uint32 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a uint32 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_int64 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a int64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_uint64 ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a uint64 <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#guint64" title="guint64"><span class="type">guint64</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_handle ()"> |
| <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 DBus message. If you're not interacting |
| with DBus, you probably don't need them. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a handle <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gint32" title="gint32"><span class="type">gint32</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_double ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a double <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_string ()"> |
| <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> |
| 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>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 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the constant string |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_dup_string ()"> |
| <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 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a string <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>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 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a newly allocated string |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_variant ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a variant <span class="type">GVariance</span> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the item contained in the variant |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_strv ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>an array of constant strings |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_dup_strv ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>an array of strings <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td> |
| <td>the length of the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>an array of constant strings |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_maybe ()"> |
| <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>value</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>value</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>type</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>. 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 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>type</code></em> must be the type of <em class="parameter"><code>value</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>child_type</code></em> :</span></p></td> |
| <td>the <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> of the child |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td> |
| <td>the child value, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> maybe instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_array ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>child_type</code></em> :</span></p></td> |
| <td>the element type of the new array |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>children</code></em> :</span></p></td> |
| <td>an array of <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> pointers, the children |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n_children</code></em> :</span></p></td> |
| <td>the length of <em class="parameter"><code>children</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> array |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_tuple ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>children</code></em> :</span></p></td> |
| <td>the items to make the tuple out of |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n_children</code></em> :</span></p></td> |
| <td>the length of <em class="parameter"><code>children</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> tuple |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_dict_entry ()"> |
| <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>. |
| </p> |
| <p> |
| <em class="parameter"><code>key</code></em> must be a value of a basic type (ie: not a container). |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td> |
| <td>a basic <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, the key |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a>, the value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new dictionary entry <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_maybe ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a maybe-typed value |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_n_children ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the number of children in the container |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_child_value ()"> |
| <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> |
| This function is O(1). |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>index_</code></em> :</span></p></td> |
| <td>the index of the child to fetch |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the child at the specified index |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_child ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>index_</code></em> :</span></p></td> |
| <td>the index of the child to deconstruct |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>arguments, as per <em class="parameter"><code>format_string</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_fixed_array ()"> |
| <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. For |
| example, if calling this function for an array of 32 bit integers, |
| you might say <code class="code">sizeof (gint32)</code>. This value isn't used |
| except for the purpose of a double-check that the form of the |
| seralised 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> array with fixed-sized elements |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>n_elements</code></em> :</span></p></td> |
| <td>a pointer to the location to store the number of items |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>element_size</code></em> :</span></p></td> |
| <td>the size of each element |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a pointer to the fixed array |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_size ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the serialised size of <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_data ()"> |
| <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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_store ()"> |
| <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 |
| <code class="function">g_variant_normalise()</code> for a solution. |
| </p> |
| <p> |
| This function is approximately O(n) in the size of <em class="parameter"><code>data</code></em>. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>the <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> to store |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td> |
| <td>the location to store the serialised data at |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_from_data ()"> |
| <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> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>a definite <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td> |
| <td>the serialised data |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td> |
| <td>the size of <em class="parameter"><code>data</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>trusted</code></em> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td> |
| <td>function to call when <em class="parameter"><code>data</code></em> is no longer needed |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td> |
| <td>data for <em class="parameter"><code>notify</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_byteswap ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the byteswapped form of <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_get_normal_form ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a trusted <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_is_normal_form ()"> |
| <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 <code class="function">g_variant_create_from_data()</code> 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_hash ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a hash value corresponding to <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_equal ()"> |
| <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>one</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>two</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_print ()"> |
| <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> |
| 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type_annotate</code></em> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a newly-allocated string holding the result. |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_print_string ()"> |
| <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="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="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="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="GString"><span class="type">GString</span></a> is allocated and it is returned. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-Strings.html#GString" title="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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type_annotate</code></em> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-Strings.html#GString" title="GString"><span class="type">GString</span></a> containing the string |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="GVariantIter"> |
| <a name="GVariantIter"></a><h3>GVariantIter</h3> |
| <pre class="programlisting">typedef struct { |
| } GVariantIter; |
| </pre> |
| <p> |
| <a class="link" href="glib-GVariant.html#GVariantIter" title="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" title="g_variant_iter_copy ()"> |
| <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="GVariantIter"><span class="returnvalue">GVariantIter</span></a> * g_variant_iter_copy (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantIter" title="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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_free ()"> |
| <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="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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr></tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_init ()"> |
| <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="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="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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a pointer to a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the number of items in <em class="parameter"><code>value</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_n_children ()"> |
| <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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>the number of children in the container |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_new ()"> |
| <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="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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a container <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new heap-allocated <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_next_value ()"> |
| <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="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> |
| </p> |
| <div class="example"> |
| <a name="id885269"></a><p class="title"><b>Example 23. 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></b></p> |
| <div class="example-contents"> |
| <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="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span><span class="normal">container</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariantIter">GVariantIter</a> iter</span><span class="symbol">;</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariant">GVariant</a> </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">(&</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="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">(&</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> |
| |
| </div> |
| <p><br class="example-break"> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_next ()"> |
| <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="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> |
| </p> |
| <div class="example"> |
| <a name="id885485"></a><p class="title"><b>Example 24. 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></b></p> |
| <div class="example-contents"> |
| <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="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span><span class="normal">dictionary</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariantIter">GVariantIter</a> iter</span><span class="symbol">;</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span> |
| <span class="normal"> <a href="glib-Basic-Types.html#gchar">gchar</a> </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">(&</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">(&</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">&</span><span class="normal">key</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</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> |
| |
| </div> |
| <p><br class="example-break"> |
| </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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a GVariant format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to unpack the value into |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_iter_loop ()"> |
| <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="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 is not recommended. |
| </p> |
| <p> |
| </p> |
| <div class="example"> |
| <a name="id885784"></a><p class="title"><b>Example 25. 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></b></p> |
| <div class="example-contents"> |
| <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="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="normal"><a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span><span class="normal">dictionary</span><span class="symbol">)</span> |
| <span class="cbracket">{</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariantIter">GVariantIter</a> iter</span><span class="symbol">;</span> |
| <span class="normal"> <a href="glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span> |
| <span class="normal"> <a href="glib-Basic-Types.html#gchar">gchar</a> </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">(&</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">(&</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">&</span><span class="normal">key</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</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="cbracket">}</span> |
| <span class="cbracket">}</span></pre></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| |
| </div> |
| <p><br class="example-break"> |
| </p> |
| <p> |
| If you want a slightly less magical alternative that requires more |
| typing, see <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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantIter" title="GVariantIter"><span class="type">GVariantIter</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a GVariant format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>the arguments to unpack the value into |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td> |
| <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 |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="GVariantBuilder"> |
| <a name="GVariantBuilder"></a><h3>GVariantBuilder</h3> |
| <pre class="programlisting">typedef 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="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" title="g_variant_builder_unref ()"> |
| <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="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="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="GVariantBuilder"><span class="type">GVariantBuilder</span></a> instances or bad |
| things will happen. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="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> |
| </td> |
| </tr></tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_ref ()"> |
| <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="GVariantBuilder"><span class="returnvalue">GVariantBuilder</span></a> * g_variant_builder_ref (<em class="parameter"><code><a class="link" href="glib-GVariant.html#GVariantBuilder" title="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="GVariantBuilder"><span class="type">GVariantBuilder</span></a> instances or bad |
| things will happen. |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new reference to <em class="parameter"><code>builder</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_new ()"> |
| <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="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="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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>a container type |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_init ()"> |
| <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="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="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="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="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="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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>a container type |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_clear ()"> |
| <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="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="GVariantBuilder"><span class="type">GVariantBuilder</span></a> without |
| freeing the <a class="link" href="glib-GVariant.html#GVariantBuilder" title="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="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 |
| <code class="function">g_variant_builder_free()</code> for that). |
| </p> |
| <p> |
| This function leaves the <a class="link" href="glib-GVariant.html#GVariantBuilder" title="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="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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr></tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_add_value ()"> |
| <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="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> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_add ()"> |
| <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="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="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> |
| This function might be used as follows: |
| </p> |
| <p> |
| </p> |
| <pre class="programlisting"> |
| GVariant * |
| make_pointless_dictionary (void) |
| { |
| GVariantBuilder *builder; |
| int i; |
| |
| builder = g_variant_builder_new (G_VARIANT_TYPE_CLASS_ARRAY, |
| NULL); |
| for (i = 0; i < 16; i++) |
| { |
| gchar buf[3]; |
| |
| sprintf (buf, "%d", i); |
| g_variant_builder_add (builder, "{is}", i, buf); |
| } |
| |
| return g_variant_builder_end (builder); |
| } |
| </pre> |
| <p> |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format_string</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> varargs format string |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>arguments, as per <em class="parameter"><code>format_string</code></em> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_end ()"> |
| <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="GVariantBuilder"><span class="type">GVariantBuilder</span></a> *builder</code></em>);</pre> |
| <p> |
| Ends the builder process and returns the constructed value. |
| </p> |
| <p> |
| This call automatically reduces the reference count on <em class="parameter"><code>builder</code></em> by |
| one, unless it has previously had <code class="function">g_variant_builder_no_autofree()</code> |
| called on it. Unless you've taken other actions, this is usually |
| sufficient to free <em class="parameter"><code>builder</code></em>. |
| </p> |
| <p> |
| Even if additional references are held, it is not permissible to use |
| <em class="parameter"><code>builder</code></em> in any way after this call except for further reference |
| counting operations. |
| </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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new, floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_open ()"> |
| <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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariantType.html#GVariantType" title="GVariantType"><span class="type">GVariantType</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_builder_close ()"> |
| <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="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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody><tr> |
| <td><p><span class="term"><em class="parameter"><code>builder</code></em> :</span></p></td> |
| <td>a <a class="link" href="glib-GVariant.html#GVariantBuilder" title="GVariantBuilder"><span class="type">GVariantBuilder</span></a> |
| </td> |
| </tr></tbody> |
| </table></div> |
| <p class="since">Since 2.24</p> |
| </div> |
| <hr> |
| <div class="refsect2" title="G_VARIANT_PARSE_ERROR"> |
| <a name="G-VARIANT-PARSE-ERROR:CAPS"></a><h3>G_VARIANT_PARSE_ERROR</h3> |
| <pre class="programlisting">#define G_VARIANT_PARSE_ERROR (g_variant_parser_get_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="GError"><span class="type">GError</span></a> for |
| information on error domains. |
| </p> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_parse ()"> |
| <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="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 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. |
| </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 occured. |
| </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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td> |
| <td>a string containing a GVariant in text form |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>limit</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>endptr</code></em> :</span></p></td> |
| <td>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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td> |
| <td>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="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> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a 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> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_parsed_va ()"> |
| <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> |
| 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="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>app</code></em> :</span></p></td> |
| <td>a pointer to a <span class="type">va_list</span> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new, usually floating, <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <hr> |
| <div class="refsect2" title="g_variant_new_parsed ()"> |
| <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 extention: 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> |
| Consider this simple example: |
| </p> |
| <p> |
| </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 <code class="code">[('one', 1), ('two', 2), ('three', 3)]</code>. |
| </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 "%*", "%?", "<code class="literal">r</code>", or anything starting |
| with "%@". |
| </p> |
| <div class="variablelist"><table border="0"> |
| <col align="left" valign="top"> |
| <tbody> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td> |
| <td>a text format <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td> |
| <td>arguments as per <em class="parameter"><code>format</code></em> |
| </td> |
| </tr> |
| <tr> |
| <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| <td>a new floating <a class="link" href="glib-GVariant.html#GVariant" title="GVariant"><span class="type">GVariant</span></a> instance |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <div class="refsect1" title="See Also"> |
| <a name="glib-GVariant.see-also"></a><h2>See Also</h2> |
| GVariantType |
| </div> |
| </div> |
| <div class="footer"> |
| <hr> |
| Generated by GTK-Doc V1.14</div> |
| </body> |
| </html> |