• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 */
15union Union {
16  sValue: String;
17  iValue: i32;
18}
19
20interface ExampleInterface {
21
22    FuncPrimitiveI8(param1: Optional<i8>): void;
23    FuncPrimitiveI16(param1: Optional<i16>): void;
24    FuncPrimitiveI32(param1: Optional<i32>): void;
25    FuncPrimitiveI64(param1: Optional<i64>): void;
26    FuncPrimitiveF32(param1: Optional<f32>): void;
27    FuncPrimitiveF64(param1: Optional<f64>): void;
28    FuncPrimitiveBool(param1: Optional<bool>): void;
29    FuncPrimitiveString(param1: Optional<String>): void;
30
31    FuncArray(param1: Optional<Array<i32>>):void;
32    FuncBuffer(param1: Optional<@arraybuffer Array<u8>>):void;
33    FuncUnion(param1: Optional<Union>):void;
34    FuncMap(param1: Optional<@record Map<String,i32>>):void;
35
36    @get GetName(): Optional<String>;
37    @get Geti8(): Optional<i8>;
38    @get Geti16(): Optional<i16>;
39    @get Geti32(): Optional<i32>;
40    @get Geti64(): Optional<i64>;  // 注意:这里应该是i64,你可能需要修正类型
41    @get Getf32(): Optional<f32>;
42    @get Getf64(): Optional<f64>;
43    @get Getbool(): Optional<bool>;
44    @get GetArraybuffer(): Optional<@arraybuffer Array<u8>>;
45
46}
47
48function GetInterface(): ExampleInterface;
49function PrintTestInterfaceName(testiface: ExampleInterface): void;
50function PrintTestInterfaceNumberi8(testiface: ExampleInterface): void;
51function PrintTestInterfaceNumberi16(testiface: ExampleInterface): void;
52function PrintTestInterfaceNumberi32(testiface: ExampleInterface): void;
53function PrintTestInterfaceNumberi64(testiface: ExampleInterface): void;
54function PrintTestInterfaceNumberf32(testiface: ExampleInterface): void;
55function PrintTestInterfaceNumberf64(testiface: ExampleInterface): void;
56function PrintTestInterfacebool(testiface: ExampleInterface): void;
57function PrintTestInterfaceArraybuffer(testiface: ExampleInterface): void;