123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title><GVariantType>: </title>
- <meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
- <link rel="home" href="index.html" title="">
- <link rel="up" href="ch01.html" title="GLib">
- <link rel="prev" href="re87.html" title="<%GLibVariantParseError>">
- <link rel="next" href="re89.html" title="Functions">
- <meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
- <link rel="stylesheet" href="style.css" type="text/css">
- </head>
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
- <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
- <td width="100%" align="left" class="shortcuts"></td>
- <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
- <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
- <td><a accesskey="p" href="re87.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
- <td><a accesskey="n" href="re89.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
- </tr></table>
- <div class="refentry">
- <a name="id-1.1.89"></a><div class="titlepage"></div>
- <div class="refnamediv">
- <h2><GVariantType></h2>
- <p><GVariantType></p>
- </div>
- <div class="refsect1">
- <a name="id-1.1.89.2"></a><h2>Description</h2>
- <p>This section introduces the GVariant type system. It is based, in
- large part, on the D-Bus type system, with two major changes and
- some minor lifting of restrictions. The
- [D-Bus specification](http://dbus.freedesktop.org/doc/dbus-specification.html),
- therefore, provides a significant amount of
- information that is useful when working with GVariant.
- </p>
- <p>The first major change with respect to the D-Bus type system is the
- introduction of maybe (or "nullable") types. Any type in GVariant can be
- converted to a maybe type, in which case, "nothing" (or "null") becomes a
- valid value. Maybe types have been added by introducing the
- character "m" to type strings.
- </p>
- <p>The second major change is that the GVariant type system supports the
- concept of "indefinite types" -- types that are less specific than
- the normal types found in D-Bus. For example, it is possible to speak
- of "an array of any type" in GVariant, where the D-Bus type system
- would require you to speak of "an array of integers" or "an array of
- strings". Indefinite types have been added by introducing the
- characters "*", "?" and "r" to type strings.
- </p>
- <p>Finally, all arbitrary restrictions relating to the complexity of
- types are lifted along with the restriction that dictionary entries
- may only appear nested inside of arrays.
- </p>
- <p>Just as in D-Bus, GVariant types are described with strings ("type
- strings"). Subject to the differences mentioned above, these strings
- are of the same form as those found in DBus. Note, however: D-Bus
- always works in terms of messages and therefore individual type
- strings appear nowhere in its interface. Instead, "signatures"
- are a concatenation of the strings of the type of each argument in a
- message. GVariant deals with single values directly so GVariant type
- strings always describe the type of exactly one value. This means
- that a D-Bus signature string is generally not a valid GVariant type
- string -- except in the case that it is the signature of a message
- containing exactly one argument.
- </p>
- <p>An indefinite type is similar in spirit to what may be called an
- abstract type in other type systems. No value can exist that has an
- indefinite type as its type, but values can exist that have types
- that are subtypes of indefinite types. That is to say,
- <code class="function">g_variant_get_type()</code> will never return an indefinite type, but
- calling <code class="function">g_variant_is_of_type()</code> with an indefinite type may return
- <code class="constant">TRUE</code>. For example, you cannot have a value that represents "an
- array of no particular type", but you can have an "array of integers"
- which certainly matches the type of "an array of no particular type",
- since "array of integers" is a subtype of "array of no particular
- type".
- </p>
- <p>This is similar to how instances of abstract classes may not
- directly exist in other type systems, but instances of their
- non-abstract subtypes may. For example, in GTK, no object that has
- the type of <span class="type">GtkBin</span> can exist (since <span class="type">GtkBin</span> is an abstract class),
- but a <span class="type">GtkWindow</span> can certainly be instantiated, and you would say
- that the <span class="type">GtkWindow</span> is a <span class="type">GtkBin</span> (since <span class="type">GtkWindow</span> is a subclass of
- <span class="type">GtkBin</span>).
- </p>
- <div class="refsect2">
- <a name="id-1.1.89.2.9"></a><h3>GVariant Type Strings</h3>
- <p>A GVariant type string can be any of the following:
- </p>
- <p>- any basic type string (listed below)
- </p>
- <p>- "v", "r" or "*"
- </p>
- <p>- one of the characters 'a' or 'm', followed by another type string
- </p>
- <p>- the character '(', followed by a concatenation of zero or more other
- type strings, followed by the character ')'
- </p>
- <p>- the character '{', followed by a basic type string (see below),
- followed by another type string, followed by the character '}'
- </p>
- <p>A basic type string describes a basic type (as per
- <code class="function">g_variant_type_is_basic()</code>) and is always a single character in length.
- The valid basic type strings are "b", "y", "n", "q", "i", "u", "x", "t",
- "h", "d", "s", "o", "g" and "?".
- </p>
- <p>The above definition is recursive to arbitrary depth. "aaaaai" and
- "(ui(nq((y)))s)" are both valid type strings, as is
- "a(aa(ui)(qna{ya(yd)}))". In order to not hit memory limits, <span class="type">GVariant</span>
- imposes a limit on recursion depth of 65 nested containers. This is the
- limit in the D-Bus specification (64) plus one to allow a <span class="type">GDBusMessage</span> to
- be nested in a top-level tuple.
- </p>
- <p>The meaning of each of the characters is as follows:
- - <code class="code">b</code>: the type string of <code class="constant">G_VARIANT_TYPE_BOOLEAN</code>; a boolean value.
- - <code class="code">y</code>: the type string of <code class="constant">G_VARIANT_TYPE_BYTE</code>; a byte.
- - <code class="code">n</code>: the type string of <code class="constant">G_VARIANT_TYPE_INT16</code>; a signed 16 bit integer.
- - <code class="code">q</code>: the type string of <code class="constant">G_VARIANT_TYPE_UINT16</code>; an unsigned 16 bit integer.
- - <code class="code">i</code>: the type string of <code class="constant">G_VARIANT_TYPE_INT32</code>; a signed 32 bit integer.
- - <code class="code">u</code>: the type string of <code class="constant">G_VARIANT_TYPE_UINT32</code>; an unsigned 32 bit integer.
- - <code class="code">x</code>: the type string of <code class="constant">G_VARIANT_TYPE_INT64</code>; a signed 64 bit integer.
- - <code class="code">t</code>: the type string of <code class="constant">G_VARIANT_TYPE_UINT64</code>; an unsigned 64 bit integer.
- - <code class="code">h</code>: the type string of <code class="constant">G_VARIANT_TYPE_HANDLE</code>; a signed 32 bit value
- that, by convention, is used as an index into an array of file
- descriptors that are sent alongside a D-Bus message.
- - <code class="code">d</code>: the type string of <code class="constant">G_VARIANT_TYPE_DOUBLE</code>; a double precision
- floating point value.
- - <code class="code">s</code>: the type string of <code class="constant">G_VARIANT_TYPE_STRING</code>; a string.
- - <code class="code">o</code>: the type string of <code class="constant">G_VARIANT_TYPE_OBJECT_PATH</code>; a string in the form
- of a D-Bus object path.
- - <code class="code">g</code>: the type string of <code class="constant">G_VARIANT_TYPE_SIGNATURE</code>; a string in the form of
- a D-Bus type signature.
- - <code class="code">?</code>: the type string of <code class="constant">G_VARIANT_TYPE_BASIC</code>; an indefinite type that
- is a supertype of any of the basic types.
- - <code class="code">v</code>: the type string of <code class="constant">G_VARIANT_TYPE_VARIANT</code>; a container type that
- contain any other type of value.
- - <code class="code">a</code>: used as a prefix on another type string to mean an array of that
- type; the type string "ai", for example, is the type of an array of
- signed 32-bit integers.
- - <code class="code">m</code>: used as a prefix on another type string to mean a "maybe", or
- "nullable", version of that type; the type string "ms", for example,
- is the type of a value that maybe contains a string, or maybe contains
- nothing.
- - <code class="code">()</code>: used to enclose zero or more other concatenated type strings to
- create a tuple type; the type string "(is)", for example, is the type of
- a pair of an integer and a string.
- - <code class="code">r</code>: the type string of <code class="constant">G_VARIANT_TYPE_TUPLE</code>; an indefinite type that is
- a supertype of any tuple type, regardless of the number of items.
- - <code class="code">{}</code>: used to enclose a basic type string concatenated with another type
- string to create a dictionary entry type, which usually appears inside of
- an array to form a dictionary; the type string "a{sd}", for example, is
- the type of a dictionary that maps strings to double precision floating
- point values.
- </p>
- <p>The first type (the basic type) is the key type and the second type is
- the value type. The reason that the first type is restricted to being a
- basic type is so that it can easily be hashed.
- - <code class="code">*</code>: the type string of <code class="constant">G_VARIANT_TYPE_ANY</code>; the indefinite type that is
- a supertype of all types. Note that, as with all type strings, this
- character represents exactly one type. It cannot be used inside of tuples
- to mean "any number of items".
- </p>
- <p>Any type string of a container that contains an indefinite type is,
- itself, an indefinite type. For example, the type string "a*"
- (corresponding to <code class="constant">G_VARIANT_TYPE_ARRAY</code>) is an indefinite type
- that is a supertype of every array type. "(*s)" is a supertype
- of all tuples that contain exactly two items where the second
- item is a string.
- </p>
- <p>"a{?*}" is an indefinite type that is a supertype of all arrays
- containing dictionary entries where the key is any basic type and
- the value is any type at all. This is, by definition, a dictionary,
- so this type string corresponds to <code class="constant">G_VARIANT_TYPE_DICTIONARY</code>. Note
- that, due to the restriction that the key of a dictionary entry must
- be a basic type, "{**}" is not a valid type string.</p>
- </div>
- </div>
- <div class="refsect1">
- <a name="id-1.1.89.3"></a><h2>Functions</h2>
- <div class="refsect2">
- <a name="id-1.1.89.3.2"></a><h3>copy</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:copy self))
- </pre></div>
- <p>Makes a copy of a <span class="type">GVariantType</span>. It is appropriate to call
- <code class="function">g_variant_type_free()</code> on the return value. <em class="parameter"><code>type</code></em> may not be <code class="constant">NULL</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.2.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.3"></a><h3>dup-string</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:dup-string self))
- </pre></div>
- <p>Returns a newly-allocated copy of the type string corresponding to
- <em class="parameter"><code>type</code></em>. The returned string is nul-terminated. It is appropriate to
- call <code class="function">g_free()</code> on the return value.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.3.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.4"></a><h3>element</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:element self))
- </pre></div>
- <p>Determines the element type of an array or maybe type.
- </p>
- <p>This function may only be used with array or maybe types.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.4.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>an array or maybe <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.5"></a><h3>equal?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:equal? self type2))
- </pre></div>
- <p>Compares <em class="parameter"><code>type1</code></em> and <em class="parameter"><code>type2</code></em> for equality.
- </p>
- <p>Only returns <code class="constant">TRUE</code> if the types are exactly equal. Even if one type
- is an indefinite type and the other is a subtype of it, <code class="constant">FALSE</code> will
- be returned if they are not exactly equal. If you want to check for
- subtypes, use <code class="function">g_variant_type_is_subtype_of()</code>.
- </p>
- <p>The argument types of <em class="parameter"><code>type1</code></em> and <em class="parameter"><code>type2</code></em> are only <span class="type">gconstpointer</span> to
- allow use with <span class="type">GHashTable</span> without function pointer casting. For
- both arguments, a valid <span class="type">GVariantType</span> must be provided.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.5.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>type1</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>type2</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">type2</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.6"></a><h3>first</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:first self))
- </pre></div>
- <p>Determines the first item type of a tuple or dictionary entry
- type.
- </p>
- <p>This function may only be used with tuple or dictionary entry types,
- but must not be used with the generic tuple type
- <code class="constant">G_VARIANT_TYPE_TUPLE</code>.
- </p>
- <p>In the case of a dictionary entry type, this returns the type of
- the key.
- </p>
- <p><code class="constant">NULL</code> is returned in case of <em class="parameter"><code>type</code></em> being <code class="constant">G_VARIANT_TYPE_UNIT</code>.
- </p>
- <p>This call, together with <code class="function">g_variant_type_next()</code> provides an iterator
- interface over tuple and dictionary entry types.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.6.8"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a tuple or dictionary entry <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.7"></a><h3>free</h3>
- <div class="informalexample"><pre class="programlisting">(define-values () (variant-type:free self))
- </pre></div>
- <p>Frees a <span class="type">GVariantType</span> that was allocated with
- <code class="function">g_variant_type_copy()</code>, <code class="function">g_variant_type_new()</code> or one of the container
- type constructor functions.
- </p>
- <p>In the case that <em class="parameter"><code>type</code></em> is <code class="constant">NULL</code>, this function does nothing.
- </p>
- <p>Since 2.24</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.7.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span>, or <code class="constant">NULL</code></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.8"></a><h3>get-string-length</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:get-string-length self))
- </pre></div>
- <p>Returns the length of the type string corresponding to the given
- <em class="parameter"><code>type</code></em>. This function must be used to determine the valid extent of
- the memory region returned by <code class="function">g_variant_type_peek_string()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.8.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.9"></a><h3>hash</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:hash self))
- </pre></div>
- <p>Hashes <em class="parameter"><code>type</code></em>.
- </p>
- <p>The argument type of <em class="parameter"><code>type</code></em> is only <span class="type">gconstpointer</span> to allow use with
- <span class="type">GHashTable</span> without function pointer casting. A valid
- <span class="type">GVariantType</span> must be provided.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.9.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.10"></a><h3>is-array?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-array? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is an array type. This is true if the
- type string for <em class="parameter"><code>type</code></em> starts with an 'a'.
- </p>
- <p>This function returns <code class="constant">TRUE</code> for any indefinite type for which every
- definite subtype is an array type -- <code class="constant">G_VARIANT_TYPE_ARRAY</code>, for
- example.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.10.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.11"></a><h3>is-basic?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-basic? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is a basic type.
- </p>
- <p>Basic types are booleans, bytes, integers, doubles, strings, object
- paths and signatures.
- </p>
- <p>Only a basic type may be used as the key of a dictionary entry.
- </p>
- <p>This function returns <code class="constant">FALSE</code> for all indefinite types except
- <code class="constant">G_VARIANT_TYPE_BASIC</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.11.7"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.12"></a><h3>is-container?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-container? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is a container type.
- </p>
- <p>Container types are any array, maybe, tuple, or dictionary
- entry types plus the variant type.
- </p>
- <p>This function returns <code class="constant">TRUE</code> for any indefinite type for which every
- definite subtype is a container -- <code class="constant">G_VARIANT_TYPE_ARRAY</code>, for
- example.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.12.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.13"></a><h3>is-definite?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-definite? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is definite (ie: not indefinite).
- </p>
- <p>A type is definite if its type string does not contain any indefinite
- type characters ('*', '?', or 'r').
- </p>
- <p>A <span class="type">GVariant</span> instance may not have an indefinite type, so calling
- this function on the result of <code class="function">g_variant_get_type()</code> will always
- result in <code class="constant">TRUE</code> being returned. Calling this function on an
- indefinite type like <code class="constant">G_VARIANT_TYPE_ARRAY</code>, however, will result in
- <code class="constant">FALSE</code> being returned.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.13.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.14"></a><h3>is-dict-entry?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-dict-entry? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is a dictionary entry type. This is
- true if the type string for <em class="parameter"><code>type</code></em> starts with a '{'.
- </p>
- <p>This function returns <code class="constant">TRUE</code> for any indefinite type for which every
- definite subtype is a dictionary entry type --
- <code class="constant">G_VARIANT_TYPE_DICT_ENTRY</code>, for example.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.14.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.15"></a><h3>is-maybe?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-maybe? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is a maybe type. This is true if the
- type string for <em class="parameter"><code>type</code></em> starts with an 'm'.
- </p>
- <p>This function returns <code class="constant">TRUE</code> for any indefinite type for which every
- definite subtype is a maybe type -- <code class="constant">G_VARIANT_TYPE_MAYBE</code>, for
- example.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.15.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.16"></a><h3>is-subtype-of?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-subtype-of? self supertype))
- </pre></div>
- <p>Checks if <em class="parameter"><code>type</code></em> is a subtype of <em class="parameter"><code>supertype</code></em>.
- </p>
- <p>This function returns <code class="constant">TRUE</code> if <em class="parameter"><code>type</code></em> is a subtype of <em class="parameter"><code>supertype</code></em>. All
- types are considered to be subtypes of themselves. Aside from that,
- only indefinite types can have subtypes.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.16.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>supertype</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">supertype</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.17"></a><h3>is-tuple?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-tuple? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is a tuple type. This is true if the
- type string for <em class="parameter"><code>type</code></em> starts with a '(' or if <em class="parameter"><code>type</code></em> is
- <code class="constant">G_VARIANT_TYPE_TUPLE</code>.
- </p>
- <p>This function returns <code class="constant">TRUE</code> for any indefinite type for which every
- definite subtype is a tuple type -- <code class="constant">G_VARIANT_TYPE_TUPLE</code>, for
- example.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.17.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.18"></a><h3>is-variant?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:is-variant? self))
- </pre></div>
- <p>Determines if the given <em class="parameter"><code>type</code></em> is the variant type.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.18.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.19"></a><h3>key</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:key self))
- </pre></div>
- <p>Determines the key type of a dictionary entry type.
- </p>
- <p>This function may only be used with a dictionary entry type. Other
- than the additional restriction, this call is equivalent to
- <code class="function">g_variant_type_first()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.19.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a dictionary entry <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.20"></a><h3>n-items</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:n-items self))
- </pre></div>
- <p>Determines the number of items contained in a tuple or
- dictionary entry type.
- </p>
- <p>This function may only be used with tuple or dictionary entry types,
- but must not be used with the generic tuple type
- <code class="constant">G_VARIANT_TYPE_TUPLE</code>.
- </p>
- <p>In the case of a dictionary entry type, this function will always
- return 2.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.20.6"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a tuple or dictionary entry <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.21"></a><h3>next</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:next self))
- </pre></div>
- <p>Determines the next item type of a tuple or dictionary entry
- type.
- </p>
- <p><em class="parameter"><code>type</code></em> must be the result of a previous call to
- <code class="function">g_variant_type_first()</code> or <code class="function">g_variant_type_next()</code>.
- </p>
- <p>If called on the key type of a dictionary entry then this call
- returns the value type. If called on the value type of a dictionary
- entry then this call returns <code class="constant">NULL</code>.
- </p>
- <p>For tuples, <code class="constant">NULL</code> is returned when <em class="parameter"><code>type</code></em> is the last item in a tuple.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.21.7"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a <span class="type">GVariantType</span> from a previous call</p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.22"></a><h3>value</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:value self))
- </pre></div>
- <p>Determines the value type of a dictionary entry type.
- </p>
- <p>This function may only be used with a dictionary entry type.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.22.5"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type</p></td>
- <td class="parameter_description">
- <p>a dictionary entry <span class="type">GVariantType</span></p>
- <p>Passed as <code class="code">self</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.23"></a><h3>variant-type:new-tuple</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:new-tuple items))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.23.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>items</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">items</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>length</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Inferred from <code class="code">items</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.24"></a><h3>variant-type:new-maybe</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:new-maybe element))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.24.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>element</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">element</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.25"></a><h3>variant-type:new-dict-entry</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:new-dict-entry key value))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.25.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>key</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">key</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>value</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">value</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.26"></a><h3>variant-type:new-array</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:new-array element))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.26.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>element</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">element</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.27"></a><h3>variant-type:new</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:new type-string))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.27.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type_string</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">type-string</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.28"></a><h3>variant-type:checked-</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:checked- arg0))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.28.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>arg0</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">arg0</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.29"></a><h3>variant-type:string-get-depth-</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:string-get-depth- type-string))
- </pre></div>
- <p>Undocumented</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.29.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type_string</p></td>
- <td class="parameter_description">
- <p></p>
- <p>Passed as <code class="code">type-string</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.30"></a><h3>variant-type:string-is-valid?</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return) (variant-type:string-is-valid? type-string))
- </pre></div>
- <p>Checks if <em class="parameter"><code>type_string</code></em> is a valid GVariant type string. This call is
- equivalent to calling <code class="function">g_variant_type_string_scan()</code> and confirming
- that the following character is a nul terminator.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.30.4"></a><h4>Parameters</h4>
- <div class="informaltable"><table><tr>
- <td class="parameter_name"><p>type_string</p></td>
- <td class="parameter_description">
- <p>a pointer to any string</p>
- <p>Passed as <code class="code">type-string</code></p>
- </td>
- </tr></table></div>
- </div>
- </div>
- <div class="refsect2">
- <a name="id-1.1.89.3.31"></a><h3>variant-type:string-scan</h3>
- <div class="informalexample"><pre class="programlisting">(define-values (%return endptr) (variant-type:string-scan string limit))
- </pre></div>
- <p>Scan for a single complete and valid GVariant type string in <em class="parameter"><code>string</code></em>.
- The memory pointed to by <em class="parameter"><code>limit</code></em> (or bytes beyond it) is never
- accessed.
- </p>
- <p>If a valid type string is found, <em class="parameter"><code>endptr</code></em> is updated to point to the
- first character past the end of the string that was found and <code class="constant">TRUE</code>
- is returned.
- </p>
- <p>If there is no valid type string starting at <em class="parameter"><code>string</code></em>, or if the type
- string does not end before <em class="parameter"><code>limit</code></em> then <code class="constant">FALSE</code> is returned.
- </p>
- <p>For the simple case of checking if a string is a valid type string,
- see <code class="function">g_variant_type_string_is_valid()</code>.</p>
- <div class="refsect3">
- <a name="id-1.1.89.3.31.7"></a><h4>Parameters</h4>
- <div class="informaltable"><table>
- <tr>
- <td class="parameter_name"><p>string</p></td>
- <td class="parameter_description">
- <p>a pointer to any string</p>
- <p>Passed as <code class="code">string</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>limit</p></td>
- <td class="parameter_description">
- <p>the end of <em class="parameter"><code>string</code></em>, or <code class="constant">NULL</code></p>
- <p>Passed as <code class="code">limit</code></p>
- </td>
- </tr>
- <tr>
- <td class="parameter_name"><p>endptr</p></td>
- <td class="parameter_description">
- <p>location to store the end pointer, or <code class="constant">NULL</code></p>
- <p>Passed as <code class="code">endptr</code></p>
- </td>
- </tr>
- </table></div>
- </div>
- </div>
- </div>
- </div>
- <div class="footer">
- <hr>Generated by GTK-Doc V1.33.1</div>
- </body>
- </html>
|