Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:12:59

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