~ubuntu-branches/debian/jessie/glib2.0/jessie

« back to all changes in this revision

Viewing changes to docs/reference/glib/html/gvariant-format-strings.html

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-09-23 10:12:15 UTC
  • mto: This revision was merged to the branch mainline in revision 120.
  • Revision ID: package-import@ubuntu.com-20140923101215-kg4894xy8gz996q1
Tags: upstream-2.42.0
ImportĀ upstreamĀ versionĀ 2.42.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
496
496
16
497
497
17
498
498
18</pre></td>
499
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value3</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value4</span><span class="symbol">;</span>
500
 
 
501
 
<span class="normal">value1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"y"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">200</span><span class="symbol">);</span>
502
 
<span class="normal">value2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"b"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">);</span>
503
 
<span class="normal">value3 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"d"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">37.5</span><span class="symbol">):</span>
504
 
<span class="normal">value4 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"x"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-Basic-Types.html#G-GINT64-CONSTANT:CAPS">G_GINT64_CONSTANT</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">998877665544332211</span><span class="symbol">));</span>
505
 
 
506
 
<span class="cbracket">{</span>
507
 
<span class="normal">  </span><span class="usertype">gdouble</span><span class="normal"> floating</span><span class="symbol">;</span>
508
 
<span class="normal">  </span><span class="usertype">gboolean</span><span class="normal"> truth</span><span class="symbol">;</span>
509
 
<span class="normal">  </span><span class="usertype">gint64</span><span class="normal"> bignum</span><span class="symbol">;</span>
510
 
 
511
 
 
512
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"y"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal">      </span><span class="comment">/* ignore the value. */</span>
513
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"b"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">truth</span><span class="symbol">);</span>
514
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value3</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"d"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">floating</span><span class="symbol">);</span>
515
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value4</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"x"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">bignum</span><span class="symbol">);</span>
516
 
<span class="cbracket">}</span></pre></td>
 
499
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>value1<span class="gtkdoc opt">, *</span>value2<span class="gtkdoc opt">, *</span>value3<span class="gtkdoc opt">, *</span>value4<span class="gtkdoc opt">;</span>
 
500
 
 
501
value1 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;y&quot;</span><span class="gtkdoc opt">,</span> <span class="number">200</span><span class="gtkdoc opt">);</span>
 
502
value2 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;b&quot;</span><span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">);</span>
 
503
value3 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;d&quot;</span><span class="gtkdoc opt">,</span> <span class="number">37.5</span><span class="gtkdoc opt">):</span>
 
504
value4 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;x&quot;</span><span class="gtkdoc opt">,</span> <span class="function"><a href="glib-Basic-Types.html#G-GINT64-CONSTANT:CAPS">G_GINT64_CONSTANT</a></span> <span class="gtkdoc opt">(</span><span class="number">998877665544332211</span><span class="gtkdoc opt">));</span>
 
505
 
 
506
<span class="gtkdoc opt">{</span>
 
507
  gdouble floating<span class="gtkdoc opt">;</span>
 
508
  gboolean truth<span class="gtkdoc opt">;</span>
 
509
  gint64 bignum<span class="gtkdoc opt">;</span>
 
510
 
 
511
 
 
512
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value1<span class="gtkdoc opt">,</span> <span class="string">&quot;y&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>      <span class="comment">/* ignore the value. */</span>
 
513
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value2<span class="gtkdoc opt">,</span> <span class="string">&quot;b&quot;</span><span class="gtkdoc opt">, &amp;</span>truth<span class="gtkdoc opt">);</span>
 
514
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value3<span class="gtkdoc opt">,</span> <span class="string">&quot;d&quot;</span><span class="gtkdoc opt">, &amp;</span>floating<span class="gtkdoc opt">);</span>
 
515
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value4<span class="gtkdoc opt">,</span> <span class="string">&quot;x&quot;</span><span class="gtkdoc opt">, &amp;</span>bignum<span class="gtkdoc opt">);</span>
 
