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 = "0.12")]
107 public bool to_stream (GLib.OutputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
108 public uint indent { get; set; }
109 [Version (since = "0.6")]
110 public uint indent_char { get; set; }
111 public bool pretty { get; set; }
112 [Version (since = "0.4")]
113 public Json.Node root { get; set; }
115 [CCode (cheader_filename = "json-glib/json-glib.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "json_node_get_type ()")]
118 [CCode (has_construct_function = false)]
119 public Node (Json.NodeType type);
120 [CCode (cname = "json_node_alloc", has_construct_function = false)]
121 [Version (since = "0.16")]
122 public Node.alloc ();
123 public Json.Node copy ();
124 public Json.Array? dup_array ();
125 public Json.Object? dup_object ();
126 public string? dup_string ();
127 [Version (since = "1.2")]
128 public bool equal (Json.Node b);
130 public unowned Json.Array? get_array ();
131 public bool get_boolean ();
132 public double get_double ();
133 public int64 get_int ();
134 [Version (since = "0.8")]
135 public Json.NodeType get_node_type ();
136 public unowned Json.Object? get_object ();
137 public unowned Json.Node? get_parent ();
138 public unowned string? get_string ();
139 public GLib.Value get_value ();
140 [Version (since = "0.4")]
141 public GLib.Type get_value_type ();
142 [Version (since = "1.2")]
144 [Version (since = "0.16")]
145 public unowned Json.Node init (Json.NodeType type);
146 [Version (since = "0.16")]
147 public unowned Json.Node init_array (Json.Array? array);
148 [Version (since = "0.16")]
149 public unowned Json.Node init_boolean (bool value);
150 [Version (since = "0.16")]
151 public unowned Json.Node init_double (double value);
152 [Version (since = "0.16")]
153 public unowned Json.Node init_int (int64 value);
154 [Version (since = "0.16")]
155 public unowned Json.Node init_null ();
156 [Version (since = "0.16")]
157 public unowned Json.Node init_object (Json.Object? object);
158 [Version (since = "0.16")]
159 public unowned Json.Node init_string (string? value);
160 [Version (since = "1.2")]
161 public bool is_immutable ();
162 [Version (since = "0.8")]
163 public bool is_null ();
164 [Version (since = "1.2")]
166 public void set_array (Json.Array array);
167 public void set_boolean (bool value);
168 public void set_double (double value);
169 public void set_int (int64 value);
170 public void set_object (Json.Object? object);
171 [Version (since = "0.8")]
172 public void set_parent (Json.Node parent);
173 public void set_string (string value);
174 public void set_value (GLib.Value value);
175 public void take_array (owned Json.Array array);
176 public void take_object (owned Json.Object object);
177 public unowned string type_name ();
179 [CCode (cheader_filename = "json-glib/json-glib.h", ref_function = "json_object_ref", type_id = "json_object_get_type ()", unref_function = "json_object_unref")]
181 public class Object {
182 [CCode (has_construct_function = false)]
184 [Version (deprecated = true, deprecated_since = "0.8", replacement = "Json.Object.set_member")]
185 public void add_member (string member_name, owned Json.Node node);
186 [Version (since = "0.6")]
187 public Json.Node dup_member (string member_name);
188 [Version (since = "1.2")]
189 public bool equal (Json.Object b);
190 [Version (since = "0.8")]
191 public void foreach_member (Json.ObjectForeach func);
192 [Version (since = "0.8")]
193 public unowned Json.Array get_array_member (string member_name);
194 [Version (since = "0.8")]
195 public bool get_boolean_member (string member_name);
196 [Version (since = "0.8")]
197 public double get_double_member (string member_name);
198 [Version (since = "0.8")]
199 public int64 get_int_member (string member_name);
200 public unowned Json.Node get_member (string member_name);
201 public GLib.List<weak string> get_members ();
202 [Version (since = "0.8")]
203 public bool get_null_member (string member_name);
204 [Version (since = "0.8")]
205 public unowned Json.Object? get_object_member (string member_name);
206 public uint get_size ();
207 [Version (since = "0.8")]
208 public unowned string get_string_member (string member_name);
209 public GLib.List<weak Json.Node> get_values ();
210 public bool has_member (string member_name);
211 [Version (since = "1.2")]
213 [Version (since = "1.2")]
214 public bool is_immutable ();
215 public unowned Json.Object @ref ();
216 public void remove_member (string member_name);
217 [Version (since = "1.2")]
219 [Version (since = "0.8")]
220 public void set_array_member (string member_name, owned Json.Array value);
221 [Version (since = "0.8")]
222 public void set_boolean_member (string member_name, bool value);
223 [Version (since = "0.8")]
224 public void set_double_member (string member_name, double value);
225 [Version (since = "0.8")]
226 public void set_int_member (string member_name, int64 value);
227 [Version (since = "0.8")]
228 public void set_member (string member_name, owned Json.Node node);
229 [Version (since = "0.8")]
230 public void set_null_member (string member_name);
231 [Version (since = "0.8")]
232 public void set_object_member (string member_name, owned Json.Object value);
233 [Version (since = "0.8")]
234 public void set_string_member (string member_name, string value);
235 public void unref ();
237 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_parser_get_type ()")]
238 public class Parser : GLib.Object {
239 [CCode (has_construct_function = false)]
241 public uint get_current_line ();
242 public uint get_current_pos ();
243 public unowned Json.Node? get_root ();
244 [Version (since = "0.4")]
245 public bool has_assignment (out unowned string variable_name);
246 [CCode (cname = "json_parser_new_immutable", has_construct_function = false)]
247 [Version (since = "1.2")]
248 public Parser.immutable_new ();
249 public bool load_from_data (string data, ssize_t length = -1) throws GLib.Error;
250 public bool load_from_file (string filename) throws GLib.Error;
251 [Version (since = "0.12")]
252 public bool load_from_stream (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
253 [Version (since = "0.12")]
254 public async bool load_from_stream_async (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
256 [Version (since = "1.2")]
257 public bool immutable { get; construct; }
258 public virtual signal void array_element (Json.Array array, int index_);
259 public virtual signal void array_end (Json.Array array);
260 public virtual signal void array_start ();
261 public virtual signal void error (void* error);
262 public virtual signal void object_end (Json.Object object);
263 public virtual signal void object_member (Json.Object object, string member_name);
264 public virtual signal void object_start ();
265 public virtual signal void parse_end ();
266 public virtual signal void parse_start ();
268 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_path_get_type ()")]
269 [Version (since = "0.14")]
270 public class Path : GLib.Object {
271 [CCode (has_construct_function = false)]
273 public bool compile (string expression) throws GLib.Error;
274 public Json.Node match (Json.Node root);
275 public static Json.Node query (string expression, Json.Node root) throws GLib.Error;
277 [CCode (cheader_filename = "json-glib/json-glib.h", type_id = "json_reader_get_type ()")]
278 [Version (since = "0.12")]
279 public class Reader : GLib.Object {
280 [CCode (has_construct_function = false)]
281 public Reader (Json.Node? node);
282 public int count_elements ();
283 public int count_members ();
284 public void end_element ();
285 public void end_member ();
286 public bool get_boolean_value ();
287 public double get_double_value ();
288 public unowned GLib.Error get_error ();
289 public int64 get_int_value ();
290 [Version (since = "0.14")]
291 public unowned string get_member_name ();
292 public bool get_null_value ();
293 public unowned string get_string_value ();
294 public unowned Json.Node get_value ();
295 public bool is_array ();
296 public bool is_object ();
297 public bool is_value ();
298 [CCode (array_length = false, array_null_terminated = true)]
299 [Version (since = "0.14")]
300 public string[] list_members ();
301 public bool read_element (uint index_);
302 public bool read_member (string member_name);
303 public void set_root (Json.Node? root);
305 public Json.Node root { owned get; set construct; }
307 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h", type_id = "json_serializable_get_type ()")]
308 public interface Serializable : GLib.Object {
309 [Version (since = "0.10")]
310 public bool default_deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
311 [Version (since = "0.10")]
312 public Json.Node default_serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
313 public abstract bool deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
314 [Version (since = "0.14")]
315 public abstract unowned GLib.ParamSpec? find_property (string name);
316 [Version (since = "0.14")]
317 public abstract GLib.Value get_property (GLib.ParamSpec pspec);
318 [CCode (array_length_pos = 0.1, array_length_type = "guint")]
319 [Version (since = "0.14")]
320 public (unowned GLib.ParamSpec)[] list_properties ();
321 public abstract Json.Node serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
322 [Version (since = "0.14")]
323 public abstract void set_property (GLib.ParamSpec pspec, GLib.Value value);
325 [CCode (cheader_filename = "json-glib/json-glib.h", has_type_id = false)]
326 [Version (since = "1.2")]
327 public struct ObjectIter {
328 public void init (Json.Object object);
329 public bool next (out unowned string member_name, out unowned Json.Node member_node);
331 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_NODE_", type_id = "json_node_type_get_type ()")]
332 public enum NodeType {
338 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_PARSER_ERROR_")]
339 public errordomain ParserError {
348 public static GLib.Quark quark ();
350 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_PATH_ERROR_INVALID_")]
351 [Version (since = "0.14")]
352 public errordomain PathError {
354 public static GLib.Quark quark ();
356 [CCode (cheader_filename = "json-glib/json-glib.h", cprefix = "JSON_READER_ERROR_")]
357 [Version (since = "0.12")]
358 public errordomain ReaderError {
366 public static GLib.Quark quark ();
368 [CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
369 [Version (since = "0.8")]
370 public delegate void ArrayForeach (Json.Array array, uint index_, Json.Node element_node);
371 [CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
372 [Version (since = "0.10")]
373 public delegate void* BoxedDeserializeFunc (Json.Node node);
374 [CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
375 [Version (since = "0.10")]
376 public delegate Json.Node BoxedSerializeFunc (void* boxed);
377 [CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
378 [Version (since = "0.8")]
379 public delegate void ObjectForeach (Json.Object object, string member_name, Json.Node member_node);
380 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MAJOR_VERSION")]
381 public const int MAJOR_VERSION;
382 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MICRO_VERSION")]
383 public const int MICRO_VERSION;
384 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_MINOR_VERSION")]
385 public const int MINOR_VERSION;
386 [CCode (cheader_filename = "json-glib/json-glib.h")]
387 public const int VERSION_HEX;
388 [CCode (cheader_filename = "json-glib/json-glib.h", cname = "JSON_VERSION_S")]
389 public const string VERSION_S;
390 [CCode (cheader_filename = "json-glib/json-glib.h")]
391 [Version (since = "0.10")]
392 public static bool boxed_can_deserialize (GLib.Type gboxed_type, Json.NodeType node_type);
393 [CCode (cheader_filename = "json-glib/json-glib.h")]
394 [Version (since = "0.10")]
395 public static bool boxed_can_serialize (GLib.Type gboxed_type, out Json.NodeType node_type);
396 [CCode (cheader_filename = "json-glib/json-glib.h")]
397 [Version (since = "0.10")]
398 public static void* boxed_deserialize (GLib.Type gboxed_type, Json.Node node);
399 [CCode (cheader_filename = "json-glib/json-glib.h")]
400 [Version (since = "0.10")]
401 public static void boxed_register_deserialize_func (GLib.Type gboxed_type, Json.NodeType node_type, Json.BoxedDeserializeFunc deserialize_func);
402 [CCode (cheader_filename = "json-glib/json-glib.h")]
403 [Version (since = "0.10")]
404 public static void boxed_register_serialize_func (GLib.Type gboxed_type, Json.NodeType node_type, Json.BoxedSerializeFunc serialize_func);
405 [CCode (cheader_filename = "json-glib/json-glib.h")]
406 [Version (since = "0.10")]
407 public static Json.Node boxed_serialize (GLib.Type gboxed_type, void* boxed);
408 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
409 [Version (deprecated = true, deprecated_since = "0.10", replacement = "Json.gobject_from_data", since = "0.4")]
410 public static GLib.Object construct_gobject (GLib.Type gtype, string data, size_t length) throws GLib.Error;
411 [CCode (cheader_filename = "json-glib/json-glib.h")]
412 [Version (since = "1.2")]
413 public static Json.Node from_string (string str) throws GLib.Error;
414 [CCode (cheader_filename = "json-glib/json-glib.h")]
415 [Version (since = "0.10")]
416 public static GLib.Object gobject_deserialize (GLib.Type gtype, Json.Node node);
417 [CCode (cheader_filename = "json-glib/json-glib.h")]
418 [Version (since = "0.10")]
419 public static GLib.Object gobject_from_data (GLib.Type gtype, string data, ssize_t length = -1) throws GLib.Error;
420 [CCode (cheader_filename = "json-glib/json-glib.h")]
421 [Version (since = "0.10")]
422 public static Json.Node gobject_serialize (GLib.Object gobject);
423 [CCode (cheader_filename = "json-glib/json-glib.h")]
424 [Version (since = "0.10")]
425 public static string gobject_to_data (GLib.Object gobject, out size_t length);
426 [CCode (cheader_filename = "json-glib/json-glib.h", returns_floating_reference = true)]
427 [Version (since = "0.14")]
428 public static GLib.Variant gvariant_deserialize (Json.Node json_node, string? signature) throws GLib.Error;
429 [CCode (cheader_filename = "json-glib/json-glib.h", returns_floating_reference = true)]
430 [Version (since = "0.14")]
431 public static GLib.Variant gvariant_deserialize_data (string json, ssize_t length, string? signature) throws GLib.Error;
432 [CCode (cheader_filename = "json-glib/json-glib.h")]
433 [Version (since = "0.14")]
434 public static Json.Node gvariant_serialize (GLib.Variant variant);
435 [CCode (cheader_filename = "json-glib/json-glib.h")]
436 [Version (since = "0.14")]
437 public static string gvariant_serialize_data (GLib.Variant variant, out size_t length);
438 [CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
439 [Version (deprecated = true, deprecated_since = "0.10", replacement = "Json.gobject_to_data")]
440 public static string serialize_gobject (GLib.Object gobject, out size_t length);
441 [CCode (cheader_filename = "json-glib/json-glib.h")]
442 [Version (since = "1.2")]
443 public static int string_compare (string a, string b);
444 [CCode (cheader_filename = "json-glib/json-glib.h")]
445 [Version (since = "1.2")]
446 public static bool string_equal (string a, string b);
447 [CCode (cheader_filename = "json-glib/json-glib.h")]
448 [Version (since = "1.2")]
449 public static uint string_hash (string key);
450 [CCode (cheader_filename = "json-glib/json-glib.h")]
451 [Version (since = "1.2")]
452 public static string to_string (Json.Node node, bool pretty);