diff --git a/docs/changes.md b/docs/changes.md index a16ef01c4..5ee4034cb 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -5,6 +5,7 @@ * 修复SDL释放的时候内存泄露的问题(感谢智明提供补丁) * 增加状态机(感谢林福提供补丁) * 修复单元测试:兼容非utf8编码的编译器(VS2015)(感谢雨欣提供补丁) + * 完善部分cast函数的文档。 2021/12/23 * 增加aworkslp平台支持(感谢林福提供补丁) diff --git a/src/tkc/object_array.h b/src/tkc/object_array.h index 1917cfdbe..1e9c66b8b 100644 --- a/src/tkc/object_array.h +++ b/src/tkc/object_array.h @@ -370,7 +370,16 @@ ret_t object_array_sort_as_double(tk_object_t* obj, bool_t ascending); */ ret_t object_array_sort_as_str(tk_object_t* obj, bool_t ascending, bool_t ignore_case); +/** + * @method object_array_cast + * 转换为object_array对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_array对象。 + * + * @return {object_array_t*} object_array对象。 + */ object_array_t* object_array_cast(tk_object_t* obj); + #define OBJECT_ARRAY(obj) object_array_cast(obj) END_C_DECLS diff --git a/src/tkc/object_compositor.h b/src/tkc/object_compositor.h index 7785af872..124e8ba89 100644 --- a/src/tkc/object_compositor.h +++ b/src/tkc/object_compositor.h @@ -56,6 +56,14 @@ typedef struct _object_compositor_t { */ tk_object_t* object_compositor_create(tk_object_t* obj1, tk_object_t* obj2); +/** + * @method object_compositor_cast + * 转换为object_compositor对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_compositor对象。 + * + * @return {object_compositor_t*} object_compositor对象。 + */ object_compositor_t* object_compositor_cast(tk_object_t* obj); #define OBJECT_COMPOSITOR(obj) object_compositor_cast(obj) diff --git a/src/tkc/object_date_time.h b/src/tkc/object_date_time.h index f97e99a43..ac77f09cd 100644 --- a/src/tkc/object_date_time.h +++ b/src/tkc/object_date_time.h @@ -58,6 +58,14 @@ typedef struct _object_date_time_t { */ tk_object_t* object_date_time_create(void); +/** + * @method object_date_time_cast + * 转换为object_date_time对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_date_time对象。 + * + * @return {object_date_time_t*} object_date_time对象。 + */ object_date_time_t* object_date_time_cast(tk_object_t* obj); #define OBJECT_DATE_TIME(obj) object_date_time_cast(obj) diff --git a/src/tkc/object_default.h b/src/tkc/object_default.h index fe93cb651..5d3ffce30 100644 --- a/src/tkc/object_default.h +++ b/src/tkc/object_default.h @@ -123,6 +123,14 @@ ret_t object_default_clear_props(tk_object_t* obj); */ value_t* object_default_find_prop(tk_object_t* obj, tk_compare_t cmp, const void* data); +/** + * @method object_default_cast + * 转换为object_default对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_default对象。 + * + * @return {object_default_t*} object_default对象。 + */ object_default_t* object_default_cast(tk_object_t* obj); #define OBJECT_DEFAULT(obj) object_default_cast(obj) diff --git a/src/tkc/object_locker.h b/src/tkc/object_locker.h index 4b28ca5c3..84c4ae236 100644 --- a/src/tkc/object_locker.h +++ b/src/tkc/object_locker.h @@ -56,6 +56,14 @@ typedef struct _object_locker_t { */ tk_object_t* object_locker_create(tk_object_t* obj); +/** + * @method object_locker_cast + * 转换为object_locker对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_locker对象。 + * + * @return {object_locker_t*} object_locker对象。 + */ object_locker_t* object_locker_cast(tk_object_t* obj); #define OBJECT_LOCKER(obj) object_locker_cast(obj) diff --git a/src/tkc/object_rbuffer.h b/src/tkc/object_rbuffer.h index f85b1d7a2..a3e5036de 100644 --- a/src/tkc/object_rbuffer.h +++ b/src/tkc/object_rbuffer.h @@ -63,6 +63,14 @@ typedef struct _object_rbuffer_t { */ tk_object_t* object_rbuffer_create(const uint8_t* data, uint32_t capacity); +/** + * @method object_rbuffer_cast + * 转换为object_rbuffer对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_rbuffer对象。 + * + * @return {object_rbuffer_t*} object_rbuffer对象。 + */ object_rbuffer_t* object_rbuffer_cast(tk_object_t* obj); #define OBJECT_RBUFFER(obj) object_rbuffer_cast(obj) diff --git a/src/tkc/object_typed_array.h b/src/tkc/object_typed_array.h index b45f3e921..660dfae66 100644 --- a/src/tkc/object_typed_array.h +++ b/src/tkc/object_typed_array.h @@ -60,6 +60,14 @@ typedef struct _object_typed_array_t { */ tk_object_t* object_typed_array_create(value_type_t type, uint32_t capacity); +/** + * @method object_typed_array_cast + * 转换为object_typed_array对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_typed_array对象。 + * + * @return {object_typed_array_t*} object_typed_array对象。 + */ object_typed_array_t* object_typed_array_cast(tk_object_t* obj); #define OBJECT_TYPED_ARRAY(obj) object_typed_array_cast(obj) diff --git a/src/tkc/object_wbuffer.h b/src/tkc/object_wbuffer.h index bcf039dd0..b0ed171b5 100644 --- a/src/tkc/object_wbuffer.h +++ b/src/tkc/object_wbuffer.h @@ -75,6 +75,14 @@ tk_object_t* object_wbuffer_create(uint8_t* data, uint32_t capacity); */ tk_object_t* object_wbuffer_create_extendable(void); +/** + * @method object_wbuffer_cast + * 转换为object_wbuffer对象。 + * @annotation ["cast"] + * @param {tk_object_t*} obj object_wbuffer对象。 + * + * @return {object_wbuffer_t*} object_wbuffer对象。 + */ object_wbuffer_t* object_wbuffer_cast(tk_object_t* obj); #define OBJECT_WBUFFER(obj) object_wbuffer_cast(obj)