Warning, file /include/json-glib-1.0/json-glib/json-types.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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_TYPES_H__
0025 #define __JSON_TYPES_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 <glib-object.h>
0032 #include <json-glib/json-version-macros.h>
0033
0034 G_BEGIN_DECLS
0035
0036
0037
0038
0039
0040
0041
0042 #define JSON_NODE_TYPE(node) (json_node_get_node_type ((node)))
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 #define JSON_NODE_HOLDS(node,t) (json_node_get_node_type ((node)) == (t))
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 #define JSON_NODE_HOLDS_VALUE(node) (JSON_NODE_HOLDS ((node), JSON_NODE_VALUE))
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 #define JSON_NODE_HOLDS_OBJECT(node) (JSON_NODE_HOLDS ((node), JSON_NODE_OBJECT))
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 #define JSON_NODE_HOLDS_ARRAY(node) (JSON_NODE_HOLDS ((node), JSON_NODE_ARRAY))
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 #define JSON_NODE_HOLDS_NULL(node) (JSON_NODE_HOLDS ((node), JSON_NODE_NULL))
0094
0095 #define JSON_TYPE_NODE (json_node_get_type ())
0096 #define JSON_TYPE_OBJECT (json_object_get_type ())
0097 #define JSON_TYPE_ARRAY (json_array_get_type ())
0098
0099 typedef struct _JsonNode JsonNode;
0100 typedef struct _JsonObject JsonObject;
0101 typedef struct _JsonArray JsonArray;
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112 typedef enum {
0113 JSON_NODE_OBJECT,
0114 JSON_NODE_ARRAY,
0115 JSON_NODE_VALUE,
0116 JSON_NODE_NULL
0117 } JsonNodeType;
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135 typedef void (* JsonObjectForeach) (JsonObject *object,
0136 const gchar *member_name,
0137 JsonNode *member_node,
0138 gpointer user_data);
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156 typedef void (* JsonArrayForeach) (JsonArray *array,
0157 guint index_,
0158 JsonNode *element_node,
0159 gpointer user_data);
0160
0161
0162
0163
0164
0165 JSON_AVAILABLE_IN_1_0
0166 GType json_node_get_type (void) G_GNUC_CONST;
0167 JSON_AVAILABLE_IN_1_0
0168 JsonNode * json_node_new (JsonNodeType type);
0169
0170 JSON_AVAILABLE_IN_1_0
0171 JsonNode * json_node_alloc (void);
0172 JSON_AVAILABLE_IN_1_0
0173 JsonNode * json_node_init (JsonNode *node,
0174 JsonNodeType type);
0175 JSON_AVAILABLE_IN_1_0
0176 JsonNode * json_node_init_object (JsonNode *node,
0177 JsonObject *object);
0178 JSON_AVAILABLE_IN_1_0
0179 JsonNode * json_node_init_array (JsonNode *node,
0180 JsonArray *array);
0181 JSON_AVAILABLE_IN_1_0
0182 JsonNode * json_node_init_int (JsonNode *node,
0183 gint64 value);
0184 JSON_AVAILABLE_IN_1_0
0185 JsonNode * json_node_init_double (JsonNode *node,
0186 gdouble value);
0187 JSON_AVAILABLE_IN_1_0
0188 JsonNode * json_node_init_boolean (JsonNode *node,
0189 gboolean value);
0190 JSON_AVAILABLE_IN_1_0
0191 JsonNode * json_node_init_string (JsonNode *node,
0192 const char *value);
0193 JSON_AVAILABLE_IN_1_0
0194 JsonNode * json_node_init_null (JsonNode *node);
0195
0196 JSON_AVAILABLE_IN_1_0
0197 JsonNode * json_node_copy (JsonNode *node);
0198 JSON_AVAILABLE_IN_1_0
0199 void json_node_free (JsonNode *node);
0200
0201 JSON_AVAILABLE_IN_1_2
0202 JsonNode * json_node_ref (JsonNode *node);
0203 JSON_AVAILABLE_IN_1_2
0204 void json_node_unref (JsonNode *node);
0205
0206 JSON_AVAILABLE_IN_1_0
0207 JsonNodeType json_node_get_node_type (JsonNode *node);
0208 JSON_AVAILABLE_IN_1_0
0209 GType json_node_get_value_type (JsonNode *node);
0210 JSON_AVAILABLE_IN_1_0
0211 void json_node_set_parent (JsonNode *node,
0212 JsonNode *parent);
0213 JSON_AVAILABLE_IN_1_0
0214 JsonNode * json_node_get_parent (JsonNode *node);
0215 JSON_AVAILABLE_IN_1_0
0216 const gchar * json_node_type_name (JsonNode *node);
0217
0218 JSON_AVAILABLE_IN_1_0
0219 void json_node_set_object (JsonNode *node,
0220 JsonObject *object);
0221 JSON_AVAILABLE_IN_1_0
0222 void json_node_take_object (JsonNode *node,
0223 JsonObject *object);
0224 JSON_AVAILABLE_IN_1_0
0225 JsonObject * json_node_get_object (JsonNode *node);
0226 JSON_AVAILABLE_IN_1_0
0227 JsonObject * json_node_dup_object (JsonNode *node);
0228 JSON_AVAILABLE_IN_1_0
0229 void json_node_set_array (JsonNode *node,
0230 JsonArray *array);
0231 JSON_AVAILABLE_IN_1_0
0232 void json_node_take_array (JsonNode *node,
0233 JsonArray *array);
0234 JSON_AVAILABLE_IN_1_0
0235 JsonArray * json_node_get_array (JsonNode *node);
0236 JSON_AVAILABLE_IN_1_0
0237 JsonArray * json_node_dup_array (JsonNode *node);
0238 JSON_AVAILABLE_IN_1_0
0239 void json_node_set_value (JsonNode *node,
0240 const GValue *value);
0241 JSON_AVAILABLE_IN_1_0
0242 void json_node_get_value (JsonNode *node,
0243 GValue *value);
0244 JSON_AVAILABLE_IN_1_0
0245 void json_node_set_string (JsonNode *node,
0246 const gchar *value);
0247 JSON_AVAILABLE_IN_1_0
0248 const gchar * json_node_get_string (JsonNode *node);
0249 JSON_AVAILABLE_IN_1_0
0250 gchar * json_node_dup_string (JsonNode *node);
0251 JSON_AVAILABLE_IN_1_0
0252 void json_node_set_int (JsonNode *node,
0253 gint64 value);
0254 JSON_AVAILABLE_IN_1_0
0255 gint64 json_node_get_int (JsonNode *node);
0256 JSON_AVAILABLE_IN_1_0
0257 void json_node_set_double (JsonNode *node,
0258 gdouble value);
0259 JSON_AVAILABLE_IN_1_0
0260 gdouble json_node_get_double (JsonNode *node);
0261 JSON_AVAILABLE_IN_1_0
0262 void json_node_set_boolean (JsonNode *node,
0263 gboolean value);
0264 JSON_AVAILABLE_IN_1_0
0265 gboolean json_node_get_boolean (JsonNode *node);
0266 JSON_AVAILABLE_IN_1_0
0267 gboolean json_node_is_null (JsonNode *node);
0268
0269 JSON_AVAILABLE_IN_1_2
0270 void json_node_seal (JsonNode *node);
0271 JSON_AVAILABLE_IN_1_2
0272 gboolean json_node_is_immutable (JsonNode *node);
0273
0274 JSON_AVAILABLE_IN_1_2
0275 guint json_string_hash (gconstpointer key);
0276 JSON_AVAILABLE_IN_1_2
0277 gboolean json_string_equal (gconstpointer a,
0278 gconstpointer b);
0279 JSON_AVAILABLE_IN_1_2
0280 gint json_string_compare (gconstpointer a,
0281 gconstpointer b);
0282
0283 JSON_AVAILABLE_IN_1_2
0284 guint json_node_hash (gconstpointer key);
0285 JSON_AVAILABLE_IN_1_2
0286 gboolean json_node_equal (gconstpointer a,
0287 gconstpointer b);
0288
0289
0290
0291
0292 JSON_AVAILABLE_IN_1_0
0293 GType json_object_get_type (void) G_GNUC_CONST;
0294 JSON_AVAILABLE_IN_1_0
0295 JsonObject * json_object_new (void);
0296 JSON_AVAILABLE_IN_1_0
0297 JsonObject * json_object_ref (JsonObject *object);
0298 JSON_AVAILABLE_IN_1_0
0299 void json_object_unref (JsonObject *object);
0300
0301 JSON_DEPRECATED_IN_1_0_FOR(json_object_set_member)
0302 void json_object_add_member (JsonObject *object,
0303 const gchar *member_name,
0304 JsonNode *node);
0305
0306 JSON_AVAILABLE_IN_1_0
0307 void json_object_set_member (JsonObject *object,
0308 const gchar *member_name,
0309 JsonNode *node);
0310 JSON_AVAILABLE_IN_1_0
0311 void json_object_set_int_member (JsonObject *object,
0312 const gchar *member_name,
0313 gint64 value);
0314 JSON_AVAILABLE_IN_1_0
0315 void json_object_set_double_member (JsonObject *object,
0316 const gchar *member_name,
0317 gdouble value);
0318 JSON_AVAILABLE_IN_1_0
0319 void json_object_set_boolean_member (JsonObject *object,
0320 const gchar *member_name,
0321 gboolean value);
0322 JSON_AVAILABLE_IN_1_0
0323 void json_object_set_string_member (JsonObject *object,
0324 const gchar *member_name,
0325 const gchar *value);
0326 JSON_AVAILABLE_IN_1_0
0327 void json_object_set_null_member (JsonObject *object,
0328 const gchar *member_name);
0329 JSON_AVAILABLE_IN_1_0
0330 void json_object_set_array_member (JsonObject *object,
0331 const gchar *member_name,
0332 JsonArray *value);
0333 JSON_AVAILABLE_IN_1_0
0334 void json_object_set_object_member (JsonObject *object,
0335 const gchar *member_name,
0336 JsonObject *value);
0337 JSON_AVAILABLE_IN_1_0
0338 GList * json_object_get_members (JsonObject *object);
0339 JSON_AVAILABLE_IN_1_0
0340 JsonNode * json_object_get_member (JsonObject *object,
0341 const gchar *member_name);
0342 JSON_AVAILABLE_IN_1_0
0343 JsonNode * json_object_dup_member (JsonObject *object,
0344 const gchar *member_name);
0345 JSON_AVAILABLE_IN_1_0
0346 gint64 json_object_get_int_member (JsonObject *object,
0347 const gchar *member_name);
0348 JSON_AVAILABLE_IN_1_6
0349 gint64 json_object_get_int_member_with_default (JsonObject *object,
0350 const char *member_name,
0351 gint64 default_value);
0352 JSON_AVAILABLE_IN_1_0
0353 gdouble json_object_get_double_member (JsonObject *object,
0354 const gchar *member_name);
0355 JSON_AVAILABLE_IN_1_6
0356 double json_object_get_double_member_with_default (JsonObject *object,
0357 const char *member_name,
0358 double default_value);
0359 JSON_AVAILABLE_IN_1_0
0360 gboolean json_object_get_boolean_member (JsonObject *object,
0361 const gchar *member_name);
0362 JSON_AVAILABLE_IN_1_6
0363 gboolean json_object_get_boolean_member_with_default (JsonObject *object,
0364 const char *member_name,
0365 gboolean default_value);
0366 JSON_AVAILABLE_IN_1_0
0367 const gchar * json_object_get_string_member (JsonObject *object,
0368 const gchar *member_name);
0369 JSON_AVAILABLE_IN_1_6
0370 const char * json_object_get_string_member_with_default (JsonObject *object,
0371 const char *member_name,
0372 const char *default_value);
0373 JSON_AVAILABLE_IN_1_0
0374 gboolean json_object_get_null_member (JsonObject *object,
0375 const gchar *member_name);
0376 JSON_AVAILABLE_IN_1_0
0377 JsonArray * json_object_get_array_member (JsonObject *object,
0378 const gchar *member_name);
0379 JSON_AVAILABLE_IN_1_0
0380 JsonObject * json_object_get_object_member (JsonObject *object,
0381 const gchar *member_name);
0382 JSON_AVAILABLE_IN_1_0
0383 gboolean json_object_has_member (JsonObject *object,
0384 const gchar *member_name);
0385 JSON_AVAILABLE_IN_1_0
0386 void json_object_remove_member (JsonObject *object,
0387 const gchar *member_name);
0388 JSON_AVAILABLE_IN_1_0
0389 GList * json_object_get_values (JsonObject *object);
0390 JSON_AVAILABLE_IN_1_0
0391 guint json_object_get_size (JsonObject *object);
0392 JSON_AVAILABLE_IN_1_0
0393 void json_object_foreach_member (JsonObject *object,
0394 JsonObjectForeach func,
0395 gpointer data);
0396
0397 JSON_AVAILABLE_IN_1_2
0398 void json_object_seal (JsonObject *object);
0399 JSON_AVAILABLE_IN_1_2
0400 gboolean json_object_is_immutable (JsonObject *object);
0401
0402 JSON_AVAILABLE_IN_1_2
0403 guint json_object_hash (gconstpointer key);
0404 JSON_AVAILABLE_IN_1_2
0405 gboolean json_object_equal (gconstpointer a,
0406 gconstpointer b);
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424 typedef struct {
0425
0426 gpointer priv_pointer[6];
0427 int priv_int[2];
0428 gboolean priv_boolean[1];
0429 } JsonObjectIter;
0430
0431 JSON_AVAILABLE_IN_1_2
0432 void json_object_iter_init (JsonObjectIter *iter,
0433 JsonObject *object);
0434 JSON_AVAILABLE_IN_1_2
0435 gboolean json_object_iter_next (JsonObjectIter *iter,
0436 const gchar **member_name,
0437 JsonNode **member_node);
0438
0439 JSON_AVAILABLE_IN_1_6
0440 void json_object_iter_init_ordered (JsonObjectIter *iter,
0441 JsonObject *object);
0442 JSON_AVAILABLE_IN_1_6
0443 gboolean json_object_iter_next_ordered (JsonObjectIter *iter,
0444 const char **member_name,
0445 JsonNode **member_node);
0446
0447 JSON_AVAILABLE_IN_1_0
0448 GType json_array_get_type (void) G_GNUC_CONST;
0449 JSON_AVAILABLE_IN_1_0
0450 JsonArray * json_array_new (void);
0451 JSON_AVAILABLE_IN_1_0
0452 JsonArray * json_array_sized_new (guint n_elements);
0453 JSON_AVAILABLE_IN_1_0
0454 JsonArray * json_array_ref (JsonArray *array);
0455 JSON_AVAILABLE_IN_1_0
0456 void json_array_unref (JsonArray *array);
0457 JSON_AVAILABLE_IN_1_0
0458 void json_array_add_element (JsonArray *array,
0459 JsonNode *node);
0460 JSON_AVAILABLE_IN_1_0
0461 void json_array_add_int_element (JsonArray *array,
0462 gint64 value);
0463 JSON_AVAILABLE_IN_1_0
0464 void json_array_add_double_element (JsonArray *array,
0465 gdouble value);
0466 JSON_AVAILABLE_IN_1_0
0467 void json_array_add_boolean_element (JsonArray *array,
0468 gboolean value);
0469 JSON_AVAILABLE_IN_1_0
0470 void json_array_add_string_element (JsonArray *array,
0471 const gchar *value);
0472 JSON_AVAILABLE_IN_1_0
0473 void json_array_add_null_element (JsonArray *array);
0474 JSON_AVAILABLE_IN_1_0
0475 void json_array_add_array_element (JsonArray *array,
0476 JsonArray *value);
0477 JSON_AVAILABLE_IN_1_0
0478 void json_array_add_object_element (JsonArray *array,
0479 JsonObject *value);
0480 JSON_AVAILABLE_IN_1_0
0481 GList * json_array_get_elements (JsonArray *array);
0482 JSON_AVAILABLE_IN_1_0
0483 JsonNode * json_array_get_element (JsonArray *array,
0484 guint index_);
0485 JSON_AVAILABLE_IN_1_0
0486 gint64 json_array_get_int_element (JsonArray *array,
0487 guint index_);
0488 JSON_AVAILABLE_IN_1_0
0489 gdouble json_array_get_double_element (JsonArray *array,
0490 guint index_);
0491 JSON_AVAILABLE_IN_1_0
0492 gboolean json_array_get_boolean_element (JsonArray *array,
0493 guint index_);
0494 JSON_AVAILABLE_IN_1_0
0495 const gchar * json_array_get_string_element (JsonArray *array,
0496 guint index_);
0497 JSON_AVAILABLE_IN_1_0
0498 gboolean json_array_get_null_element (JsonArray *array,
0499 guint index_);
0500 JSON_AVAILABLE_IN_1_0
0501 JsonArray * json_array_get_array_element (JsonArray *array,
0502 guint index_);
0503 JSON_AVAILABLE_IN_1_0
0504 JsonObject * json_array_get_object_element (JsonArray *array,
0505 guint index_);
0506 JSON_AVAILABLE_IN_1_0
0507 JsonNode * json_array_dup_element (JsonArray *array,
0508 guint index_);
0509 JSON_AVAILABLE_IN_1_0
0510 void json_array_remove_element (JsonArray *array,
0511 guint index_);
0512 JSON_AVAILABLE_IN_1_0
0513 guint json_array_get_length (JsonArray *array);
0514 JSON_AVAILABLE_IN_1_0
0515 void json_array_foreach_element (JsonArray *array,
0516 JsonArrayForeach func,
0517 gpointer data);
0518 JSON_AVAILABLE_IN_1_2
0519 void json_array_seal (JsonArray *array);
0520 JSON_AVAILABLE_IN_1_2
0521 gboolean json_array_is_immutable (JsonArray *array);
0522
0523 JSON_AVAILABLE_IN_1_2
0524 guint json_array_hash (gconstpointer key);
0525 JSON_AVAILABLE_IN_1_2
0526 gboolean json_array_equal (gconstpointer a,
0527 gconstpointer b);
0528
0529 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
0530 G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonArray, json_array_unref)
0531 G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonObject, json_object_unref)
0532 G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_unref)
0533 #endif
0534
0535 G_END_DECLS
0536
0537 #endif