mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-01 19:49:11 +08:00
improve tools
This commit is contained in:
parent
5b22cb8bcc
commit
165bdf18b4
@ -364,11 +364,28 @@ ret_t ${className}_set_${iter.name}(widget_t* widget, ${paramDecl}) {
|
||||
return result;
|
||||
}
|
||||
|
||||
genFreeProps(json) {
|
||||
let result = '';
|
||||
const className = json.name;
|
||||
if (!json.props || !json.props.length) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = json.props.map((iter, index) => {
|
||||
if(iter.type.indexOf('char*') >= 0) {
|
||||
return ` TKMEM_FREE(${className}->${iter.name});\n`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}).join('');
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
genGetPropDispatch(json) {
|
||||
let result = '';
|
||||
if (!json.props || !json.props.length) {
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
const className = json.name;
|
||||
@ -401,6 +418,7 @@ ret_t ${className}_set_${iter.name}(widget_t* widget, ${paramDecl}) {
|
||||
const propSetterImpls = this.genPropSetterImpls(json);
|
||||
const propSetPropDispatch = this.genSetPropDispatch(json);
|
||||
const propGetPropDispatch = this.genGetPropDispatch(json);
|
||||
const freeProps = this.genFreeProps(json);
|
||||
let defaultInclude = this.genIncludes(className);
|
||||
|
||||
if (json.includes) {
|
||||
@ -436,7 +454,7 @@ static ret_t ${className}_on_destroy(widget_t* widget) {
|
||||
${className}_t* ${className} = ${uclassName}(widget);
|
||||
return_value_if_fail(widget != NULL && ${className} != NULL, RET_BAD_PARAMS);
|
||||
|
||||
(void)${className};
|
||||
${freeProps}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -13,18 +13,13 @@
|
||||
"type":"char*"
|
||||
},
|
||||
{
|
||||
"name":"file_icon",
|
||||
"desc":"文件项的图标",
|
||||
"type":"char*"
|
||||
"name":"ignore_hidden_files",
|
||||
"desc":"忽略隐藏文件",
|
||||
"type":"bool_t"
|
||||
},
|
||||
{
|
||||
"name":"folder_icon",
|
||||
"desc":"目录项的图标",
|
||||
"type":"char*"
|
||||
},
|
||||
{
|
||||
"name":"return_up_icon",
|
||||
"desc":"返回上一级目录的图标",
|
||||
"name":"sort_by",
|
||||
"desc":"排序方式。可选值(name, size, mtime)",
|
||||
"type":"char*"
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user