File cJSON.c

FileList > engine > src > vendor > cJSON.c

Go to the source code of this file

  • #include <string.h>
  • #include <stdio.h>
  • #include <math.h>
  • #include <stdlib.h>
  • #include <limits.h>
  • #include <ctype.h>
  • #include <float.h>
  • #include "cJSON.h"

Classes

Type Name
struct error
struct internal_hooks
struct parse_buffer
struct printbuffer

Public Types

Type Name
typedef struct internal_hooks internal_hooks

Public Static Attributes

Type Name
error global_error = { NULL, 0 }
internal_hooks global_hooks = { internal\_malloc, internal\_free, internal\_realloc }

Public Functions

Type Name
CJSON_PUBLIC (const char *)
CJSON_PUBLIC (char *)
CJSON_PUBLIC (double)
CJSON_PUBLIC (void)
CJSON_PUBLIC (cJSON *)
CJSON_PUBLIC (cJSON_bool)
CJSON_PUBLIC (void *)
cJSON * cJSON_Duplicate_rec (const cJSON * item, size_t depth, cJSON_bool recurse)

Public Static Functions

Type Name
cJSON_bool add_item_to_array (cJSON * array, cJSON * item)
cJSON_bool add_item_to_object (cJSON *const object, const char *const string, cJSON *const item, const internal_hooks *const hooks, const cJSON_bool constant_key)
parse_buffer * buffer_skip_whitespace (parse_buffer *const buffer)
cJSON * cJSON_New_Item (const internal_hooks *const hooks)
unsigned char * cJSON_strdup (const unsigned char * string, const internal_hooks *const hooks)
int case_insensitive_strcmp (const unsigned char * string1, const unsigned char * string2)
void * cast_away_const (const void * string)
cJSON_bool compare_double (double a, double b)
cJSON * create_reference (const cJSON * item, const internal_hooks *const hooks)
unsigned char * ensure (printbuffer *const p, size_t needed)
cJSON * get_array_item (const cJSON * array, size_t index)
unsigned char get_decimal_point (void)
cJSON * get_object_item (const cJSON *const object, const char *const name, const cJSON_bool case_sensitive)
void minify_string (char ** input, char ** output)
cJSON_bool parse_array (cJSON *const item, parse_buffer *const input_buffer)
unsigned parse_hex4 (const unsigned char *const input)
cJSON_bool parse_number (cJSON *const item, parse_buffer *const input_buffer)
cJSON_bool parse_object (cJSON *const item, parse_buffer *const input_buffer)
cJSON_bool parse_string (cJSON *const item, parse_buffer *const input_buffer)
cJSON_bool parse_value (cJSON *const item, parse_buffer *const input_buffer)
unsigned char * print (const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks)
cJSON_bool print_array (const cJSON *const item, printbuffer *const output_buffer)
cJSON_bool print_number (const cJSON *const item, printbuffer *const output_buffer)
cJSON_bool print_object (const cJSON *const item, printbuffer *const output_buffer)
cJSON_bool print_string (const cJSON *const item, printbuffer *const p)
cJSON_bool print_string_ptr (const unsigned char *const input, printbuffer *const output_buffer)
cJSON_bool print_value (const cJSON *const item, printbuffer *const output_buffer)
cJSON_bool replace_item_in_object (cJSON * object, const char * string, cJSON * replacement, cJSON_bool case_sensitive)
void skip_multiline_comment (char ** input)
void skip_oneline_comment (char ** input)
parse_buffer * skip_utf8_bom (parse_buffer *const buffer)
void suffix_object (cJSON * prev, cJSON * item)
void update_offset (printbuffer *const buffer)
unsigned char utf16_literal_to_utf8 (const unsigned char *const input_pointer, const unsigned char *const input_end, unsigned char ** output_pointer)

Macros

Type Name
define NAN 0.0/0.0
define buffer_at_offset (buffer) ((buffer)-&gt;content + (buffer)-&gt;offset)
define can_access_at_index (buffer, index) ((buffer != NULL) && (((buffer)-&gt;offset + index) &lt; (buffer)-&gt;length))
define can_read (buffer, size) ((buffer != NULL) && (((buffer)-&gt;offset + size) &lt;= (buffer)-&gt;length))
define cannot_access_at_index (buffer, index) (!can\_access\_at\_index(buffer, index))
define cjson_min (a, b) (((a) &lt; (b)) ? (a) : (b))
define false ((cJSON\_bool)0)
define internal_free free
define internal_malloc malloc
define internal_realloc realloc
define isinf (d) (isnan((d - d)) && !isnan(d))
define isnan (d) (d != d)
define static_strlen (string_literal) (sizeof(string\_literal) - sizeof(""))
define true ((cJSON\_bool)1)

Public Types Documentation

typedef internal_hooks

typedef struct internal_hooks internal_hooks;

Public Static Attributes Documentation

variable global_error

error global_error;

variable global_hooks

internal_hooks global_hooks;

Public Functions Documentation

function CJSON_PUBLIC

CJSON_PUBLIC (
    const char *
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    char *
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    double
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    void
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    cJSON *
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    cJSON_bool
) 

function CJSON_PUBLIC

CJSON_PUBLIC (
    void *
) 

function cJSON_Duplicate_rec

