Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:42

0001 /* json-builder.h: JSON tree builder
0002  *
0003  * This file is part of JSON-GLib
0004  * Copyright (C) 2010  Luca Bruno <lethalman88@gmail.com>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
0018  *
0019  * Author:
0020  *   Luca Bruno  <lethalman88@gmail.com>
0021  */
0022 
0023 #ifndef __JSON_BUILDER_H__
0024 #define __JSON_BUILDER_H__
0025 
0026 #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
0027 #error "Only <json-glib/json-glib.h> can be included directly."
0028 #endif
0029 
0030 #include <json-glib/json-types.h>
0031 
0032 G_BEGIN_DECLS
0033 
0034 #define JSON_TYPE_BUILDER             (json_builder_get_type ())
0035 #define JSON_BUILDER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_BUILDER, JsonBuilder))
0036 #define JSON_IS_BUILDER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_BUILDER))
0037 #define JSON_BUILDER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_BUILDER, JsonBuilderClass))
0038 #define JSON_IS_BUILDER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_BUILDER))
0039 #define JSON_BUILDER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_BUILDER, JsonBuilderClass))
0040 
0041 typedef struct _JsonBuilder           JsonBuilder;
0042 typedef struct _JsonBuilderPrivate    JsonBuilderPrivate;
0043 typedef struct _JsonBuilderClass      JsonBuilderClass;
0044 
0045 struct _JsonBuilder
0046 {
0047   /*< private >*/
0048   GObject parent_instance;
0049 
0050   JsonBuilderPrivate *priv;
0051 };
0052 
0053 struct _JsonBuilderClass
0054 {
0055   /*< private >*/
0056   GObjectClass parent_class;
0057 
0058   /* padding, for future expansion */
0059   void (* _json_reserved1) (void);
0060   void (* _json_reserved2) (void);
0061 };
0062 
0063 JSON_AVAILABLE_IN_1_0
0064 GType json_builder_get_type (void) G_GNUC_CONST;
0065 
0066 JSON_AVAILABLE_IN_1_0
0067 JsonBuilder *json_builder_new                (void);
0068 JSON_AVAILABLE_IN_1_2
0069 JsonBuilder *json_builder_new_immutable      (void);
0070 JSON_AVAILABLE_IN_1_0
0071 JsonNode    *json_builder_get_root           (JsonBuilder  *builder);
0072 JSON_AVAILABLE_IN_1_0
0073 void         json_builder_reset              (JsonBuilder  *builder);
0074 
0075 JSON_AVAILABLE_IN_1_0
0076 JsonBuilder *json_builder_begin_array        (JsonBuilder  *builder);
0077 JSON_AVAILABLE_IN_1_0
0078 JsonBuilder *json_builder_end_array          (JsonBuilder  *builder);
0079 JSON_AVAILABLE_IN_1_0
0080 JsonBuilder *json_builder_begin_object       (JsonBuilder  *builder);
0081 JSON_AVAILABLE_IN_1_0
0082 JsonBuilder *json_builder_end_object         (JsonBuilder  *builder);
0083 
0084 JSON_AVAILABLE_IN_1_0
0085 JsonBuilder *json_builder_set_member_name    (JsonBuilder  *builder,
0086                                               const gchar  *member_name);
0087 JSON_AVAILABLE_IN_1_0
0088 JsonBuilder *json_builder_add_value          (JsonBuilder  *builder,
0089                                               JsonNode     *node);
0090 JSON_AVAILABLE_IN_1_0
0091 JsonBuilder *json_builder_add_int_value      (JsonBuilder  *builder,
0092                                               gint64        value);
0093 JSON_AVAILABLE_IN_1_0
0094 JsonBuilder *json_builder_add_double_value   (JsonBuilder  *builder,
0095                                               gdouble       value);
0096 JSON_AVAILABLE_IN_1_0
0097 JsonBuilder *json_builder_add_boolean_value  (JsonBuilder  *builder,
0098                                               gboolean      value);
0099 JSON_AVAILABLE_IN_1_0
0100 JsonBuilder *json_builder_add_string_value   (JsonBuilder  *builder,
0101                                               const gchar  *value);
0102 JSON_AVAILABLE_IN_1_0
0103 JsonBuilder *json_builder_add_null_value     (JsonBuilder  *builder);
0104 
0105 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
0106 G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonBuilder, g_object_unref)
0107 #endif
0108 
0109 G_END_DECLS
0110 
0111 #endif /* __JSON_BUILDER_H__ */