516
<span class="gtkdoc opt">}</span></pre></td>
517
517
      </tr>
518
518
    </tbody>
519
519
  </table>
569
569
15
570
570
16
571
571
17</pre></td>
572
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value3</span><span class="symbol">;</span>
573
 
 
574
 
<span class="normal">value1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"hello world!"</span><span class="symbol">);</span>
575
 
<span class="normal">value2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"o"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"/must/be/a/valid/path"</span><span class="symbol">);</span>
576
 
<span class="normal">value3 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"g"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"iias"</span><span class="symbol">);</span>
577
 
 
578
 
<span class="preproc">#if</span><span class="normal"> </span><span class="number">0</span>
579
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal">      </span><span class="comment">/* not valid: NULL is not a string. */</span>
580
 
<span class="preproc">#endif</span>
581
 
 
582
 
<span class="cbracket">{</span>
583
 
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">result</span><span class="symbol">;</span>
584
 
 
585
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">result</span><span class="symbol">);</span>
586
 
<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">"It was '%s'</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> result</span><span class="symbol">);</span>
587
 
<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">result</span><span class="symbol">);</span>
588
 
<span class="cbracket">}</span></pre></td>
 
572
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>value1<span class="gtkdoc opt">, *</span>value2<span class="gtkdoc opt">, *</span>value3<span class="gtkdoc opt">;</span>
 
573
 
 
574
value1 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;hello world!&quot;</span><span class="gtkdoc opt">);</span>
 
575
value2 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;o&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;/must/be/a/valid/path&quot;</span><span class="gtkdoc opt">);</span>
 
576
value3 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;g&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;iias&quot;</span><span class="gtkdoc opt">);</span>
 
577
 
 
578
<span class="gtkdoc ppc">#if 0</span>
 
579
  <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>      <span class="comment">/* not valid: NULL is not a string. */</span>
 
580
<span class="gtkdoc ppc">#endif</span>
 
581
 
 
582
<span class="gtkdoc opt">{</span>
 
583
  gchar <span class="gtkdoc opt">*</span>result<span class="gtkdoc opt">;</span>
 
584
 
 
585
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value1<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">, &amp;</span>result<span class="gtkdoc opt">);</span>
 
586
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;It was '%s'</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> result<span class="gtkdoc opt">);</span>
 
587
  <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">);</span>
 
588
<span class="gtkdoc opt">}</span></pre></td>
589
589
      </tr>
590
590
    </tbody>
591
591
  </table>
630
630
7
631
631
8
632
632
9</pre></td>
633
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">y</span><span class="symbol">;</span>
 
633
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>x<span class="gtkdoc opt">, *</span>y<span class="gtkdoc opt">;</span>
634
634
 
635
635
<span class="comment">/* the following two lines are equivalent: */</span>
636
 
<span class="normal">x </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"v"</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">);</span>
637
 
<span class="normal">x </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new-variant">g_variant_new_variant</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">y</span><span class="symbol">);</span>
 
636
x <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;v&quot;</span><span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">);</span>
 
637
x <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new-variant">g_variant_new_variant</a></span> <span class="gtkdoc opt">(</span>y<span class="gtkdoc opt">);</span>
638
638
 
639
639
<span class="comment">/* as are these: */</span>
640
 
<span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"v"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">y</span><span class="symbol">);</span>
641
 
<span class="normal">y </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get-variant">g_variant_get_variant</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">);</span></pre></td>
 
640
<span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>x<span class="gtkdoc opt">,</span> <span class="string">&quot;v&quot;</span><span class="gtkdoc opt">, &amp;</span>y<span class="gtkdoc opt">);</span>
 
641
y <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-get-variant">g_variant_get_variant</a></span> <span class="gtkdoc opt">(</span>x<span class="gtkdoc opt">);</span></pre></td>
642
642
      </tr>
643
643
    </tbody>
644
644
  </table>
702
702
20
703
703
21
704
704
22</pre></td>
705
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">builder</span><span class="symbol">;</span>
706
 
<span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span>
707
 
 
708
 