cJSON * cJSON_Duplicate_rec (
    const cJSON * item,
    size_t depth,
    cJSON_bool recurse
) 

Public Static Functions Documentation

function add_item_to_array

static cJSON_bool add_item_to_array (
    cJSON * array,
    cJSON * item
) 

function add_item_to_object

static cJSON_bool add_item_to_object (
    cJSON *const object,
    const char *const string,
    cJSON *const item,
    const internal_hooks *const hooks,
    const cJSON_bool constant_key
) 

function buffer_skip_whitespace

static parse_buffer * buffer_skip_whitespace (
    parse_buffer *const buffer
) 

function cJSON_New_Item

static cJSON * cJSON_New_Item (
    const internal_hooks *const hooks
) 

function cJSON_strdup

static unsigned char * cJSON_strdup (
    const unsigned char * string,
    const internal_hooks *const hooks
) 

function case_insensitive_strcmp

static int case_insensitive_strcmp (
    const unsigned char * string1,
    const unsigned char * string2
) 

function cast_away_const

static void * cast_away_const (
    const void * string
) 

function compare_double

static cJSON_bool compare_double (
    double a,
    double b
) 

function create_reference

static cJSON * create_reference (
    const cJSON * item,
    const internal_hooks *const hooks
) 

function ensure

static unsigned char * ensure (
    printbuffer *const p,
    size_t needed
) 

function get_array_item

static cJSON * get_array_item (
    const cJSON * array,
    size_t index
) 

function get_decimal_point

static unsigned char get_decimal_point (
    void
) 

function get_object_item

static cJSON * get_object_item (
    const cJSON *const object,
    const char *const name,
    const cJSON_bool case_sensitive
) 

function minify_string

static void minify_string (
    char ** input,
    char ** output
) 

function parse_array

static cJSON_bool parse_array (
    cJSON *const item,
    parse_buffer *const input_buffer
) 

function parse_hex4

static unsigned parse_hex4 (
    const unsigned char *const input
) 

function parse_number

static cJSON_bool parse_number (
    cJSON *const item,
    parse_buffer *const input_buffer
) 

function parse_object

static cJSON_bool parse_object (
    cJSON *const item,
    parse_buffer *const input_buffer
) 

function parse_string

static cJSON_bool parse_string (
    cJSON *const item,
    parse_buffer *const input_buffer
) 

function parse_value

static cJSON_bool parse_value (
    cJSON *const item,
    parse_buffer *const input_buffer
) 

function print

static unsigned char * print (
    const cJSON *const item,
    cJSON_bool format,
    const internal_hooks *const hooks
) 

function print_array

static cJSON_bool print_array (
    const cJSON *const item,
    printbuffer *const output_buffer
) 

function print_number

static cJSON_bool print_number (
    const cJSON *const item,
    printbuffer *const output_buffer
) 

function print_object

static cJSON_bool print_object (
    const cJSON *const item,
    printbuffer *const output_buffer
) 

function print_string

static cJSON_bool print_string (
    const cJSON *const item,
    printbuffer *const p
) 

function print_string_ptr

static cJSON_bool print_string_ptr (
    const unsigned char *const input,
    printbuffer *const output_buffer
) 

function print_value

static cJSON_bool print_value (
    const cJSON *const item,
    printbuffer *const output_buffer
) 

function replace_item_in_object

static cJSON_bool replace_item_in_object (
    cJSON * object,
    const char * string,
    cJSON * replacement,
    cJSON_bool case_sensitive
) 

function skip_multiline_comment

static void skip_multiline_comment (
    char ** input
) 

function skip_oneline_comment

static void skip_oneline_comment (
    char ** input
) 

function skip_utf8_bom

static parse_buffer * skip_utf8_bom (
    parse_buffer *const buffer
) 

function suffix_object

static void suffix_object (
    cJSON * prev,
    cJSON * item
) 

function update_offset

static void update_offset (
    printbuffer *const buffer
) 

function utf16_literal_to_utf8

static unsigned char utf16_literal_to_utf8 (
    const unsigned char *const input_pointer,
    const unsigned char *const input_end,
    unsigned char ** output_pointer
) 

Macro Definition Documentation

define NAN

#define NAN `0.0/0.0`

define buffer_at_offset

#define buffer_at_offset (
    buffer
) `((buffer)->content + (buffer)->offset)`

define can_access_at_index

#define can_access_at_index (
    buffer,
    index
) `((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))`

define can_read

#define can_read (
    buffer,
    size
) `((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))`

define cannot_access_at_index

#define cannot_access_at_index (
    buffer,
    index
) `(!can_access_at_index(buffer, index))`

define cjson_min

#define cjson_min (
    a,
    b
) `(((a) < (b)) ? (a) : (b))`

define false

#define false `((cJSON_bool)0)`

define internal_free

#define internal_free `free`

define internal_malloc

#define internal_malloc `malloc`

define internal_realloc

#define internal_realloc `realloc`

define isinf

#define isinf (
    d
) `(isnan((d - d)) && !isnan(d))`

define isnan

#define isnan (
    d
) `(d != d)`

define static_strlen

#define static_strlen (
    string_literal
) `(sizeof(string_literal) - sizeof(""))`

define true

#define true `((cJSON_bool)1)`


The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/src/vendor/cJSON.c