awtk/tools/object_gen
2021-09-08 17:10:49 +08:00
..
samples update data 2021-09-08 17:10:49 +08:00
gen_object.js add tool to generate object code 2021-06-28 16:01:57 +08:00
README.md add tool to generate object code 2021-06-28 16:01:57 +08:00

object 代码生成器

用来生成 object 的框架代码的小工具。

1.编写描述文件

{
  "name":"foobar",
  "date":"2021-06-15",
  "team":"AWTK Develop Team",
  "author":"Li XianJing <xianjimli@hotmail.com>",
  "desc":"foobar",
  "copyright":"Guangzhou ZHIYUAN Electronics Co.,Ltd.",
  "parent": "object",
  "includes":[],
  "props": [
    {
      "name":"type",
      "desc":"a int value",
      "init_value":0,
      "type":"uint32_t"
    },
    {
      "name":"name",
      "desc":"a string value",
      "init_value":"NULL",
      "type":"char*"
    }
  ]
}

属性的类型目前支持:

  • int8_t
  • int16_t
  • int32_t
  • int64_t
  • uint8_t
  • uint16_t
  • uint32_t
  • uint64_t
  • float
  • double
  • char*

2.生成代码

node gen_object.js samples/foobar.json