The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/json: Add bool getter function

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
f47c384b b5dd07f2

+26
+1
doc/changes/aux/mr.266.2.md
··· 1 + u/json: Add bool getter function.
+17
src/xrt/auxiliary/util/u_json.c
··· 47 47 } 48 48 49 49 bool 50 + u_json_get_bool(const cJSON *json, bool *out_bool) 51 + { 52 + assert(out_bool != NULL); 53 + 54 + if (!json) { 55 + return false; 56 + } 57 + if (!cJSON_IsBool(json)) { 58 + return false; 59 + } 60 + 61 + *out_bool = json->valueint; 62 + 63 + return true; 64 + } 65 + 66 + bool 50 67 u_json_get_int(const cJSON *json, int *out_int) 51 68 { 52 69 assert(out_int != NULL);
+8
src/xrt/auxiliary/util/u_json.h
··· 31 31 u_json_get_string_into_array(const cJSON *json, char *out, size_t max_size); 32 32 33 33 /*! 34 + * @brief Parse an bool from a JSON object. 35 + * 36 + * @return true if successful, false if not. 37 + */ 38 + bool 39 + u_json_get_bool(const cJSON *json, bool *out_bool); 40 + 41 + /*! 34 42 * @brief Parse an int from a JSON object. 35 43 * 36 44 * @return true if successful, false if not.