From 85773ecf1733dd10f5a4e5eacb4d0ddbc770c176 Mon Sep 17 00:00:00 2001 From: wqking Date: Tue, 16 Nov 2021 20:26:22 +0800 Subject: [PATCH] Added document for remove functions in ScopedRemover --- doc/scopedremover.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/scopedremover.md b/doc/scopedremover.md index 9b55557..de3177b 100644 --- a/doc/scopedremover.md +++ b/doc/scopedremover.md @@ -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.