PipeWire  0.3.33
SPA JSON Parser

Data Structures

struct  spa_json
 

Macros

#define SPA_JSON_INIT(data, size)   (struct spa_json) { (data), (data)+(size), }
 
#define SPA_JSON_ENTER(iter)   (struct spa_json) { (iter)->cur, (iter)->end, (iter), }
 

Functions

void spa_json_init (struct spa_json *iter, const char *data, size_t size)
 
void spa_json_enter (struct spa_json *iter, struct spa_json *sub)
 
int spa_json_next (struct spa_json *iter, const char **value)
 Get the next token. More...
 
int spa_json_enter_container (struct spa_json *iter, struct spa_json *sub, char type)
 
int spa_json_is_container (const char *val, int len)
 
int spa_json_container_len (struct spa_json *iter, const char *value, int len)
 
int spa_json_is_object (const char *val, int len)
 
int spa_json_enter_object (struct spa_json *iter, struct spa_json *sub)
 
bool spa_json_is_array (const char *val, int len)
 
int spa_json_enter_array (struct spa_json *iter, struct spa_json *sub)
 
bool spa_json_is_null (const char *val, int len)
 
int spa_json_parse_float (const char *val, int len, float *result)
 
bool spa_json_is_float (const char *val, int len)
 
int spa_json_get_float (struct spa_json *iter, float *res)
 
int spa_json_parse_int (const char *val, int len, int *result)
 
bool spa_json_is_int (const char *val, int len)
 
int spa_json_get_int (struct spa_json *iter, int *res)
 
bool spa_json_is_true (const char *val, int len)
 
bool spa_json_is_false (const char *val, int len)
 
bool spa_json_is_bool (const char *val, int len)
 
int spa_json_parse_bool (const char *val, int len, bool *result)
 
int spa_json_get_bool (struct spa_json *iter, bool *res)
 
bool spa_json_is_string (const char *val, int len)
 
int spa_json_parse_string (const char *val, int len, char *result)
 
int spa_json_get_string (struct spa_json *iter, char *res, int maxlen)
 
int spa_json_encode_string (char *str, int size, const char *val)
 

Detailed Description

Macro Definition Documentation

◆ SPA_JSON_ENTER

#define SPA_JSON_ENTER (   iter)    (struct spa_json) { (iter)->cur, (iter)->end, (iter), }

◆ SPA_JSON_INIT

#define SPA_JSON_INIT (   data,
  size 
)    (struct spa_json) { (data), (data)+(size), }

Function Documentation

◆ spa_json_container_len()

int spa_json_container_len ( struct spa_json iter,
const char *  value,
int  len 
)
inline

◆ spa_json_encode_string()

int spa_json_encode_string ( char *  str,
int  size,
const char *  val 
)
inline

References __PUT.

Referenced by pw_properties_serialize_dict().

◆ spa_json_enter()

void spa_json_enter ( struct spa_json iter,
struct spa_json sub 
)
inline

◆ spa_json_enter_array()

int spa_json_enter_array ( struct spa_json iter,
struct spa_json sub 
)
inline

◆ spa_json_enter_container()

int spa_json_enter_container ( struct spa_json iter,
struct spa_json sub,
char  type 
)
inline

◆ spa_json_enter_object()

int spa_json_enter_object ( struct spa_json iter,
struct spa_json sub 
)
inline

◆ spa_json_get_bool()

int spa_json_get_bool ( struct spa_json iter,
bool *  res 
)
inline

◆ spa_json_get_float()

int spa_json_get_float ( struct spa_json iter,
float *  res 
)
inline

◆ spa_json_get_int()

int spa_json_get_int ( struct spa_json iter,
int *  res 
)
inline

◆ spa_json_get_string()

int spa_json_get_string ( struct spa_json iter,
char *  res,
int  maxlen 
)
inline

◆ spa_json_init()

void spa_json_init ( struct spa_json iter,
const char *  data,
size_t  size 
)
inline

◆ spa_json_is_array()

bool spa_json_is_array ( const char *  val,
int  len 
)
inline

◆ spa_json_is_bool()

bool spa_json_is_bool ( const char *  val,
int  len 
)
inline

◆ spa_json_is_container()

int spa_json_is_container ( const char *  val,
int  len 
)
inline

◆ spa_json_is_false()

bool spa_json_is_false ( const char *  val,
int  len 
)
inline

◆ spa_json_is_float()

bool spa_json_is_float ( const char *  val,
int  len 
)
inline

◆ spa_json_is_int()

bool spa_json_is_int ( const char *  val,
int  len 
)
inline

References spa_json_parse_int().

◆ spa_json_is_null()

bool spa_json_is_null ( const char *  val,
int  len 
)
inline

◆ spa_json_is_object()

int spa_json_is_object ( const char *  val,
int  len 
)
inline

◆ spa_json_is_string()

bool spa_json_is_string ( const char *  val,
int  len 
)
inline

◆ spa_json_is_true()

bool spa_json_is_true ( const char *  val,
int  len 
)
inline

◆ spa_json_next()

int spa_json_next ( struct spa_json iter,
const char **  value 
)
inline

Get the next token.

value points to the token and the return value is the length.

References cur, depth, end, parent, SPA_FALLTHROUGH, and state.

Referenced by pw_properties_update_string(), spa_json_container_len(), spa_json_enter_container(), spa_json_get_bool(), spa_json_get_float(), spa_json_get_int(), and spa_json_get_string().

◆ spa_json_parse_bool()

int spa_json_parse_bool ( const char *  val,
int  len,
bool *  result 
)
inline

◆ spa_json_parse_float()

int spa_json_parse_float ( const char *  val,
int  len,
float *  result 
)
inline

References end.

Referenced by spa_json_get_float(), and spa_json_is_float().

◆ spa_json_parse_int()

int spa_json_parse_int ( const char *  val,
int  len,
int *  result 
)
inline

References end.

Referenced by spa_json_get_int(), and spa_json_is_int().

◆ spa_json_parse_string()

int spa_json_parse_string ( const char *  val,
int  len,
char *  result 
)
inline