File: json-serializable.xml

package info (click to toggle)
json-glib 0.10.2-2squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,040 kB
  • ctags: 1,024
  • sloc: sh: 10,309; ansic: 7,318; xml: 3,751; makefile: 239
file content (259 lines) | stat: -rw-r--r-- 16,759 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>

<refentry id="json-glib-Serializable-Interface">
<refmeta>
<refentrytitle role="top_of_page" id="json-glib-Serializable-Interface.top_of_page">Serializable Interface</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>JSON-GLIB Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Serializable Interface</refname>
<refpurpose>Interface for serialize and deserialize special GObjects</refpurpose>
</refnamediv>

<refsynopsisdiv id="json-glib-Serializable-Interface.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="JsonSerializableIface">JsonSerializableIface</link>;
<link linkend="JsonNode">JsonNode</link> *          <link linkend="json-serializable-serialize-property">json_serializable_serialize_property</link>
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         const <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec);
<link linkend="gboolean">gboolean</link>            <link linkend="json-serializable-deserialize-property">json_serializable_deserialize_property</link>
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec,
                                                         <link linkend="JsonNode">JsonNode</link> *property_node);

<link linkend="JsonNode">JsonNode</link> *          <link linkend="json-serializable-default-serialize-property">json_serializable_default_serialize_property</link>
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         const <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec);
<link linkend="gboolean">gboolean</link>            <link linkend="json-serializable-default-deserialize-property">json_serializable_default_deserialize_property</link>
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec,
                                                         <link linkend="JsonNode">JsonNode</link> *property_node);
</synopsis>
</refsynopsisdiv>









<refsect1 id="json-glib-Serializable-Interface.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="JsonSerializable"><type>JsonSerializable</type></link> is an interface for <link linkend="GObject"><type>GObject</type></link> classes that
allows controlling how the class is going to be serialized
or deserialized by <link linkend="json-construct-gobject"><function>json_construct_gobject()</function></link> and
<link linkend="json-serialize-gobject"><function>json_serialize_gobject()</function></link> respectively.</para>
<para>
</para>
</refsect1>

<refsect1 id="json-glib-Serializable-Interface.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="JsonSerializableIface" role="struct">
<title>JsonSerializableIface</title>
<indexterm zone="JsonSerializableIface"><primary sortas="SerializableIface">JsonSerializableIface</primary></indexterm><programlisting>typedef struct {
  JsonNode *(* serialize_property)   (JsonSerializable *serializable,
                                      const gchar      *property_name,
                                      const GValue     *value,
                                      GParamSpec       *pspec);
  gboolean  (* deserialize_property) (JsonSerializable *serializable,
                                      const gchar      *property_name,
                                      GValue           *value,
                                      GParamSpec       *pspec,
                                      JsonNode         *property_node);
} JsonSerializableIface;
</programlisting>
<para>
Interface that allows serializing and deserializing <link linkend="GObject"><type>GObject</type></link><!-- -->s
with properties storing complex data types. The <link linkend="json-serialize-gobject"><function>json_serialize_gobject()</function></link>
function will check if the passed <link linkend="GObject"><type>GObject</type></link> implements this interface,
so it can also be used to override the default property serialization
sequence.</para>
<para>
</para><variablelist role="struct">
<varlistentry>
<term><structfield>serialize_property</structfield>&#160;()</term>
<listitem><simpara> virtual function for serializing a <link linkend="GObject"><type>GObject</type></link> property
  into a <link linkend="JsonNode"><type>JsonNode</type></link>
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>deserialize_property</structfield>&#160;()</term>
<listitem><simpara> virtual function for deserializing a <link linkend="JsonNode"><type>JsonNode</type></link>
  into a <link linkend="GObject"><type>GObject</type></link> property
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="json-serializable-serialize-property" role="function">
<title>json_serializable_serialize_property ()</title>
<indexterm zone="json-serializable-serialize-property"><primary sortas="serializable_serialize_property">json_serializable_serialize_property</primary></indexterm><programlisting><link linkend="JsonNode">JsonNode</link> *          json_serializable_serialize_property
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         const <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec);</programlisting>
<para>
Asks a <link linkend="JsonSerializable"><type>JsonSerializable</type></link> implementation to serialize a <link linkend="GObject"><type>GObject</type></link>
property into a <link linkend="JsonNode"><type>JsonNode</type></link> object.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>serializable</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonSerializable"><type>JsonSerializable</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_name</parameter>&#160;:</term>
<listitem><simpara> the name of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> the value of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pspec</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GParamSpec"><type>GParamSpec</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="JsonNode"><type>JsonNode</type></link> containing the serialized property
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="json-serializable-deserialize-property" role="function">
<title>json_serializable_deserialize_property ()</title>
<indexterm zone="json-serializable-deserialize-property"><primary sortas="serializable_deserialize_property">json_serializable_deserialize_property</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            json_serializable_deserialize_property
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec,
                                                         <link linkend="JsonNode">JsonNode</link> *property_node);</programlisting>
