• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef CJSON__H
17 #define CJSON__H
18 
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif
23 
24 #include <stddef.h>
25 
26 /* The cJSON structure: */
27 typedef int cJSON_bool;
28 typedef struct cJSON
29 {
30     struct cJSON* next;
31     struct cJSON* prev;
32     struct cJSON* child;
33     int type;
34     char* valuestring;
35     int valueint;
36     double valuedouble;
37     char* string;
38 } cJSON;
39 
40 extern int g_getArrayItemTime;
41 extern int g_getObjectItem;
42 extern int g_isStringTime;
43 extern int g_createNumberTime;
44 extern int g_replaceItemInObjectTime;
45 extern int g_createArrayTime;
46 extern int g_createStringTime;
47 extern int g_addItemToArray;
48 extern int g_addItemToObject;
49 extern int g_createObject;
50 extern int g_parse;
51 extern int g_getArraySize;
52 extern int g_printUnformatted;
53 
54 cJSON* cJSON_GetObjectItem(const cJSON* const object, const char* const string);
55 cJSON_bool cJSON_IsNumber(const cJSON* const item);
56 cJSON_bool cJSON_IsString(const cJSON* const item);
57 double cJSON_GetNumberValue(const cJSON* const item);
58 int cJSON_GetArraySize(const cJSON* array);
59 cJSON* cJSON_CreateArray(void);
60 cJSON* cJSON_CreateObject(void);
61 cJSON* cJSON_CreateNumber(double num);
62 cJSON* cJSON_CreateString(const char* string);
63 cJSON_bool cJSON_AddItemToArray(cJSON* array, cJSON* item);
64 void cJSON_Delete(cJSON* item);
65 cJSON_bool cJSON_AddItemToObject(cJSON* object, const char* string, cJSON* item);
66 cJSON_bool cJSON_ReplaceItemInObject(cJSON* object, const char* string, cJSON* newitem);
67 cJSON* cJSON_GetArrayItem(const cJSON* array, int index);
68 cJSON* cJSON_Parse(const char* value);
69 void cJSON_free(void* object);
70 char* cJSON_PrintUnformatted(const cJSON* item);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif
77