<span class="normal">builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"as"</span><span class="symbol">));</span>
709
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"when"</span><span class="symbol">);</span>
710
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"in"</span><span class="symbol">);</span>
711
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"the"</span><span class="symbol">);</span>
712
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"course"</span><span class="symbol">);</span>
713
 
<span class="normal">value </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"as"</span><span class="symbol">,</span><span class="normal"> builder</span><span class="symbol">);</span>
714
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-unref">g_variant_builder_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">);</span>
715
 
 
716
 
<span class="cbracket">{</span>
717
 
<span class="normal">  </span><span class="usertype">GVariantIter</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">iter</span><span class="symbol">;</span>
718
 
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">str</span><span class="symbol">;</span>
719
 
 
720
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</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="string">"as"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">iter</span><span class="symbol">);</span>
721
 
<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">"s"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">str</span><span class="symbol">))</span>
722
 
<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">"%s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">);</span>
723
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-iter-free">g_variant_iter_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">iter</span><span class="symbol">);</span>
724
 
<span class="cbracket">}</span>
725
 
 
726
 
<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></pre></td>
 
705
        <td class="listing_code"><pre class="programlisting">GVariantBuilder <span class="gtkdoc opt">*</span>builder<span class="gtkdoc opt">;</span>
 
706
GVariant <span class="gtkdoc opt">*</span>value<span class="gtkdoc opt">;</span>
 
707
 
 
708
builder <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;as&quot;</span><span class="gtkdoc opt">));</span>
 
709
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>builder<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;when&quot;</span><span class="gtkdoc opt">);</span>
 
710
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>builder<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;in&quot;</span><span class="gtkdoc opt">);</span>
 
711
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>builder<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;the&quot;</span><span class="gtkdoc opt">);</span>
 
712
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>builder<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;course&quot;</span><span class="gtkdoc opt">);</span>
 
713
value <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;as&quot;</span><span class="gtkdoc opt">,</span> builder<span class="gtkdoc opt">);</span>
 
714
<span class="function"><a href="glib-GVariant.html#g-variant-builder-unref">g_variant_builder_unref</a></span> <span class="gtkdoc opt">(</span>builder<span class="gtkdoc opt">);</span>
 
715
 
 
716
<span class="gtkdoc opt">{</span>
 
717
  GVariantIter <span class="gtkdoc opt">*</span>iter<span class="gtkdoc opt">;</span>
 
718
  gchar <span class="gtkdoc opt">*</span>str<span class="gtkdoc opt">;</span>
 
719
 
 
720
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">,</span> <span class="string">&quot;as&quot;</span><span class="gtkdoc opt">, &amp;</span>iter<span class="gtkdoc opt">);</span>
 
721
  <span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariant.html#g-variant-iter-loop">g_variant_iter_loop</a></span> <span class="gtkdoc opt">(</span>iter<span class="gtkdoc opt">,</span> <span class="string">&quot;s&quot;</span><span class="gtkdoc opt">, &amp;</span>str<span class="gtkdoc opt">))</span>
 
722
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;%s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> str<span class="gtkdoc opt">);</span>
 
723
  <span class="function"><a href="glib-GVariant.html#g-variant-iter-free">g_variant_iter_free</a></span> <span class="gtkdoc opt">(</span>iter<span class="gtkdoc opt">);</span>
 
724
<span class="gtkdoc opt">}</span>
 
725
 
 
726
<span class="function"><a href="glib-GVariant.html#g-variant-unref">g_variant_unref</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span></pre></td>
727
727
      </tr>
728
728
    </tbody>
729
729
  </table>
847
847
53
848
848
54
849
849
55</pre></td>
850
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value3</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value4</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value5</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value6</span><span class="symbol">;</span>
851
 
<span class="normal">value1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"ms"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Hello world"</span><span class="symbol">);</span>
852
 
<span class="normal">value2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"ms"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
853
 
