]> saetta.ns0.it Git - zakform/json/commitdiff
Added function ::get_stringify.
authorAndrea Zagli <azagli@libero.it>
Mon, 10 Aug 2020 14:07:04 +0000 (16:07 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 10 Aug 2020 14:07:04 +0000 (16:07 +0200)
src/form.c
src/form.h

index f2fb3b5d3b739900d10aa2f1d8a362c70a409a05..19d80c8197f3bb3bfb8a1bbdc1475e5bcde6420e 100644 (file)
@@ -256,6 +256,25 @@ const gchar
        return ret;
 }
 
+const gchar
+*zak_form_json_provider_get_stringify (ZakFormJsonProvider *provider)
+{
+       const gchar *ret;
+
+       JsonGenerator *generator;
+
+       ZakFormJsonProviderPrivate *priv = zak_form_json_provider_get_instance_private (provider);
+
+       generator = json_generator_new ();
+       json_generator_set_root (generator, priv->root);
+
+       ret = json_generator_to_data (generator, NULL);
+
+       g_object_unref (generator);
+
+       return ret;
+}
+
 /* PRIVATE */
 static void
 zak_form_json_provider_set_property (GObject *object,
index 5be56e63df3ffca82f0717fc8b790b71a62f522c..4dfb1aa2b2f4f556b91d49e8e12cde79b12aa351 100644 (file)
@@ -38,6 +38,9 @@ ZakFormJsonProvider *zak_form_json_provider_new_from_data (const gchar *data, gs
 void zak_form_json_provider_set_filename (ZakFormJsonProvider *provider, const gchar *filename);
 const gchar *zak_form_json_provider_get_filename (ZakFormJsonProvider *provider);
 
+const gchar *zak_form_json_provider_get_stringify (ZakFormJsonProvider *provider);
+
+
 G_END_DECLS