1/*
2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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
16import { TcBase } from './tctbase'
17
18type cJSON_bool = number;
19// 对应cJSON.h中: typedef struct cJSON {}
20export interface cJSON {
21  next: cJSON | null;
22  prev: cJSON | null;
23  child: cJSON | null;
24  type: number;
25  valuestring: string;
26  valueint: number;
27  valuedouble: number;
28  string: string;
29}
30
31export interface TcCJsonSample extends TcBase {
32  name: string;
33  cjson_version: () => string;
34
35  // 对应cJSON.h中: CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); 方法的dts接口
36  KH418_cJSON_Parse: (value: string) => cJSON;
37  // 对应cJSON.h中: CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); 方法的dts接口
38  KH373_cJSON_GetArraySize: (array: cJSON) => number;
39  // 对应cJSON.h中: CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); 方法的dts接口
40  KH735_cJSON_Print: (item: cJSON) => string;
41  // 对应cJSON.h中: CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); 方法的dts接口
42  KH361_cJSON_CreateObject: () => cJSON;
43  // 对应cJSON.h中: CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); 方法的dts接口
44  KH515_cJSON_CreateString: (string: string) => cJSON;
45  // 对应cJSON.h中:CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); 方法的dts接口
46  KH526_cJSON_AddStringToObject: (object: cJSON, name: string, string: string) => cJSON;
47  // 对应cJSON.h中: CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); 方法的dts接口
48  KH206_cJSON_AddNumberToObject: (object: cJSON, name: string, number: number) => cJSON;
49  // 对应cJSON.h中: CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); 方法的dts接口
50  KH545_cJSON_AddFalseToObject: (object: cJSON, name: string) => cJSON;
51  // 对应cJSON.h中: CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); 方法的dts接口
52  KH180_cJSON_AddItemToObject:(object: cJSON, string: string, item: cJSON) => cJSON;
53  // 对应cJSON.h中: CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); 方法的dts接口
54  KH386_cJSON_CreateArray:() => cJSON;
55  // 对应cJSON.h中: CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); 方法的dts接口
56  KH203_cJSON_CreateIntArray:(numbers: number[], count: number) => cJSON;
57  // 对应cJSON.h中: CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); 方法的dts接口
58  KH802_cJSON_AddItemToArray:(array: cJSON, item: cJSON) => cJSON;
59}