<span class="normal">value3 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(m(ii)s)"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">,</span><span class="normal"> </span><span class="number">123</span><span class="symbol">,</span><span class="normal"> </span><span class="number">456</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Done"</span><span class="symbol">);</span>
854
 
<span class="normal">value4 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(m(ii)s)"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Done"</span><span class="symbol">);</span><span class="normal">          </span><span class="comment">/* both '-1' are ignored. */</span>
855
 
<span class="normal">value5 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(m@(ii)s)"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Done"</span><span class="symbol">);</span>
856
 
 
857
 
<span class="cbracket">{</span>
858
 
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">contents</span><span class="symbol">;</span>
859
 
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cstr</span><span class="symbol">;</span>
860
 
<span class="normal">  </span><span class="usertype">gboolean</span><span class="normal"> just</span><span class="symbol">;</span>
861
 
<span class="normal">  </span><span class="usertype">gint32</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">;</span>
862
 
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">str</span><span class="symbol">;</span>
863
 
 
864
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"ms"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">str</span><span class="symbol">);</span>
865
 
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">str </span><span class="symbol">!=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
866
 
<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">"str: %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">);</span>
867
 
<span class="normal">  </span><span class="keyword">else</span>
868
 
<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">"it was null</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
869
 
<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">str</span><span class="symbol">);</span>
870
 
 
871
 
 
872
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"m&amp;s"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">cstr</span><span class="symbol">);</span>
873
 
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cstr </span><span class="symbol">!=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
874
 
<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">"str: %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> cstr</span><span class="symbol">);</span>
875
 
<span class="normal">  </span><span class="keyword">else</span>
876
 
<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">"it was null</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
877
 
<span class="normal">  </span><span class="comment">/* don't free 'cstr' */</span>
878
 
 
879
 
 
880
 
<span class="normal">  </span><span class="comment">/* NULL passed for the gboolean *, but two 'gint32 *' still collected */</span>
881
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value3</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(m(ii)s)"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">str</span><span class="symbol">);</span>
882
 
<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">"string is %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">);</span>
883
 
<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">str</span><span class="symbol">);</span>
884
 
 
885
 
<span class="normal">  </span><span class="comment">/* note: &amp;s used, so g_free() not needed */</span>
886
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value4</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(m(ii)&amp;s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">just</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">y</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">cstr</span><span class="symbol">);</span>
887
 
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">just</span><span class="symbol">)</span>
888
 
<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">"it was (%d, %d)</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">);</span>
889
 
<span class="normal">  </span><span class="keyword">else</span>
890
 
<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">"it was null</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
891
 
<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">"string is %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> cstr</span><span class="symbol">);</span>
892
 
<span class="normal">  </span><span class="comment">/* don't free 'cstr' */</span>
893
 
 
894
 
 
895
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value5</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(m*s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">contents</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal"> </span><span class="comment">/* ignore the string. */</span>
896
 
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">contents </span><span class="symbol">!=</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
897
 
<span class="normal">    </span><span class="cbracket">{</span>
898
 
<span class="normal">      </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">contents</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(ii)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">y</span><span class="symbol">);</span>
899
 
<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">"it was (%d, %d)</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">);</span>
900
 
<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">contents</span><span class="symbol">);</span>
901
 
<span class="normal">    </span><span class="cbracket">}</span>
902
 
<span class="normal">  </span><span class="keyword">else</span>
903
 
<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">"it was null</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
904
 
<span class="cbracket">}</span></pre></td>
 
850
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>value1<span class="gtkdoc opt">, *</span>value2<span class="gtkdoc opt">, *</span>value3<span class="gtkdoc opt">, *</span>value4<span class="gtkdoc opt">, *</span>value5<span class="gtkdoc opt">, *</span>value6<span class="gtkdoc opt">;</span>
 
851
value1 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;ms&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;Hello world&quot;</span><span class="gtkdoc opt">);</span>
 
852
value2 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;ms&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
 
853
value3 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(m(ii)s)&quot;</span><span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">,</span> <span class="number">123</span><span class="gtkdoc opt">,</span> <span class="number">456</span><span class="gtkdoc opt">,</span> <span class="string">&quot;Done&quot;</span><span class="gtkdoc opt">);</span>
 
