Zen-C
Loading...
Searching...
No Matches
cJSON.c File Reference
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include <float.h>
#include "cJSON.h"
Include dependency graph for cJSON.c:

Data Structures

struct  error
 
struct  internal_hooks
 
struct  parse_buffer
 
struct  printbuffer
 

Macros

#define true   ((cJSON_bool)1)
 
#define false   ((cJSON_bool)0)
 
#define isinf(d)   (isnan((d - d)) && !isnan(d))
 
#define isnan(d)   (d != d)
 
#define NAN   0.0 / 0.0
 
#define internal_malloc   malloc
 
#define internal_free   free
 
#define internal_realloc   realloc
 
#define static_strlen(string_literal)   (sizeof(string_literal) - sizeof(""))
 
#define can_read(buffer, size)   ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
 
#define can_access_at_index(buffer, index)    ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
 
#define cannot_access_at_index(buffer, index)   (!can_access_at_index(buffer, index))
 
#define buffer_at_offset(buffer)   ((buffer)->content + (buffer)->offset)
 
#define cjson_min(a, b)   (((a) < (b)) ? (a) : (b))
 

Typedefs

typedef struct internal_hooks internal_hooks
 

Functions

 CJSON_PUBLIC (const char *)
 
 CJSON_PUBLIC (char *)
 
 CJSON_PUBLIC (double)
 
 CJSON_PUBLIC (void)
 
 cJSON_ParseWithOpts (const char *value, const char **return_parse_end, cJSON_bool require_null_terminated)
 
 cJSON_ParseWithLengthOpts (const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated)
 
 CJSON_PUBLIC (cJSON *)
 
 cJSON_PrintPreallocated (cJSON *item, char *buffer, const int length, const cJSON_bool format)
 
 CJSON_PUBLIC (int)
 
 cJSON_GetObjectItemCaseSensitive (const cJSON *const object, const char *const string)
 
 cJSON_AddItemReferenceToObject (cJSON *object, const char *string, cJSON *item)
 
 cJSON_AddBoolToObject (cJSON *const object, const char *const name, const cJSON_bool boolean)
 
 cJSON_AddNumberToObject (cJSON *const object, const char *const name, const double number)
 
 cJSON_AddStringToObject (cJSON *const object, const char *const name, const char *const string)
 
 cJSON_AddRawToObject (cJSON *const object, const char *const name, const char *const raw)
 
 cJSON_ReplaceItemViaPointer (cJSON *const parent, cJSON *const item, cJSON *replacement)
 
 cJSON_ReplaceItemInObject (cJSON *object, const char *string, cJSON *newitem)
 
 cJSON_ReplaceItemInObjectCaseSensitive (cJSON *object, const char *string, cJSON *newitem)
 
cJSONcJSON_Duplicate_rec (const cJSON *item, size_t depth, cJSON_bool recurse)
 
 cJSON_Compare (const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive)
 
 CJSON_PUBLIC (void *)
 

Macro Definition Documentation

◆ buffer_at_offset

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

◆ can_access_at_index

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

◆ can_read

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

◆ cannot_access_at_index

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

◆ cjson_min

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

◆ false

#define false   ((cJSON_bool)0)

◆ internal_free

#define internal_free   free

◆ internal_malloc

#define internal_malloc   malloc

◆ internal_realloc

#define internal_realloc   realloc

◆ isinf

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

◆ isnan

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

◆ NAN

#define NAN   0.0 / 0.0

◆ static_strlen

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

◆ true

#define true   ((cJSON_bool)1)

Typedef Documentation

◆ internal_hooks

Function Documentation

◆ cJSON_AddBoolToObject()

cJSON_AddBoolToObject ( cJSON *const  object,
const char *const  name,
const cJSON_bool  boolean 
)

◆ cJSON_AddItemReferenceToObject()

cJSON_AddItemReferenceToObject ( cJSON object,
const char *  string,
cJSON item 
)

◆ cJSON_AddNumberToObject()

cJSON_AddNumberToObject ( cJSON *const  object,
const char *const  name,
const double  number 
)
Here is the caller graph for this function:

◆ cJSON_AddRawToObject()

cJSON_AddRawToObject ( cJSON *const  object,
const char *const  name,
const char *const  raw 
)

◆ cJSON_AddStringToObject()

cJSON_AddStringToObject ( cJSON *const  object,
const char *const  name,
const char *const  string 
)
Here is the caller graph for this function:

◆ cJSON_Compare()

cJSON_Compare ( const cJSON *const  a,
const cJSON *const  b,
const cJSON_bool  case_sensitive 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cJSON_Duplicate_rec()

cJSON * cJSON_Duplicate_rec ( const cJSON item,
size_t  depth,
cJSON_bool  recurse 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cJSON_GetObjectItemCaseSensitive()

cJSON_GetObjectItemCaseSensitive ( const cJSON *const  object,
const char *const  string 
)

◆ cJSON_ParseWithLengthOpts()

cJSON_ParseWithLengthOpts ( const char *  value,
size_t  buffer_length,
const char **  return_parse_end,
cJSON_bool  require_null_terminated 
)
Here is the caller graph for this function:

◆ cJSON_ParseWithOpts()

cJSON_ParseWithOpts ( const char *  value,
const char **  return_parse_end,
cJSON_bool  require_null_terminated 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cJSON_PrintPreallocated()

cJSON_PrintPreallocated ( cJSON item,
char *  buffer,
const int  length,
const cJSON_bool  format 
)

◆ CJSON_PUBLIC() [1/7]

CJSON_PUBLIC ( char *  )

◆ CJSON_PUBLIC() [2/7]

CJSON_PUBLIC ( cJSON )
Here is the call graph for this function:

◆ CJSON_PUBLIC() [3/7]

CJSON_PUBLIC ( const char *  )

◆ CJSON_PUBLIC() [4/7]

CJSON_PUBLIC ( double  )

◆ CJSON_PUBLIC() [5/7]

CJSON_PUBLIC ( int  )

◆ CJSON_PUBLIC() [6/7]

CJSON_PUBLIC ( void *  )
Here is the call graph for this function:

◆ CJSON_PUBLIC() [7/7]

CJSON_PUBLIC ( void  )
Here is the call graph for this function:

◆ cJSON_ReplaceItemInObject()

cJSON_ReplaceItemInObject ( cJSON object,
const char *  string,
cJSON newitem 
)

◆ cJSON_ReplaceItemInObjectCaseSensitive()

cJSON_ReplaceItemInObjectCaseSensitive ( cJSON object,
const char *  string,
cJSON newitem 
)

◆ cJSON_ReplaceItemViaPointer()

cJSON_ReplaceItemViaPointer ( cJSON *const  parent,
cJSON *const  item,
cJSON replacement 
)