2 // Automatically generated from "/usr/share/gir-1.0/Json-1.0.gir"
5 public import gtk2
.glib2
;
6 alias gtk2
.glib2 GLib2
;
7 public import gtk2
.gobject2
;
8 alias gtk2
.gobject2 GObject2
;
9 public import gtk2
.gio2
;
12 // package: "json-glib-1.0";
13 // C header: "json-glib/json-glib.h";
15 // c:symbol-prefixes: ["json"]
16 // c:identifier-prefixes: ["Json"]
21 // A JSON array type. The contents of the #JsonArray structure are private
22 // and should only be accessed by the provided API
25 // Creates a new #JsonArray.
26 // RETURNS: the newly created #JsonArray
27 static Array
* /*new*/ new_()() {
28 return json_array_new();
31 // Creates a new #JsonArray with @n_elements slots already allocated.
32 // RETURNS: the newly created #JsonArray
33 // <n_elements>: number of slots to pre-allocate
34 static Array
* /*new*/ sized_new()(uint n_elements
) {
35 return json_array_sized_new(n_elements
);
39 // Conveniently adds an array into @array. The @array takes ownership
40 // of the newly added #JsonArray
42 // See also: json_array_add_element(), json_node_take_array()
43 // <value>: a #JsonArray
44 void add_array_element()(Array
* value
) {
45 json_array_add_array_element(&this, value
);
49 // Conveniently adds a boolean @value into @array
51 // See also: json_array_add_element(), json_node_set_boolean()
52 // <value>: a boolean value
53 void add_boolean_element()(int value
) {
54 json_array_add_boolean_element(&this, value
);
58 // Conveniently adds a floating point @value into @array
60 // See also: json_array_add_element(), json_node_set_double()
61 // <value>: a floating point value
62 void add_double_element()(double value
) {
63 json_array_add_double_element(&this, value
);
66 // Appends @node inside @array. The array will take ownership of the
68 // <node>: a #JsonNode
69 void add_element()(Node
* node
) {
70 json_array_add_element(&this, node
);
74 // Conveniently adds an integer @value into @array
76 // See also: json_array_add_element(), json_node_set_int()
77 // <value>: an integer value
78 void add_int_element()(long value
) {
79 json_array_add_int_element(&this, value
);
83 // Conveniently adds a null element into @array
85 // See also: json_array_add_element(), %JSON_NODE_NULL
86 void add_null_element()() {
87 json_array_add_null_element(&this);
91 // Conveniently adds an object into @array. The @array takes ownership
92 // of the newly added #JsonObject
94 // See also: json_array_add_element(), json_node_take_object()
95 // <value>: a #JsonObject
96 void add_object_element()(Object
* value
) {
97 json_array_add_object_element(&this, value
);
101 // Conveniently adds a string @value into @array
103 // See also: json_array_add_element(), json_node_set_string()
104 // <value>: a string value
105 void add_string_element()(char* value
) {
106 json_array_add_string_element(&this, value
);
110 // Retrieves a copy of the #JsonNode containing the value of the
111 // element at @index_ inside a #JsonArray
113 // index. Use json_node_free() when done.
114 // RETURNS: a copy of the #JsonNode at the requested
115 // <index_>: the index of the element to retrieve
116 Node
* /*new*/ dup_element()(uint index_
) {
117 return json_array_dup_element(&this, index_
);
121 // Iterates over all elements of @array and calls @func on
124 // It is safe to change the value of a #JsonNode of the @array
125 // from within the iterator @func, but it is not safe to add or
126 // remove elements from the @array.
127 // <func>: the function to be called on each element
128 // <data>: data to be passed to the function
129 void foreach_element()(ArrayForeach func
, void* data
) {
130 json_array_foreach_element(&this, func
, data
);
134 // Conveniently retrieves the array from the element at @index_
137 // See also: json_array_get_element(), json_node_get_array()
138 // RETURNS: the array
139 // <index_>: the index of the element to retrieve
140 Array
* get_array_element()(uint index_
) {
141 return json_array_get_array_element(&this, index_
);
145 // Conveniently retrieves the boolean value of the element at @index_
148 // See also: json_array_get_element(), json_node_get_boolean()
149 // RETURNS: the integer value
150 // <index_>: the index of the element to retrieve
151 int get_boolean_element()(uint index_
) {
152 return json_array_get_boolean_element(&this, index_
);
156 // Conveniently retrieves the floating point value of the element at
157 // @index_ inside @array
159 // See also: json_array_get_element(), json_node_get_double()
160 // RETURNS: the floating point value
161 // <index_>: the index of the element to retrieve
162 double get_double_element()(uint index_
) {
163 return json_array_get_double_element(&this, index_
);
166 // Retrieves the #JsonNode containing the value of the element at @index_
167 // inside a #JsonArray.
168 // RETURNS: a pointer to the #JsonNode at the requested index
169 // <index_>: the index of the element to retrieve
170 Node
* get_element()(uint index_
) {
171 return json_array_get_element(&this, index_
);
174 // Gets the elements of a #JsonArray as a list of #JsonNode<!-- -->s.
176 // containing the elements of the array. The contents of the list are
177 // owned by the array and should never be modified or freed. Use
178 // g_list_free() on the returned list when done using it
180 GLib2
.List
* /*new container*/ get_elements()() {
181 return json_array_get_elements(&this);
185 // Conveniently retrieves the integer value of the element at @index_
188 // See also: json_array_get_element(), json_node_get_int()
189 // RETURNS: the integer value
190 // <index_>: the index of the element to retrieve
191 long get_int_element()(uint index_
) {
192 return json_array_get_int_element(&this, index_
);
195 // Retrieves the length of a #JsonArray
196 // RETURNS: the length of the array
197 uint get_length()() {
198 return json_array_get_length(&this);
202 // Conveniently retrieves whether the element at @index_ is set to null
204 // See also: json_array_get_element(), JSON_NODE_TYPE(), %JSON_NODE_NULL
205 // RETURNS: %TRUE if the element is null
206 // <index_>: the index of the element to retrieve
207 int get_null_element()(uint index_
) {
208 return json_array_get_null_element(&this, index_
);
212 // Conveniently retrieves the object from the element at @index_
215 // See also: json_array_get_element(), json_node_get_object()
216 // RETURNS: the object
217 // <index_>: the index of the element to retrieve
218 Object
* get_object_element()(uint index_
) {
219 return json_array_get_object_element(&this, index_
);
223 // Conveniently retrieves the string value of the element at @index_
226 // See also: json_array_get_element(), json_node_get_string()
228 // the #JsonArray and should not be modified or freed
229 // RETURNS: the string value; the returned string is owned by
230 // <index_>: the index of the element to retrieve
231 char* get_string_element()(uint index_
) {
232 return json_array_get_string_element(&this, index_
);
235 // Increase by one the reference count of a #JsonArray.
238 // RETURNS: the passed #JsonArray, with the reference count
239 Array
* /*new*/ ref_()() {
240 return json_array_ref(&this);
243 // Removes the #JsonNode inside @array at @index_ freeing its allocated
245 // <index_>: the position of the element to be removed
246 void remove_element()(uint index_
) {
247 json_array_remove_element(&this, index_
);
250 // Decreases by one the reference count of a #JsonArray. If the
251 // reference count reaches zero, the array is destroyed and all
252 // its allocated resources are freed.
254 json_array_unref(&this);
260 // The function to be passed to json_array_foreach_element(). You
261 // should not add or remove elements to and from @array within
262 // this function. It is safe to change the value of @element_node.
263 // <array>: the iterated #JsonArray
264 // <index_>: the index of the element
265 // <element_node>: a #JsonNode containing the value at @index_
266 // <user_data>: data passed to the function
267 extern (C
) alias void function (Array
* array
, uint index_
, Node
* element_node
, void* user_data
) ArrayForeach
;
270 // Unintrospectable callback: BoxedDeserializeFunc() / ()
272 // Deserializes the contents of the passed #JsonNode into a #GBoxed
273 // RETURNS: the newly created boxed type
274 // <node>: a #JsonNode
275 extern (C
) alias void* function (Node
* node
) BoxedDeserializeFunc
;
279 // Serializes the passed #GBoxed and stores it inside a #JsonNode
280 // RETURNS: the newly created #JsonNode
281 // <boxed>: a #GBoxed
282 extern (C
) alias Node
* /*new*/ function (const(void)* boxed
) BoxedSerializeFunc
;
285 // The <structname>JsonBuilder</structname> structure contains only
286 // private data and shouls be accessed using the provided API
287 struct Builder
/* : GObject.Object */ /* Version 0.12 */ {
288 alias parent_instance
this;
289 alias parent_instance super_
;
290 alias parent_instance object
;
291 GObject2
.Object parent_instance
;
292 private BuilderPrivate
* priv
;
295 // Creates a new #JsonBuilder. You can use this object to generate a
296 // JSON tree and obtain the root #JsonNode<!-- -->s.
297 // RETURNS: the newly created #JsonBuilder instance
298 static Builder
* /*new*/ new_()() {
299 return json_builder_new();
302 // If called after json_builder_set_member_name(), sets @value as member of the
303 // most recent opened object, otherwise @value is added as element of the most
304 // recent opened array.
306 // See also: json_builder_add_value()
307 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
308 // <value>: the value of the member or element
309 Builder
* add_boolean_value()(int value
) {
310 return json_builder_add_boolean_value(&this, value
);
313 // If called after json_builder_set_member_name(), sets @value as member of the
314 // most recent opened object, otherwise @value is added as element of the most
315 // recent opened array.
317 // See also: json_builder_add_value()
318 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
319 // <value>: the value of the member or element
320 Builder
* add_double_value()(double value
) {
321 return json_builder_add_double_value(&this, value
);
324 // If called after json_builder_set_member_name(), sets @value as member of the
325 // most recent opened object, otherwise @value is added as element of the most
326 // recent opened array.
328 // See also: json_builder_add_value()
329 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
330 // <value>: the value of the member or element
331 Builder
* add_int_value()(long value
) {
332 return json_builder_add_int_value(&this, value
);
335 // If called after json_builder_set_member_name(), sets null as member of the
336 // most recent opened object, otherwise null is added as element of the most
337 // recent opened array.
339 // See also: json_builder_add_value()
340 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
341 Builder
* add_null_value()() {
342 return json_builder_add_null_value(&this);
345 // If called after json_builder_set_member_name(), sets @value as member of the
346 // most recent opened object, otherwise @value is added as element of the most
347 // recent opened array.
349 // See also: json_builder_add_value()
350 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
351 // <value>: the value of the member or element
352 Builder
* add_string_value()(char* value
) {
353 return json_builder_add_string_value(&this, value
);
356 // If called after json_builder_set_member_name(), sets @node as member of the
357 // most recent opened object, otherwise @node is added as element of the most
358 // recent opened array.
359 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
360 // <node>: the value of the member or element
361 Builder
* add_value()(Node
* node
) {
362 return json_builder_add_value(&this, node
);
365 // Opens a subarray inside the given @builder. When done adding members to
366 // the subarray, json_builder_end_array() must be called.
368 // Can be called for first or only if the call is associated to an object member
369 // or an array element.
370 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
371 Builder
* begin_array()() {
372 return json_builder_begin_array(&this);
375 // Opens a subobject inside the given @builder. When done adding members to
376 // the subobject, json_builder_end_object() must be called.
378 // Can be called for first or only if the call is associated to an object member
379 // or an array element.
380 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
381 Builder
* begin_object()() {
382 return json_builder_begin_object(&this);
385 // Closes the subarray inside the given @builder that was opened by the most
386 // recent call to json_builder_begin_array().
388 // Cannot be called after json_builder_set_member_name().
389 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
390 Builder
* end_array()() {
391 return json_builder_end_array(&this);
394 // Closes the subobject inside the given @builder that was opened by the most
395 // recent call to json_builder_begin_object().
397 // Cannot be called after json_builder_set_member_name().
398 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
399 Builder
* end_object()() {
400 return json_builder_end_object(&this);
403 // Returns the root of the current constructed tree, if the build is complete
404 // (ie: all opened objects, object members and arrays are being closed).
406 // Free the returned value with json_node_free().
407 // RETURNS: the #JsonNode, or %NULL if the build is not complete.
408 Node
* /*new*/ get_root()() {
409 return json_builder_get_root(&this);
411 // Resets the state of the @builder back to its initial state.
413 json_builder_reset(&this);
416 // Set the name of the next member in an object. The next call must add a value,
417 // open an object or an array.
419 // Can be called only if the call is associated to an object.
420 // RETURNS: the #JsonBuilder, or %NULL if the call was inconsistent
421 // <member_name>: the name of the member
422 Builder
* set_member_name()(char* member_name
) {
423 return json_builder_set_member_name(&this, member_name
);
428 // The <structname>JsonBuilder</structname> structure contains only
430 struct BuilderClass
/* Version 0.12 */ {
431 private GObject2
.ObjectClass parent_class
;
432 extern (C
) void function () _json_reserved1
;
433 extern (C
) void function () _json_reserved2
;
436 struct BuilderPrivate
{
440 // JSON data streams generator. The contents of the #JsonGenerator structure
441 // are private and should only be accessed via the provided API.
442 struct Generator
/* : GObject.Object */ {
443 alias parent_instance
this;
444 alias parent_instance super_
;
445 alias parent_instance object
;
446 GObject2
.Object parent_instance
;
447 private GeneratorPrivate
* priv
;
450 // Creates a new #JsonGenerator. You can use this object to generate a
451 // JSON data stream starting from a data object model composed by
452 // #JsonNode<!-- -->s.
453 // RETURNS: the newly created #JsonGenerator instance
454 static Generator
* /*new*/ new_()() {
455 return json_generator_new();
459 // Retrieves the value set using json_generator_set_indent().
460 // RETURNS: the number of repetitions per indentation level
461 uint get_indent()() {
462 return json_generator_get_indent(&this);
466 // Retrieves the value set using json_generator_set_indent_char().
467 // RETURNS: the character to be used when indenting
468 dchar get_indent_char()() {
469 return json_generator_get_indent_char(&this);
473 // Retrieves the value set using json_generator_set_pretty().
476 // RETURNS: %TRUE if the generated JSON should be pretty-printed, and
478 return json_generator_get_pretty(&this);
482 // Retrieves a pointer to the root #JsonNode set using
483 // json_generator_set_root().
485 // is owned by the #JsonGenerator and it should not be freed
486 // RETURNS: a #JsonNode, or %NULL. The returned node
488 return json_generator_get_root(&this);
492 // Sets the number of repetitions for each indentation level.
493 // <indent_level>: the number of repetitions of the indentation character that should be applied when pretty printing
494 void set_indent()(uint indent_level
) {
495 json_generator_set_indent(&this, indent_level
);
499 // Sets the character to be used when indenting
500 // <indent_char>: a Unicode character to be used when indenting
501 void set_indent_char()(dchar indent_char
) {
502 json_generator_set_indent_char(&this, indent_char
);
506 // Sets whether the generated JSON should be pretty printed, using the
507 // indentation character specified in the #JsonGenerator:indent-char
508 // property and the spacing specified in #JsonGenerator:indent property.
509 // <is_pretty>: whether the generated string should be pretty printed
510 void set_pretty()(int is_pretty
) {
511 json_generator_set_pretty(&this, is_pretty
);
514 // Sets @node as the root of the JSON data stream to be serialized by
515 // the #JsonGenerator.
517 // <note>The node is copied by the generator object, so it can be safely
518 // freed after calling this function.</note>
519 // <node>: a #JsonNode
520 void set_root()(Node
* node
) {
521 json_generator_set_root(&this, node
);
524 // Generates a JSON data stream from @generator and returns it as a
527 // Use g_free() to free the allocated resources.
528 // RETURNS: a newly allocated buffer holding a JSON data stream.
529 // <length>: return location for the length of the returned buffer, or %NULL
530 char* /*new*/ to_data()(/*out*/ size_t
* length
) {
531 return json_generator_to_data(&this, length
);
534 // Creates a JSON data stream and puts it inside @filename, overwriting the
535 // current file contents. This operation is atomic.
536 // RETURNS: %TRUE if saving was successful.
537 // <filename>: path to the target file
538 int to_file()(char* filename
, GLib2
.Error
** error
=null) {
539 return json_generator_to_file(&this, filename
, error
);
543 // Outputs JSON data and streams it (synchronously) to @stream.
545 // on failure. In case of error, the #GError will be filled accordingly
546 // RETURNS: %TRUE if the write operation was successful, and %FALSE
547 // <stream>: a #GOutputStream
548 // <cancellable>: a #GCancellable, or %NULL
549 int to_stream()(Gio2
.OutputStream
* stream
, Gio2
.Cancellable
* cancellable
, GLib2
.Error
** error
=null) {
550 return json_generator_to_stream(&this, stream
, cancellable
, error
);
554 // #JsonGenerator class
555 struct GeneratorClass
{
556 private GObject2
.ObjectClass parent_class
;
557 extern (C
) void function () _json_reserved1
;
558 extern (C
) void function () _json_reserved2
;
559 extern (C
) void function () _json_reserved3
;
560 extern (C
) void function () _json_reserved4
;
563 struct GeneratorPrivate
{
567 // A generic container of JSON data types. The contents of the #JsonNode
568 // structure are private and should only be accessed via the provided
569 // functions and never directly.
572 // Creates a new #JsonNode of @type.
573 // RETURNS: the newly created #JsonNode
574 // <type>: a #JsonNodeType
575 static Node
* /*new*/ new_()(NodeType type
) {
576 return json_node_new(type
);
579 // Copies @node. If the node contains complex data types then the reference
580 // count of the objects is increased.
581 // RETURNS: the copied #JsonNode
582 Node
* /*new*/ copy()() {
583 return json_node_copy(&this);
586 // Retrieves the #JsonArray stored inside a #JsonNode and returns it
587 // with its reference count increased by one.
590 // RETURNS: the #JsonArray with its reference
591 Array
* /*new*/ dup_array()() {
592 return json_node_dup_array(&this);
595 // Retrieves the #JsonObject inside @node. The reference count of
596 // the returned object is increased.
597 // RETURNS: the #JsonObject
598 Object
* /*new*/ dup_object()() {
599 return json_node_dup_object(&this);
602 // Gets a copy of the string value stored inside a #JsonNode
604 // of the #JsonNode contents. Use g_free() to free the allocated resources
605 // RETURNS: a newly allocated string containing a copy
606 char* /*new*/ dup_string()() {
607 return json_node_dup_string(&this);
609 // Frees the resources allocated by @node.
611 json_node_free(&this);
614 // Retrieves the #JsonArray stored inside a #JsonNode
615 // RETURNS: the #JsonArray
616 Array
* get_array()() {
617 return json_node_get_array(&this);
620 // Gets the boolean value stored inside a #JsonNode
621 // RETURNS: a boolean value.
622 int get_boolean()() {
623 return json_node_get_boolean(&this);
626 // Gets the double value stored inside a #JsonNode
627 // RETURNS: a double value.
628 double get_double()() {
629 return json_node_get_double(&this);
632 // Gets the integer value stored inside a #JsonNode
633 // RETURNS: an integer value.
635 return json_node_get_int(&this);
639 // Retrieves the #JsonNodeType of @node
640 // RETURNS: the type of the node
641 NodeType
get_node_type()() {
642 return json_node_get_node_type(&this);
645 // Retrieves the #JsonObject stored inside a #JsonNode
646 // RETURNS: the #JsonObject
647 Object
* get_object()() {
648 return json_node_get_object(&this);
651 // Retrieves the parent #JsonNode of @node.
654 // RETURNS: the parent node, or %NULL if @node is
655 Node
* get_parent()() {
656 return json_node_get_parent(&this);
659 // Gets the string value stored inside a #JsonNode
660 // RETURNS: a string value.
661 char* get_string()() {
662 return json_node_get_string(&this);
665 // Retrieves a value from a #JsonNode and copies into @value. When done
666 // using it, call g_value_unset() on the #GValue.
667 // <value>: return location for an uninitialized value
668 void get_value()(/*out*/ GObject2
.Value
* value
) {
669 json_node_get_value(&this, value
);
673 // Returns the #GType of the payload of the node.
674 // RETURNS: a #GType for the payload.
675 Type
get_value_type()() {
676 return json_node_get_value_type(&this);
680 // Checks whether @node is a %JSON_NODE_NULL
682 // <note>A null node is not the same as a %NULL #JsonNode</note>
683 // RETURNS: %TRUE if the node is null
685 return json_node_is_null(&this);
688 // Sets @array inside @node and increases the #JsonArray reference count
689 // <array>: a #JsonArray
690 void set_array()(Array
* array
) {
691 json_node_set_array(&this, array
);
694 // Sets @value as the boolean content of the @node, replacing any existing
696 // <value>: a boolean value
697 void set_boolean()(int value
) {
698 json_node_set_boolean(&this, value
);
701 // Sets @value as the double content of the @node, replacing any existing
703 // <value>: a double value
704 void set_double()(double value
) {
705 json_node_set_double(&this, value
);
708 // Sets @value as the integer content of the @node, replacing any existing
710 // <value>: an integer value
711 void set_int()(long value
) {
712 json_node_set_int(&this, value
);
715 // Sets @objects inside @node. The reference count of @object is increased.
716 // <object>: a #JsonObject
717 void set_object()(Object
* object
) {
718 json_node_set_object(&this, object
);
722 // Sets the parent #JsonNode of @node
723 // <parent>: the parent #JsonNode of @node
724 void set_parent()(Node
* parent
) {
725 json_node_set_parent(&this, parent
);
728 // Sets @value as the string content of the @node, replacing any existing
730 // <value>: a string value
731 void set_string()(char* value
) {
732 json_node_set_string(&this, value
);
735 // Sets @value inside @node. The passed #GValue is copied into the #JsonNode
736 // <value>: the #GValue to set
737 void set_value()(GObject2
.Value
* value
) {
738 json_node_set_value(&this, value
);
741 // Sets @array into @node without increasing the #JsonArray reference count.
742 // <array>: a #JsonArray
743 void take_array()(Array
* array
) {
744 json_node_take_array(&this, array
);
747 // Sets @object inside @node. The reference count of @object is not increased.
748 // <object>: a #JsonObject
749 void take_object()(Object
* object
) {
750 json_node_take_object(&this, object
);
753 // Retrieves the user readable name of the data type contained by @node.
755 // is owned by the node and should never be modified or freed
756 // RETURNS: a string containing the name of the type. The returned string
757 char* type_name()() {
758 return json_node_type_name(&this);
762 // Indicates the content of a #JsonNode.
770 // A JSON object type. The contents of the #JsonObject structure are private
771 // and should only be accessed by the provided API
774 // Creates a new #JsonObject, an JSON object type representation.
775 // RETURNS: the newly created #JsonObject
776 static Object
* /*new*/ new_()() {
777 return json_object_new();
780 // DEPRECATED (v0.8) method: add_member - Use json_object_set_member() instead
781 // Adds a member named @member_name and containing @node into a #JsonObject.
782 // The object will take ownership of the #JsonNode.
784 // This function will return if the @object already contains a member
786 // <member_name>: the name of the member
787 // <node>: the value of the member
788 void add_member()(char* member_name
, Node
* node
) {
789 json_object_add_member(&this, member_name
, node
);
793 // Retrieves a copy of the #JsonNode containing the value of @member_name
794 // inside a #JsonObject
796 // object member or %NULL. Use json_node_free() when done.
797 // RETURNS: a copy of the node for the requested
798 // <member_name>: the name of the JSON object member to access
799 Node
* /*new*/ dup_member()(char* member_name
) {
800 return json_object_dup_member(&this, member_name
);
804 // Iterates over all members of @object and calls @func on
807 // It is safe to change the value of a #JsonNode of the @object
808 // from within the iterator @func, but it is not safe to add or
809 // remove members from the @object.
810 // <func>: the function to be called on each member
811 // <data>: data to be passed to the function
812 void foreach_member()(ObjectForeach func
, void* data
) {
813 json_object_foreach_member(&this, func
, data
);
817 // Convenience function that retrieves the array
818 // stored in @member_name of @object
820 // See also: json_object_get_member()
821 // RETURNS: the array inside the object's member
822 // <member_name>: the name of the member
823 Array
* get_array_member()(char* member_name
) {
824 return json_object_get_array_member(&this, member_name
);
828 // Convenience function that retrieves the boolean value
829 // stored in @member_name of @object
831 // See also: json_object_get_member()
832 // RETURNS: the boolean value of the object's member
833 // <member_name>: the name of the member
834 int get_boolean_member()(char* member_name
) {
835 return json_object_get_boolean_member(&this, member_name
);
839 // Convenience function that retrieves the floating point value
840 // stored in @member_name of @object
842 // See also: json_object_get_member()
843 // RETURNS: the floating point value of the object's member
844 // <member_name>: the name of the member
845 double get_double_member()(char* member_name
) {
846 return json_object_get_double_member(&this, member_name
);
850 // Convenience function that retrieves the integer value
851 // stored in @member_name of @object
853 // See also: json_object_get_member()
854 // RETURNS: the integer value of the object's member
855 // <member_name>: the name of the member
856 long get_int_member()(char* member_name
) {
857 return json_object_get_int_member(&this, member_name
);
860 // Retrieves the #JsonNode containing the value of @member_name inside
864 // RETURNS: a pointer to the node for the requested object
865 // <member_name>: the name of the JSON object member to access
866 Node
* get_member()(char* member_name
) {
867 return json_object_get_member(&this, member_name
);
870 // Retrieves all the names of the members of a #JsonObject. You can
871 // obtain the value for each member using json_object_get_member().
873 // of member names. The content of the list is owned by the #JsonObject
874 // and should never be modified or freed. When you have finished using
875 // the returned list, use g_list_free() to free the resources it has
878 GLib2
.List
* /*new container*/ get_members()() {
879 return json_object_get_members(&this);
883 // Convenience function that checks whether the value
884 // stored in @member_name of @object is null
886 // See also: json_object_get_member()
887 // RETURNS: %TRUE if the value is null
888 // <member_name>: the name of the member
889 int get_null_member()(char* member_name
) {
890 return json_object_get_null_member(&this, member_name
);
894 // Convenience function that retrieves the object
895 // stored in @member_name of @object
897 // See also: json_object_get_member()
898 // RETURNS: the object inside the object's member
899 // <member_name>: the name of the member
900 Object
* get_object_member()(char* member_name
) {
901 return json_object_get_object_member(&this, member_name
);
904 // Retrieves the number of members of a #JsonObject.
905 // RETURNS: the number of members
907 return json_object_get_size(&this);
911 // Convenience function that retrieves the string value
912 // stored in @member_name of @object
914 // See also: json_object_get_member()
915 // RETURNS: the string value of the object's member
916 // <member_name>: the name of the member
917 char* get_string_member()(char* member_name
) {
918 return json_object_get_string_member(&this, member_name
);
921 // Retrieves all the values of the members of a #JsonObject.
923 // #JsonNode<!-- -->s. The content of the list is owned by the #JsonObject
924 // and should never be modified or freed. When you have finished using the
925 // returned list, use g_list_free() to free the resources it has allocated.
926 // RETURNS: a #GList of
927 GLib2
.List
* /*new container*/ get_values()() {
928 return json_object_get_values(&this);
931 // Checks whether @object has a member named @member_name.
932 // RETURNS: %TRUE if the JSON object has the requested member
933 // <member_name>: the name of a JSON object member
934 int has_member()(char* member_name
) {
935 return json_object_has_member(&this, member_name
);
938 // Increase by one the reference count of a #JsonObject.
941 // RETURNS: the passed #JsonObject, with the reference count
942 Object
* /*new*/ ref_()() {
943 return json_object_ref(&this);
946 // Removes @member_name from @object, freeing its allocated resources.
947 // <member_name>: the name of the member to remove
948 void remove_member()(char* member_name
) {
949 json_object_remove_member(&this, member_name
);
953 // Convenience function for setting an array @value of
954 // @member_name inside @object.
956 // The @object will take ownership of the passed #JsonArray
958 // See also: json_object_set_member()
959 // <member_name>: the name of the member
960 // <value>: the value of the member
961 void set_array_member()(char* member_name
, Array
* value
) {
962 json_object_set_array_member(&this, member_name
, value
);
966 // Convenience function for setting a boolean @value of
967 // @member_name inside @object.
969 // See also: json_object_set_member()
970 // <member_name>: the name of the member
971 // <value>: the value of the member
972 void set_boolean_member()(char* member_name
, int value
) {
973 json_object_set_boolean_member(&this, member_name
, value
);
977 // Convenience function for setting a floating point @value
978 // of @member_name inside @object.
980 // See also: json_object_set_member()
981 // <member_name>: the name of the member
982 // <value>: the value of the member
983 void set_double_member()(char* member_name
, double value
) {
984 json_object_set_double_member(&this, member_name
, value
);
988 // Convenience function for setting an integer @value of
989 // @member_name inside @object.
991 // See also: json_object_set_member()
992 // <member_name>: the name of the member
993 // <value>: the value of the member
994 void set_int_member()(char* member_name
, long value
) {
995 json_object_set_int_member(&this, member_name
, value
);
999 // Sets @node as the value of @member_name inside @object.
1001 // If @object already contains a member called @member_name then
1002 // the member's current value is overwritten. Otherwise, a new
1003 // member is added to @object.
1004 // <member_name>: the name of the member
1005 // <node>: the value of the member
1006 void set_member()(char* member_name
, Node
* node
) {
1007 json_object_set_member(&this, member_name
, node
);
1011 // Convenience function for setting a null @value of
1012 // @member_name inside @object.
1014 // See also: json_object_set_member()
1015 // <member_name>: the name of the member
1016 void set_null_member()(char* member_name
) {
1017 json_object_set_null_member(&this, member_name
);
1021 // Convenience function for setting an object @value of
1022 // @member_name inside @object.
1024 // The @object will take ownership of the passed #JsonObject
1026 // See also: json_object_set_member()
1027 // <member_name>: the name of the member
1028 // <value>: the value of the member
1029 void set_object_member()(char* member_name
, Object
* value
) {
1030 json_object_set_object_member(&this, member_name
, value
);
1034 // Convenience function for setting a string @value of
1035 // @member_name inside @object.
1037 // See also: json_object_set_member()
1038 // <member_name>: the name of the member
1039 // <value>: the value of the member
1040 void set_string_member()(char* member_name
, char* value
) {
1041 json_object_set_string_member(&this, member_name
, value
);
1044 // Decreases by one the reference count of a #JsonObject. If the
1045 // reference count reaches zero, the object is destroyed and all
1046 // its allocated resources are freed.
1048 json_object_unref(&this);
1054 // The function to be passed to json_object_foreach_member(). You
1055 // should not add or remove members to and from @object within
1056 // this function. It is safe to change the value of @member_node.
1057 // <object>: the iterated #JsonObject
1058 // <member_name>: the name of the member
1059 // <member_node>: a #JsonNode containing the @member_name value
1060 // <user_data>: data passed to the function
1061 extern (C
) alias void function (Object
* object
, char* member_name
, Node
* member_node
, void* user_data
) ObjectForeach
;
1064 // JSON data streams parser. The contents of the #JsonParser structure are
1065 // private and should only be accessed via the provided API.
1066 struct Parser
/* : GObject.Object */ {
1067 alias parent_instance
this;
1068 alias parent_instance super_
;
1069 alias parent_instance object
;
1070 GObject2
.Object parent_instance
;
1071 private ParserPrivate
* priv
;
1074 // Creates a new #JsonParser instance. You can use the #JsonParser to
1075 // load a JSON stream from either a file or a buffer and then walk the
1076 // hierarchy using the data types API.
1078 // to release all the memory it allocates.
1079 // RETURNS: the newly created #JsonParser. Use g_object_unref()
1080 static Parser
* /*new*/ new_()() {
1081 return json_parser_new();
1083 static GLib2
.Quark
error_quark()() {
1084 return json_parser_error_quark();
1087 // Retrieves the line currently parsed, starting from 1.
1089 // This function has defined behaviour only while parsing; calling this
1090 // function from outside the signal handlers emitted by #JsonParser will
1092 // RETURNS: the currently parsed line, or 0.
1093 uint get_current_line()() {
1094 return json_parser_get_current_line(&this);
1097 // Retrieves the current position inside the current line, starting
1100 // This function has defined behaviour only while parsing; calling this
1101 // function from outside the signal handlers emitted by #JsonParser will
1103 // RETURNS: the position in the current line, or 0.
1104 uint get_current_pos()() {
1105 return json_parser_get_current_pos(&this);
1108 // Retrieves the top level node from the parsed JSON stream.
1110 // node is owned by the #JsonParser and should never be modified
1112 // RETURNS: the root #JsonNode . The returned
1113 Node
* get_root()() {
1114 return json_parser_get_root(&this);
1118 // A JSON data stream might sometimes contain an assignment, like:
1121 // var _json_data = { "member_name" : [ ...
1124 // even though it would technically constitute a violation of the RFC.
1126 // #JsonParser will ignore the left hand identifier and parse the right
1127 // hand value of the assignment. #JsonParser will record, though, the
1128 // existence of the assignment in the data stream and the variable name
1131 // @variable_name is not %NULL it will be set to the name of the variable
1132 // used in the assignment. The string is owned by #JsonParser and should
1133 // never be modified or freed.
1134 // RETURNS: %TRUE if there was an assignment, %FALSE otherwise. If
1135 // <variable_name>: Return location for the variable name, or %NULL
1136 int has_assignment()(/*out*/ char** variable_name
=null) {
1137 return json_parser_has_assignment(&this, variable_name
);
1140 // Loads a JSON stream from a buffer and parses it. You can call this function
1141 // multiple times with the same #JsonParser object, but the contents of the
1142 // parser will be destroyed each time.
1144 // of error, @error is set accordingly and %FALSE is returned
1145 // RETURNS: %TRUE if the buffer was succesfully parser. In case
1146 // <data>: the buffer to parse
1147 // <length>: the length of the buffer, or -1
1148 int load_from_data()(char* data
, ssize_t length
, GLib2
.Error
** error
=null) {
1149 return json_parser_load_from_data(&this, data
, length
, error
);
1152 // Loads a JSON stream from the content of @filename and parses it. See
1153 // json_parser_load_from_data().
1155 // In case of error, @error is set accordingly and %FALSE is returned
1156 // RETURNS: %TRUE if the file was successfully loaded and parsed.
1157 // <filename>: the path for the file to parse
1158 int load_from_file()(char* filename
, GLib2
.Error
** error
=null) {
1159 return json_parser_load_from_file(&this, filename
, error
);
1163 // Loads the contents of an input stream and parses them.
1165 // If @cancellable is not %NULL, then the operation can be cancelled by
1166 // triggering the @cancellable object from another thread. If the
1167 // operation was cancelled, the error %G_IO_ERROR_CANCELLED will be set
1168 // on the passed @error.
1170 // parsed, and %FALSE otherwise
1171 // RETURNS: %TRUE if the data stream was successfully read and
1172 // <stream>: an open #GInputStream
1173 // <cancellable>: a #GCancellable, or %NULL
1174 int load_from_stream()(Gio2
.InputStream
* stream
, Gio2
.Cancellable
* cancellable
, GLib2
.Error
** error
=null) {
1175 return json_parser_load_from_stream(&this, stream
, cancellable
, error
);
1179 // Asynchronously reads the contents of @stream.
1181 // For more details, see json_parser_load_from_stream() which is the
1182 // synchronous version of this call.
1184 // When the operation is finished, @callback will be called. You should
1185 // then call json_parser_load_from_stream_finish() to get the result
1186 // of the operation.
1187 // <stream>: a #GInputStream
1188 // <cancellable>: a #GCancellable, or %NULL
1189 // <callback>: a #GAsyncReadyCallback to call when the request is satisfied
1190 // <user_data>: the data to pass to @callback
1191 void load_from_stream_async()(Gio2
.InputStream
* stream
, Gio2
.Cancellable
* cancellable
, Gio2
.AsyncReadyCallback callback
, void* user_data
) {
1192 json_parser_load_from_stream_async(&this, stream
, cancellable
, callback
, user_data
);
1196 // Finishes an asynchronous stream loading started with
1197 // json_parser_load_from_stream_async().
1199 // and parsed, and %FALSE otherwise. In case of error, the #GError will be
1200 // filled accordingly.
1201 // RETURNS: %TRUE if the content of the stream was successfully retrieves
1202 // <result>: a #GAsyncResult
1203 int load_from_stream_finish()(Gio2
.AsyncResult
* result
, GLib2
.Error
** error
=null) {
1204 return json_parser_load_from_stream_finish(&this, result
, error
);
1207 // The ::array-element signal is emitted each time the #JsonParser
1208 // has successfully parsed a single element of a #JsonArray. The
1209 // array and element index are passed to the signal handlers.
1210 // <array>: a #JsonArray
1211 // <index_>: the index of the newly parsed element
1212 extern (C
) alias static void function (Parser
* this_
, Array
* array
, int index_
, void* user_data
=null) signal_array_element
;
1214 ulong signal_connect(string name
, CB
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1215 return super_
.signal_connect
!name(cb
, data
, cf
);
1218 ulong signal_connect(string name
:"array-element", CB
:signal_array_element
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1219 return signal_connect_data
!()(&this, cast(char*)"array-element",
1220 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1223 // The ::array-end signal is emitted each time the #JsonParser
1224 // has successfully parsed an entire #JsonArray
1225 // <array>: the parsed #JsonArray
1226 extern (C
) alias static void function (Parser
* this_
, Array
* array
, void* user_data
=null) signal_array_end
;
1227 ulong signal_connect(string name
:"array-end", CB
:signal_array_end
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1228 return signal_connect_data
!()(&this, cast(char*)"array-end",
1229 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1232 // The ::array-start signal is emitted each time the #JsonParser
1233 // starts parsing a #JsonArray
1234 extern (C
) alias static void function (Parser
* this_
, void* user_data
=null) signal_array_start
;
1235 ulong signal_connect(string name
:"array-start", CB
:signal_array_start
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1236 return signal_connect_data
!()(&this, cast(char*)"array-start",
1237 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1240 // The ::error signal is emitted each time a #JsonParser encounters
1241 // an error in a JSON stream.
1242 // <error>: a pointer to the #GError
1243 extern (C
) alias static void function (Parser
* this_
, void* error
, void* user_data
=null) signal_error
;
1244 ulong signal_connect(string name
:"error", CB
:signal_error
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1245 return signal_connect_data
!()(&this, cast(char*)"error",
1246 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1249 // The ::object-end signal is emitted each time the #JsonParser
1250 // has successfully parsed an entire #JsonObject.
1251 // <object>: the parsed #JsonObject
1252 extern (C
) alias static void function (Parser
* this_
, Object
* object
, void* user_data
=null) signal_object_end
;
1253 ulong signal_connect(string name
:"object-end", CB
:signal_object_end
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1254 return signal_connect_data
!()(&this, cast(char*)"object-end",
1255 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1258 // The ::object-member signal is emitted each time the #JsonParser
1259 // has successfully parsed a single member of a #JsonObject. The
1260 // object and member are passed to the signal handlers.
1261 // <object>: a #JsonObject
1262 // <member_name>: the name of the newly parsed member
1263 extern (C
) alias static void function (Parser
* this_
, Object
* object
, char* member_name
, void* user_data
=null) signal_object_member
;
1264 ulong signal_connect(string name
:"object-member", CB
:signal_object_member
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1265 return signal_connect_data
!()(&this, cast(char*)"object-member",
1266 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1269 // The ::object-start signal is emitted each time the #JsonParser
1270 // starts parsing a #JsonObject.
1271 extern (C
) alias static void function (Parser
* this_
, void* user_data
=null) signal_object_start
;
1272 ulong signal_connect(string name
:"object-start", CB
:signal_object_start
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1273 return signal_connect_data
!()(&this, cast(char*)"object-start",
1274 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1277 // The ::parse-end signal is emitted when the parser successfully
1278 // finished parsing a JSON data stream
1279 extern (C
) alias static void function (Parser
* this_
, void* user_data
=null) signal_parse_end
;
1280 ulong signal_connect(string name
:"parse-end", CB
:signal_parse_end
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1281 return signal_connect_data
!()(&this, cast(char*)"parse-end",
1282 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1285 // The ::parse-start signal is emitted when the parser began parsing
1286 // a JSON data stream.
1287 extern (C
) alias static void function (Parser
* this_
, void* user_data
=null) signal_parse_start
;
1288 ulong signal_connect(string name
:"parse-start", CB
:signal_parse_start
)(CB cb
, void* data
=null, ConnectFlags cf
=cast(ConnectFlags
)0) {
1289 return signal_connect_data
!()(&this, cast(char*)"parse-start",
1290 cast(GObject2
.Callback
)cb
, data
, null, cf
);
1294 // #JsonParser class.
1295 struct ParserClass
{
1296 private GObject2
.ObjectClass parent_class
;
1297 extern (C
) void function (Parser
* parser
) parse_start
;
1298 extern (C
) void function (Parser
* parser
) object_start
;
1299 extern (C
) void function (Parser
* parser
, Object
* object
, char* member_name
) object_member
;
1300 extern (C
) void function (Parser
* parser
, Object
* object
) object_end
;
1301 extern (C
) void function (Parser
* parser
) array_start
;
1302 extern (C
) void function (Parser
* parser
, Array
* array
, int index_
) array_element
;
1303 extern (C
) void function (Parser
* parser
, Array
* array
) array_end
;
1304 extern (C
) void function (Parser
* parser
) parse_end
;
1305 extern (C
) void function (Parser
* parser
, GLib2
.Error
* error
) error
;
1306 extern (C
) void function () _json_reserved1
;
1307 extern (C
) void function () _json_reserved2
;
1308 extern (C
) void function () _json_reserved3
;
1309 extern (C
) void function () _json_reserved4
;
1310 extern (C
) void function () _json_reserved5
;
1311 extern (C
) void function () _json_reserved6
;
1312 extern (C
) void function () _json_reserved7
;
1313 extern (C
) void function () _json_reserved8
;
1317 // Error enumeration for #JsonParser
1319 // This enumeration can be extended at later date
1325 INVALID_BAREWORD
= 4,
1328 struct ParserPrivate
{
1332 // The <structname>JsonPath</structname> structure is an opaque object
1333 // whose members cannot be directly accessed except through the provided
1335 struct Path
/* : GObject.Object */ /* Version 0.14 */ {
1336 alias method_parent
this;
1337 alias method_parent super_
;
1338 alias method_parent object
;
1339 GObject2
.Object method_parent
;
1343 // Creates a new #JsonPath instance.
1345 // Once created, the #JsonPath object should be used with json_path_compile()
1346 // and json_path_match().
1348 // g_object_unref() to free the allocated resources when done
1349 // RETURNS: the newly created #JsonPath instance. Use
1350 static Path
* /*new*/ new_()() {
1351 return json_path_new();
1353 static GLib2
.Quark
error_quark()() {
1354 return json_path_error_quark();
1358 // Queries a JSON tree using a JSONPath expression.
1360 // This function is a simple wrapper around json_path_new(),
1361 // json_path_compile() and json_path_match(). It implicitly
1362 // creates a #JsonPath instance, compiles @expression and
1363 // matches it against the JSON tree pointed by @root.
1365 // %JSON_NODE_ARRAY containing an array of matching #JsonNode<!-- -->s.
1366 // Use json_node_free() when done
1367 // RETURNS: a newly-created #JsonNode of type
1368 // <expression>: a JSONPath expression
1369 // <root>: the root of a JSON tree
1370 static Node
* /*new*/ query()(char* expression
, Node
* root
, GLib2
.Error
** error
=null) {
1371 return json_path_query(expression
, root
, error
);
1375 // Validates and decomposes @expression.
1377 // A JSONPath expression must be compiled before calling json_path_match().
1379 // the %JSON_PATH_ERROR domain and a code from the #JsonPathError
1380 // enumeration, and %FALSE will be returned
1381 // RETURNS: %TRUE on success; on error, @error will be set with
1382 // <expression>: a JSONPath expression
1383 int compile()(char* expression
, GLib2
.Error
** error
=null) {
1384 return json_path_compile(&this, expression
, error
);
1388 // Matches the JSON tree pointed by @root using the expression compiled
1389 // into the #JsonPath.
1391 // The matching #JsonNode<!-- -->s will be copied into a #JsonArray and
1392 // returned wrapped in a #JsonNode.
1394 // %JSON_NODE_ARRAY containing an array of matching #JsonNode<!-- -->s.
1395 // Use json_node_free() when done
1396 // RETURNS: a newly-created #JsonNode of type
1397 // <root>: a #JsonNode
1398 Node
* /*new*/ match()(Node
* root
) {
1399 return json_path_match(&this, root
);
1404 // The <structname>JsonPathClass</structname> structure is an opaque
1405 // object class whose members cannot be directly accessed.
1406 struct PathClass
/* Version 0.14 */ {
1409 // Error code enumeration for the %JSON_PATH_ERROR domain.
1410 enum PathError
/* Version 0.14 */ {
1411 PATH_ERROR_INVALID_QUERY
= 0
1414 // The <structname>JsonReader</structname> structure contains only
1415 // private data and should only be accessed using the provided API
1416 struct Reader
/* : GObject.Object */ /* Version 0.12 */ {
1417 alias parent_instance
this;
1418 alias parent_instance super_
;
1419 alias parent_instance object
;
1420 GObject2
.Object parent_instance
;
1421 private ReaderPrivate
* priv
;
1425 // Creates a new #JsonReader. You can use this object to read the contents of
1426 // the JSON tree starting from @node
1428 // release the allocated resources when done
1429 // RETURNS: the newly created #JsonReader. Use g_object_unref() to
1430 // <node>: a #JsonNode, or %NULL
1431 static Reader
* /*new*/ new_()(Node
* node
=null) {
1432 return json_reader_new(node
);
1434 static GLib2
.Quark
error_quark()() {
1435 return json_reader_error_quark();
1439 // Counts the elements of the current position, if @reader is
1440 // positioned on an array
1442 // the #JsonReader is set in an error state
1443 // RETURNS: the number of elements, or -1. In case of failure
1444 int count_elements()() {
1445 return json_reader_count_elements(&this);
1449 // Counts the members of the current position, if @reader is
1450 // positioned on an object
1452 // the #JsonReader is set in an error state
1453 // RETURNS: the number of members, or -1. In case of failure
1454 int count_members()() {
1455 return json_reader_count_members(&this);
1459 // Moves the cursor back to the previous node after being positioned
1462 // This function resets the error state of @reader, if any was set
1463 void end_element()() {
1464 json_reader_end_element(&this);
1468 // Moves the cursor back to the previous node after being positioned
1471 // This function resets the error state of @reader, if any was set
1472 void end_member()() {
1473 json_reader_end_member(&this);
1477 // Retrieves the boolean value of the current position of @reader
1478 // RETURNS: the boolean value
1479 int get_boolean_value()() {
1480 return json_reader_get_boolean_value(&this);
1484 // Retrieves the floating point value of the current position of @reader
1485 // RETURNS: the floating point value
1486 double get_double_value()() {
1487 return json_reader_get_double_value(&this);
1491 // Retrieves the #GError currently set on @reader, if the #JsonReader
1492 // is in error state
1493 // RETURNS: the pointer to the error, or %NULL
1494 GLib2
.Error
* get_error()() {
1495 return json_reader_get_error(&this);
1499 // Retrieves the integer value of the current position of @reader
1500 // RETURNS: the integer value
1501 long get_int_value()() {
1502 return json_reader_get_int_value(&this);
1506 // Retrieves the name of the current member.
1507 // RETURNS: the name of the member, or %NULL
1508 char* get_member_name()() {
1509 return json_reader_get_member_name(&this);
1513 // Checks whether the value of the current position of @reader is 'null'
1514 // RETURNS: %TRUE if 'null' is set, and %FALSE otherwise
1515 int get_null_value()() {
1516 return json_reader_get_null_value(&this);
1520 // Retrieves the string value of the current position of @reader
1521 // RETURNS: the string value
1522 char* get_string_value()() {
1523 return json_reader_get_string_value(&this);
1527 // Retrieves the #JsonNode of the current position of @reader
1529 // is owned by the #JsonReader and it should not be modified or freed
1531 // RETURNS: a #JsonNode, or %NULL. The returned node
1532 Node
* get_value()() {
1533 return json_reader_get_value(&this);
1537 // Checks whether the @reader is currently on an array
1540 // RETURNS: %TRUE if the #JsonReader is on an array, and %FALSE
1542 return json_reader_is_array(&this);
1546 // Checks whether the @reader is currently on an object
1549 // RETURNS: %TRUE if the #JsonReader is on an object, and %FALSE
1551 return json_reader_is_object(&this);
1555 // Checks whether the @reader is currently on a value
1558 // RETURNS: %TRUE if the #JsonReader is on a value, and %FALSE
1560 return json_reader_is_value(&this);
1564 // Retrieves a list of member names from the current position, if @reader
1565 // is positioned on an object.
1567 // array of strings holding the members name. Use g_strfreev() when
1569 // RETURNS: a newly allocated, %NULL-terminated
1570 char** /*new*/ list_members()() {
1571 return json_reader_list_members(&this);
1575 // Advances the cursor of @reader to the element @index_ of the array
1576 // or the object at the current position.
1578 // You can use the json_reader_get_value* family of functions to retrieve
1579 // the value of the element; for instance:
1582 // json_reader_read_element (reader, 0);
1583 // int_value = json_reader_get_int_value (reader);
1586 // After reading the value, json_reader_end_element() should be called to
1587 // reposition the cursor inside the #JsonReader, e.g.:
1590 // json_reader_read_element (reader, 1);
1591 // str_value = json_reader_get_string_value (reader);
1592 // json_reader_end_element (reader);
1594 // json_reader_read_element (reader, 2);
1595 // str_value = json_reader_get_string_value (reader);
1596 // json_reader_end_element (reader);
1599 // If @reader is not currently on an array or an object, or if the @index_ is
1600 // bigger than the size of the array or the object, the #JsonReader will be
1601 // put in an error state until json_reader_end_element() is called.
1602 // RETURNS: %TRUE on success, and %FALSE otherwise
1603 // <index_>: the index of the element
1604 int read_element()(uint index_
) {
1605 return json_reader_read_element(&this, index_
);
1609 // Advances the cursor of @reader to the @member_name of the object at the
1610 // current position.
1612 // You can use the json_reader_get_value* family of functions to retrieve
1613 // the value of the member; for instance:
1616 // json_reader_read_member (reader, "width");
1617 // width = json_reader_get_int_value (reader);
1620 // After reading the value, json_reader_end_member() should be called to
1621 // reposition the cursor inside the #JsonReader, e.g.:
1624 // json_reader_read_member (reader, "author");
1625 // author = json_reader_get_string_value (reader);
1626 // json_reader_end_element (reader);
1628 // json_reader_read_element (reader, "title");
1629 // title = json_reader_get_string_value (reader);
1630 // json_reader_end_element (reader);
1633 // If @reader is not currently on an object, or if the @member_name is not
1634 // defined in the object, the #JsonReader will be put in an error state until
1635 // json_reader_end_member() is called.
1636 // RETURNS: %TRUE on success, and %FALSE otherwise
1637 // <member_name>: the name of the member to read
1638 int read_member()(char* member_name
) {
1639 return json_reader_read_member(&this, member_name
);
1643 // Sets the root #JsonNode to be read by @reader. The @reader will take
1646 // If another #JsonNode is currently set as root, it will be replaced.
1647 // <root>: a #JsonNode
1648 void set_root()(Node
* root
=null) {
1649 json_reader_set_root(&this, root
);
1654 // The <structname>JsonReaderClass</structname> structure contains only
1656 struct ReaderClass
/* Version 0.12 */ {
1657 private GObject2
.ObjectClass parent_class
;
1658 extern (C
) void function () _json_padding0
;
1659 extern (C
) void function () _json_padding1
;
1660 extern (C
) void function () _json_padding2
;
1661 extern (C
) void function () _json_padding3
;
1662 extern (C
) void function () _json_padding4
;
1665 // Error codes enumeration for #JsonReader errors
1666 enum ReaderError
/* Version 0.12 */ {
1675 struct ReaderPrivate
{
1678 struct Serializable
/* Interface */ {
1679 mixin template __interface__() {
1681 // Calls the default implementation of the #JsonSerializable
1682 // deserialize_property() virtual function
1684 // This function can be used inside a custom implementation
1685 // of the deserialize_property() virtual function in lieu of:
1688 // JsonSerializable *iface;
1691 // iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
1692 // res = iface->deserialize_property (serializable, property_name,
1697 // RETURNS: %TRUE if the property was successfully deserialized.
1698 // <property_name>: the name of the property
1699 // <value>: a pointer to an uninitialized #GValue
1700 // <pspec>: a #GParamSpec
1701 // <property_node>: a #JsonNode containing the serialized property
1702 int default_deserialize_property()(char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
, Node
* property_node
) {
1703 return json_serializable_default_deserialize_property(cast(Serializable
*)&this, property_name
, value
, pspec
, property_node
);
1707 // Calls the default implementation of the #JsonSerializable
1708 // serialize_property() virtual function
1710 // This function can be used inside a custom implementation
1711 // of the serialize_property() virtual function in lieu of:
1714 // JsonSerializable *iface;
1717 // iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
1718 // node = iface->serialize_property (serializable, property_name,
1724 // RETURNS: a #JsonNode containing the serialized
1725 // <property_name>: the name of the property
1726 // <value>: the value of the property
1727 // <pspec>: a #GParamSpec
1728 Node
* /*new*/ default_serialize_property()(char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
) {
1729 return json_serializable_default_serialize_property(cast(Serializable
*)&this, property_name
, value
, pspec
);
1732 // Asks a #JsonSerializable implementation to deserialize the
1733 // property contained inside @property_node into @value.
1734 // RETURNS: %TRUE if the property was successfully deserialized.
1735 // <property_name>: the name of the property
1736 // <value>: a pointer to an uninitialized #GValue
1737 // <pspec>: a #GParamSpec
1738 // <property_node>: a #JsonNode containing the serialized property
1739 int deserialize_property()(char* property_name
, /*out*/ GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
, Node
* property_node
) {
1740 return json_serializable_deserialize_property(cast(Serializable
*)&this, property_name
, value
, pspec
, property_node
);
1746 // or %NULL if no property was found
1747 // RETURNS: the #GParamSpec for the property
1748 // <name>: the name of the property
1749 GObject2
.ParamSpec
* find_property()(char* name
) {
1750 return json_serializable_find_property(cast(Serializable
*)&this, name
);
1752 void get_property()(GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
) {
1753 json_serializable_get_property(cast(Serializable
*)&this, pspec
, value
);
1759 // of #GParamSpec. Use g_free() to free the array when done.
1760 // RETURNS: an array
1761 // <n_pspecs>: return location for the length of the array of #GParamSpec returned by the function
1762 GObject2
.ParamSpec
** /*new container*/ list_properties()(/*out*/ uint* n_pspecs
) {
1763 return json_serializable_list_properties(cast(Serializable
*)&this, n_pspecs
);
1766 // Asks a #JsonSerializable implementation to serialize a #GObject
1767 // property into a #JsonNode object.
1768 // RETURNS: a #JsonNode containing the serialized property
1769 // <property_name>: the name of the property
1770 // <value>: the value of the property
1771 // <pspec>: a #GParamSpec
1772 Node
* /*new*/ serialize_property()(char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
) {
1773 return json_serializable_serialize_property(cast(Serializable
*)&this, property_name
, value
, pspec
);
1775 void set_property()(GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
) {
1776 json_serializable_set_property(cast(Serializable
*)&this, pspec
, value
);
1779 mixin __interface__
;
1783 // Interface that allows serializing and deserializing #GObject<!-- -->s
1784 // with properties storing complex data types. The json_serialize_gobject()
1785 // function will check if the passed #GObject implements this interface,
1786 // so it can also be used to override the default property serialization
1788 struct SerializableIface
{
1789 private GObject2
.TypeInterface g_iface
;
1791 // RETURNS: a #JsonNode containing the serialized property
1792 // <property_name>: the name of the property
1793 // <value>: the value of the property
1794 // <pspec>: a #GParamSpec
1795 extern (C
) Node
* /*new*/ function (Serializable
* serializable
, char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
) serialize_property
;
1797 // RETURNS: %TRUE if the property was successfully deserialized.
1798 // <property_name>: the name of the property
1799 // <value>: a pointer to an uninitialized #GValue
1800 // <pspec>: a #GParamSpec
1801 // <property_node>: a #JsonNode containing the serialized property
1802 extern (C
) int function (Serializable
* serializable
, char* property_name
, /*out*/ GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
, Node
* property_node
) deserialize_property
;
1804 // RETURNS: the #GParamSpec for the property
1805 // <name>: the name of the property
1806 extern (C
) GObject2
.ParamSpec
* function (Serializable
* serializable
, char* name
) find_property
;
1807 // Unintrospectable functionp: list_properties() / ()
1808 extern (C
) GObject2
.ParamSpec
** function (Serializable
* serializable
, uint* n_pspecs
) list_properties
;
1809 extern (C
) void function (Serializable
* serializable
, GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
) set_property
;
1810 extern (C
) void function (Serializable
* serializable
, GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
) get_property
;
1815 // Checks whether it is possible to deserialize a #GBoxed of
1816 // type @gboxed_type from a #JsonNode of type @node_type
1817 // RETURNS: %TRUE if the type can be deserialized, %FALSE otherwise
1818 // <gboxed_type>: a boxed type
1819 // <node_type>: a #JsonNode type
1820 static int boxed_can_deserialize()(Type gboxed_type
, NodeType node_type
) {
1821 return json_boxed_can_deserialize(gboxed_type
, node_type
);
1826 // Checks whether it is possible to serialize a #GBoxed of
1827 // type @gboxed_type into a #JsonNode. The type of the
1828 // #JsonNode is placed inside @node_type if the function
1829 // returns %TRUE and it's undefined otherwise.
1831 // and %FALSE otherwise.
1832 // RETURNS: %TRUE if the type can be serialized,
1833 // <gboxed_type>: a boxed type
1834 // <node_type>: the #JsonNode type to which the boxed type can be serialized into
1835 static int boxed_can_serialize()(Type gboxed_type
, /*out*/ NodeType
* node_type
) {
1836 return json_boxed_can_serialize(gboxed_type
, node_type
);
1841 // Deserializes @node into a #GBoxed of @gboxed_type
1843 // g_boxed_free() to release the resources allocated by this
1845 // RETURNS: the newly allocated #GBoxed. Use
1846 // <gboxed_type>: a boxed type
1847 // <node>: a #JsonNode
1848 static void* /*new*/ boxed_deserialize()(Type gboxed_type
, Node
* node
) {
1849 return json_boxed_deserialize(gboxed_type
, node
);
1853 // Unintrospectable function: boxed_register_deserialize_func() / json_boxed_register_deserialize_func()
1855 // Registers a deserialization function for a #GBoxed of type @gboxed_type
1856 // from a #JsonNode of type @node_type
1857 // <gboxed_type>: a boxed type
1858 // <node_type>: a node type
1859 // <deserialize_func>: deserialization function for @boxed_type from a #JsonNode of type @node_type
1860 static void boxed_register_deserialize_func()(Type gboxed_type
, NodeType node_type
, BoxedDeserializeFunc deserialize_func
) {
1861 json_boxed_register_deserialize_func(gboxed_type
, node_type
, deserialize_func
);
1865 // Unintrospectable function: boxed_register_serialize_func() / json_boxed_register_serialize_func()
1867 // Registers a serialization function for a #GBoxed of type @gboxed_type
1868 // to a #JsonNode of type @node_type
1869 // <gboxed_type>: a boxed type
1870 // <node_type>: a node type
1871 // <serialize_func>: serialization function for @boxed_type into a #JsonNode of type @node_type
1872 static void boxed_register_serialize_func()(Type gboxed_type
, NodeType node_type
, BoxedSerializeFunc serialize_func
) {
1873 json_boxed_register_serialize_func(gboxed_type
, node_type
, serialize_func
);
1878 // Serializes @boxed, a pointer to a #GBoxed of type @gboxed_type,
1881 // boxed type, or %NULL if serialization either failed or was not possible
1882 // RETURNS: a #JsonNode with the serialization of the
1883 // <gboxed_type>: a boxed type
1884 // <boxed>: a pointer to a #GBoxed of type @gboxed_type
1885 static Node
* /*new*/ boxed_serialize()(Type gboxed_type
, const(void)* boxed
) {
1886 return json_boxed_serialize(gboxed_type
, boxed
);
1891 // DEPRECATED (v0.10) function: construct_gobject - Use json_gobject_from_data() instead
1892 // Deserializes a JSON data stream and creates the corresponding
1893 // #GObject class. If @gtype implements the #JsonSerializableIface
1894 // interface, it will be asked to deserialize all the JSON members
1895 // into the respective properties; otherwise, the default implementation
1896 // will be used to translate the compatible JSON native types.
1898 // Note: the JSON data stream must be an object declaration.
1899 // RETURNS: a #GObject or %NULL
1900 // <gtype>: the #GType of object to construct
1901 // <data>: a JSON data stream
1902 // <length>: length of the data stream
1903 static GObject2
.Object
* /*new*/ construct_gobject()(Type gtype
, char* data
, size_t length
, GLib2
.Error
** error
=null) {
1904 return json_construct_gobject(gtype
, data
, length
, error
);
1909 // Creates a new #GObject of type @gtype, and constructs it
1910 // using the members of the passed #JsonObject
1912 // instance. Use g_object_unref() to free the resources
1913 // allocated by this function
1914 // RETURNS: The newly created #GObject
1915 // <gtype>: the type of the #GObject to create
1916 // <node>: a #JsonNode of type %JSON_NODE_OBJECT describing the instance of type @gtype
1917 static GObject2
.Object
* /*new*/ gobject_deserialize()(Type gtype
, Node
* node
) {
1918 return json_gobject_deserialize(gtype
, node
);
1923 // Deserializes a JSON data stream and creates the corresponding
1924 // #GObject class. If @gtype implements the #JsonSerializableIface
1925 // interface, it will be asked to deserialize all the JSON members
1926 // into the respective properties; otherwise, the default implementation
1927 // will be used to translate the compatible JSON native types.
1929 // Note: the JSON data stream must be an object declaration.
1930 // RETURNS: a #GObject or %NULL
1931 // <gtype>: the #GType of object to construct
1932 // <data>: a JSON data stream
1933 // <length>: length of the data stream, or -1 if it is NUL-terminated
1934 static GObject2
.Object
* /*new*/ gobject_from_data()(Type gtype
, char* data
, ssize_t length
, GLib2
.Error
** error
=null) {
1935 return json_gobject_from_data(gtype
, data
, length
, error
);
1940 // Creates a #JsonNode representing the passed #GObject
1941 // instance. Each member of the returned JSON object will
1942 // map to a property of the #GObject
1944 // of type %JSON_NODE_OBJECT. Use json_node_free() to free
1945 // the resources allocated by this function
1946 // RETURNS: the newly created #JsonNode
1947 // <gobject>: a #GObject
1948 static Node
* /*new*/ gobject_serialize()(GObject2
.Object
* gobject
) {
1949 return json_gobject_serialize(gobject
);
1954 // Serializes a #GObject into a JSON data stream, iterating recursively
1955 // over each property.
1957 // If @gobject implements the #JsonSerializableIface interface, it will
1958 // be asked to serialize all its properties; otherwise, the default
1959 // implementation will be use to translate the compatible types into
1960 // JSON native types.
1961 // RETURNS: a JSON data stream representing the passed #GObject
1962 // <gobject>: a #GObject
1963 // <length>: return value for the length of the buffer, or %NULL
1964 static char* /*new*/ gobject_to_data()(GObject2
.Object
* gobject
, /*out*/ size_t
* length
) {
1965 return json_gobject_to_data(gobject
, length
);
1970 // Converts a JSON data structure to a GVariant value using @signature to
1971 // resolve ambiguous data types. If no error occurs, the resulting #GVariant
1972 // is guaranteed to conform to @signature.
1974 // If @signature is not %NULL but does not represent a valid GVariant type
1975 // string, %NULL is returned and error is set to %G_IO_ERROR_INVALID_ARGUMENT.
1976 // If a @signature is provided but the JSON structure cannot be mapped to it,
1977 // %NULL is returned and error is set to %G_IO_ERROR_INVALID_DATA.
1978 // If @signature is %NULL, the conversion is done based strictly on the types
1979 // in the JSON nodes.
1981 // @signature, or %NULL on error
1982 // RETURNS: A newly created #GVariant compliant with
1983 // <json_node>: A #JsonNode to convert
1984 // <signature>: A valid #GVariant type string, or %NULL
1985 static GLib2
.Variant
* /*new*/ gvariant_deserialize()(Node
* json_node
, char* signature
, GLib2
.Error
** error
=null) {
1986 return json_gvariant_deserialize(json_node
, signature
, error
);
1991 // Converts a JSON string to a #GVariant value. This method works exactly
1992 // like json_gvariant_deserialize(), but takes a JSON encoded string instead.
1993 // The string is first converted to a #JsonNode using #JsonParser, and then
1994 // json_gvariant_deserialize() is called.
1996 // @signature, or %NULL on error
1997 // RETURNS: A newly created #GVariant compliant with
1998 // <json>: A JSON data string
1999 // <length>: The length of @json, or -1 if %NULL-terminated
2000 // <signature>: A valid #GVariant type string, or %NULL
2001 static GLib2
.Variant
* /*new*/ gvariant_deserialize_data()(char* json
, ssize_t length
, char* signature
, GLib2
.Error
** error
=null) {
2002 return json_gvariant_deserialize_data(json
, length
, signature
, error
);
2007 // Converts @variant to a JSON tree.
2009 // JSON data structure obtained from @variant
2010 // RETURNS: A #JsonNode representing the root of the
2011 // <variant>: A #GVariant to convert
2012 static Node
* /*new*/ gvariant_serialize()(GLib2
.Variant
* variant
) {
2013 return json_gvariant_serialize(variant
);
2018 // Converts @variant to its JSON encoded string representation. This method
2019 // is actually a helper function. It uses json_gvariant_serialize() to obtain the
2020 // JSON tree, and then #JsonGenerator to stringify it.
2023 // RETURNS: The JSON encoded string corresponding to
2024 // <variant>: A #GVariant to convert
2025 // <length>: Return location for the length of the returned string, or %NULL
2026 static char* /*new*/ gvariant_serialize_data()(GLib2
.Variant
* variant
, /*out*/ size_t
* length
=null) {
2027 return json_gvariant_serialize_data(variant
, length
);
2031 // DEPRECATED (v0.10) function: serialize_gobject - Use json_gobject_to_data() instead
2032 // Serializes a #GObject into a JSON data stream. If @gobject implements
2033 // the #JsonSerializableIface interface, it will be asked to serizalize all
2034 // its properties; otherwise, the default implementation will be use to
2035 // translate the compatible types into JSON native types.
2036 // RETURNS: a JSON data stream representing the passed #GObject
2037 // <gobject>: a #GObject
2038 // <length>: return value for the length of the buffer, or %NULL
2039 static char* /*new*/ serialize_gobject()(GObject2
.Object
* gobject
, /*out*/ size_t
* length
) {
2040 return json_serialize_gobject(gobject
, length
);
2047 Array
* /*new*/ json_array_new();
2048 Array
* /*new*/ json_array_sized_new(uint n_elements
);
2049 void json_array_add_array_element(Array
* this_
, Array
* value
);
2050 void json_array_add_boolean_element(Array
* this_
, int value
);
2051 void json_array_add_double_element(Array
* this_
, double value
);
2052 void json_array_add_element(Array
* this_
, Node
* node
);
2053 void json_array_add_int_element(Array
* this_
, long value
);
2054 void json_array_add_null_element(Array
* this_
);
2055 void json_array_add_object_element(Array
* this_
, Object
* value
);
2056 void json_array_add_string_element(Array
* this_
, char* value
);
2057 Node
* /*new*/ json_array_dup_element(Array
* this_
, uint index_
);
2058 void json_array_foreach_element(Array
* this_
, ArrayForeach func
, void* data
);
2059 Array
* json_array_get_array_element(Array
* this_
, uint index_
);
2060 int json_array_get_boolean_element(Array
* this_
, uint index_
);
2061 double json_array_get_double_element(Array
* this_
, uint index_
);
2062 Node
* json_array_get_element(Array
* this_
, uint index_
);
2063 GLib2
.List
* /*new container*/ json_array_get_elements(Array
* this_
);
2064 long json_array_get_int_element(Array
* this_
, uint index_
);
2065 uint json_array_get_length(Array
* this_
);
2066 int json_array_get_null_element(Array
* this_
, uint index_
);
2067 Object
* json_array_get_object_element(Array
* this_
, uint index_
);
2068 char* json_array_get_string_element(Array
* this_
, uint index_
);
2069 Array
* /*new*/ json_array_ref(Array
* this_
);
2070 void json_array_remove_element(Array
* this_
, uint index_
);
2071 void json_array_unref(Array
* this_
);
2072 Builder
* /*new*/ json_builder_new();
2073 Builder
* json_builder_add_boolean_value(Builder
* this_
, int value
);
2074 Builder
* json_builder_add_double_value(Builder
* this_
, double value
);
2075 Builder
* json_builder_add_int_value(Builder
* this_
, long value
);
2076 Builder
* json_builder_add_null_value(Builder
* this_
);
2077 Builder
* json_builder_add_string_value(Builder
* this_
, char* value
);
2078 Builder
* json_builder_add_value(Builder
* this_
, Node
* node
);
2079 Builder
* json_builder_begin_array(Builder
* this_
);
2080 Builder
* json_builder_begin_object(Builder
* this_
);
2081 Builder
* json_builder_end_array(Builder
* this_
);
2082 Builder
* json_builder_end_object(Builder
* this_
);
2083 Node
* /*new*/ json_builder_get_root(Builder
* this_
);
2084 void json_builder_reset(Builder
* this_
);
2085 Builder
* json_builder_set_member_name(Builder
* this_
, char* member_name
);
2086 Generator
* /*new*/ json_generator_new();
2087 uint json_generator_get_indent(Generator
* this_
);
2088 dchar json_generator_get_indent_char(Generator
* this_
);
2089 int json_generator_get_pretty(Generator
* this_
);
2090 Node
* json_generator_get_root(Generator
* this_
);
2091 void json_generator_set_indent(Generator
* this_
, uint indent_level
);
2092 void json_generator_set_indent_char(Generator
* this_
, dchar indent_char
);
2093 void json_generator_set_pretty(Generator
* this_
, int is_pretty
);
2094 void json_generator_set_root(Generator
* this_
, Node
* node
);
2095 char* /*new*/ json_generator_to_data(Generator
* this_
, /*out*/ size_t
* length
);
2096 int json_generator_to_file(Generator
* this_
, char* filename
, GLib2
.Error
** error
);
2097 int json_generator_to_stream(Generator
* this_
, Gio2
.OutputStream
* stream
, Gio2
.Cancellable
* cancellable
, GLib2
.Error
** error
);
2098 Node
* /*new*/ json_node_new(NodeType type
);
2099 Node
* /*new*/ json_node_copy(Node
* this_
);
2100 Array
* /*new*/ json_node_dup_array(Node
* this_
);
2101 Object
* /*new*/ json_node_dup_object(Node
* this_
);
2102 char* /*new*/ json_node_dup_string(Node
* this_
);
2103 void json_node_free(Node
* this_
);
2104 Array
* json_node_get_array(Node
* this_
);
2105 int json_node_get_boolean(Node
* this_
);
2106 double json_node_get_double(Node
* this_
);
2107 long json_node_get_int(Node
* this_
);
2108 NodeType
json_node_get_node_type(Node
* this_
);
2109 Object
* json_node_get_object(Node
* this_
);
2110 Node
* json_node_get_parent(Node
* this_
);
2111 char* json_node_get_string(Node
* this_
);
2112 void json_node_get_value(Node
* this_
, /*out*/ GObject2
.Value
* value
);
2113 Type
json_node_get_value_type(Node
* this_
);
2114 int json_node_is_null(Node
* this_
);
2115 void json_node_set_array(Node
* this_
, Array
* array
);
2116 void json_node_set_boolean(Node
* this_
, int value
);
2117 void json_node_set_double(Node
* this_
, double value
);
2118 void json_node_set_int(Node
* this_
, long value
);
2119 void json_node_set_object(Node
* this_
, Object
* object
);
2120 void json_node_set_parent(Node
* this_
, Node
* parent
);
2121 void json_node_set_string(Node
* this_
, char* value
);
2122 void json_node_set_value(Node
* this_
, GObject2
.Value
* value
);
2123 void json_node_take_array(Node
* this_
, Array
* array
);
2124 void json_node_take_object(Node
* this_
, Object
* object
);
2125 char* json_node_type_name(Node
* this_
);
2126 Object
* /*new*/ json_object_new();
2127 void json_object_add_member(Object
* this_
, char* member_name
, Node
* node
);
2128 Node
* /*new*/ json_object_dup_member(Object
* this_
, char* member_name
);
2129 void json_object_foreach_member(Object
* this_
, ObjectForeach func
, void* data
);
2130 Array
* json_object_get_array_member(Object
* this_
, char* member_name
);
2131 int json_object_get_boolean_member(Object
* this_
, char* member_name
);
2132 double json_object_get_double_member(Object
* this_
, char* member_name
);
2133 long json_object_get_int_member(Object
* this_
, char* member_name
);
2134 Node
* json_object_get_member(Object
* this_
, char* member_name
);
2135 GLib2
.List
* /*new container*/ json_object_get_members(Object
* this_
);
2136 int json_object_get_null_member(Object
* this_
, char* member_name
);
2137 Object
* json_object_get_object_member(Object
* this_
, char* member_name
);
2138 uint json_object_get_size(Object
* this_
);
2139 char* json_object_get_string_member(Object
* this_
, char* member_name
);
2140 GLib2
.List
* /*new container*/ json_object_get_values(Object
* this_
);
2141 int json_object_has_member(Object
* this_
, char* member_name
);
2142 Object
* /*new*/ json_object_ref(Object
* this_
);
2143 void json_object_remove_member(Object
* this_
, char* member_name
);
2144 void json_object_set_array_member(Object
* this_
, char* member_name
, Array
* value
);
2145 void json_object_set_boolean_member(Object
* this_
, char* member_name
, int value
);
2146 void json_object_set_double_member(Object
* this_
, char* member_name
, double value
);
2147 void json_object_set_int_member(Object
* this_
, char* member_name
, long value
);
2148 void json_object_set_member(Object
* this_
, char* member_name
, Node
* node
);
2149 void json_object_set_null_member(Object
* this_
, char* member_name
);
2150 void json_object_set_object_member(Object
* this_
, char* member_name
, Object
* value
);
2151 void json_object_set_string_member(Object
* this_
, char* member_name
, char* value
);
2152 void json_object_unref(Object
* this_
);
2153 Parser
* /*new*/ json_parser_new();
2154 GLib2
.Quark
json_parser_error_quark();
2155 uint json_parser_get_current_line(Parser
* this_
);
2156 uint json_parser_get_current_pos(Parser
* this_
);
2157 Node
* json_parser_get_root(Parser
* this_
);
2158 int json_parser_has_assignment(Parser
* this_
, /*out*/ char** variable_name
=null);
2159 int json_parser_load_from_data(Parser
* this_
, char* data
, ssize_t length
, GLib2
.Error
** error
);
2160 int json_parser_load_from_file(Parser
* this_
, char* filename
, GLib2
.Error
** error
);
2161 int json_parser_load_from_stream(Parser
* this_
, Gio2
.InputStream
* stream
, Gio2
.Cancellable
* cancellable
, GLib2
.Error
** error
);
2162 void json_parser_load_from_stream_async(Parser
* this_
, Gio2
.InputStream
* stream
, Gio2
.Cancellable
* cancellable
, Gio2
.AsyncReadyCallback callback
, void* user_data
);
2163 int json_parser_load_from_stream_finish(Parser
* this_
, Gio2
.AsyncResult
* result
, GLib2
.Error
** error
);
2164 Path
* /*new*/ json_path_new();
2165 GLib2
.Quark
json_path_error_quark();
2166 Node
* /*new*/ json_path_query(char* expression
, Node
* root
, GLib2
.Error
** error
);
2167 int json_path_compile(Path
* this_
, char* expression
, GLib2
.Error
** error
);
2168 Node
* /*new*/ json_path_match(Path
* this_
, Node
* root
);
2169 Reader
* /*new*/ json_reader_new(Node
* node
=null);
2170 GLib2
.Quark
json_reader_error_quark();
2171 int json_reader_count_elements(Reader
* this_
);
2172 int json_reader_count_members(Reader
* this_
);
2173 void json_reader_end_element(Reader
* this_
);
2174 void json_reader_end_member(Reader
* this_
);
2175 int json_reader_get_boolean_value(Reader
* this_
);
2176 double json_reader_get_double_value(Reader
* this_
);
2177 GLib2
.Error
* json_reader_get_error(Reader
* this_
);
2178 long json_reader_get_int_value(Reader
* this_
);
2179 char* json_reader_get_member_name(Reader
* this_
);
2180 int json_reader_get_null_value(Reader
* this_
);
2181 char* json_reader_get_string_value(Reader
* this_
);
2182 Node
* json_reader_get_value(Reader
* this_
);
2183 int json_reader_is_array(Reader
* this_
);
2184 int json_reader_is_object(Reader
* this_
);
2185 int json_reader_is_value(Reader
* this_
);
2186 char** /*new*/ json_reader_list_members(Reader
* this_
);
2187 int json_reader_read_element(Reader
* this_
, uint index_
);
2188 int json_reader_read_member(Reader
* this_
, char* member_name
);
2189 void json_reader_set_root(Reader
* this_
, Node
* root
=null);
2190 int json_serializable_default_deserialize_property(Serializable
* this_
, char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
, Node
* property_node
);
2191 Node
* /*new*/ json_serializable_default_serialize_property(Serializable
* this_
, char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
);
2192 int json_serializable_deserialize_property(Serializable
* this_
, char* property_name
, /*out*/ GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
, Node
* property_node
);
2193 GObject2
.ParamSpec
* json_serializable_find_property(Serializable
* this_
, char* name
);
2194 void json_serializable_get_property(Serializable
* this_
, GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
);
2195 GObject2
.ParamSpec
** /*new container*/ json_serializable_list_properties(Serializable
* this_
, /*out*/ uint* n_pspecs
);
2196 Node
* /*new*/ json_serializable_serialize_property(Serializable
* this_
, char* property_name
, GObject2
.Value
* value
, GObject2
.ParamSpec
* pspec
);
2197 void json_serializable_set_property(Serializable
* this_
, GObject2
.ParamSpec
* pspec
, GObject2
.Value
* value
);
2198 int json_boxed_can_deserialize(Type gboxed_type
, NodeType node_type
);
2199 int json_boxed_can_serialize(Type gboxed_type
, /*out*/ NodeType
* node_type
);
2200 void* /*new*/ json_boxed_deserialize(Type gboxed_type
, Node
* node
);
2201 void json_boxed_register_deserialize_func(Type gboxed_type
, NodeType node_type
, BoxedDeserializeFunc deserialize_func
);
2202 void json_boxed_register_serialize_func(Type gboxed_type
, NodeType node_type
, BoxedSerializeFunc serialize_func
);
2203 Node
* /*new*/ json_boxed_serialize(Type gboxed_type
, const(void)* boxed
);
2204 GObject2
.Object
* /*new*/ json_construct_gobject(Type gtype
, char* data
, size_t length
, GLib2
.Error
** error
);
2205 GObject2
.Object
* /*new*/ json_gobject_deserialize(Type gtype
, Node
* node
);
2206 GObject2
.Object
* /*new*/ json_gobject_from_data(Type gtype
, char* data
, ssize_t length
, GLib2
.Error
** error
);
2207 Node
* /*new*/ json_gobject_serialize(GObject2
.Object
* gobject
);
2208 char* /*new*/ json_gobject_to_data(GObject2
.Object
* gobject
, /*out*/ size_t
* length
);
2209 GLib2
.Variant
* /*new*/ json_gvariant_deserialize(Node
* json_node
, char* signature
, GLib2
.Error
** error
);
2210 GLib2
.Variant
* /*new*/ json_gvariant_deserialize_data(char* json
, ssize_t length
, char* signature
, GLib2
.Error
** error
);
2211 Node
* /*new*/ json_gvariant_serialize(GLib2
.Variant
* variant
);
2212 char* /*new*/ json_gvariant_serialize_data(GLib2
.Variant
* variant
, /*out*/ size_t
* length
=null);
2213 char* /*new*/ json_serialize_gobject(GObject2
.Object
* gobject
, /*out*/ size_t
* length
);