]> saetta.ns0.it Git - libzakutilsjsonxml/commitdiff
Added functions Json::set_*.
authorAndrea Zagli <azagli@libero.it>
Tue, 21 Jul 2020 13:30:37 +0000 (15:30 +0200)
committerAndrea Zagli <azagli@libero.it>
Tue, 21 Jul 2020 13:30:37 +0000 (15:30 +0200)
src/json.c
src/json.h

index 8968e620ded7da58dd2b1c08ebbae5a13058539a..3c0e38099fd807efb3d02f7400f272419a11238a 100644 (file)
@@ -69,3 +69,31 @@ zak_utils_json_get_boolean (JsonReader *reader, const gchar *name)
 
        return ret;
 }
+
+void
+zak_utils_json_set_integer (JsonBuilder *builder, const gchar *name, gint value)
+{
+       json_builder_set_member_name (builder, name);
+       json_builder_add_int_value (builder, value);
+}
+
+void
+zak_utils_json_set_double (JsonBuilder *builder, const gchar *name, gdouble value)
+{
+       json_builder_set_member_name (builder, name);
+       json_builder_add_double_value (builder, value);
+}
+
+void
+zak_utils_json_set_string (JsonBuilder *builder, const gchar *name, const gchar *value)
+{
+       json_builder_set_member_name (builder, name);
+       json_builder_add_string_value (builder, value);
+}
+
+void
+zak_utils_json_set_boolean (JsonBuilder *builder, const gchar *name, gboolean value)
+{
+       json_builder_set_member_name (builder, name);
+       json_builder_add_boolean_value (builder, value);
+}
index 9fbe3b07ae8c1b773f774ea873225790de658334..4aa1a1bb408039d1278ad8958d30c6fe729e47b4 100644 (file)
@@ -34,6 +34,11 @@ gdouble zak_utils_json_get_double (JsonReader *reader, const gchar *name);
 const gchar *zak_utils_json_get_string (JsonReader *reader, const gchar *name);
 gboolean zak_utils_json_get_boolean (JsonReader *reader, const gchar *name);
 
+void zak_utils_json_set_integer (JsonBuilder *builder, const gchar *name, gint value);
+void zak_utils_json_set_double (JsonBuilder *builder, const gchar *name, gdouble value);
+void zak_utils_json_set_string (JsonBuilder *builder, const gchar *name, const gchar *value);
+void zak_utils_json_set_boolean (JsonBuilder *builder, const gchar *name, gboolean value);
+
 
 G_END_DECLS