1 /* json-glib-1.0.vapi generated by vapigen, do not modify. */
3 [CCode (cprefix = "Json", gir_namespace = "Json", gir_version = "1.0", lower_case_cprefix = "json_")]
5 [CCode (cheader_filename = "json-glib/json-glib.h", ref_function = "json_array_ref", type_id = "json_array_get_type ()", unref_function = "json_array_unref")]
8 [CCode (has_construct_function = false)]
10 [Version (since = "0.8")]
11 public void add_array_element (owned Json.Array? value);
12 [Version (since = "0.8")]
13 public void add_boolean_element (bool value);
14 [Version (since = "0.8")]
15 public void add_double_element (double value);
16 public void add_element (owned Json.Node node);
17 [Version (since = "0.8")]
18 public void add_int_element (int64 value);
19 [Version (since = "0.8")]
20 public void add_null_element ();
21 [Version (since = "0.8")]
22 public void add_object_element (owned Json.Object value);
23 [Version (since = "0.8")]
24 public void add_string_element (string value);
25 [Version (since = "0.6")]
26 public Json.Node dup_element (uint index_);
27 [Version (since = "1.2")]
28 public bool equal (Json.Array b);
29 [Version (since = "0.8")]
30 public void foreach_element (Json.ArrayForeach func);
31 [Version (since = "0.8")]
32 public unowned Json.Array get_array_element (uint index_);
33 [Version (since = "0.8")]
34 public bool get_boolean_element (uint index_);
35 [Version (since = "0.8")]
36 public double get_double_element (uint index_);
37 public unowned Json.Node get_element (uint index_);
38 public GLib.List<weak Json.Node> get_elements ();
39 [Version (since = "0.8")]
40 public int64 get_int_element (uint index_);
41 public uint get_length ();
42 [Version (since = "0.8")]
43 public bool get_null_element (uint index_);
44 [Version (since = "0.8")]
45 public unowned Json.Object get_object_element (uint index_);
46 [Version (since = "0.8")]
47 public unowned string get_string_element (uint index_);
48 [Version (since = "1.2")]
50 [Version (since = "1.2")]
51 public bool is_immutable ();
52 public unowned Json.Array @ref ();
53 public void remove_element (uint index_);
54 [Version (since = "1.2")]
56 [CCode (cname = "json_array_sized_new", has_construct_function = false)]
57 public Array.sized (uint n_elements);
60 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_builder_get_type ()")]
61 [Version (since = "0.12")]
62 public class Builder : GLib.Object {
63 [CCode (has_construct_function = false)]
65 public unowned Json.Builder? add_boolean_value (bool value);
66 public unowned Json.Builder? add_double_value (double value);
67 public unowned Json.Builder? add_int_value (int64 value);
68 public unowned Json.Builder? add_null_value ();
69 public unowned Json.Builder? add_string_value (string value);
70 public unowned Json.Builder? add_value (owned Json.Node node);
71 public unowned Json.Builder? begin_array ();
72 public unowned Json.Builder? begin_object ();
73 public unowned Json.Builder? end_array ();
74 public unowned Json.Builder? end_object ();
75 public Json.Node? get_root ();
76 [CCode (cname = "json_builder_new_immutable", has_construct_function = false)]
77 [Version (since = "1.2")]
78 public Builder.immutable_new ();
80 public unowned Json.Builder? set_member_name (string member_name);
82 [Version (since = "1.2")]
83 public bool immutable { get; construct; }
85 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_generator_get_type ()")]
86 public class Generator : GLib.Object {
87 [CCode (has_construct_function = false)]
89 [Version (since = "0.14")]
90 public uint get_indent ();
91 [Version (since = "0.14")]
92 public unichar get_indent_char ();
93 [Version (since = "0.14")]
94 public bool get_pretty ();
95 [Version (since = "0.14")]
96 public unowned Json.Node? get_root ();
97 [Version (since = "0.14")]
98 public void set_indent (uint indent_level);
99 [Version (since = "0.14")]
100 public void set_indent_char (unichar indent_char);
101 [Version (since = "0.14")]
102 public void set_pretty (bool is_pretty);
103 public void set_root (Json.Node node);
104 public string to_data (out size_t length);
105 public bool to_file (string filename) throws GLib.Error;
106 [Version (since = "1.4")]
107 public unowned GLib.StringBuilder to_gstring (GLib.StringBuilder string);
108 [Version (since = "0.12")]
109 public bool to_stream (GLib.OutputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
110 public uint indent { get; set; }
111 [Version (since = "0.6")]
112 public uint indent_char { get; set; }
113 public bool pretty { get; set; }
114 [Version (since = "0.4")]
115 public Json.Node root { get; set; }
117 [CCode (cheader_filename = "json-glib/json-glib.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "json_node_get_type ()")]
120 [CCode (has_construct_function = false)]
121 public Node (Json.NodeType type);
122 [CCode (cname = "json_node_alloc", has_construct_function = false)]
123 [Version (since = "0.16")]
124 public Node.alloc ();
125 public Json.Node copy ();
126 public Json.Array? dup_array ();
127 public Json.Object? dup_object ();
128 public string? dup_string ();
129 [Version (since = "1.2")]
130 public bool equal (Json.Node b);
132 public unowned Json.Array? get_array ();
133 public bool get_boolean ();
134 public double get_double ();
135 public int64 get_int ();
136 [Version (since = "0.8")]
137 public Json.NodeType get_node_type ();
138 public unowned Json.Object? get_object ();
139 public unowned Json.Node? get_parent ();
140 public unowned string? get_string ();
141 public GLib.Value get_value ();
142 [Version (since = "0.4")]
143 public GLib.Type get_value_type ();
144 [Version (since = "1.2")]
146 [Version (since = "0.16")]
147 public unowned Json.Node init (Json.NodeType type);
148 [Version (since = "0.16")]
149 public unowned Json.Node init_array (Json.Array? array);
150 [Version (since = "0.16")]
151 public unowned Json.Node init_boolean (bool value);
152 [Version (since = "0.16")]
153 public unowned Json.Node init_double (double value);
154 [Version (since = "0.16")]
155 public unowned Json.Node init_int (int64 value);
156 [Version (since = "0.16")]
157 public unowned Json.Node init_null ();
158 [Version (since = "0.16")]
159 public unowned Json.Node init_object (Json.Object? object);
160 [Version (since = "0.16")]
161 public unowned Json.Node init_string (string? value);
162 [Version (since = "1.2")]
163 public bool is_immutable ();
164 [Version (since = "0.8")]
165 public bool is_null ();
166 [Version (since = "1.2")]
168 public void set_array (Json.Array array);
169 public void set_boolean (bool value);
170 public void set_double (double value);
171 public void set_int (int64 value);
172 public void set_object (Json.Object? object);
173 [Version (since = "0.8")]
174 public void set_parent (Json.Node parent);
175 public void set_string (string value);
176 public void set_value (GLib.Value value);
177 public void take_array (owned Json.Array array);
178 public void take_object (owned Json.Object object);
179 public unowned string type_name ();
181 [CCode (cheader_filename = "json-glib/json-glib.h", ref_function = "json_object_ref", type_id = "json_object_get_type ()", unref_function = "json_object_unref")]
183 public class Object {
184 [CCode (has_construct_function = false)]
186 [Version (deprecated = true, deprecated_since = "0.8", replacement = "Json.Object.set_member")]
187 public void add_member (string member_name, owned Json.Node node);
188 [Version (since = "0.6")]
189 public Json.Node? dup_member (string member_name);
190 [Version (since = "1.2")]
191 public bool equal (Json.Object b);
192 [Version (since = "0.8")]
193 public void foreach_member (Json.ObjectForeach func);
194 [Version (since = "0.8")]
195 public unowned Json.Array get_array_member (string member_name);
196 [Version (since = "0.8")]
197 public bool get_boolean_member (string member_name);
198 [Version (since = "1.6")]
199 public bool get_boolean_member_with_default (string member_name, bool default_value);
200 [Version (since = "0.8")]
201 public double get_double_member (string member_name);
202 [Version (since = "1.6")]
203 public double get_double_member_with_default (string member_name, double default_value);
204 [Version (since = "0.8")]
205 public int64 get_int_member (string member_name);
206 [Version (since = "1.6")]
207 public int64 get_int_member_with_default (string member_name, int64 default_value);
208 public unowned Json.Node? get_member (string member_name);
209 public GLib.List<weak string>? get_members ();
210 [Version (since = "0.8")]
211 public bool get_null_member (string member_name);
212 [Version (since = "0.8")]
213 public unowned Json.Object? get_object_member (string member_name);
214 public uint get_size ();
215 [Version (since = "0.8")]
216 public unowned string get_string_member (string member_name);
217 [Version (since = "1.6")]
218 public unowned string get_string_member_with_default (string member_name, string default_value);
219 public GLib.List<weak Json.Node>? get_values ();
220 public bool has_member (string member_name);
221 [Version (since = "1.2")]
223 [Version (since = "1.2")]
224 public bool is_immutable ();
225 public unowned Json.Object @ref ();
226 public void remove_member (string member_name);
227 [Version (since = "1.2")]
229 [Version (since = "0.8")]
230 public void set_array_member (string member_name, owned Json.Array value);
231 [Version (since = "0.8")]
232 public void set_boolean_member (string member_name, bool value);
233 [Version (since = "0.8")]
234 public void set_double_member (string member_name, double value);
235 [Version (since = "0.8")]
236 public void set_int_member (string member_name, int64 value);
237 [Version (since = "0.8")]
238 public void set_member (string member_name, owned Json.Node node);
239 [Version (since = "0.8")]
240 public void set_null_member (string member_name);
241 [Version (since = "0.8")]
242 public void set_object_member (string member_name, owned Json.Object value);
243 [Version (since = "0.8")]
244 public void set_string_member (string member_name, string value);
245 public void unref ();
247 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_parser_get_type ()")]
248 public class Parser : GLib.Object {
249 [CCode (has_construct_function = false)]
251 public uint get_current_line ();
252 public uint get_current_pos ();
253 public unowned Json.Node? get_root ();
254 [Version (since = "0.4")]
255 public bool has_assignment (out unowned string variable_name);
256 [CCode (cname = "json_parser_new_immutable", has_construct_function = false)]
257 [Version (since = "1.2")]
258 public Parser.immutable_new ();
259 public bool load_from_data (string data, ssize_t length = -1) throws GLib.Error;
260 public bool load_from_file (string filename) throws GLib.Error;
261 [Version (since = "0.12")]
262 public bool load_from_stream (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
263 [Version (since = "0.12")]
264 public async bool load_from_stream_async (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
265 [Version (since = "1.4")]
266 public Json.Node? steal_root ();
268 [Version (since = "1.2")]
269 public bool immutable { get; construct; }
270 public virtual signal void array_element (Json.Array array, int index_);
271 public virtual signal void array_end (Json.Array array);
272 public virtual signal void array_start ();
273 public virtual signal void error (void* error);
274 public virtual signal void object_end (Json.Object object);
275 public virtual signal void object_member (Json.Object object, string member_name);
276 public virtual signal void object_start ();
277 public virtual signal void parse_end ();
278 public virtual signal void parse_start ();
280 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_path_get_type ()")]
281 [Version (since = "0.14")]
282 public class Path : GLib.Object {
283 [CCode (has_construct_function = false)]
285 public bool compile (string expression) throws GLib.Error;
286 public Json.Node match (Json.Node root);
287 public static Json.Node query (string expression, Json.Node root) throws GLib.Error;
289 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_reader_get_type ()")]
290 [Version (since = "0.12")]
291 public class Reader : GLib.Object {
292 [CCode (has_construct_function = false)]
293 public Reader (Json.Node? node);
294 public int count_elements ();
295 public int count_members ();
296 public void end_element ();
297 public void end_member ();
298 public bool get_boolean_value ();
299 public double get_double_value ();
300 public unowned GLib.Error? get_error ();
301 public int64 get_int_value ();
302 [Version (since = "0.14")]
303 public unowned string? get_member_name ();
304 public bool get_null_value ();
305 public unowned string get_string_value ();
306 public unowned Json.Node? get_value ();
307 public bool is_array ();
308 public bool is_object ();
309 public bool is_value ();
310 [CCode (array_length = false, array_null_terminated = true)]
311 [Version (since = "0.14")]
312 public string[] list_members ();
313 public bool read_element (uint index_);
314 public bool read_member (string member_name);
315 public void set_root (Json.Node? root);
317 public Json.Node root { owned get; set construct; }
319 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h", type_id = "json_serializable_get_type ()")]
320 public interface Serializable : GLib.Object {
321 [Version (since = "0.10")]
322 public bool default_deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
323 [Version (since = "0.10")]
324 public Json.Node default_serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
325 public abstract bool deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
326 [Version (since = "0.14")]
327 public abstract unowned GLib.ParamSpec? find_property (string name);
328 [Version (since = "0.14")]
329 public abstract GLib.Value get_property (GLib.ParamSpec pspec);
330 [CCode (array_length_pos = 0.1, array_length_type = "guint")]
331 [Version (since = "0.14")]
332 public (unowned GLib.ParamSpec)[] list_properties ();
333 public abstract Json.Node serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
334 [Version (since = "0.14")]
335 public abstract void set_property (GLib.ParamSpec pspec, GLib.Value value);
337 [CCode (cheader_filename = "json-glib/json-glib.h", has_type_id = false)]
338 [Version (since = "1.2")]
339 public struct ObjectIter {
340 public void init (Json.Object object);
341 public bool next (out unowned string member_name, out unowned Json.Node member_node);
343 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_NODE_", type_id = "json_node_type_get_type ()")]
344 public enum NodeType {
350 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_PARSER_ERROR_")]
351 public errordomain ParserError {
360 public static GLib.Quark quark ();
362 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_PATH_ERROR_INVALID_")]
363 [Version (since = "0.14")]
364 public errordomain PathError {
366 public static GLib.Quark quark ();
368 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_READER_ERROR_")]
369 [Version (since = "0.12")]
370 public errordomain ReaderError {
378 public static GLib.Quark quark ();
380 [CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
381 [Version (since = "0.8")]
382 public delegate void ArrayForeach (Json.Array array, uint index_, Json.Node element_node);
383 [CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
384 [Version (since = "0.10")]
385 public delegate void* BoxedDeserializeFunc (Json.Node node);
386 [CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
387 [Version (since = "0.10")]
388 public delegate Json.Node BoxedSerializeFunc (void* boxed);
389 [CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
390 [Version (since = "0.8")]
391 public delegate void ObjectForeach (Json.Object object, string member_name, Json.Node member_node);
392 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MAJOR_VERSION")]
393 public const int MAJOR_VERSION;
394 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MICRO_VERSION")]
395 public const int MICRO_VERSION;
396 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MINOR_VERSION")]
397 public const int MINOR_VERSION;
398 [CCode (cheader_filename = "json-glib/json-glib.h")]
399 public const int VERSION_HEX;
400 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_VERSION_S")]
401 public const string VERSION_S;
402 [CCode (cheader_filename = "json-glib/json-glib.h")]
403 [Version (since = "0.10")]
404 public static bool boxed_can_deserialize (GLib.Type gboxed_type, Json.NodeType node_type);
405 [CCode (cheader_filename = "json-glib/json-glib.h")]
406 [Version (since = "0.10")]
407 public static bool boxed_can_serialize (GLib.Type gboxed_type, out Json.NodeType node_type);
408 [CCode (cheader_filename = "json-glib/json-glib.h")]
409 [Version (since = "0.10")]
410 public static void* boxed_deserialize (GLib.Type gboxed_type, Json.Node node);
411 [CCode (cheader_filename = "json-glib/json-glib.h")]
412 [Version (since = "0.10")]
413 public static void boxed_register_deserialize_func (GLib.Type gboxed_type, Json.NodeType node_type, Json.BoxedDeserializeFunc deserialize_func);
414 [CCode (cheader_filename = "json-glib/json-glib.h")]
415 [Version (since = "0.10")]
416 public static void boxed_register_serialize_func (GLib.Type gboxed_type, Json.NodeType node_type, Json.BoxedSerializeFunc serialize_func);
417 [CCode (cheader_filename = "json-glib/json-glib.h")]
418 [Version (since = "0.10")]
419 public static Json.Node? boxed_serialize (GLib.Type gboxed_type, void* boxed);
420 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
421 [Version (deprecated = true, deprecated_since = "0.10", replacement = "Json.gobject_from_data", since = "0.4")]
422 public static GLib.Object construct_gobject (GLib.Type gtype, string data, size_t length) throws GLib.Error;
423 [CCode (cheader_filename = "json-glib/json-glib.h")]
424 [Version (since = "1.2")]
425 public static Json.Node from_string (string str) throws GLib.Error;
426 [CCode (cheader_filename = "json-glib/json-glib.h")]
427 [Version (since = "0.10")]
428 public static GLib.Object gobject_deserialize (GLib.Type gtype, Json.Node node);
429 [CCode (cheader_filename = "json-glib/json-glib.h")]
430 [Version (since = "0.10")]
431 public static GLib.Object gobject_from_data (GLib.Type gtype, string data, ssize_t length = -1) throws GLib.Error;
432 [CCode (cheader_filename = "json-glib/json-glib.h")]
433 [Version (since = "0.10")]
434 public static Json.Node gobject_serialize (GLib.Object gobject);
435 [CCode (cheader_filename = "json-glib/json-glib.h")]
436 [Version (since = "0.10")]
437 public static string gobject_to_data (GLib.Object gobject, out size_t length);
438 [CCode (cheader_filename = "json-glib/json-glib.h", returns_floating_reference = true)]
439 [Version (since = "0.14")]
440 public static GLib.Variant? gvariant_deserialize (Json.Node json_node, string? signature) throws GLib.Error;
441 [CCode (cheader_filename = "json-glib/json-glib.h", returns_floating_reference = true)]
442 [Version (since = "0.14")]
443 public static GLib.Variant? gvariant_deserialize_data (string json, ssize_t length, string? signature) throws GLib.Error;
444 [CCode (cheader_filename = "json-glib/json-glib.h")]
445 [Version (since = "0.14")]
446 public static Json.Node gvariant_serialize (GLib.Variant variant);
447 [CCode (cheader_filename = "json-glib/json-glib.h")]
448 [Version (since = "0.14")]
449 public static string gvariant_serialize_data (GLib.Variant variant, out size_t length);
450 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
451 [Version (deprecated = true, deprecated_since = "0.10", replacement = "Json.gobject_to_data")]
452 public static string serialize_gobject (GLib.Object gobject, out size_t length);
453 [CCode (cheader_filename = "json-glib/json-glib.h")]
454 [Version (since = "1.2")]
455 public static int string_compare (string a, string b);
456 [CCode (cheader_filename = "json-glib/json-glib.h")]
457 [Version (since = "1.2")]
458 public static bool string_equal (string a, string b);
459 [CCode (cheader_filename = "json-glib/json-glib.h")]
460 [Version (since = "1.2")]
461 public static uint string_hash (string key);
462 [CCode (cheader_filename = "json-glib/json-glib.h")]
463 [Version (since = "1.2")]
464 public static string to_string (Json.Node node, bool pretty);