<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [

<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gobject-Value-arrays">
<refmeta>
<refentrytitle role="top_of_page" id="gobject-Value-arrays.top_of_page">Value arrays</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GOBJECT Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Value arrays</refname>
<refpurpose>A container structure to maintain an array of
generic values</refpurpose>
</refnamediv>

<refsect1 id="gobject-Value-arrays.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GValue"><returnvalue>GValue</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-get-nth">g_value_array_get_nth</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-new">g_value_array_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-copy">g_value_array_copy</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-value-array-free">g_value_array_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-append">g_value_array_append</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-prepend">g_value_array_prepend</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-insert">g_value_array_insert</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-remove">g_value_array_remove</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-sort">g_value_array_sort</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-value-array-sort-with-data">g_value_array_sort_with_data</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<anchor id="GValueArray"/><refsect1 id="gobject-Value-arrays.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GValueArray-struct">GValueArray</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gobject-Value-arrays.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GBoxed">GBoxed</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GValueArray
</screen>
</refsect1>

<refsect1 id="gobject-Value-arrays.includes"><title>Includes</title><synopsis>#include &lt;glib-object.h&gt;
</synopsis></refsect1>

<refsect1 id="gobject-Value-arrays.description" role="desc">
<title role="desc.title">Description</title>
<para>The prime purpose of a <link linkend="GValueArray"><type>GValueArray</type></link> is for it to be used as an
object property that holds an array of values. A <link linkend="GValueArray"><type>GValueArray</type></link> wraps
an array of <link linkend="GValue"><type>GValue</type></link> elements in order for it to be used as a boxed
type through <link linkend="G-TYPE-VALUE-ARRAY:CAPS"><literal>G_TYPE_VALUE_ARRAY</literal></link>.</para>
<para><link linkend="GValueArray"><type>GValueArray</type></link> is deprecated in favour of <link linkend="GArray"><type>GArray</type></link> since GLib 2.32. It
is possible to create a <link linkend="GArray"><type>GArray</type></link> that behaves like a <link linkend="GValueArray"><type>GValueArray</type></link> by
using the size of <link linkend="GValue"><type>GValue</type></link> as the element size, and by setting
<link linkend="g-value-unset"><function>g_value_unset()</function></link> as the clear function using <link linkend="g-array-set-clear-func"><function>g_array_set_clear_func()</function></link>,
for instance, the following code:</para>
<informalexample><programlisting role="example"><![CDATA[
  GValueArray *array = g_value_array_new (10);
]]></programlisting></informalexample>
<para></para>
<para>can be replaced by:</para>
<informalexample><programlisting role="example"><![CDATA[
  GArray *array = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 10);
  g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
]]></programlisting></informalexample>
<para></para>

</refsect1>
<refsect1 id="gobject-Value-arrays.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-value-array-get-nth" role="function" condition="deprecated:2.32: Use g_array_index() instead.">
<title>g_value_array_get_nth&#160;()</title>
<indexterm zone="g-value-array-get-nth" role="deprecated"><primary sortas="value_array_get_nth">g_value_array_get_nth</primary></indexterm>
<programlisting language="C"><link linkend="GValue"><returnvalue>GValue</returnvalue></link>&#160;*
g_value_array_get_nth (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                       <parameter><link linkend="guint"><type>guint</type></link> index_</parameter>);</programlisting>
<warning><para><literal>g_value_array_get_nth</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-array-index"><function>g_array_index()</function></link> instead.</para>
</warning>
<para>Return a pointer to the value at <parameter>index_</parameter>
 containd in <parameter>value_array</parameter>
.</para>
<refsect3 id="g-value-array-get-nth.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to get a value from</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>index_</para></entry>
<entry role="parameter_description"><para>index of the value of interest</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-get-nth.returns" role="returns">
<title>Returns</title>
<para>pointer to a value at <parameter>index_</parameter>
in <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-new" role="function" condition="deprecated:2.32: Use #GArray and g_array_sized_new() instead.">
<title>g_value_array_new&#160;()</title>
<indexterm zone="g-value-array-new" role="deprecated"><primary sortas="value_array_new">g_value_array_new</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_new (<parameter><link linkend="guint"><type>guint</type></link> n_prealloced</parameter>);</programlisting>
<warning><para><literal>g_value_array_new</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-sized-new"><function>g_array_sized_new()</function></link> instead.</para>
</warning>
<para>Allocate and initialize a new <link linkend="GValueArray"><type>GValueArray</type></link>, optionally preserve space
for <parameter>n_prealloced</parameter>
 elements. New arrays always contain 0 elements,
