<refentry id="gobject-Boxed-Types">
<refmeta>
<refentrytitle>GBoxed</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GOBJECT Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GBoxed</refname><refpurpose>Mechanism to wrap opaque C structures registered by the type system.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gobject.h&gt;


<link linkend="gpointer">gpointer</link>    (<link linkend="GBoxedCopyFunc">*GBoxedCopyFunc</link>)               (<link linkend="gpointer">gpointer</link> boxed);
void        (<link linkend="GBoxedFreeFunc">*GBoxedFreeFunc</link>)               (<link linkend="gpointer">gpointer</link> boxed);
<link linkend="gpointer">gpointer</link>    <link linkend="g-boxed-copy">g_boxed_copy</link>                    (<link linkend="GType">GType</link> boxed_type,
                                             <link linkend="gconstpointer">gconstpointer</link> src_boxed);
void        <link linkend="g-boxed-free">g_boxed_free</link>                    (<link linkend="GType">GType</link> boxed_type,
                                             <link linkend="gpointer">gpointer</link> boxed);
<link linkend="GType">GType</link>       <link linkend="g-boxed-type-register-static">g_boxed_type_register_static</link>    (const <link linkend="gchar">gchar</link> *name,
                                             <link linkend="GBoxedCopyFunc">GBoxedCopyFunc</link> boxed_copy,
                                             <link linkend="GBoxedFreeFunc">GBoxedFreeFunc</link> boxed_free);
<link linkend="GType">GType</link>       <link linkend="g-pointer-type-register-static">g_pointer_type_register_static</link>  (const <link linkend="gchar">gchar</link> *name);

#define     <link linkend="G-TYPE-GSTRING-CAPS">G_TYPE_GSTRING</link>


</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GBoxedCopyFunc">GBoxedCopyFunc ()</title>
<programlisting><link linkend="gpointer">gpointer</link>    (*GBoxedCopyFunc)               (<link linkend="gpointer">gpointer</link> boxed);</programlisting>
<para>
This function is provided by the user and should produce a copy of the passed
in boxed structure.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>boxed</parameter>&nbsp;:</entry>
<entry>  The boxed structure to be copied.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>The newly created copy of the boxed structure.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="GBoxedFreeFunc">GBoxedFreeFunc ()</title>
<programlisting>void        (*GBoxedFreeFunc)               (<link linkend="gpointer">gpointer</link> boxed);</programlisting>
<para>
This function is provided by the user and should free the boxed
structure passed.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>boxed</parameter>&nbsp;:</entry>
<entry>The boxed structure to be freed.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-boxed-copy">g_boxed_copy ()</title>
<programlisting><link linkend="gpointer">gpointer</link>    g_boxed_copy                    (<link linkend="GType">GType</link> boxed_type,
                                             <link linkend="gconstpointer">gconstpointer</link> src_boxed);</programlisting>
<para>
Provide a copy of a boxed structure <parameter>src_boxed</parameter> which is of type <parameter>boxed_type</parameter>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>boxed_type</parameter>&nbsp;:</entry>
<entry>The type of <parameter>src_boxed</parameter>.
</entry></row>
<row><entry align="right"><parameter>src_boxed</parameter>&nbsp;:</entry>
<entry> The boxed structure to be copied.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>   The newly created copy of the boxed structure.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-boxed-free">g_boxed_free ()</title>
<programlisting>void        g_boxed_free                    (<link linkend="GType">GType</link> boxed_type,
                                             <link linkend="gpointer">gpointer</link> boxed);</programlisting>
<para>
Free the boxed structure <parameter>boxed</parameter> which is of type <parameter>boxed_type</parameter>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>boxed_type</parameter>&nbsp;:</entry>
<entry>The type of <parameter>boxed</parameter>.
</entry></row>
<row><entry align="right"><parameter>boxed</parameter>&nbsp;:</entry>
<entry>     The boxed structure to be freed.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-boxed-type-register-static">g_boxed_type_register_static ()</title>
<programlisting><link linkend="GType">GType</link>       g_boxed_type_register_static    (const <link linkend="gchar">gchar</link> *name,
                                             <link linkend="GBoxedCopyFunc">GBoxedCopyFunc</link> boxed_copy,
                                             <link linkend="GBoxedFreeFunc">GBoxedFreeFunc</link> boxed_free);</programlisting>
<para>
This function creates a new <literal>G_TYPE_BOXED</literal> derived type id for a new
boxed type with name <parameter>name</parameter>. Boxed type handling functions have to be
provided to copy and free opaque boxed structures of this type.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>Name of the new boxed type.
</entry></row>
<row><entry align="right"><parameter>boxed_copy</parameter>&nbsp;:</entry>
<entry>Boxed structure copy function.
</entry></row>
<row><entry align="right"><parameter>boxed_free</parameter>&nbsp;:</entry>
<entry>Boxed structure free function.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>New <literal>G_TYPE_BOXED</literal> derived type id for <parameter>name</parameter>.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="g-pointer-type-register-static">g_pointer_type_register_static ()</title>
<programlisting><link linkend="GType">GType</link>       g_pointer_type_register_static  (const <link linkend="gchar">gchar</link> *name);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>name</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="G-TYPE-GSTRING-CAPS">G_TYPE_GSTRING</title>
<programlisting>#define	G_TYPE_GSTRING		(g_gstring_get_type ())
</programlisting>
<para>

</para></refsect2>

</refsect1>



<refsect1>
<title>See Also</title>
<para>
<link linkend="GParamSpecBoxed">GParamSpecBoxed</link>, <link linkend="g-param-spec-boxed">g_param_spec_boxed</link>()
</para>
</refsect1>

</refentry>
