add emitter_forward_retarget

This commit is contained in:
lixianjing 2023-05-28 16:29:45 +08:00
parent a8a790647d
commit 493104194f
3 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,8 @@
# 最新动态
2023/05/28
* 增加函数emitter\_forward\_retarget。
2023/05/27
* 完善ubjson\_do\_parse\_array数组中包含数组的处理。

View File

@ -412,3 +412,9 @@ ret_t emitter_dispatch_simple_event(emitter_t* emitter, uint32_t type) {
ret_t emitter_forward(void* ctx, event_t* e) {
return emitter_dispatch(EMITTER(ctx), e);
}
ret_t emitter_forward_retarget(void* ctx, event_t* e) {
return_value_if_fail(e != NULL, RET_BAD_PARAMS);
e->target = ctx;
return emitter_dispatch(EMITTER(ctx), e);
}

View File

@ -295,6 +295,17 @@ emitter_t* emitter_cast(emitter_t* emitter);
*/
ret_t emitter_forward(void* ctx, event_t* e);
/**
* @method emitter_forward_retarget
* e->target强制设置为ctx
*
* @param {void*} ctx emitter对象
* @param {event_t*} e
*
* @return {ret_t} RET_OK表示成功
*/
ret_t emitter_forward_retarget(void* ctx, event_t* e);
#define EMITTER(emitter) ((emitter_t*)(emitter))
#define EMITTER_ENABLE(emitter) \