summaryrefslogtreecommitdiff
path: root/include/svl/SfxBroadcaster.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-01 14:22:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-11 18:24:29 +0200
commit7c66fc45239d2589e90fd694d54b3ff826b1bd15 (patch)
tree064a3ba4eaeaf05ae13ebcebfc6d8beb9234d8f2 /include/svl/SfxBroadcaster.hxx
parent3a6d360b5e585b8e92cc0d58d5fbc497448e11fb (diff)
use internal iterator for SfxBroadcaster
So we can avoid exposing the internal listener vector. (which allows further optimisations) Change-Id: If288141a37314dcc01d203029dc51c71ec2b7f54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152857 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl/SfxBroadcaster.hxx')
-rw-r--r--include/svl/SfxBroadcaster.hxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/svl/SfxBroadcaster.hxx b/include/svl/SfxBroadcaster.hxx
index 2c05a6abfe5a..fba30061f574 100644
--- a/include/svl/SfxBroadcaster.hxx
+++ b/include/svl/SfxBroadcaster.hxx
@@ -21,6 +21,7 @@
#include <svl/svldllapi.h>
#include <vector>
+#include <functional>
class SfxListener;
class SfxHint;
@@ -52,15 +53,13 @@ public:
/** Get the number of listeners which are registered at this broadcaster */
size_t GetListenerCount() const;
- /** Get the size of the internally stored vector.
- * Use it to iterate over all listeners.
- */
- size_t GetSizeOfVector() const;
+ /** Iterate over all the listeners and call the passed function.
+ return true to break the loop. */
+ void ForAllListeners(std::function<bool(SfxListener*)> f) const;
- /** Get a listener by its position in the internally stored vector.
- * Note that this method may return NULL
+ /** Get a vector of the current listeners - used by unit test code.
*/
- SfxListener* GetListener( size_t nNo ) const;
+ std::vector<SfxListener*> GetListenersForUnitTest() const;
friend class SfxListener;
friend class ::SfxBroadcasterTest;