mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
parent
fafdd3793e
commit
e53e74db80
@ -299,11 +299,10 @@ ret_t ${className}_set_${iter.name}(${className}_t* ${className}, ${paramDecl})
|
|||||||
let parentAnnotation = "";
|
let parentAnnotation = "";
|
||||||
const className = json.name;
|
const className = json.name;
|
||||||
const uclassName = json.name.toUpperCase();
|
const uclassName = json.name.toUpperCase();
|
||||||
const parentType = json.parent != 'object' ? json.parent + '_t' : 'tk_object_t';
|
|
||||||
|
|
||||||
if (json.parent) {
|
if (json.parent) {
|
||||||
parent = `${parentType} ${json.parent};`
|
parent = `${json.parent}_t ${json.parent};`
|
||||||
parentAnnotation = `@parent ${parentType}`
|
parentAnnotation = `@parent ${json.parent}`
|
||||||
if (json.parent != 'object') {
|
if (json.parent != 'object') {
|
||||||
includes = `#include "${json.parent}.h"\n`
|
includes = `#include "${json.parent}.h"\n`
|
||||||
}
|
}
|
||||||
@ -404,7 +403,7 @@ ret_t ${className}_get_prop(${className}_t* ${className}, const char* name, valu
|
|||||||
*
|
*
|
||||||
* @return {${className}_t*} 返回非NULL表示成功,否则表示失败。
|
* @return {${className}_t*} 返回非NULL表示成功,否则表示失败。
|
||||||
*/
|
*/
|
||||||
${className}_t* ${className}_cast(tk_object_t* obj);
|
${className}_t* ${className}_cast(object_t* obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method ${className}_create
|
* @method ${className}_create
|
||||||
@ -485,7 +484,7 @@ ${this.genSetPropDispatch(json)}
|
|||||||
return RET_NOT_FOUND;
|
return RET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ret_t ${className}_set_prop_obj(tk_object_t* obj, const char* name, const value_t* v) {
|
static ret_t ${className}_set_prop_obj(object_t* obj, const char* name, const value_t* v) {
|
||||||
${className}_t* ${className} = ${uclassName}(obj);
|
${className}_t* ${className} = ${uclassName}(obj);
|
||||||
return_value_if_fail(${className} != NULL && name != NULL && v != NULL , RET_BAD_PARAMS);
|
return_value_if_fail(${className} != NULL && name != NULL && v != NULL , RET_BAD_PARAMS);
|
||||||
|
|
||||||
@ -501,7 +500,7 @@ ${this.genGetPropDispatch(json)}
|
|||||||
return RET_NOT_FOUND;
|
return RET_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ret_t ${className}_get_prop_obj(tk_object_t* obj, const char* name, value_t* v) {
|
static ret_t ${className}_get_prop_obj(object_t* obj, const char* name, value_t* v) {
|
||||||
${className}_t* ${className} = ${uclassName}(obj);
|
${className}_t* ${className} = ${uclassName}(obj);
|
||||||
return_value_if_fail(${className} != NULL && name != NULL && v != NULL , RET_BAD_PARAMS);
|
return_value_if_fail(${className} != NULL && name != NULL && v != NULL , RET_BAD_PARAMS);
|
||||||
|
|
||||||
@ -516,11 +515,11 @@ ${parentDeinit}
|
|||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ret_t ${className}_on_destroy(tk_object_t* obj) {
|
static ret_t ${className}_on_destroy(object_t* obj) {
|
||||||
return ${className}_deinit(${uclassName}(obj));
|
return ${className}_deinit(${uclassName}(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const tk_object_vtable_t s_${className}_vtable = {.type = "${className}",
|
static const object_vtable_t s_${className}_vtable = {.type = "${className}",
|
||||||
.desc = "${className}",
|
.desc = "${className}",
|
||||||
.size = sizeof(${className}_t),
|
.size = sizeof(${className}_t),
|
||||||
.is_collection = FALSE,
|
.is_collection = FALSE,
|
||||||
@ -538,13 +537,13 @@ ${this.genPropInits(json)}
|
|||||||
}
|
}
|
||||||
|
|
||||||
${className}_t* ${className}_create(void) {
|
${className}_t* ${className}_create(void) {
|
||||||
tk_object_t* o = tk_object_create(&s_${className}_vtable);
|
object_t* o = object_create(&s_${className}_vtable);
|
||||||
return_value_if_fail(o != NULL, NULL);
|
return_value_if_fail(o != NULL, NULL);
|
||||||
|
|
||||||
return ${className}_init(${uclassName}(o));
|
return ${className}_init(${uclassName}(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
${className}_t* ${className}_cast(tk_object_t* obj) {
|
${className}_t* ${className}_cast(object_t* obj) {
|
||||||
return_value_if_fail(obj != NULL && obj->vt == &s_${className}_vtable, NULL);
|
return_value_if_fail(obj != NULL && obj->vt == &s_${className}_vtable, NULL);
|
||||||
|
|
||||||
return (${className}_t*)(obj);
|
return (${className}_t*)(obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user