File indexing completed on 2025-01-18 10:01:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef __JSON_GENERATOR_H__
0025 #define __JSON_GENERATOR_H__
0026
0027 #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
0028 #error "Only <json-glib/json-glib.h> can be included directly."
0029 #endif
0030
0031 #include <json-glib/json-types.h>
0032 #include <gio/gio.h>
0033
0034 G_BEGIN_DECLS
0035
0036 #define JSON_TYPE_GENERATOR (json_generator_get_type ())
0037 #define JSON_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_GENERATOR, JsonGenerator))
0038 #define JSON_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_GENERATOR))
0039 #define JSON_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_GENERATOR, JsonGeneratorClass))
0040 #define JSON_IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_GENERATOR))
0041 #define JSON_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_GENERATOR, JsonGeneratorClass))
0042
0043 typedef struct _JsonGenerator JsonGenerator;
0044 typedef struct _JsonGeneratorPrivate JsonGeneratorPrivate;
0045 typedef struct _JsonGeneratorClass JsonGeneratorClass;
0046
0047 struct _JsonGenerator
0048 {
0049
0050 GObject parent_instance;
0051
0052 JsonGeneratorPrivate *priv;
0053 };
0054
0055 struct _JsonGeneratorClass
0056 {
0057
0058 GObjectClass parent_class;
0059
0060
0061 void (* _json_reserved1) (void);
0062 void (* _json_reserved2) (void);
0063 void (* _json_reserved3) (void);
0064 void (* _json_reserved4) (void);
0065 };
0066
0067 JSON_AVAILABLE_IN_1_0
0068 GType json_generator_get_type (void) G_GNUC_CONST;
0069
0070 JSON_AVAILABLE_IN_1_0
0071 JsonGenerator * json_generator_new (void);
0072
0073 JSON_AVAILABLE_IN_1_0
0074 void json_generator_set_pretty (JsonGenerator *generator,
0075 gboolean is_pretty);
0076 JSON_AVAILABLE_IN_1_0
0077 gboolean json_generator_get_pretty (JsonGenerator *generator);
0078 JSON_AVAILABLE_IN_1_0
0079 void json_generator_set_indent (JsonGenerator *generator,
0080 guint indent_level);
0081 JSON_AVAILABLE_IN_1_0
0082 guint json_generator_get_indent (JsonGenerator *generator);
0083 JSON_AVAILABLE_IN_1_0
0084 void json_generator_set_indent_char (JsonGenerator *generator,
0085 gunichar indent_char);
0086 JSON_AVAILABLE_IN_1_0
0087 gunichar json_generator_get_indent_char (JsonGenerator *generator);
0088 JSON_AVAILABLE_IN_1_0
0089 void json_generator_set_root (JsonGenerator *generator,
0090 JsonNode *node);
0091 JSON_AVAILABLE_IN_1_0
0092 JsonNode * json_generator_get_root (JsonGenerator *generator);
0093
0094 JSON_AVAILABLE_IN_1_4
0095 GString *json_generator_to_gstring (JsonGenerator *generator,
0096 GString *string);
0097
0098 JSON_AVAILABLE_IN_1_0
0099 gchar * json_generator_to_data (JsonGenerator *generator,
0100 gsize *length);
0101 JSON_AVAILABLE_IN_1_0
0102 gboolean json_generator_to_file (JsonGenerator *generator,
0103 const gchar *filename,
0104 GError **error);
0105 JSON_AVAILABLE_IN_1_0
0106 gboolean json_generator_to_stream (JsonGenerator *generator,
0107 GOutputStream *stream,
0108 GCancellable *cancellable,
0109 GError **error);
0110
0111 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
0112 G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonGenerator, g_object_unref)
0113 #endif
0114
0115 G_END_DECLS
0116
0117 #endif