regardless of the value of <parameter>n_prealloced</parameter>
.</para>
<refsect3 id="g-value-array-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>n_prealloced</para></entry>
<entry role="parameter_description"><para>number of values to preallocate space for</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GValueArray"><type>GValueArray</type></link> with 0 values</para>
</refsect3></refsect2>
<refsect2 id="g-value-array-copy" role="function" condition="deprecated:2.32: Use #GArray and g_array_ref() instead.">
<title>g_value_array_copy&#160;()</title>
<indexterm zone="g-value-array-copy" role="deprecated"><primary sortas="value_array_copy">g_value_array_copy</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_copy (<parameter>const <link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>);</programlisting>
<warning><para><literal>g_value_array_copy</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-ref"><function>g_array_ref()</function></link> instead.</para>
</warning>
<para>Construct an exact copy of a <link linkend="GValueArray"><type>GValueArray</type></link> by duplicating all its
contents.</para>
<refsect3 id="g-value-array-copy.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to copy</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-copy.returns" role="returns">
<title>Returns</title>
<para>Newly allocated copy of <link linkend="GValueArray"><type>GValueArray</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-free" role="function" condition="deprecated:2.32: Use #GArray and g_array_unref() instead.">
<title>g_value_array_free&#160;()</title>
<indexterm zone="g-value-array-free" role="deprecated"><primary sortas="value_array_free">g_value_array_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_value_array_free (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>);</programlisting>
<warning><para><literal>g_value_array_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-unref"><function>g_array_unref()</function></link> instead.</para>
</warning>
<para>Free a <link linkend="GValueArray"><type>GValueArray</type></link> including its contents.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="g-value-array-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to free</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-value-array-append" role="function" condition="deprecated:2.32: Use #GArray and g_array_append_val() instead.">
<title>g_value_array_append&#160;()</title>
<indexterm zone="g-value-array-append" role="deprecated"><primary sortas="value_array_append">g_value_array_append</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_append (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                      <parameter>const <link linkend="GValue"><type>GValue</type></link> *value</parameter>);</programlisting>
<warning><para><literal>g_value_array_append</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-append-val"><function>g_array_append_val()</function></link> instead.</para>
</warning>
<para>Insert a copy of <parameter>value</parameter>
 as last element of <parameter>value_array</parameter>
. If <parameter>value</parameter>
 is
<link linkend="NULL:CAPS"><literal>NULL</literal></link>, an uninitialized value is appended.</para>
<refsect3 id="g-value-array-append.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to add an element to</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para><link linkend="GValue"><type>GValue</type></link> to copy into <link linkend="GValueArray"><type>GValueArray</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-append.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-prepend" role="function" condition="deprecated:2.32: Use #GArray and g_array_prepend_val() instead.">
<title>g_value_array_prepend&#160;()</title>
<indexterm zone="g-value-array-prepend" role="deprecated"><primary sortas="value_array_prepend">g_value_array_prepend</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_prepend (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                       <parameter>const <link linkend="GValue"><type>GValue</type></link> *value</parameter>);</programlisting>
<warning><para><literal>g_value_array_prepend</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-prepend-val"><function>g_array_prepend_val()</function></link> instead.</para>
</warning>
<para>Insert a copy of <parameter>value</parameter>
 as first element of <parameter>value_array</parameter>
. If <parameter>value</parameter>
 is
<link linkend="NULL:CAPS"><literal>NULL</literal></link>, an uninitialized value is prepended.</para>
<refsect3 id="g-value-array-prepend.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to add an element to</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para><link linkend="GValue"><type>GValue</type></link> to copy into <link linkend="GValueArray"><type>GValueArray</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-prepend.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-insert" role="function" condition="deprecated:2.32: Use #GArray and g_array_insert_val() instead.">
<title>g_value_array_insert&#160;()</title>
<indexterm zone="g-value-array-insert" role="deprecated"><primary sortas="value_array_insert">g_value_array_insert</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_insert (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                      <parameter><link linkend="guint"><type>guint</type></link> index_</parameter>,
                      <parameter>const <link linkend="GValue"><type>GValue</type></link> *value</parameter>);</programlisting>
<warning><para><literal>g_value_array_insert</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-insert-val"><function>g_array_insert_val()</function></link> instead.</para>
</warning>
<para>Insert a copy of <parameter>value</parameter>
 at specified position into <parameter>value_array</parameter>
. If <parameter>value</parameter>

is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, an uninitialized value is inserted.</para>
<refsect3 id="g-value-array-insert.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to add an element to</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>index_</para></entry>
<entry role="parameter_description"><para>insertion position, must be &lt;= value_array->;n_values</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>value</para></entry>
<entry role="parameter_description"><para><link linkend="GValue"><type>GValue</type></link> to copy into <link linkend="GValueArray"><type>GValueArray</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-insert.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-remove" role="function" condition="deprecated:2.32: Use #GArray and g_array_remove_index() instead.">
<title>g_value_array_remove&#160;()</title>
<indexterm zone="g-value-array-remove" role="deprecated"><primary sortas="value_array_remove">g_value_array_remove</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_remove (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                      <parameter><link linkend="guint"><type>guint</type></link> index_</parameter>);</programlisting>
<warning><para><literal>g_value_array_remove</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-remove-index"><function>g_array_remove_index()</function></link> instead.</para>
</warning>
<para>Remove the value at position <parameter>index_</parameter>
 from <parameter>value_array</parameter>
