73389af6c59c33b3c16f9278d7d7f6ac833121f4
[src/app-framework-binder.git] / src / wrap-json.h
1 /*
2  Copyright (C) 2016-2019 "IoT.bzh"
3
4  author: José Bollo <jose.bollo@iot.bzh>
5
6  Licensed under the Apache License, Version 2.0 (the "License");
7  you may not use this file except in compliance with the License.
8  You may obtain a copy of the License at
9
10      http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 */
18
19 #pragma once
20
21 #ifdef __cplusplus
22     extern "C" {
23 #endif
24
25 #include <stdarg.h>
26 #include <json-c/json.h>
27
28 extern int wrap_json_get_error_position(int rc);
29 extern int wrap_json_get_error_code(int rc);
30 extern const char *wrap_json_get_error_string(int rc);
31
32 extern int wrap_json_vpack(struct json_object **result, const char *desc, va_list args);
33 extern int wrap_json_pack(struct json_object **result, const char *desc, ...);
34
35 extern int wrap_json_vunpack(struct json_object *object, const char *desc, va_list args);
36 extern int wrap_json_unpack(struct json_object *object, const char *desc, ...);
37 extern int wrap_json_vcheck(struct json_object *object, const char *desc, va_list args);
38 extern int wrap_json_check(struct json_object *object, const char *desc, ...);
39 extern int wrap_json_vmatch(struct json_object *object, const char *desc, va_list args);
40 extern int wrap_json_match(struct json_object *object, const char *desc, ...);
41
42 extern void wrap_json_optarray_for_all(struct json_object *object, void (*callback)(void*,struct json_object*), void *closure);
43 extern void wrap_json_array_for_all(struct json_object *object, void (*callback)(void*,struct json_object*), void *closure);
44 extern void wrap_json_object_for_all(struct json_object *object, void (*callback)(void*,struct json_object*,const char*), void *closure);
45 extern void wrap_json_optobject_for_all(struct json_object *object, void (*callback)(void*,struct json_object*,const char*), void *closure);
46 extern void wrap_json_for_all(struct json_object *object, void (*callback)(void*,struct json_object*,const char*), void *closure);
47
48 extern struct json_object *wrap_json_clone(struct json_object *object);
49 extern struct json_object *wrap_json_clone_deep(struct json_object *object);
50 extern struct json_object *wrap_json_clone_depth(struct json_object *object, int depth);
51
52 extern struct json_object *wrap_json_object_add(struct json_object *dest, struct json_object *added);
53
54 extern struct json_object *wrap_json_sort(struct json_object *array);
55 extern struct json_object *wrap_json_keys(struct json_object *object);
56 extern int wrap_json_cmp(struct json_object *x, struct json_object *y);
57 extern int wrap_json_equal(struct json_object *x, struct json_object *y);
58 extern int wrap_json_contains(struct json_object *x, struct json_object *y);
59
60 #ifdef __cplusplus
61     }
62 #endif