gwenhywfar  5.14.1
Macros | Functions
json.c File Reference
#include "./json_p.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/path.h>
#include <ctype.h>
Include dependency graph for json.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG
 

Functions

static GWEN_JSON_ELEM_findByTypeAndData (GWEN_JSON_ELEM *je, int t, const char *s)
 
static void * _handlePath (const char *entry, void *data, int idx, uint32_t flags)
 
void * _handlePath (const char *entry, void *data, int idx, GWEN_UNUSED uint32_t flags)
 
GWEN_JSON_ELEMGWEN_JsonElement_FindByIdxTypeAndData (const GWEN_JSON_ELEM *jeSearch, int t, const char *s, int idx)
 
GWEN_JSON_ELEMGWEN_JsonElement_FindFirstByTypeAndData (const GWEN_JSON_ELEM *je, int t, const char *s)
 
GWEN_JSON_ELEMGWEN_JsonElement_FindNextByTypeAndData (const GWEN_JSON_ELEM *je, int t, const char *s)
 
void GWEN_JsonElement_free (GWEN_JSON_ELEM *je)
 
const char * GWEN_JsonElement_GetData (const GWEN_JSON_ELEM *je)
 
GWEN_JSON_ELEMGWEN_JsonElement_GetElementByPath (GWEN_JSON_ELEM *je, const char *path, uint32_t flags)
 
int GWEN_JsonElement_GetType (const GWEN_JSON_ELEM *je)
 
GWEN_JSON_ELEMGWEN_JsonElement_new (int t, const char *sData)
 
void GWEN_JsonElement_SetData (GWEN_JSON_ELEM *je, const char *s)
 
void GWEN_JsonElement_SetType (GWEN_JSON_ELEM *je, int t)
 
 GWEN_TREE2_FUNCTIONS (GWEN_JSON_ELEM, GWEN_JsonElement)
 

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 28 of file json.c.

Function Documentation

◆ _findByTypeAndData()

GWEN_JSON_ELEM * _findByTypeAndData ( GWEN_JSON_ELEM je,
int  t,
const char *  s 
)
static

Definition at line 154 of file json.c.

References GWEN_JSON_ELEMTYPE_ARRAY, GWEN_JSON_ELEMTYPE_KEY, GWEN_JSON_ELEMTYPE_OBJECT, GWEN_JsonElement_GetData(), GWEN_JsonElement_GetType(), and NULL.

Referenced by GWEN_JsonElement_FindFirstByTypeAndData(), and GWEN_JsonElement_FindNextByTypeAndData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _handlePath() [1/2]

static void* _handlePath ( const char *  entry,
void *  data,
int  idx,
uint32_t  flags 
)
static

Referenced by GWEN_JsonElement_GetElementByPath().

Here is the caller graph for this function:

◆ _handlePath() [2/2]

void* _handlePath ( const char *  entry,
void *  data,
int  idx,
GWEN_UNUSED uint32_t  flags 
)

Definition at line 193 of file json.c.

References GWEN_JSON_ELEMTYPE_KEY, GWEN_JsonElement_FindByIdxTypeAndData(), and NULL.

Here is the call graph for this function:

◆ GWEN_JsonElement_FindByIdxTypeAndData()

GWEN_JSON_ELEM* GWEN_JsonElement_FindByIdxTypeAndData ( const GWEN_JSON_ELEM jeSearch,
int  t,
const char *  s,
int  idx 
)

Definition at line 132 of file json.c.

References GWEN_JsonElement_FindFirstByTypeAndData(), GWEN_JsonElement_FindNextByTypeAndData(), and NULL.

Referenced by _handlePath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_JsonElement_FindFirstByTypeAndData()

GWEN_JSON_ELEM* GWEN_JsonElement_FindFirstByTypeAndData ( const GWEN_JSON_ELEM je,
int  t,
const char *  s 
)

Definition at line 112 of file json.c.

References _findByTypeAndData().

Referenced by GWEN_JsonElement_FindByIdxTypeAndData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_JsonElement_FindNextByTypeAndData()

GWEN_JSON_ELEM* GWEN_JsonElement_FindNextByTypeAndData ( const GWEN_JSON_ELEM je,
int  t,
const char *  s 
)

Definition at line 122 of file json.c.

References _findByTypeAndData().

Referenced by GWEN_JsonElement_FindByIdxTypeAndData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_JsonElement_free()

void GWEN_JsonElement_free ( GWEN_JSON_ELEM je)

Definition at line 63 of file json.c.

References GWEN_FREE_OBJECT, and GWEN_TREE2_FINI.

Referenced by _readArray(), and _readObject().

Here is the caller graph for this function:

◆ GWEN_JsonElement_GetData()

const char* GWEN_JsonElement_GetData ( const GWEN_JSON_ELEM je)

Definition at line 92 of file json.c.

References NULL.

Referenced by _findByTypeAndData(), and GWEN_JsonElement_DumpToBuffer().

Here is the caller graph for this function:

◆ GWEN_JsonElement_GetElementByPath()

GWEN_JSON_ELEM* GWEN_JsonElement_GetElementByPath ( GWEN_JSON_ELEM je,
const char *  path,
uint32_t  flags 
)

Definition at line 147 of file json.c.

References _handlePath(), and GWEN_Path_HandleWithIdx().

Referenced by test_json().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_JsonElement_GetType()

int GWEN_JsonElement_GetType ( const GWEN_JSON_ELEM je)

Definition at line 75 of file json.c.

References GWEN_JSON_ELEMTYPE_UNKNOWN.

Referenced by _findByTypeAndData(), and GWEN_JsonElement_DumpToBuffer().

Here is the caller graph for this function:

◆ GWEN_JsonElement_new()

GWEN_JSON_ELEM* GWEN_JsonElement_new ( int  t,
const char *  sData 
)

Definition at line 50 of file json.c.

References GWEN_JsonElement_SetData(), GWEN_JsonElement_SetType(), GWEN_NEW_OBJECT, and GWEN_TREE2_INIT.

Referenced by _readArray(), _readObject(), and _readValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_JsonElement_SetData()

void GWEN_JsonElement_SetData ( GWEN_JSON_ELEM je,
const char *  s 
)

Definition at line 101 of file json.c.

References NULL.

Referenced by GWEN_JsonElement_new().

Here is the caller graph for this function:

◆ GWEN_JsonElement_SetType()

void GWEN_JsonElement_SetType ( GWEN_JSON_ELEM je,
int  t 
)

Definition at line 84 of file json.c.

Referenced by GWEN_JsonElement_new().

Here is the caller graph for this function:

◆ GWEN_TREE2_FUNCTIONS()

GWEN_TREE2_FUNCTIONS ( GWEN_JSON_ELEM  ,
GWEN_JsonElement   
)