<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Boxed Types Serialization: JSON-GLib Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="JSON-GLib Reference Manual"> <link rel="up" href="json-advanced.html" title="Part IV. JSON-GLib Advanced API"> <link rel="prev" href="json-glib-Serializable-Interface.html" title="Serializable Interface"> <link rel="next" href="json-glib-JSON-GVariant-Integration.html" title="JSON GVariant Integration"> <meta name="generator" content="GTK-Doc V1.25 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#json-glib-Boxed-Types-Serialization.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="json-advanced.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="json-glib-Serializable-Interface.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="json-glib-JSON-GVariant-Integration.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="json-glib-Boxed-Types-Serialization"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="json-glib-Boxed-Types-Serialization.top_of_page"></a>Boxed Types Serialization</span></h2> <p>Boxed Types Serialization — Serialize and deserialize GBoxed types</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="json-glib-Boxed-Types-Serialization.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_return"> <col class="functions_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> * </td> <td class="function_name"> <span class="c_punctuation">(</span><a class="link" href="json-glib-Boxed-Types-Serialization.html#JsonBoxedSerializeFunc" title="JsonBoxedSerializeFunc ()">*JsonBoxedSerializeFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> </td> <td class="function_name"> <span class="c_punctuation">(</span><a class="link" href="json-glib-Boxed-Types-Serialization.html#JsonBoxedDeserializeFunc" title="JsonBoxedDeserializeFunc ()">*JsonBoxedDeserializeFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-register-serialize-func" title="json_boxed_register_serialize_func ()">json_boxed_register_serialize_func</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-register-deserialize-func" title="json_boxed_register_deserialize_func ()">json_boxed_register_deserialize_func</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-can-serialize" title="json_boxed_can_serialize ()">json_boxed_can_serialize</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-can-deserialize" title="json_boxed_can_deserialize ()">json_boxed_can_deserialize</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> * </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-serialize" title="json_boxed_serialize ()">json_boxed_serialize</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> </td> <td class="function_name"> <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-deserialize" title="json_boxed_deserialize ()">json_boxed_deserialize</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="json-glib-Boxed-Types-Serialization.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <json-glib/json-glib.h> </pre> </div> <div class="refsect1"> <a name="json-glib-Boxed-Types-Serialization.description"></a><h2>Description</h2> <p>GLib's <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> type is a generic wrapper for arbitrary C structures.</p> <p>JSON-GLib allows serialization and deserialization of a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> type by registering functions mapping a <a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a> to a specific <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a>.</p> <p>When registering a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> type you should also register the corresponding transformation functions, e.g.:</p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</pre></td> <td class="listing_code"><pre class="programlisting"><span class="normal"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a></span> <span class="function">my_struct_get_type</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span> <span class="cbracket">{</span> <span class="normal"> </span><span class="keyword">static</span><span class="normal"> </span><span class="usertype">GType</span><span class="normal"> boxed_type </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span> <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">boxed_type </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span> <span class="normal"> </span><span class="cbracket">{</span> <span class="normal"> boxed_type </span><span class="symbol">=</span> <span class="normal"> </span><span class="function"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html#g-boxed-type-register-static">g_boxed_type_register_static</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Quarks.html#g-intern-static-string">g_intern_static_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"MyStruct"</span><span class="symbol">),</span> <span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html#GBoxedCopyFunc">GBoxedCopyFunc</a></span><span class="symbol">)</span><span class="normal"> my_struct_copy</span><span class="symbol">,</span> <span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html#GBoxedFreeFunc">GBoxedFreeFunc</a></span><span class="symbol">)</span><span class="normal"> my_struct_free</span><span class="symbol">);</span> <span class="normal"> </span><span class="function"><a href="json-glib-Boxed-Types-Serialization.html#json-boxed-register-serialize-func">json_boxed_register_serialize_func</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">boxed_type</span><span class="symbol">,</span><span class="normal"> <a href="json-glib-JSON-Node.html#JSON-NODE-OBJECT:CAPS">JSON_NODE_OBJECT</a></span><span class="symbol">,</span> <span class="normal"> my_struct_serialize</span><span class="symbol">);</span> <span class="normal"> </span><span class="function"><a href="json-glib-Boxed-Types-Serialization.html#json-boxed-register-deserialize-func">json_boxed_register_deserialize_func</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">boxed_type</span><span class="symbol">,</span><span class="normal"> <a href="json-glib-JSON-Node.html#JSON-NODE-OBJECT:CAPS">JSON_NODE_OBJECT</a></span><span class="symbol">,</span> <span class="normal"> my_struct_deserialize</span><span class="symbol">);</span> <span class="normal"> </span><span class="cbracket">}</span> <span class="normal"> </span><span class="keyword">return</span><span class="normal"> boxed_type</span><span class="symbol">;</span> <span class="cbracket">}</span></pre></td> </tr> </tbody> </table> </div> <p></p> <p>The serialization function will be invoked by <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-serialize" title="json_boxed_serialize ()"><code class="function">json_boxed_serialize()</code></a>: it will be passed a pointer to the C structure and it must return a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a>. The deserialization function will be invoked by <a class="link" href="json-glib-Boxed-Types-Serialization.html#json-boxed-deserialize" title="json_boxed_deserialize ()"><code class="function">json_boxed_deserialize()</code></a>: it will be passed a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> for the declared type and it must return a newly allocated C structure.</p> <p>It is possible to check whether a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> type can be deserialized from a specific <a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a>, and whether a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> can be serialized and to which specific <a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a>.</p> </div> <div class="refsect1"> <a name="json-glib-Boxed-Types-Serialization.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="JsonBoxedSerializeFunc"></a><h3>JsonBoxedSerializeFunc ()</h3> <pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> * <span class="c_punctuation">(</span>*JsonBoxedSerializeFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"><span class="type">gconstpointer</span></a> boxed</code></em>);</pre> <p>Serializes the passed <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> and stores it inside a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p> <div class="refsect3"> <a name="JsonBoxedSerializeFunc.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>boxed</p></td> <td class="parameter_description"><p>a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="JsonBoxedSerializeFunc.returns"></a><h4>Returns</h4> <p> the newly created <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="JsonBoxedDeserializeFunc"></a><h3>JsonBoxedDeserializeFunc ()</h3> <pre class="programlisting"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <span class="c_punctuation">(</span>*JsonBoxedDeserializeFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> *node</code></em>);</pre> <p>Deserializes the contents of the passed <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> into a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a></p> <div class="refsect3"> <a name="JsonBoxedDeserializeFunc.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>node</p></td> <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="JsonBoxedDeserializeFunc.returns"></a><h4>Returns</h4> <p> the newly created boxed type</p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-register-serialize-func"></a><h3>json_boxed_register_serialize_func ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> json_boxed_register_serialize_func (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a> node_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-Boxed-Types-Serialization.html#JsonBoxedSerializeFunc" title="JsonBoxedSerializeFunc ()"><span class="type">JsonBoxedSerializeFunc</span></a> serialize_func</code></em>);</pre> <p>Registers a serialization function for a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> to a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> of type <em class="parameter"><code>node_type</code></em> </p> <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> <div class="refsect3"> <a name="json-boxed-register-serialize-func.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>node_type</p></td> <td class="parameter_description"><p>a node type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>serialize_func</p></td> <td class="parameter_description"><p>serialization function for <em class="parameter"><code>boxed_type</code></em> into a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> of type <em class="parameter"><code>node_type</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-register-deserialize-func"></a><h3>json_boxed_register_deserialize_func ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> json_boxed_register_deserialize_func (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a> node_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-Boxed-Types-Serialization.html#JsonBoxedDeserializeFunc" title="JsonBoxedDeserializeFunc ()"><span class="type">JsonBoxedDeserializeFunc</span></a> deserialize_func</code></em>);</pre> <p>Registers a deserialization function for a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> from a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> of type <em class="parameter"><code>node_type</code></em> </p> <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> <div class="refsect3"> <a name="json-boxed-register-deserialize-func.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>node_type</p></td> <td class="parameter_description"><p>a node type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>deserialize_func</p></td> <td class="parameter_description"><p>deserialization function for <em class="parameter"><code>boxed_type</code></em> from a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> of type <em class="parameter"><code>node_type</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-can-serialize"></a><h3>json_boxed_can_serialize ()</h3> <pre class="programlisting"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> json_boxed_can_serialize (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a> *node_type</code></em>);</pre> <p>Checks whether it is possible to serialize a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> into a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a>. The type of the <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> is placed inside <em class="parameter"><code>node_type</code></em> if the function returns <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> and it's undefined otherwise.</p> <div class="refsect3"> <a name="json-boxed-can-serialize.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>node_type</p></td> <td class="parameter_description"><p> the <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> type to which the boxed type can be serialized into. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="json-boxed-can-serialize.returns"></a><h4>Returns</h4> <p> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the type can be serialized, and <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-can-deserialize"></a><h3>json_boxed_can_deserialize ()</h3> <pre class="programlisting"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> json_boxed_can_deserialize (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNodeType" title="enum JsonNodeType"><span class="type">JsonNodeType</span></a> node_type</code></em>);</pre> <p>Checks whether it is possible to deserialize a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> from a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> of type <em class="parameter"><code>node_type</code></em> </p> <div class="refsect3"> <a name="json-boxed-can-deserialize.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>node_type</p></td> <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> type</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="json-boxed-can-deserialize.returns"></a><h4>Returns</h4> <p> <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the type can be deserialized, <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-serialize"></a><h3>json_boxed_serialize ()</h3> <pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> * json_boxed_serialize (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gconstpointer"><span class="type">gconstpointer</span></a> boxed</code></em>);</pre> <p>Serializes <em class="parameter"><code>boxed</code></em> , a pointer to a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> , into a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p> <div class="refsect3"> <a name="json-boxed-serialize.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>boxed</p></td> <td class="parameter_description"><p>a pointer to a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of type <em class="parameter"><code>gboxed_type</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="json-boxed-serialize.returns"></a><h4>Returns</h4> <p> a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> with the serialization of the boxed type, or <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if serialization either failed or was not possible. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> <hr> <div class="refsect2"> <a name="json-boxed-deserialize"></a><h3>json_boxed_deserialize ()</h3> <pre class="programlisting"><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> json_boxed_deserialize (<em class="parameter"><code><a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> gboxed_type</code></em>, <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> *node</code></em>);</pre> <p>Deserializes <em class="parameter"><code>node</code></em> into a <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a> of <em class="parameter"><code>gboxed_type</code></em> </p> <div class="refsect3"> <a name="json-boxed-deserialize.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>gboxed_type</p></td> <td class="parameter_description"><p>a boxed type</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>node</p></td> <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="json-boxed-deserialize.returns"></a><h4>Returns</h4> <p> the newly allocated <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html"><span class="type">GBoxed</span></a>. Use <a href="/home/vagrant/ruby-gnome2.win32/glib2/vendor/local/share/gtk-doc/html/gobject/gobject-Boxed-Types.html#g-boxed-free"><code class="function">g_boxed_free()</code></a> to release the resources allocated by this function. </p> <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p> </div> </div> <div class="refsect1"> <a name="json-glib-Boxed-Types-Serialization.other_details"></a><h2>Types and Values</h2> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.25</div> </body> </html>