| 292 | /* type things */ |
| 293 | |
| 294 | int md_json_is(const md_json_type_t jtype, md_json_t *json, ...) |
| 295 | { |
| 296 | json_t *j; |
| 297 | va_list ap; |
| 298 | |
| 299 | va_start(ap, json); |
| 300 | j = jselect(json, ap); |
| 301 | va_end(ap); |
| 302 | switch (jtype) { |
| 303 | case MD_JSON_TYPE_OBJECT: return (j && json_is_object(j)); |
| 304 | case MD_JSON_TYPE_ARRAY: return (j && json_is_array(j)); |
| 305 | case MD_JSON_TYPE_STRING: return (j && json_is_string(j)); |
| 306 | case MD_JSON_TYPE_REAL: return (j && json_is_real(j)); |
| 307 | case MD_JSON_TYPE_INT: return (j && json_is_integer(j)); |
| 308 | case MD_JSON_TYPE_BOOL: return (j && (json_is_true(j) || json_is_false(j))); |
| 309 | case MD_JSON_TYPE_NULL: return (j == NULL); |
| 310 | } |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | static const char *md_json_type_name(const md_json_t *json) |
| 315 | { |
no test coverage detected