Loading...
Searching...
No Matches
gjson.c
Go to the documentation of this file.
/*!
\file lib/external/parson/gjson.c
\brief GRASS JSON Library
\since 8.5
*/
/*****************************************************************************
*
* MODULE: GRASS json output interface
*
* AUTHOR: Nishant Bansal (nishant.bansal.282003@gmail.com)
*
* PURPOSE: parson library function wrapper
* part of the gjson library
*
* COPYRIGHT: (C) 2024 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
*
*****************************************************************************/
#include "gjson.h"
#include "parson.h"
/// \since version 8.5
typedef struct json_object_t G_json_object_t;
/// \since version 8.5
typedef struct json_array_t G_json_array_t;
/// \since version 8.5
typedef struct json_value_t G_json_value_t;
/* *************************************************************** */
/* ***** WRAPPER FOR PARSON FUNCTIONS USED IN GRASS ************** */
/* *************************************************************** */
/// \since version 8.5
G_JSON_Value *G_json_value_init_object(void)
{
return (G_JSON_Value *)json_value_init_object();
}
/// \since version 8.5
G_JSON_Value *G_json_value_init_array(void)
{
return (G_JSON_Value *)json_value_init_array();
}
/// \since version 8.5
G_JSON_Value_Type G_json_value_get_type(const G_JSON_Value *value)
{
return json_value_get_type((const JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Object *G_json_value_get_object(const G_JSON_Value *value)
{
return (G_JSON_Object *)json_value_get_object((const JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Object *G_json_object(const G_JSON_Value *value)
{
return (G_JSON_Object *)json_object((const JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Object *G_json_object_get_object(const G_JSON_Object *object,
const char *name)
{
return (G_JSON_Object *)json_object_get_object((const JSON_Object *)object,
name);
}
/// \since version 8.5
G_JSON_Array *G_json_object_get_array(const G_JSON_Object *object,
const char *name)
{
return (G_JSON_Array *)json_object_get_array((const JSON_Object *)object,
name);
}
/// \since version 8.5
G_JSON_Value *G_json_object_get_value(const G_JSON_Object *object,
const char *name)
{
return (G_JSON_Value *)json_object_get_value((const JSON_Object *)object,
name);
}
/// \since version 8.5
const char *G_json_object_get_string(const G_JSON_Object *object,
const char *name)
{
return json_object_get_string((const JSON_Object *)object, name);
}
/// \since version 8.5
double G_json_object_get_number(const G_JSON_Object *object, const char *name)
{
return json_object_get_number((const JSON_Object *)object, name);
}
/// \since version 8.5
int G_json_object_get_boolean(const G_JSON_Object *object, const char *name)
{
return json_object_get_boolean((const JSON_Object *)object, name);
}
/// \since version 8.5
G_JSON_Value *G_json_object_get_wrapping_value(const G_JSON_Object *object)
{
return (G_JSON_Value *)json_object_get_wrapping_value(
(const JSON_Object *)object);
}
/// \since version 8.5
G_JSON_Status G_json_object_set_value(G_JSON_Object *object, const char *name,
G_JSON_Value *value)
{
return json_object_set_value((JSON_Object *)object, name,
(JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Status G_json_object_set_string(G_JSON_Object *object, const char *name,
const char *string)
{
return json_object_set_string((JSON_Object *)object, name, string);
}
/// \since version 8.5
G_JSON_Status G_json_object_set_number(G_JSON_Object *object, const char *name,
double number)
{
return json_object_set_number((JSON_Object *)object, name, number);
}
/// \since version 8.5
G_JSON_Status G_json_object_set_boolean(G_JSON_Object *object, const char *name,
int boolean)
{
return json_object_set_boolean((JSON_Object *)object, name, boolean);
}
/// \since version 8.5
G_JSON_Status G_json_object_set_null(G_JSON_Object *object, const char *name)
{
return json_object_set_null((JSON_Object *)object, name);
}
/// \since version 8.5
G_JSON_Status G_json_object_dotset_string(G_JSON_Object *object,
const char *name, const char *string)
{
return json_object_dotset_string((JSON_Object *)object, name, string);
}
/// \since version 8.5
const char *G_json_object_dotget_string(G_JSON_Object *object, const char *name)
{
return json_object_dotget_string((JSON_Object *)object, name);
}
/// \since version 8.5
G_JSON_Status G_json_object_dotset_number(G_JSON_Object *object,
const char *name, double number)
{
return json_object_dotset_number((JSON_Object *)object, name, number);
}
/// \since version 8.5
double G_json_object_dotget_number(G_JSON_Object *object, const char *name)
{
return json_object_dotget_number((JSON_Object *)object, name);
}
/// \since version 8.5
G_JSON_Status G_json_object_dotset_null(G_JSON_Object *object, const char *name)
{
return json_object_dotset_null((JSON_Object *)object, name);
}
/// \since version 8.5
G_JSON_Array *G_json_array(const G_JSON_Value *value)
{
return (G_JSON_Array *)json_array((const JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Value *G_json_array_get_value(const G_JSON_Array *array, size_t index)
{
return (G_JSON_Value *)json_array_get_value((const JSON_Array *)array,
index);
}
/// \since version 8.5
const char *G_json_array_get_string(const G_JSON_Array *array, size_t index)
{
return json_array_get_string((const JSON_Array *)array, index);
}
/// \since version 8.5
double G_json_array_get_number(const G_JSON_Array *array, size_t index)
{
return json_array_get_number((const JSON_Array *)array, index);
}
/// \since version 8.5
int G_json_array_get_boolean(const G_JSON_Array *array, size_t index)
{
return json_array_get_boolean((const JSON_Array *)array, index);
}
/// \since version 8.5
G_JSON_Status G_json_array_append_value(G_JSON_Array *array,
G_JSON_Value *value)
{
return json_array_append_value((JSON_Array *)array, (JSON_Value *)value);
}
/// \since version 8.5
G_JSON_Status G_json_array_append_string(G_JSON_Array *array,
const char *string)
{
return json_array_append_string((JSON_Array *)array, string);
}
/// \since version 8.5
G_JSON_Status G_json_array_append_number(G_JSON_Array *array, double number)
{
return json_array_append_number((JSON_Array *)array, number);
}
/// \since version 8.5
G_JSON_Status G_json_array_append_boolean(G_JSON_Array *array, int boolean)
{
return json_array_append_boolean((JSON_Array *)array, boolean);
}
/// \since version 8.5
G_JSON_Status G_json_array_append_null(G_JSON_Array *array)
{
return json_array_append_null((JSON_Array *)array);
}
/// \since version 8.5
void G_json_set_float_serialization_format(const char *format)
{
json_set_float_serialization_format(format);
}
/// \since version 8.5
char *G_json_serialize_to_string_pretty(const G_JSON_Value *value)
{
return json_serialize_to_string_pretty((const JSON_Value *)value);
}
/// \since version 8.5
char *G_json_serialize_to_string(const G_JSON_Value *value)
{
return json_serialize_to_string((const JSON_Value *)value);
}
/// \since version 8.5
void G_json_free_serialized_string(char *string)
{
json_free_serialized_string(string);
}
/// \since version 8.5
void G_json_value_free(G_JSON_Value *value)
{
json_value_free((JSON_Value *)value);
}
G_json_object_get_object
G_JSON_Object * G_json_object_get_object(const G_JSON_Object *object, const char *name)
Definition gjson.c:71
G_json_array_append_boolean
G_JSON_Status G_json_array_append_boolean(G_JSON_Array *array, int boolean)
Definition gjson.c:239
G_json_value_t
struct json_value_t G_json_value_t
Definition gjson.c:34
G_json_object_set_number
G_JSON_Status G_json_object_set_number(G_JSON_Object *object, const char *name, double number)
Definition gjson.c:136
G_json_array
G_JSON_Array * G_json_array(const G_JSON_Value *value)
Definition gjson.c:188
G_json_object_set_null
G_JSON_Status G_json_object_set_null(G_JSON_Object *object, const char *name)
Definition gjson.c:150
G_json_array_append_null
G_JSON_Status G_json_array_append_null(G_JSON_Array *array)
Definition gjson.c:245
G_json_object_get_wrapping_value
G_JSON_Value * G_json_object_get_wrapping_value(const G_JSON_Object *object)
Definition gjson.c:114
G_json_array_get_value
G_JSON_Value * G_json_array_get_value(const G_JSON_Array *array, size_t index)
Definition gjson.c:194
G_json_value_free
void G_json_value_free(G_JSON_Value *value)
Definition gjson.c:275
G_json_object_dotset_null
G_JSON_Status G_json_object_dotset_null(G_JSON_Object *object, const char *name)
Definition gjson.c:182
G_json_object_set_value
G_JSON_Status G_json_object_set_value(G_JSON_Object *object, const char *name, G_JSON_Value *value)
Definition gjson.c:121
G_json_object_get_boolean
int G_json_object_get_boolean(const G_JSON_Object *object, const char *name)
Definition gjson.c:108
G_json_object_dotset_number
G_JSON_Status G_json_object_dotset_number(G_JSON_Object *object, const char *name, double number)
Definition gjson.c:169
G_json_object_dotset_string
G_JSON_Status G_json_object_dotset_string(G_JSON_Object *object, const char *name, const char *string)
Definition gjson.c:156
G_json_object_set_boolean
G_JSON_Status G_json_object_set_boolean(G_JSON_Object *object, const char *name, int boolean)
Definition gjson.c:143
G_json_array_append_number
G_JSON_Status G_json_array_append_number(G_JSON_Array *array, double number)
Definition gjson.c:233
G_json_free_serialized_string
void G_json_free_serialized_string(char *string)
Definition gjson.c:269
G_json_array_get_number
double G_json_array_get_number(const G_JSON_Array *array, size_t index)
Definition gjson.c:207
G_json_object_get_array
G_JSON_Array * G_json_object_get_array(const G_JSON_Object *object, const char *name)
Definition gjson.c:79
G_json_serialize_to_string
char * G_json_serialize_to_string(const G_JSON_Value *value)
Definition gjson.c:263
G_json_array_get_boolean
int G_json_array_get_boolean(const G_JSON_Array *array, size_t index)
Definition gjson.c:213
G_json_array_get_string
const char * G_json_array_get_string(const G_JSON_Array *array, size_t index)
Definition gjson.c:201
G_json_serialize_to_string_pretty
char * G_json_serialize_to_string_pretty(const G_JSON_Value *value)
Definition gjson.c:257
G_json_value_get_type
G_JSON_Value_Type G_json_value_get_type(const G_JSON_Value *value)
Definition gjson.c:53
G_json_object_get_number
double G_json_object_get_number(const G_JSON_Object *object, const char *name)
Definition gjson.c:102
G_json_object_dotget_number
double G_json_object_dotget_number(G_JSON_Object *object, const char *name)
Definition gjson.c:176
G_json_object_set_string
G_JSON_Status G_json_object_set_string(G_JSON_Object *object, const char *name, const char *string)
Definition gjson.c:129
G_json_value_init_object
G_JSON_Value * G_json_value_init_object(void)
Definition gjson.c:41
G_json_object_t
struct json_object_t G_json_object_t
Definition gjson.c:30
G_json_value_get_object
G_JSON_Object * G_json_value_get_object(const G_JSON_Value *value)
Definition gjson.c:59
G_json_array_append_string
G_JSON_Status G_json_array_append_string(G_JSON_Array *array, const char *string)
Definition gjson.c:226
G_json_object_get_value
G_JSON_Value * G_json_object_get_value(const G_JSON_Object *object, const char *name)
Definition gjson.c:87
G_json_value_init_array
G_JSON_Value * G_json_value_init_array(void)
Definition gjson.c:47
G_json_object_dotget_string
const char * G_json_object_dotget_string(G_JSON_Object *object, const char *name)
Definition gjson.c:163
G_json_object
G_JSON_Object * G_json_object(const G_JSON_Value *value)
Definition gjson.c:65
G_json_array_t
struct json_array_t G_json_array_t
Definition gjson.c:32
G_json_set_float_serialization_format
void G_json_set_float_serialization_format(const char *format)
Definition gjson.c:251
G_json_object_get_string
const char * G_json_object_get_string(const G_JSON_Object *object, const char *name)
Definition gjson.c:95
G_json_array_append_value
G_JSON_Status G_json_array_append_value(G_JSON_Array *array, G_JSON_Value *value)
Definition gjson.c:219
gjson.h
G_JSON_Array
struct G_json_array_t G_JSON_Array
Definition gjson.h:11
G_JSON_Object
struct G_json_object_t G_JSON_Object
Definition gjson.h:10
G_JSON_Value
struct G_json_value_t G_JSON_Value
Definition gjson.h:12
G_JSON_Status
int G_JSON_Status
Definition gjson.h:26
G_JSON_Value_Type
int G_JSON_Value_Type
Definition gjson.h:23
name
const char * name
Definition named_colr.c:6
json_object_dotset_string
JSON_Status json_object_dotset_string(JSON_Object *object, const char *name, const char *string)
Definition parson.c:2559
json_object_get_boolean
int json_object_get_boolean(const JSON_Object *object, const char *name)
Definition parson.c:1660
json_array_append_null
JSON_Status json_array_append_null(JSON_Array *array)
Definition parson.c:2391
json_array_get_value
JSON_Value * json_array_get_value(const JSON_Array *array, size_t index)
Definition parson.c:1765
json_array_get_string
const char * json_array_get_string(const JSON_Array *array, size_t index)
Definition parson.c:1773
json_array_append_boolean
JSON_Status json_array_append_boolean(JSON_Array *array, int boolean)
Definition parson.c:2378
json_object_dotget_string
const char * json_object_dotget_string(const JSON_Object *object, const char *name)
Definition parson.c:1677
json_object_dotset_null
JSON_Status json_object_dotset_null(JSON_Object *object, const char *name)
Definition parson.c:2616
json_object_set_number
JSON_Status json_object_set_number(JSON_Object *object, const char *name, double number)
Definition parson.c:2473
json_object_get_object
JSON_Object * json_object_get_object(const JSON_Object *object, const char *name)
Definition parson.c:1650
json_set_float_serialization_format
void json_set_float_serialization_format(const char *format)
Definition parson.c:2841
json_array_get_number
double json_array_get_number(const JSON_Array *array, size_t index)
Definition parson.c:1783
json_object_set_string
JSON_Status json_object_set_string(JSON_Object *object, const char *name, const char *string)
Definition parson.c:2450
json_object_set_boolean
JSON_Status json_object_set_boolean(JSON_Object *object, const char *name, int boolean)
Definition parson.c:2484
json_free_serialized_string
void json_free_serialized_string(char *string)
Definition parson.c:2217
json_value_init_array
JSON_Value * json_value_init_array(void)
Definition parson.c:1901
json_object_get_wrapping_value
JSON_Value * json_object_get_wrapping_value(const JSON_Object *object)
Definition parson.c:1732
json_array_append_value
JSON_Status json_array_append_value(JSON_Array *array, JSON_Value *value)
Definition parson.c:2330
json_array
JSON_Array * json_array(const JSON_Value *value)
Definition parson.c:2804
json_object_get_array
JSON_Array * json_object_get_array(const JSON_Object *object, const char *name)
Definition parson.c:1655
json_object_get_value
JSON_Value * json_object_get_value(const JSON_Object *object, const char *name)
Definition parson.c:1627
json_object_get_string
const char * json_object_get_string(const JSON_Object *object, const char *name)
Definition parson.c:1635
json_array_get_boolean
int json_array_get_boolean(const JSON_Array *array, size_t index)
Definition parson.c:1798
json_serialize_to_string
char * json_serialize_to_string(const JSON_Value *value)
Definition parson.c:2128
json_object_set_value
JSON_Status json_object_set_value(JSON_Object *object, const char *name, JSON_Value *value)
Definition parson.c:2404
json_value_free
void json_value_free(JSON_Value *value)
Definition parson.c:1867
json_object_set_null
JSON_Status json_object_set_null(JSON_Object *object, const char *name)
Definition parson.c:2495
json_array_append_string
JSON_Status json_array_append_string(JSON_Array *array, const char *string)
Definition parson.c:2338
json_object_get_number
double json_object_get_number(const JSON_Object *object, const char *name)
Definition parson.c:1645
json_object_dotget_number
double json_object_dotget_number(const JSON_Object *object, const char *name)
Definition parson.c:1689
json_value_get_type
JSON_Value_Type json_value_get_type(const JSON_Value *value)
Definition parson.c:1817
json_value_get_object
JSON_Object * json_value_get_object(const JSON_Value *value)
Definition parson.c:1822
json_object
JSON_Object * json_object(const JSON_Value *value)
Definition parson.c:2799
json_value_init_object
JSON_Value * json_value_init_object(void)
Definition parson.c:1885
json_serialize_to_string_pretty
char * json_serialize_to_string_pretty(const JSON_Value *value)
Definition parson.c:2196
json_object_dotset_number
JSON_Status json_object_dotset_number(JSON_Object *object, const char *name, double number)
Definition parson.c:2588
json_array_append_number
JSON_Status json_array_append_number(JSON_Array *array, double number)
Definition parson.c:2365
parson.h
JSON_Array
struct json_array_t JSON_Array
Definition parson.h:46
JSON_Value
struct json_value_t JSON_Value
Definition parson.h:47
JSON_Object
struct json_object_t JSON_Object
Definition parson.h:45