• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2024 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 { FuncTransferMap } from "../gen/datatype";
17
18export let transferMap: FuncTransferMap[] = [
19  {
20    fromType: 'bool',
21    // 分离出array , vector, map等
22    tranferContent: ['WriteBoolUnaligned', 'ReadBoolUnaligned']
23  },
24  {
25    fromType: 'int8_t',
26    tranferContent: ['WriteInt8', 'ReadInt8']
27  },
28  {
29    fromType: 'uint8_t',
30    tranferContent: ['WriteUint8', 'ReadUint8']
31  },
32  {
33    fromType: 'int16_t',
34    tranferContent: ['WriteInt16', 'ReadInt16']
35  },
36  {
37    fromType: 'uint16_t',
38    tranferContent: ['WriteUint16', 'ReadUint16']
39  },
40  {
41    fromType: 'int32_t',
42    tranferContent: ['WriteInt32', 'ReadInt32']
43  },
44  {
45    fromType: 'uint32_t',
46    tranferContent: ['WriteUint32', 'ReadUint32']
47  },
48  {
49    fromType: 'int64_t',
50    tranferContent: ['WriteInt64', 'ReadInt64']
51  },
52  {
53    fromType: 'uint64_t',
54    tranferContent: ['WriteUint64', 'ReadUint64']
55  },
56  {
57    fromType: 'float',
58    tranferContent: ['WriteFloat', 'ReadFloat']
59  },
60  {
61    fromType: 'double',
62    tranferContent: ['WriteDouble', 'ReadDouble']
63  },
64  {
65    fromType: 'char *',
66    tranferContent: ['WriteCString', 'ReadCString']
67  },
68  {
69    fromType: 'string',
70    tranferContent: ['WriteString', 'ReadString']
71  },
72  {
73    fromType: 'vector<bool>',
74    tranferContent: ['WriteBoolVector', 'ReadBoolVector']
75  },
76  {
77    fromType: 'vector<int8_t>',
78    tranferContent: ['WriteInt8Vector', 'ReadInt8Vector']
79  },
80  {
81    fromType: 'vector<uint8_t>',
82    tranferContent: ['WriteUInt8Vector', 'ReadUInt8Vector']
83  },
84  {
85    fromType: 'vector<int16_t>',
86    tranferContent: ['WriteInt16Vector', 'ReadInt16Vector']
87  },
88  {
89    fromType: 'vector<uint16_t>',
90    tranferContent: ['WriteUInt16Vector', 'ReadUInt16Vector']
91  },
92  {
93    fromType: 'vector<int32_t>',
94    tranferContent: ['WriteInt32Vector', 'ReadUInt32Vector']
95  },
96  {
97    fromType: 'vector<uint32_t>',
98    tranferContent: ['WriteUInt32Vector', 'ReadUInt32Vector']
99  },
100  {
101    fromType: 'vector<int64_t>',
102    tranferContent: [ 'WriteInt64Vector', 'ReadInt64Vector']
103  },
104  {
105    fromType: 'vector<uint64_t>',
106    tranferContent: ['WriteUInt64Vector', 'ReadUInt64Vector']
107  },
108  {
109    fromType: 'vector<float>',
110    tranferContent: ['WriteFloatVector', 'ReadFloatVector']
111  },
112  {
113    fromType: 'vector<double>',
114    tranferContent: ['WriteDoubleVector', 'ReadDoubleVector']
115  },
116  {
117    fromType: 'vector<string>',
118    tranferContent: ['WriteStringVector', 'ReadStringVector']
119  },
120]
121
122
123export let idlTransferType: FuncTransferMap[] = [
124  {
125    fromType: 'bool',
126    tranferContent: ['boolean']
127  },
128  {
129    fromType: 'string',
130    tranferContent: ['String']
131  },
132]
133
134// 将ts type转换为 c type
135export let tsTransferType: FuncTransferMap[] = [
136  {
137    fromType: 'boolean',
138    tranferContent: ['bool']
139  },
140  {
141    fromType: 'string',
142    tranferContent: ['std::string']
143  },
144  {
145    fromType: 'number',
146    tranferContent: ['int32_t', 'uint32_t', 'int', 'int64_t', 'uint64_t']
147  }
148]
149