X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Futils-json.h;fp=src%2Futils-json.h;h=5b8ebecea5c712d9a946a3fbe949e57eaa9f4e9f;hb=6b3c3b1916b0af0494041c12a3c86819e441105e;hp=97783475fba11db03648f17663bea7eea2054a40;hpb=bf650bc39188c86cec8a11097f2c341e3f1b54b1;p=src%2Fapp-framework-main.git diff --git a/src/utils-json.h b/src/utils-json.h index 9778347..5b8ebec 100644 --- a/src/utils-json.h +++ b/src/utils-json.h @@ -16,14 +16,26 @@ limitations under the License. */ -int j_object(struct json_object *obj, const char *key, struct json_object **value); -int j_string(struct json_object *obj, const char *key, const char **value); -int j_boolean(struct json_object *obj, const char *key, int *value); -int j_integer(struct json_object *obj, const char *key, int *value); - -extern const char *j_get_string(struct json_object *obj, const char *key, const char *defval); -extern int j_get_boolean(struct json_object *obj, const char *key, int defval); -extern int j_get_integer(struct json_object *obj, const char *key, int defval); +#define j_is_string(o) (json_object_get_type(o) == json_type_string) +#define j_is_boolean(o) (json_object_get_type(o) == json_type_boolean) +#define j_is_integer(o) (json_object_get_type(o) == json_type_int) + +extern int j_read_string(struct json_object *obj, const char **value); +extern int j_read_boolean(struct json_object *obj, int *value); +extern int j_read_integer(struct json_object *obj, int *value); + +extern const char *j_string(struct json_object *obj, const char *defval); +extern int j_boolean(struct json_object *obj, int defval); +extern int j_integer(struct json_object *obj, int defval); + +extern int j_read_object_at(struct json_object *obj, const char *key, struct json_object **value); +extern int j_read_string_at(struct json_object *obj, const char *key, const char **value); +extern int j_read_boolean_at(struct json_object *obj, const char *key, int *value); +extern int j_read_integer_at(struct json_object *obj, const char *key, int *value); + +extern const char *j_string_at(struct json_object *obj, const char *key, const char *defval); +extern int j_boolean_at(struct json_object *obj, const char *key, int defval); +extern int j_integer_at(struct json_object *obj, const char *key, int defval); extern int j_add(struct json_object *obj, const char *key, struct json_object *val); extern int j_add_string(struct json_object *obj, const char *key, const char *val);