Imported Upstream version 1.2.4
[platform/upstream/json-glib.git] / doc / reference / html / json-glib-Serializable-Interface.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Serializable Interface: JSON-GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="JSON-GLib Reference Manual">
8 <link rel="up" href="json-advanced.html" title="Part IV. JSON-GLib Advanced API">
9 <link rel="prev" href="json-glib-GObject-Serialization.html" title="GObject Serialization">
10 <link rel="next" href="json-glib-Boxed-Types-Serialization.html" title="Boxed Types Serialization">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#json-glib-Serializable-Interface.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
19                   <a href="#json-glib-Serializable-Interface.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20 </td>
21 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
22 <td><a accesskey="u" href="json-advanced.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
23 <td><a accesskey="p" href="json-glib-GObject-Serialization.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
24 <td><a accesskey="n" href="json-glib-Boxed-Types-Serialization.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25 </tr></table>
26 <div class="refentry">
27 <a name="json-glib-Serializable-Interface"></a><div class="titlepage"></div>
28 <div class="refnamediv"><table width="100%"><tr>
29 <td valign="top">
30 <h2><span class="refentrytitle"><a name="json-glib-Serializable-Interface.top_of_page"></a>Serializable Interface</span></h2>
31 <p>Serializable Interface — Interface for serialize and deserialize special GObjects</p>
32 </td>
33 <td class="gallery_image" valign="top" align="right"></td>
34 </tr></table></div>
35 <div class="refsect1">
36 <a name="json-glib-Serializable-Interface.functions"></a><h2>Functions</h2>
37 <div class="informaltable"><table class="informaltable" width="100%" border="0">
38 <colgroup>
39 <col width="150px" class="functions_return">
40 <col class="functions_name">
41 </colgroup>
42 <tbody>
43 <tr>
44 <td class="function_type">
45 <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
46 </td>
47 <td class="function_name">
48 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-serialize-property" title="json_serializable_serialize_property ()">json_serializable_serialize_property</a> <span class="c_punctuation">()</span>
49 </td>
50 </tr>
51 <tr>
52 <td class="function_type">
53 <span class="returnvalue">gboolean</span>
54 </td>
55 <td class="function_name">
56 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-deserialize-property" title="json_serializable_deserialize_property ()">json_serializable_deserialize_property</a> <span class="c_punctuation">()</span>
57 </td>
58 </tr>
59 <tr>
60 <td class="function_type">
61 <span class="returnvalue">GParamSpec</span> *
62 </td>
63 <td class="function_name">
64 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-find-property" title="json_serializable_find_property ()">json_serializable_find_property</a> <span class="c_punctuation">()</span>
65 </td>
66 </tr>
67 <tr>
68 <td class="function_type">
69 <span class="returnvalue">void</span>
70 </td>
71 <td class="function_name">
72 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-get-property" title="json_serializable_get_property ()">json_serializable_get_property</a> <span class="c_punctuation">()</span>
73 </td>
74 </tr>
75 <tr>
76 <td class="function_type">
77 <span class="returnvalue">GParamSpec</span> **
78 </td>
79 <td class="function_name">
80 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-list-properties" title="json_serializable_list_properties ()">json_serializable_list_properties</a> <span class="c_punctuation">()</span>
81 </td>
82 </tr>
83 <tr>
84 <td class="function_type">
85 <span class="returnvalue">void</span>
86 </td>
87 <td class="function_name">
88 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-set-property" title="json_serializable_set_property ()">json_serializable_set_property</a> <span class="c_punctuation">()</span>
89 </td>
90 </tr>
91 <tr>
92 <td class="function_type">
93 <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
94 </td>
95 <td class="function_name">
96 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-default-serialize-property" title="json_serializable_default_serialize_property ()">json_serializable_default_serialize_property</a> <span class="c_punctuation">()</span>
97 </td>
98 </tr>
99 <tr>
100 <td class="function_type">
101 <span class="returnvalue">gboolean</span>
102 </td>
103 <td class="function_name">
104 <a class="link" href="json-glib-Serializable-Interface.html#json-serializable-default-deserialize-property" title="json_serializable_default_deserialize_property ()">json_serializable_default_deserialize_property</a> <span class="c_punctuation">()</span>
105 </td>
106 </tr>
107 </tbody>
108 </table></div>
109 </div>
110 <a name="JsonSerializable"></a><div class="refsect1">
111 <a name="json-glib-Serializable-Interface.other"></a><h2>Types and Values</h2>
112 <div class="informaltable"><table class="informaltable" width="100%" border="0">
113 <colgroup>
114 <col width="150px" class="name">
115 <col class="description">
116 </colgroup>
117 <tbody><tr>
118 <td class="datatype_keyword">struct</td>
119 <td class="function_name"><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface" title="struct JsonSerializableIface">JsonSerializableIface</a></td>
120 </tr></tbody>
121 </table></div>
122 </div>
123 <div class="refsect1">
124 <a name="json-glib-Serializable-Interface.object-hierarchy"></a><h2>Object Hierarchy</h2>
125 <pre class="screen">    <a href="/home/ebassi/gnome/install/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a>
126     <span class="lineart">╰──</span> JsonSerializable
127 </pre>
128 </div>
129 <div class="refsect1">
130 <a name="json-glib-Serializable-Interface.description"></a><h2>Description</h2>
131 <p><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> is an interface for <span class="type">GObject</span> classes that
132 allows controlling how the class is going to be serialized
133 or deserialized by <a class="link" href="json-glib-GObject-Serialization.html#json-construct-gobject" title="json_construct_gobject ()"><code class="function">json_construct_gobject()</code></a> and
134 <a class="link" href="json-glib-GObject-Serialization.html#json-serialize-gobject" title="json_serialize_gobject ()"><code class="function">json_serialize_gobject()</code></a> respectively.</p>
135 </div>
136 <div class="refsect1">
137 <a name="json-glib-Serializable-Interface.functions_details"></a><h2>Functions</h2>
138 <div class="refsect2">
139 <a name="json-serializable-serialize-property"></a><h3>json_serializable_serialize_property ()</h3>
140 <pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
141 json_serializable_serialize_property (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
142                                       <em class="parameter"><code>const <span class="type">gchar</span> *property_name</code></em>,
143                                       <em class="parameter"><code>const <span class="type">GValue</span> *value</code></em>,
144                                       <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>);</pre>
145 <p>Asks a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> implementation to serialize a <span class="type">GObject</span>
146 property into a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> object.</p>
147 <div class="refsect3">
148 <a name="json-serializable-serialize-property.parameters"></a><h4>Parameters</h4>
149 <div class="informaltable"><table class="informaltable" width="100%" border="0">
150 <colgroup>
151 <col width="150px" class="parameters_name">
152 <col class="parameters_description">
153 <col width="200px" class="parameters_annotations">
154 </colgroup>
155 <tbody>
156 <tr>
157 <td class="parameter_name"><p>serializable</p></td>
158 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> object</p></td>
159 <td class="parameter_annotations"> </td>
160 </tr>
161 <tr>
162 <td class="parameter_name"><p>property_name</p></td>
163 <td class="parameter_description"><p>the name of the property</p></td>
164 <td class="parameter_annotations"> </td>
165 </tr>
166 <tr>
167 <td class="parameter_name"><p>value</p></td>
168 <td class="parameter_description"><p>the value of the property</p></td>
169 <td class="parameter_annotations"> </td>
170 </tr>
171 <tr>
172 <td class="parameter_name"><p>pspec</p></td>
173 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
174 <td class="parameter_annotations"> </td>
175 </tr>
176 </tbody>
177 </table></div>
178 </div>
179 <div class="refsect3">
180 <a name="json-serializable-serialize-property.returns"></a><h4>Returns</h4>
181 <p> a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> containing the serialized property</p>
182 </div>
183 </div>
184 <hr>
185 <div class="refsect2">
186 <a name="json-serializable-deserialize-property"></a><h3>json_serializable_deserialize_property ()</h3>
187 <pre class="programlisting"><span class="returnvalue">gboolean</span>
188 json_serializable_deserialize_property
189                                (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
190                                 <em class="parameter"><code>const <span class="type">gchar</span> *property_name</code></em>,
191                                 <em class="parameter"><code><span class="type">GValue</span> *value</code></em>,
192                                 <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>,
193                                 <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> *property_node</code></em>);</pre>
194 <p>Asks a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> implementation to deserialize the
195 property contained inside <em class="parameter"><code>property_node</code></em>
196  into <em class="parameter"><code>value</code></em>
197 .</p>
198 <div class="refsect3">
199 <a name="json-serializable-deserialize-property.parameters"></a><h4>Parameters</h4>
200 <div class="informaltable"><table class="informaltable" width="100%" border="0">
201 <colgroup>
202 <col width="150px" class="parameters_name">
203 <col class="parameters_description">
204 <col width="200px" class="parameters_annotations">
205 </colgroup>
206 <tbody>
207 <tr>
208 <td class="parameter_name"><p>serializable</p></td>
209 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
210 <td class="parameter_annotations"> </td>
211 </tr>
212 <tr>
213 <td class="parameter_name"><p>property_name</p></td>
214 <td class="parameter_description"><p>the name of the property</p></td>
215 <td class="parameter_annotations"> </td>
216 </tr>
217 <tr>
218 <td class="parameter_name"><p>value</p></td>
219 <td class="parameter_description"><p> a pointer to an uninitialized <span class="type">GValue</span>. </p></td>
220 <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>
221 </tr>
222 <tr>
223 <td class="parameter_name"><p>pspec</p></td>
224 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
225 <td class="parameter_annotations"> </td>
226 </tr>
227 <tr>
228 <td class="parameter_name"><p>property_node</p></td>
229 <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> containing the serialized property</p></td>
230 <td class="parameter_annotations"> </td>
231 </tr>
232 </tbody>
233 </table></div>
234 </div>
235 <div class="refsect3">
236 <a name="json-serializable-deserialize-property.returns"></a><h4>Returns</h4>
237 <p> <code class="literal">TRUE</code> if the property was successfully deserialized.</p>
238 </div>
239 </div>
240 <hr>
241 <div class="refsect2">
242 <a name="json-serializable-find-property"></a><h3>json_serializable_find_property ()</h3>
243 <pre class="programlisting"><span class="returnvalue">GParamSpec</span> *
244 json_serializable_find_property (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
245                                  <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre>
246 <p>Calls the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.find-property"><code class="function">JsonSerializableIface.find_property()</code></a> implementation on
247 the <em class="parameter"><code>serializable</code></em>
248  instance. *</p>
249 <div class="refsect3">
250 <a name="json-serializable-find-property.parameters"></a><h4>Parameters</h4>
251 <div class="informaltable"><table class="informaltable" width="100%" border="0">
252 <colgroup>
253 <col width="150px" class="parameters_name">
254 <col class="parameters_description">
255 <col width="200px" class="parameters_annotations">
256 </colgroup>
257 <tbody>
258 <tr>
259 <td class="parameter_name"><p>serializable</p></td>
260 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
261 <td class="parameter_annotations"> </td>
262 </tr>
263 <tr>
264 <td class="parameter_name"><p>name</p></td>
265 <td class="parameter_description"><p>the name of the property</p></td>
266 <td class="parameter_annotations"> </td>
267 </tr>
268 </tbody>
269 </table></div>
270 </div>
271 <div class="refsect3">
272 <a name="json-serializable-find-property.returns"></a><h4>Returns</h4>
273 <p> the <span class="type">GParamSpec</span> for the property
274 or <code class="literal">NULL</code> if no property was found. </p>
275 <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
276 </div>
277 <p class="since">Since: <a class="link" href="ix08.html#api-index-0.14">0.14</a></p>
278 </div>
279 <hr>
280 <div class="refsect2">
281 <a name="json-serializable-get-property"></a><h3>json_serializable_get_property ()</h3>
282 <pre class="programlisting"><span class="returnvalue">void</span>
283 json_serializable_get_property (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
284                                 <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>,
285                                 <em class="parameter"><code><span class="type">GValue</span> *value</code></em>);</pre>
286 <p>Calls the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.get-property"><code class="function">JsonSerializableIface.get_property()</code></a> implementation
287 on the <em class="parameter"><code>serializable</code></em>
288  instance.</p>
289 <div class="refsect3">
290 <a name="json-serializable-get-property.parameters"></a><h4>Parameters</h4>
291 <div class="informaltable"><table class="informaltable" width="100%" border="0">
292 <colgroup>
293 <col width="150px" class="parameters_name">
294 <col class="parameters_description">
295 <col width="200px" class="parameters_annotations">
296 </colgroup>
297 <tbody>
298 <tr>
299 <td class="parameter_name"><p>serializable</p></td>
300 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
301 <td class="parameter_annotations"> </td>
302 </tr>
303 <tr>
304 <td class="parameter_name"><p>pspec</p></td>
305 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
306 <td class="parameter_annotations"> </td>
307 </tr>
308 <tr>
309 <td class="parameter_name"><p>value</p></td>
310 <td class="parameter_description"><p> return location for the property value. </p></td>
311 <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>
312 </tr>
313 </tbody>
314 </table></div>
315 </div>
316 <p class="since">Since: <a class="link" href="ix08.html#api-index-0.14">0.14</a></p>
317 </div>
318 <hr>
319 <div class="refsect2">
320 <a name="json-serializable-list-properties"></a><h3>json_serializable_list_properties ()</h3>
321 <pre class="programlisting"><span class="returnvalue">GParamSpec</span> **
322 json_serializable_list_properties (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
323                                    <em class="parameter"><code><span class="type">guint</span> *n_pspecs</code></em>);</pre>
324 <p>Calls the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.list-properties"><code class="function">JsonSerializableIface.list_properties()</code></a> implementation on
325 the <em class="parameter"><code>serializable</code></em>
326  instance.</p>
327 <div class="refsect3">
328 <a name="json-serializable-list-properties.parameters"></a><h4>Parameters</h4>
329 <div class="informaltable"><table class="informaltable" width="100%" border="0">
330 <colgroup>
331 <col width="150px" class="parameters_name">
332 <col class="parameters_description">
333 <col width="200px" class="parameters_annotations">
334 </colgroup>
335 <tbody>
336 <tr>
337 <td class="parameter_name"><p>serializable</p></td>
338 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
339 <td class="parameter_annotations"> </td>
340 </tr>
341 <tr>
342 <td class="parameter_name"><p>n_pspecs</p></td>
343 <td class="parameter_description"><p> return location for the length of the array
344 of <span class="type">GParamSpec</span> returned by the function. </p></td>
345 <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>
346 </tr>
347 </tbody>
348 </table></div>
349 </div>
350 <div class="refsect3">
351 <a name="json-serializable-list-properties.returns"></a><h4>Returns</h4>
352 <p> an array
353 of <span class="type">GParamSpec</span>. Use <code class="function">g_free()</code> to free the array when done. </p>
354 <p><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_pspecs][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
355 </div>
356 <p class="since">Since: <a class="link" href="ix08.html#api-index-0.14">0.14</a></p>
357 </div>
358 <hr>
359 <div class="refsect2">
360 <a name="json-serializable-set-property"></a><h3>json_serializable_set_property ()</h3>
361 <pre class="programlisting"><span class="returnvalue">void</span>
362 json_serializable_set_property (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
363                                 <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>,
364                                 <em class="parameter"><code>const <span class="type">GValue</span> *value</code></em>);</pre>
365 <p>Calls the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.set-property"><code class="function">JsonSerializableIface.set_property()</code></a> implementation
366 on the <em class="parameter"><code>serializable</code></em>
367  instance.</p>
368 <div class="refsect3">
369 <a name="json-serializable-set-property.parameters"></a><h4>Parameters</h4>
370 <div class="informaltable"><table class="informaltable" width="100%" border="0">
371 <colgroup>
372 <col width="150px" class="parameters_name">
373 <col class="parameters_description">
374 <col width="200px" class="parameters_annotations">
375 </colgroup>
376 <tbody>
377 <tr>
378 <td class="parameter_name"><p>serializable</p></td>
379 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
380 <td class="parameter_annotations"> </td>
381 </tr>
382 <tr>
383 <td class="parameter_name"><p>pspec</p></td>
384 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
385 <td class="parameter_annotations"> </td>
386 </tr>
387 <tr>
388 <td class="parameter_name"><p>value</p></td>
389 <td class="parameter_description"><p>the property value to set</p></td>
390 <td class="parameter_annotations"> </td>
391 </tr>
392 </tbody>
393 </table></div>
394 </div>
395 <p class="since">Since: <a class="link" href="ix08.html#api-index-0.14">0.14</a></p>
396 </div>
397 <hr>
398 <div class="refsect2">
399 <a name="json-serializable-default-serialize-property"></a><h3>json_serializable_default_serialize_property ()</h3>
400 <pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
401 json_serializable_default_serialize_property
402                                (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
403                                 <em class="parameter"><code>const <span class="type">gchar</span> *property_name</code></em>,
404                                 <em class="parameter"><code>const <span class="type">GValue</span> *value</code></em>,
405                                 <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>);</pre>
406 <p>Calls the default implementation of the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a>
407 <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.serialize-property"><code class="function">JsonSerializableIface.serialize_property()</code></a> virtual function.</p>
408 <p>This function can be used inside a custom implementation
409 of the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializableIface.serialize-property"><code class="function">JsonSerializableIface.serialize_property()</code></a> virtual
410 function in lieu of calling the default implementation
411 through <code class="function">g_type_default_interface_peek()</code>:</p>
412 <div class="informalexample">
413   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
414     <tbody>
415       <tr>
416         <td class="listing_lines" align="right"><pre>1
417 2
418 3
419 4
420 5
421 6
422 7</pre></td>
423         <td class="listing_code"><pre class="programlisting"><span class="usertype">JsonSerializable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">iface</span><span class="symbol">;</span>
424 <span class="usertype">JsonNode</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">node</span><span class="symbol">;</span>
425
426 <span class="normal">iface </span><span class="symbol">=</span><span class="normal"> </span><span class="function">g_type_default_interface_peek</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">JSON_TYPE_SERIALIZABLE</span><span class="symbol">);</span>
427 <span class="normal">node </span><span class="symbol">=</span><span class="normal"> iface</span><span class="symbol">-&gt;</span><span class="function">serialize_property</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">serializable</span><span class="symbol">,</span><span class="normal"> property_name</span><span class="symbol">,</span>
428 <span class="normal">                                  value</span><span class="symbol">,</span>
429 <span class="normal">                                  pspec</span><span class="symbol">);</span></pre></td>
430       </tr>
431     </tbody>
432   </table>
433 </div>
434
435 <p></p>
436 <div class="refsect3">
437 <a name="json-serializable-default-serialize-property.parameters"></a><h4>Parameters</h4>
438 <div class="informaltable"><table class="informaltable" width="100%" border="0">
439 <colgroup>
440 <col width="150px" class="parameters_name">
441 <col class="parameters_description">
442 <col width="200px" class="parameters_annotations">
443 </colgroup>
444 <tbody>
445 <tr>
446 <td class="parameter_name"><p>serializable</p></td>
447 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> object</p></td>
448 <td class="parameter_annotations"> </td>
449 </tr>
450 <tr>
451 <td class="parameter_name"><p>property_name</p></td>
452 <td class="parameter_description"><p>the name of the property</p></td>
453 <td class="parameter_annotations"> </td>
454 </tr>
455 <tr>
456 <td class="parameter_name"><p>value</p></td>
457 <td class="parameter_description"><p>the value of the property</p></td>
458 <td class="parameter_annotations"> </td>
459 </tr>
460 <tr>
461 <td class="parameter_name"><p>pspec</p></td>
462 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
463 <td class="parameter_annotations"> </td>
464 </tr>
465 </tbody>
466 </table></div>
467 </div>
468 <div class="refsect3">
469 <a name="json-serializable-default-serialize-property.returns"></a><h4>Returns</h4>
470 <p> a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> containing the serialized
471 property. </p>
472 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
473 </div>
474 <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p>
475 </div>
476 <hr>
477 <div class="refsect2">
478 <a name="json-serializable-default-deserialize-property"></a><h3>json_serializable_default_deserialize_property ()</h3>
479 <pre class="programlisting"><span class="returnvalue">gboolean</span>
480 json_serializable_default_deserialize_property
481                                (<em class="parameter"><code><a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a> *serializable</code></em>,
482                                 <em class="parameter"><code>const <span class="type">gchar</span> *property_name</code></em>,
483                                 <em class="parameter"><code><span class="type">GValue</span> *value</code></em>,
484                                 <em class="parameter"><code><span class="type">GParamSpec</span> *pspec</code></em>,
485                                 <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> *property_node</code></em>);</pre>
486 <p>Calls the default implementation of the <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a>
487 <code class="function">deserialize_property()</code> virtual function</p>
488 <p>This function can be used inside a custom implementation
489 of the <code class="function">deserialize_property()</code> virtual function in lieu of:</p>
490 <div class="informalexample">
491   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
492     <tbody>
493       <tr>
494         <td class="listing_lines" align="right"><pre>1
495 2
496 3
497 4
498 5
499 6
500 7
501 8</pre></td>
502         <td class="listing_code"><pre class="programlisting"><span class="usertype">JsonSerializable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">iface</span><span class="symbol">;</span>
503 <span class="usertype">gboolean</span><span class="normal"> res</span><span class="symbol">;</span>
504
505 <span class="normal">iface </span><span class="symbol">=</span><span class="normal"> </span><span class="function">g_type_default_interface_peek</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">JSON_TYPE_SERIALIZABLE</span><span class="symbol">);</span>
506 <span class="normal">res </span><span class="symbol">=</span><span class="normal"> iface</span><span class="symbol">-&gt;</span><span class="function">deserialize_property</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">serializable</span><span class="symbol">,</span><span class="normal"> property_name</span><span class="symbol">,</span>
507 <span class="normal">                                   value</span><span class="symbol">,</span>
508 <span class="normal">                                   pspec</span><span class="symbol">,</span>
509 <span class="normal">                                   property_node</span><span class="symbol">);</span></pre></td>
510       </tr>
511     </tbody>
512   </table>
513 </div>
514
515 <p></p>
516 <div class="refsect3">
517 <a name="json-serializable-default-deserialize-property.parameters"></a><h4>Parameters</h4>
518 <div class="informaltable"><table class="informaltable" width="100%" border="0">
519 <colgroup>
520 <col width="150px" class="parameters_name">
521 <col class="parameters_description">
522 <col width="200px" class="parameters_annotations">
523 </colgroup>
524 <tbody>
525 <tr>
526 <td class="parameter_name"><p>serializable</p></td>
527 <td class="parameter_description"><p>a <a class="link" href="json-glib-Serializable-Interface.html#JsonSerializable"><span class="type">JsonSerializable</span></a></p></td>
528 <td class="parameter_annotations"> </td>
529 </tr>
530 <tr>
531 <td class="parameter_name"><p>property_name</p></td>
532 <td class="parameter_description"><p>the name of the property</p></td>
533 <td class="parameter_annotations"> </td>
534 </tr>
535 <tr>
536 <td class="parameter_name"><p>value</p></td>
537 <td class="parameter_description"><p>a pointer to an uninitialized <span class="type">GValue</span></p></td>
538 <td class="parameter_annotations"> </td>
539 </tr>
540 <tr>
541 <td class="parameter_name"><p>pspec</p></td>
542 <td class="parameter_description"><p>a <span class="type">GParamSpec</span></p></td>
543 <td class="parameter_annotations"> </td>
544 </tr>
545 <tr>
546 <td class="parameter_name"><p>property_node</p></td>
547 <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> containing the serialized property</p></td>
548 <td class="parameter_annotations"> </td>
549 </tr>
550 </tbody>
551 </table></div>
552 </div>
553 <div class="refsect3">
554 <a name="json-serializable-default-deserialize-property.returns"></a><h4>Returns</h4>
555 <p> <code class="literal">TRUE</code> if the property was successfully deserialized.</p>
556 </div>
557 <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10">0.10</a></p>
558 </div>
559 </div>
560 <div class="refsect1">
561 <a name="json-glib-Serializable-Interface.other_details"></a><h2>Types and Values</h2>
562 <div class="refsect2">
563 <a name="JsonSerializableIface"></a><h3>struct JsonSerializableIface</h3>
564 <pre class="programlisting">struct JsonSerializableIface {
565   JsonNode *(* serialize_property)   (JsonSerializable *serializable,
566                                       const gchar      *property_name,
567                                       const GValue     *value,
568                                       GParamSpec       *pspec);
569   gboolean  (* deserialize_property) (JsonSerializable *serializable,
570                                       const gchar      *property_name,
571                                       GValue           *value,
572                                       GParamSpec       *pspec,
573                                       JsonNode         *property_node);
574
575   GParamSpec * (* find_property)       (JsonSerializable *serializable,
576                                         const char       *name);
577   GParamSpec **(* list_properties)     (JsonSerializable *serializable,
578                                         guint            *n_pspecs);
579   void         (* set_property)        (JsonSerializable *serializable,
580                                         GParamSpec       *pspec,
581                                         const GValue     *value);
582   void         (* get_property)        (JsonSerializable *serializable,
583                                         GParamSpec       *pspec,
584                                         GValue           *value);
585 };
586 </pre>
587 <p>Interface that allows serializing and deserializing <span class="type">GObject</span> instances
588 with properties storing complex data types. The <a class="link" href="json-glib-GObject-Serialization.html#json-serialize-gobject" title="json_serialize_gobject ()"><code class="function">json_serialize_gobject()</code></a>
589 function will check if the passed <span class="type">GObject</span> implements this interface,
590 so it can also be used to override the default property serialization
591 sequence.</p>
592 <div class="refsect3">
593 <a name="JsonSerializableIface.members"></a><h4>Members</h4>
594 <div class="informaltable"><table class="informaltable" width="100%" border="0">
595 <colgroup>
596 <col width="300px" class="struct_members_name">
597 <col class="struct_members_description">
598 <col width="200px" class="struct_members_annotations">
599 </colgroup>
600 <tbody>
601 <tr>
602 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.serialize-property"></a>serialize_property</code></em> ()</p></td>
603 <td class="struct_member_description"><p>virtual function for serializing a <span class="type">GObject</span> property
604 into a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p></td>
605 <td class="struct_member_annotations"> </td>
606 </tr>
607 <tr>
608 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.deserialize-property"></a>deserialize_property</code></em> ()</p></td>
609 <td class="struct_member_description"><p>virtual function for deserializing a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a>
610 into a <span class="type">GObject</span> property</p></td>
611 <td class="struct_member_annotations"> </td>
612 </tr>
613 <tr>
614 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.find-property"></a>find_property</code></em> ()</p></td>
615 <td class="struct_member_description"><p>virtual function for finding a property definition using
616 its name</p></td>
617 <td class="struct_member_annotations"> </td>
618 </tr>
619 <tr>
620 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.list-properties"></a>list_properties</code></em> ()</p></td>
621 <td class="struct_member_description"><p>virtual function for listing the installed property
622 definitions</p></td>
623 <td class="struct_member_annotations"> </td>
624 </tr>
625 <tr>
626 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.set-property"></a>set_property</code></em> ()</p></td>
627 <td class="struct_member_description"><p>virtual function for setting a property</p></td>
628 <td class="struct_member_annotations"> </td>
629 </tr>
630 <tr>
631 <td class="struct_member_name"><p><em class="structfield"><code><a name="JsonSerializableIface.get-property"></a>get_property</code></em> ()</p></td>
632 <td class="struct_member_description"><p>virtual function for getting a property</p></td>
633 <td class="struct_member_annotations"> </td>
634 </tr>
635 </tbody>
636 </table></div>
637 </div>
638 </div>
639 </div>
640 </div>
641 <div class="footer">
642 <hr>Generated by GTK-Doc V1.25.1</div>
643 </body>
644 </html>