<para>
Asks a <link linkend="JsonSerializable"><type>JsonSerializable</type></link> implementation to deserialize the
property contained inside <parameter>property_node</parameter> into <parameter>value</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>serializable</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonSerializable"><type>JsonSerializable</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_name</parameter>&#160;:</term>
<listitem><simpara> the name of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> a pointer to an uninitialized <link linkend="GValue"><type>GValue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pspec</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GParamSpec"><type>GParamSpec</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_node</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonNode"><type>JsonNode</type></link> containing the serialized property
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the property was successfully deserialized.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="json-serializable-default-serialize-property" role="function" condition="since:0.10">
<title>json_serializable_default_serialize_property ()</title>
<indexterm zone="json-serializable-default-serialize-property" role="0.10"><primary sortas="serializable_default_serialize_property">json_serializable_default_serialize_property</primary></indexterm><programlisting><link linkend="JsonNode">JsonNode</link> *          json_serializable_default_serialize_property
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         const <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec);</programlisting>
<para>
Calls the default implementation of the <link linkend="JsonSerializable"><type>JsonSerializable</type></link>
<link linkend="serialize-property"><function>serialize_property()</function></link> virtual function
</para>
<para>
This function can be used inside a custom implementation
of the <link linkend="serialize-property"><function>serialize_property()</function></link> virtual function in lieu of:
</para>
<para>
<informalexample><programlisting>
  JsonSerializable *iface;
  JsonNode *node;

  iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
  node = iface->serialize_property (serializable, property_name,
                                    value,
                                    pspec);
</programlisting></informalexample></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>serializable</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonSerializable"><type>JsonSerializable</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_name</parameter>&#160;:</term>
<listitem><simpara> the name of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> the value of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pspec</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GParamSpec"><type>GParamSpec</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>transfer full. <acronym>transfer</acronym> full. </simpara></listitem></varlistentry>
</variablelist><para role="since">Since 0.10</para></refsect2>
<refsect2 id="json-serializable-default-deserialize-property" role="function" condition="since:0.10">
<title>json_serializable_default_deserialize_property ()</title>
<indexterm zone="json-serializable-default-deserialize-property" role="0.10"><primary sortas="serializable_default_deserialize_property">json_serializable_default_deserialize_property</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            json_serializable_default_deserialize_property
                                                        (<link linkend="JsonSerializable">JsonSerializable</link> *serializable,
                                                         const <link linkend="gchar">gchar</link> *property_name,
                                                         <link linkend="GValue">GValue</link> *value,
                                                         <link linkend="GParamSpec">GParamSpec</link> *pspec,
                                                         <link linkend="JsonNode">JsonNode</link> *property_node);</programlisting>
<para>
Calls the default implementation of the <link linkend="JsonSerializable"><type>JsonSerializable</type></link>
<link linkend="deserialize-property"><function>deserialize_property()</function></link> virtual function
</para>
<para>
This function can be used inside a custom implementation
of the <link linkend="deserialize-property"><function>deserialize_property()</function></link> virtual function in lieu of:
</para>
<para>
<informalexample><programlisting>
  JsonSerializable *iface;
  gboolean res;

  iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
  res = iface->deserialize_property (serializable, property_name,
                                     value,
                                     pspec,
                                     property_node);
</programlisting></informalexample></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>serializable</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonSerializable"><type>JsonSerializable</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_name</parameter>&#160;:</term>
<listitem><simpara> the name of the property
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&#160;:</term>
<listitem><simpara> a pointer to an uninitialized <link linkend="GValue"><type>GValue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pspec</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GParamSpec"><type>GParamSpec</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>property_node</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="JsonNode"><type>JsonNode</type></link> containing the serialized property
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the property was successfully deserialized.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 0.10</para></refsect2>

</refsect1>




</refentry>