854
value4 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(m(ii)s)&quot;</span><span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="string">&quot;Done&quot;</span><span class="gtkdoc opt">);</span>          <span class="comment">/* both '-1' are ignored. */</span>
 
855
value5 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(m&#64;(ii)s)&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">,</span> <span class="string">&quot;Done&quot;</span><span class="gtkdoc opt">);</span>
 
856
 
 
857
<span class="gtkdoc opt">{</span>
 
858
  GVariant <span class="gtkdoc opt">*</span>contents<span class="gtkdoc opt">;</span>
 
859
  <span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>cstr<span class="gtkdoc opt">;</span>
 
860
  gboolean just<span class="gtkdoc opt">;</span>
 
861
  gint32 x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">;</span>
 
862
  gchar <span class="gtkdoc opt">*</span>str<span class="gtkdoc opt">;</span>
 
863
 
 
864
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value1<span class="gtkdoc opt">,</span> <span class="string">&quot;ms&quot;</span><span class="gtkdoc opt">, &amp;</span>str<span class="gtkdoc opt">);</span>
 
865
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>str <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
 
866
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;str: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> str<span class="gtkdoc opt">);</span>
 
867
  <span class="keyword">else</span>
 
868
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was null</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
 
869
  <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>str<span class="gtkdoc opt">);</span>
 
870
 
 
871
 
 
872
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value2<span class="gtkdoc opt">,</span> <span class="string">&quot;m&amp;s&quot;</span><span class="gtkdoc opt">, &amp;</span>cstr<span class="gtkdoc opt">);</span>
 
873
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>cstr <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
 
874
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;str: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> cstr<span class="gtkdoc opt">);</span>
 
875
  <span class="keyword">else</span>
 
876
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was null</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
 
877
  <span class="comment">/* don't free 'cstr' */</span>
 
878
 
 
879
 
 
880
  <span class="comment">/* NULL passed for the gboolean *, but two 'gint32 *' still collected */</span>
 
881
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value3<span class="gtkdoc opt">,</span> <span class="string">&quot;(m(ii)s)&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">, &amp;</span>str<span class="gtkdoc opt">);</span>
 
882
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;string is %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> str<span class="gtkdoc opt">);</span>
 
883
  <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>str<span class="gtkdoc opt">);</span>
 
884
 
 
885
  <span class="comment">/* note: &amp;s used, so g_free() not needed */</span>
 
886
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value4<span class="gtkdoc opt">,</span> <span class="string">&quot;(m(ii)&amp;s)&quot;</span><span class="gtkdoc opt">, &amp;</span>just<span class="gtkdoc opt">, &amp;</span>x<span class="gtkdoc opt">, &amp;</span>y<span class="gtkdoc opt">, &amp;</span>cstr<span class="gtkdoc opt">);</span>
 
887
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>just<span class="gtkdoc opt">)</span>
 
888
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was (%d, %d)</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">);</span>
 
889
  <span class="keyword">else</span>
 
890
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was null</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
 
891
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;string is %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> cstr<span class="gtkdoc opt">);</span>
 
892
  <span class="comment">/* don't free 'cstr' */</span>
 
893
 
 
894
 
 
895
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value5<span class="gtkdoc opt">,</span> <span class="string">&quot;(m*s)&quot;</span><span class="gtkdoc opt">, &amp;</span>contents<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span> <span class="comment">/* ignore the string. */</span>
 
896
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>contents <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
 
897
    <span class="gtkdoc opt">{</span>
 
898
      <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>contents<span class="gtkdoc opt">,</span> <span class="string">&quot;(ii)&quot;</span><span class="gtkdoc opt">, &amp;</span>x<span class="gtkdoc opt">, &amp;</span>y<span class="gtkdoc opt">);</span>
 
899
      <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was (%d, %d)</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">);</span>
 
