1
0
mirror of https://github.com/wqking/eventpp.git synced 2024-12-27 00:17:02 +08:00

Added document for remove functions in ScopedRemover

This commit is contained in:
wqking 2021-11-16 20:26:22 +08:00
parent 5eaf23ea40
commit 85773ecf17

View File

@ -72,6 +72,10 @@ typename DispatcherType::Handle insertListener(
const typename DispatcherType::Callback & listener,
const typename DispatcherType::Handle & before
);
bool removeListener(
const typename DispatcherType::Event & event,
const typename DispatcherType::Handle handle
);
```
**Member functions for CallbackList**
@ -92,10 +96,14 @@ typename CallbackListType::Handle insert(
const typename CallbackListType::Callback & callback,
const typename CallbackListType::Handle & before
);
bool remove(const typename CallbackListType::Handle handle);
```
The function `reset()` removes all listeners which added by ScopedRemover from the dispatcher or callback list, as if the ScopedRemover object has gone out of scope.
The function `setDispatcher()` and `setCallbackList` sets the dispatcher or callback list, and reset the ScopedRemover object.
The functions `setDispatcher()` and `setCallbackList` sets the dispatcher or callback list, and reset the ScopedRemover object.
The functions `removeListener` and `remove` remove the listener, similar to the same name functions in the underlying class (CallbackList, EventDispatcher, or EventQueue). They are useful to remove the listeners without destorying the ScopedRemover object. The functions return `true` if the listener is removed successfully, `false` if the listener is not found.
The other member functions that have the same names with the corresponding underlying class (CallbackList, EventDispatcher, or EventQueue). Those functions add listener to the dispatcher.