Monado OpenXR Runtime
|
Tiny JSON wrapper around cJSON. More...
#include "util/u_json.h"
#include "util/u_logging.h"
#include <assert.h>
#include <stdio.h>
#include "cjson/cJSON.c"
Functions | |
static const cJSON * | get (const cJSON *json, const char *f) |
Less typing. More... | |
const cJSON * | u_json_get (const cJSON *json, const char *f) |
Get a JSON object by string from a JSON object. More... | |
bool | u_json_get_string_into_array (const cJSON *json, char *out_str, size_t max_size) |
Parse a string from a JSON object into a char array. More... | |
bool | u_json_get_bool (const cJSON *json, bool *out_bool) |
Parse an bool from a JSON object. More... | |
bool | u_json_get_int (const cJSON *json, int *out_int) |
Parse an int from a JSON object. More... | |
bool | u_json_get_double (const cJSON *json, double *out_double) |
Parse a double from a JSON object. More... | |
bool | u_json_get_float (const cJSON *json, float *out_float) |
Parse a float from a JSON object. More... | |
bool | u_json_get_vec3 (const cJSON *json, struct xrt_vec3 *out_vec3) |
Parse an xrt_vec3 from a JSON object. More... | |
bool | u_json_get_vec3_array (const cJSON *json, struct xrt_vec3 *out_vec3) |
Parse an xrt_vec3 from a JSON array. More... | |
bool | u_json_get_vec3_f64_array (const cJSON *json, struct xrt_vec3_f64 *out_vec3) |
Parse an xrt_vec3_f64 from a JSON array. More... | |
bool | u_json_get_quat (const cJSON *json, struct xrt_quat *out_quat) |
Parse a quaternion from a JSON object. More... | |
bool | u_json_get_pose (const cJSON *json, struct xrt_pose *out_pose) |
Parse a pose from a JSON object, composed of a vec3 named "position" and a quat named "orientation". More... | |
bool | u_json_get_pose_permissive (const cJSON *json, struct xrt_pose *out_pose) |
Parse a pose from a JSON object, composed of a vec3 named "position", "translation", "location", "pos", or "loc" and a quat named "orientation". More... | |
size_t | u_json_get_float_array (const cJSON *json_array, float *out_array, size_t max_size) |
Parse up to max_size floats from a JSON array. More... | |
size_t | u_json_get_double_array (const cJSON *json_array, double *out_array, size_t max_size) |
Parse up to max_size doubles from a JSON array. More... | |
size_t | u_json_get_int_array (const cJSON *json_array, int *out_array, size_t max_size) |
Parse up to max_size int from a JSON array. More... | |
bool | u_json_get_matrix_3x3 (const cJSON *json, struct xrt_matrix_3x3 *out_matrix) |
Parse a matrix_3x3 from a JSON object. More... | |
Tiny JSON wrapper around cJSON.
|
inlinestatic |
const cJSON * u_json_get | ( | const cJSON * | json, |
const char * | f | ||
) |
Get a JSON object by string from a JSON object.
References get().
Referenced by json_bool(), json_int(), json_rs2_format(), json_rs2_stream(), u_json_get_pose(), and u_json_get_pose_permissive().
Parse an bool from a JSON object.
Referenced by json_bool().
bool u_json_get_double | ( | const cJSON * | json, |
double * | out_double | ||
) |
Parse a double from a JSON object.
Referenced by u_json_get_double_array(), and u_json_get_float().
Parse up to max_size doubles from a JSON array.
References u_json_get_double(), and U_LOG_W.
bool u_json_get_float | ( | const cJSON * | json, |
float * | out_float | ||
) |
Parse a float from a JSON object.
References u_json_get_double().
Referenced by u_json_get_float_array(), u_json_get_quat(), and u_json_get_vec3().
Parse up to max_size floats from a JSON array.
References u_json_get_float(), and U_LOG_W.
bool u_json_get_int | ( | const cJSON * | json, |
int * | out_int | ||
) |
Parse an int from a JSON object.
Referenced by json_int(), json_rs2_format(), json_rs2_stream(), and u_json_get_int_array().
Parse up to max_size int from a JSON array.
References u_json_get_int(), and U_LOG_W.
bool u_json_get_matrix_3x3 | ( | const cJSON * | json, |
struct xrt_matrix_3x3 * | out_matrix | ||
) |
Parse a matrix_3x3 from a JSON object.
Parse a pose from a JSON object, composed of a vec3 named "position" and a quat named "orientation".
References u_json_get(), u_json_get_quat(), and u_json_get_vec3().
Parse a pose from a JSON object, composed of a vec3 named "position", "translation", "location", "pos", or "loc" and a quat named "orientation".
"rotation", or "rot"
References ARRAY_SIZE, u_json_get(), and u_json_get_vec3().
Parse a quaternion from a JSON object.
References get(), and u_json_get_float().
Referenced by u_json_get_pose().
Parse a string from a JSON object into a char array.
References U_LOG_E.
Parse an xrt_vec3 from a JSON object.
References get(), and u_json_get_float().
Referenced by u_json_get_pose(), and u_json_get_pose_permissive().
Parse an xrt_vec3 from a JSON array.
bool u_json_get_vec3_f64_array | ( | const cJSON * | json, |
struct xrt_vec3_f64 * | out_vec3 | ||
) |
Parse an xrt_vec3_f64 from a JSON array.