900
      <span class="function"><a href="glib-GVariant.html#g-variant-unref">g_variant_unref</a></span> <span class="gtkdoc opt">(</span>contents<span class="gtkdoc opt">);</span>
 
901
    <span class="gtkdoc opt">}</span>
 
902
  <span class="keyword">else</span>
 
903
    <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it was null</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
 
904
<span class="gtkdoc opt">}</span></pre></td>
905
905
      </tr>
906
906
    </tbody>
907
907
  </table>
941
941
13
942
942
14
943
943
15</pre></td>
944
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value2</span><span class="symbol">;</span>
945
 
 
946
 
<span class="normal">value1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(s(ii))"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Hello"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">55</span><span class="symbol">,</span><span class="normal"> </span><span class="number">77</span><span class="symbol">);</span>
947
 
<span class="normal">value2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"()"</span><span class="symbol">);</span>
948
 
 
949
 
<span class="cbracket">{</span>
950
 
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">string</span><span class="symbol">;</span>
951
 
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">;</span>
952
 
 
953
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(s(ii))"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">string</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">y</span><span class="symbol">);</span>
954
 
<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">"%s, %d, %d</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> string</span><span class="symbol">,</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">);</span>
955
 
<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">string</span><span class="symbol">);</span>
956
 
 
957
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"()"</span><span class="symbol">);</span><span class="normal">   </span><span class="comment">/* do nothing... */</span>
958
 
<span class="cbracket">}</span></pre></td>
 
944
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>value1<span class="gtkdoc opt">, *</span>value2<span class="gtkdoc opt">;</span>
 
945
 
 
946
value1 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(s(ii))&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;Hello&quot;</span><span class="gtkdoc opt">,</span> <span class="number">55</span><span class="gtkdoc opt">,</span> <span class="number">77</span><span class="gtkdoc opt">);</span>
 
947
value2 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;()&quot;</span><span class="gtkdoc opt">);</span>
 
948
 
 
949
<span class="gtkdoc opt">{</span>
 
950
  gchar <span class="gtkdoc opt">*</span>string<span class="gtkdoc opt">;</span>
 
951
  gint x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">;</span>
 
952
 
 
953
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value1<span class="gtkdoc opt">,</span> <span class="string">&quot;(s(ii))&quot;</span><span class="gtkdoc opt">, &amp;</span>string<span class="gtkdoc opt">, &amp;</span>x<span class="gtkdoc opt">, &amp;</span>y<span class="gtkdoc opt">);</span>
 
954
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;%s, %d, %d</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> string<span class="gtkdoc opt">,</span> x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">);</span>
 
955
  <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>string<span class="gtkdoc opt">);</span>
 
956
 
 
957
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value2<span class="gtkdoc opt">,</span> <span class="string">&quot;()&quot;</span><span class="gtkdoc opt">);</span>   <span class="comment">/* do nothing... */</span>
 
958
<span class="gtkdoc opt">}</span></pre></td>
959
959
      </tr>
960
960
    </tbody>
961
961
  </table>
987
987
5
988
988
6
989
989
7</pre></td>
990
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">b</span><span class="symbol">;</span>
991
 
<span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">dict</span><span class="symbol">;</span>
 
990
        <td class="listing_code"><pre class="programlisting">GVariantBuilder <span class="gtkdoc opt">*</span>b<span class="gtkdoc opt">;</span>
 
991
GVariant <span class="gtkdoc opt">*</span>dict<span class="gtkdoc opt">;</span>
992
992
 
993
 
<span class="normal">b </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"a{sv}"</span><span class="symbol">));</span>
994
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">b</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{sv}"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"name"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"foo"</span><span class="symbol">));</span>
995
 
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">b</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"{sv}"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"timeout"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">10</span><span class="symbol">));</span>
996
 
<span class="normal">dict </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-builder-end">g_variant_builder_end</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">b</span><span class="symbol">);</span></pre></td>
 
993
b <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;a{sv}&quot;</span><span class="gtkdoc opt">));</span>
 
