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 #include <stddef.h> 19 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 25 /* The cJSON structure: */ 26 typedef int cJSON_bool; 27 typedef struct cJSON { 28 struct cJSON* next; 29 struct cJSON* prev; 30 struct cJSON* child; 31 int type; 32 char* valuestring; 33 int valueint; 34 double valuedouble; 35 char* string; 36 } cJSON; 37 38 extern int g_getArrayItemTime; 39 extern int g_getObjectItem; 40 extern int g_isStringTime; 41 extern int g_createNumberTime; 42 extern int g_replaceItemInObjectTime; 43 extern int g_createArrayTime; 44 extern int g_createStringTime; 45 extern int g_addItemToArray; 46 extern int g_addItemToObject; 47 extern int g_createObject; 48 extern int g_parse; 49 extern int g_getArraySize; 50 extern int g_printUnformatted; 51 52 cJSON* cJSON_GetObjectItem(const cJSON* const object, const char* const string); 53 cJSON_bool cJSON_IsNumber(const cJSON* const item); 54 cJSON_bool cJSON_IsString(const cJSON* const item); 55 double cJSON_GetNumberValue(const cJSON* const item); 56 int cJSON_GetArraySize(const cJSON* array); 57 cJSON* cJSON_CreateArray(void); 58 cJSON* cJSON_CreateObject(void); 59 cJSON* cJSON_CreateNumber(double num); 60 cJSON* cJSON_CreateString(const char* string); 61 cJSON_bool cJSON_AddItemToArray(cJSON* array, cJSON* item); 62 void cJSON_Delete(cJSON* item); 63 cJSON_bool cJSON_AddItemToObject(cJSON* object, const char* string, cJSON* item); 64 cJSON_bool cJSON_ReplaceItemInObject(cJSON* object, const char* string, cJSON* newitem); 65 cJSON* cJSON_GetArrayItem(const cJSON* array, int index); 66 cJSON* cJSON_Parse(const char* value); 67 void cJSON_free(void* object); 68 char* cJSON_PrintUnformatted(const cJSON* item); 69 void GetHandle(void); 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif 76