.</para>
<refsect3 id="g-value-array-remove.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to remove an element from</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>index_</para></entry>
<entry role="parameter_description"><para>position of value to remove, which must be less than
<parameter>value_array->n_values</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-remove.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-sort" role="function" condition="deprecated:2.32: Use #GArray and g_array_sort().">
<title>g_value_array_sort&#160;()</title>
<indexterm zone="g-value-array-sort" role="deprecated"><primary sortas="value_array_sort">g_value_array_sort</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_sort (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                    <parameter><link linkend="GCompareFunc"><type>GCompareFunc</type></link> compare_func</parameter>);</programlisting>
<warning><para><literal>g_value_array_sort</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-sort"><function>g_array_sort()</function></link>.</para>
</warning>
<para>Sort <parameter>value_array</parameter>
 using <parameter>compare_func</parameter>
 to compare the elements according to
the semantics of <link linkend="GCompareFunc"><type>GCompareFunc</type></link>.</para>
<para>The current implementation uses the same sorting algorithm as standard
C <link linkend="qsort"><function>qsort()</function></link> function.</para>
<refsect3 id="g-value-array-sort.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to sort</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>compare_func</para></entry>
<entry role="parameter_description"><para>function to compare elements. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope call</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-sort.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="g-value-array-sort-with-data" role="function" condition="deprecated:2.32: Use #GArray and g_array_sort_with_data().">
<title>g_value_array_sort_with_data&#160;()</title>
<indexterm zone="g-value-array-sort-with-data" role="deprecated"><primary sortas="value_array_sort_with_data">g_value_array_sort_with_data</primary></indexterm>
<programlisting language="C"><link linkend="GValueArray"><returnvalue>GValueArray</returnvalue></link>&#160;*
g_value_array_sort_with_data (<parameter><link linkend="GValueArray"><type>GValueArray</type></link> *value_array</parameter>,
                              <parameter><link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> compare_func</parameter>,
                              <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<warning><para><literal>g_value_array_sort_with_data</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="GArray"><type>GArray</type></link> and <link linkend="g-array-sort-with-data"><function>g_array_sort_with_data()</function></link>.</para>
</warning>
<para>Sort <parameter>value_array</parameter>
 using <parameter>compare_func</parameter>
 to compare the elements according
to the semantics of <link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link>.</para>
<para>The current implementation uses the same sorting algorithm as standard
C <link linkend="qsort"><function>qsort()</function></link> function.</para>

<para><emphasis role="annotation">[<acronym>rename-to</acronym> g_value_array_sort]</emphasis></para><refsect3 id="g-value-array-sort-with-data.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>value_array</para></entry>
<entry role="parameter_description"><para><link linkend="GValueArray"><type>GValueArray</type></link> to sort</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>compare_func</para></entry>
<entry role="parameter_description"><para>function to compare elements. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope call</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>extra data argument provided for <parameter>compare_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-value-array-sort-with-data.returns" role="returns">
<title>Returns</title>
<para>the <link linkend="GValueArray"><type>GValueArray</type></link> passed in as <parameter>value_array</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gobject-Value-arrays.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GValueArray-struct" role="struct">
<title>struct GValueArray</title>
<indexterm zone="GValueArray-struct"><primary sortas="ValueArray">GValueArray</primary></indexterm>
<programlisting language="C">struct GValueArray {
  guint   n_values;
  GValue *values;
};
</programlisting>
<para>A <link linkend="GValueArray"><type>GValueArray</type></link> contains an array of <link linkend="GValue"><type>GValue</type></link> elements.</para>
<refsect3 id="GValueArray.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="guint"><type>guint</type></link>&#160;<structfield id="GValueArray-struct.n-values">n_values</structfield>;</para></entry>
<entry role="struct_member_description"><para>number of values contained in the array</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="GValue"><type>GValue</type></link>&#160;*<structfield id="GValueArray-struct.values">values</structfield>;</para></entry>
<entry role="struct_member_description"><para>array of values</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>

</refsect1>
<refsect1 id="gobject-Value-arrays.see-also">
<title>See Also</title>
<para><link linkend="GValue"><type>GValue</type></link>, <link linkend="GParamSpecValueArray"><type>GParamSpecValueArray</type></link>, <link linkend="g-param-spec-value-array"><function>g_param_spec_value_array()</function></link></para>

</refsect1>

</refentry>