994
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>b<span class="gtkdoc opt">,</span> <span class="string">&quot;{sv}&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;name&quot;</span><span class="gtkdoc opt">,</span> <span class="function"><a href="glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;foo&quot;</span><span class="gtkdoc opt">));</span>
 
995
<span class="function"><a href="glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span> <span class="gtkdoc opt">(</span>b<span class="gtkdoc opt">,</span> <span class="string">&quot;{sv}&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;timeout&quot;</span><span class="gtkdoc opt">,</span> <span class="function"><a href="glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span> <span class="gtkdoc opt">(</span><span class="number">10</span><span class="gtkdoc opt">));</span>
 
996
dict <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-builder-end">g_variant_builder_end</a></span> <span class="gtkdoc opt">(</span>b<span class="gtkdoc opt">);</span></pre></td>
997
997
      </tr>
998
998
    </tbody>
999
999
  </table>
1066
1066
21
1067
1067
22
1068
1068
23</pre></td>
1069
 
        <td class="listing_code"><pre class="programlisting"><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value2</span><span class="symbol">;</span>
 
1069
        <td class="listing_code"><pre class="programlisting">GVariant <span class="gtkdoc opt">*</span>value1<span class="gtkdoc opt">, *</span>value2<span class="gtkdoc opt">;</span>
1070
1070
 
1071
 
<span class="normal">value1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(i@ii)"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">44</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">55</span><span class="symbol">),</span><span class="normal"> </span><span class="number">66</span><span class="symbol">);</span>
 
1071
value1 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(i&#64;ii)&quot;</span><span class="gtkdoc opt">,</span> <span class="number">44</span><span class="gtkdoc opt">,</span> <span class="function"><a href="glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span> <span class="gtkdoc opt">(</span><span class="number">55</span><span class="gtkdoc opt">),</span> <span class="number">66</span><span class="gtkdoc opt">);</span>
1072
1072
 
1073
1073
<span class="comment">/* note: consumes floating reference count on 'value1' */</span>
1074
 
<span class="normal">value2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(@(iii)*)"</span><span class="symbol">,</span><span class="normal"> value1</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"foo"</span><span class="symbol">));</span>
1075
 
 
1076
 
<span class="cbracket">{</span>
1077
 
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">string</span><span class="symbol">;</span>
1078
 
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">tmp</span><span class="symbol">;</span>
1079
 
<span class="normal">  </span><span class="usertype">gsize</span><span class="normal"> length</span><span class="symbol">;</span>
1080
 
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span><span class="normal"> z</span><span class="symbol">;</span>
1081
 
 
1082
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"((iii)*)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">y</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">z</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">tmp</span><span class="symbol">);</span>
1083
 
<span class="normal">  string </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get-string">g_variant_get_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">tmp</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">length</span><span class="symbol">);</span>
1084
 
<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">"it is %d %d %d %s (length=%d)</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> x</span><span class="symbol">,</span><span class="normal"> y</span><span class="symbol">,</span><span class="normal"> z</span><span class="symbol">,</span><span class="normal"> string</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="symbol">)</span><span class="normal"> length</span><span class="symbol">);</span>
1085
 
<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">tmp</span><span class="symbol">);</span>
1086
 
 
1087
 
<span class="normal">  </span><span class="comment">/* quick way to skip all the values in a tuple */</span>
1088
 
<span class="normal">  </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value2</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(rs)"</span><span class="symbol">,</span><span class="normal"> <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">string</span><span class="symbol">);</span><span class="normal"> </span><span class="comment">/* or "(@(iii)s)" */</span>
1089
 
<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">"i only got the string: %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> string</span><span class="symbol">);</span>
1090
 
<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">string</span><span class="symbol">);</span>
1091
 
<span class="cbracket">}</span></pre></td>
 
