1 /* json-generator.h - JSON streams generator
3 * This file is part of JSON-GLib
4 * Copyright (C) 2007 OpenedHand Ltd.
5 * Copyright (C) 2009 Intel Corp.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 * Emmanuele Bassi <ebassi@linux.intel.com>
24 #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
25 #error "Only <json-glib/json-glib.h> can be included directly."
28 #ifndef __JSON_GENERATOR_H__
29 #define __JSON_GENERATOR_H__
31 #include <json-glib/json-types.h>
36 #define JSON_TYPE_GENERATOR (json_generator_get_type ())
37 #define JSON_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_GENERATOR, JsonGenerator))
38 #define JSON_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_GENERATOR))
39 #define JSON_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_GENERATOR, JsonGeneratorClass))
40 #define JSON_IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_GENERATOR))
41 #define JSON_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_GENERATOR, JsonGeneratorClass))
43 typedef struct _JsonGenerator JsonGenerator;
44 typedef struct _JsonGeneratorPrivate JsonGeneratorPrivate;
45 typedef struct _JsonGeneratorClass JsonGeneratorClass;
50 * JSON data streams generator. The contents of the #JsonGenerator structure
51 * are private and should only be accessed via the provided API.
56 GObject parent_instance;
58 JsonGeneratorPrivate *priv;
64 * #JsonGenerator class
66 struct _JsonGeneratorClass
69 GObjectClass parent_class;
71 /* padding, for future expansion */
72 void (* _json_reserved1) (void);
73 void (* _json_reserved2) (void);
74 void (* _json_reserved3) (void);
75 void (* _json_reserved4) (void);
78 GType json_generator_get_type (void) G_GNUC_CONST;
80 JsonGenerator * json_generator_new (void);
82 void json_generator_set_pretty (JsonGenerator *generator,
84 gboolean json_generator_get_pretty (JsonGenerator *generator);
85 void json_generator_set_indent (JsonGenerator *generator,
87 guint json_generator_get_indent (JsonGenerator *generator);
88 void json_generator_set_indent_char (JsonGenerator *generator,
89 gunichar indent_char);
90 gunichar json_generator_get_indent_char (JsonGenerator *generator);
91 void json_generator_set_root (JsonGenerator *generator,
93 JsonNode * json_generator_get_root (JsonGenerator *generator);
95 gchar * json_generator_to_data (JsonGenerator *generator,
97 gboolean json_generator_to_file (JsonGenerator *generator,
98 const gchar *filename,
100 gboolean json_generator_to_stream (JsonGenerator *generator,
101 GOutputStream *stream,
102 GCancellable *cancellable,
107 #endif /* __JSON_GENERATOR_H__ */