Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
docs/ | 12-May-2024 | - | 122 | 64 | ||
resources/ | 12-May-2024 | - | 62 | 45 | ||
src/com/sk/ts/ | 12-May-2024 | - | 1,927 | 1,226 | ||
README_zh.md | D | 12-May-2024 | 3.7 KiB | 131 | 84 |
README_zh.md
1# TS框架生成工具IntelliJ插件说明 2 3## 简介 4 5ts(type-script)接口生成工具,它可以根据定义在c++头文件中的接口,生成type-script语言的ts接口文件。目前工具支持可执行文件、IntelliJ插件两种入口,本文主要介绍IntelliJ插件使用说明。 6 7## 目录 8 9 ├── ts # TS框架代码生成工具 10 │ ├── ... # 其它文件 11 │ ├── ts_IntelliJ_plugin # IntelliJ插件代码 12 │ │ ├── docs # IntelliJ插件说明 13 │ │ ├── resources # IntelliJ插件说明 14 │ │ ├── src # IntelliJ插件源码 15 │ │ └── README_zh # IntelliJ插件说明 16 17## 约束 18 19系统:建议Windows 10 20 21依赖版本:JDK 11 22 23开发工具:DevEco stdio、IDEA Community 2021.3.3 24 25## 使用方法 26 27### 使用对象 28 29系统开发者、应用Native开发者 30 31### 使用场景 32 331) 系统框架层新增子系统,需对应用层提供接口。 342) 系统框架层子系统能力增强后,需对应用层提供新接口。 353) 应用层引入C++三方库,需增加OpenHarmony应用层接口。 36 37### 工具使用 38 39插件下载路径如下,选择generator.jar下载。 40 41[下载链接1]( http://ftpkaihongdigi.i234.me:5000/sharing/PC6uOorrM) 42 43[下载链接2]( http://ftp.kaihong.com:5000/sharing/PC6uOorrM) 44 45[下载链接3]( http://ftp.kaihongdigi.com:5000/sharing/PC6uOorrM) 46 47具体的工具使用步骤,可以左键单击以下链接了解: 48 49[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_IntelliJ_plugin/docs/INSTRUCTION_ZH.md) 50 51### 工具输出 52 53根据使用者指定的.h文件,工具会输出对应的ts接口文件。为了方便使用者快速上手工具,可供测试的test.h文件样例如下: 54 55``` 56#include < string > 57 #include < vector > 58 using namespace std; 59 60 class TestA { 61 public: 62 char16_t string1; 63 void add(string v, long double v1[]); 64 }; 65 double count(double v, double v1[]); 66 67 namespace Space { 68 class TestBB { 69 public: 70 short string4; 71 bool ifExist(bool v, bool v1[]); 72 }; 73 uint32_t max(uint32_t v, uint32_t v1[]); 74 } 75``` 76 77在window环境下的,根据输入文件test.h,生成的输出文件,如下所示: 78 79其中生成的"test.d.ts"文件,定义了应用开发接口,如下所示: 80 81 82```c++ 83declare class TestA { 84 string1: string; 85 add(v: string, v1: Array<number>): void; 86} 87declare namespace Space { 88 function max(v: number, v1: Array<number>): number; 89 class TestBB { 90 string4: number; 91 ifExist(v: boolean, v1: Array<boolean>): boolean; 92 } 93} 94declare function count(v: number, v1: Array<number>): number; 95 96export default Space; 97``` 98 99## 开发说明 100 101### 对象 102 103工具的开发者 104 105### 开发场景 106 107若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。 108 109### 开发步骤 110 111开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发: 112 113 [工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/hdc/ts/ts_IntelliJ_plugin/docs/DEVELOP_ZH.md) 114 115## 版本说明 116 117当前版本已支持的特性和待开发的特性,如下所示: 118 119 [已支持特性](https://gitee.com/openharmony/napi_generator/blob/master/docs/ts/ts_Gen-1.0.md) 120 121 [待支持特性](https://gitee.com/openharmony/napi_generator/blob/master/docs/ts/ROADMAP_ZH.md) 122 123## FAQ 124 125对于常见问题解决方法指导如下: 126 127 [FAQ](https://gitee.com/openharmony/napi_generator/tree/master/docs/ts/FAQ.md) 128 129## 相关仓 130 131暂无