1074
value2 <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;(&#64;(iii)*)&quot;</span><span class="gtkdoc opt">,</span> value1<span class="gtkdoc opt">,</span> <span class="function"><a href="glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;foo&quot;</span><span class="gtkdoc opt">));</span>
 
1075
 
 
1076
<span class="gtkdoc opt">{</span>
 
1077
  <span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>string<span class="gtkdoc opt">;</span>
 
1078
  GVariant <span class="gtkdoc opt">*</span>tmp<span class="gtkdoc opt">;</span>
 
1079
  gsize length<span class="gtkdoc opt">;</span>
 
1080
  gint x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">,</span> z<span class="gtkdoc opt">;</span>
 
1081
 
 
1082
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value2<span class="gtkdoc opt">,</span> <span class="string">&quot;((iii)*)&quot;</span><span class="gtkdoc opt">, &amp;</span>x<span class="gtkdoc opt">, &amp;</span>y<span class="gtkdoc opt">, &amp;</span>z<span class="gtkdoc opt">, &amp;</span>tmp<span class="gtkdoc opt">);</span>
 
1083
  string <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-get-string">g_variant_get_string</a></span> <span class="gtkdoc opt">(</span>tmp<span class="gtkdoc opt">, &amp;</span>length<span class="gtkdoc opt">);</span>
 
1084
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;it is %d %d %d %s (length=%d)</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">,</span> z<span class="gtkdoc opt">,</span> string<span class="gtkdoc opt">, (</span><span class="gtkdoc kwb">int</span><span class="gtkdoc opt">)</span> length<span class="gtkdoc opt">);</span>
 
1085
  <span class="function"><a href="glib-GVariant.html#g-variant-unref">g_variant_unref</a></span> <span class="gtkdoc opt">(</span>tmp<span class="gtkdoc opt">);</span>
 
1086
 
 
1087
  <span class="comment">/* quick way to skip all the values in a tuple */</span>
 
1088
  <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value2<span class="gtkdoc opt">,</span> <span class="string">&quot;(rs)&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">, &amp;</span>string<span class="gtkdoc opt">);</span> <span class="comment">/* or &quot;(&#64;(iii)s)&quot; */</span>
 
1089
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;i only got the string: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> string<span class="gtkdoc opt">);</span>
 
1090
  <span class="function"><a href="glib-Memory-Allocation.html#g-free">g_free</a></span> <span class="gtkdoc opt">(</span>string<span class="gtkdoc opt">);</span>
 
1091
<span class="gtkdoc opt">}</span></pre></td>
1092
1092
      </tr>
1093
1093
    </tbody>
1094
1094
  </table>
1132
1132
7
1133
1133
8
1134
1134
9</pre></td>
1135
 
        <td class="listing_code"><pre class="programlisting"><span class="cbracket">{</span>
1136
 
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">str</span><span class="symbol">;</span>
1137
 
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">;</span>
 
1135
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">{</span>
 
1136
  <span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>str<span class="gtkdoc opt">;</span>
 
1137
  GVariant <span class="gtkdoc opt">*</span>value<span class="gtkdoc opt">;</span>
1138
1138
 
1139
 
<span class="normal">  value </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"&amp;s"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"hello world"</span><span class="symbol">);</span>
1140
 
<span class="normal">  str </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</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="string">"&amp;s"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">str</span><span class="symbol">);</span>
1141
 
<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">"string is: %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">);</span>
1142
 
<span class="normal">  </span><span class="comment">/* no need to free str */</span>
1143
 
<span class="cbracket">}</span></pre></td>
 
1139
  value <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-new">g_variant_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;&amp;s&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;hello world&quot;</span><span class="gtkdoc opt">);</span>
 
1140
  str <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-GVariant.html#g-variant-get">g_variant_get</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">,</span> <span class="string">&quot;&amp;s&quot;</span><span class="gtkdoc opt">, &amp;</span>str<span class="gtkdoc opt">);</span>
 
1141
  <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;string is: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> str<span class="gtkdoc opt">);</span>
 
1142
  <span class="comment">/* no need to free str */</span>
 
1143
<span class="gtkdoc opt">}</span></pre></td>
1144
1144
      </tr>
1145
1145
    </tbody>
1146
1146
  </table>