diff options
author | Tobias Lippert <drtl@fastmail.fm> | 2014-07-18 15:36:30 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-07-22 06:26:06 +0000 |
commit | 798379313dca8de97e431ef2fe68129aaa1dcf04 (patch) | |
tree | dd9e0a372e2fa1f59608a125c04faecb416bf9a6 /include/svl/SfxBroadcaster.hxx | |
parent | 312926823dc6da7e87eb60c98ba084f14f0aa676 (diff) |
fdo#76754 Speed up registration of new listeners to SfxBroadcaster
Also change behavior for the GetListenerCount() method which now
returns the count of listeners.
The previous behavior is available in method GetSizeOfVector().
Change-Id: I5b03fa55a309f4ff5aea5e8830c137786fc07e89
Reviewed-on: https://gerrit.libreoffice.org/10344
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/svl/SfxBroadcaster.hxx')
-rw-r--r-- | include/svl/SfxBroadcaster.hxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/svl/SfxBroadcaster.hxx b/include/svl/SfxBroadcaster.hxx index 5c135b5dfca2..a29a5c008798 100644 --- a/include/svl/SfxBroadcaster.hxx +++ b/include/svl/SfxBroadcaster.hxx @@ -31,6 +31,8 @@ class SVL_DLLPUBLIC SfxBroadcaster { typedef std::vector<SfxListener*> SfxListenerArr_Impl; + /** Contains the positions of removed listeners. */ + std::vector<size_t> m_RemovedPositions; SfxListenerArr_Impl m_Listeners; private: @@ -51,12 +53,21 @@ public: void Broadcast( const SfxHint &rHint ); bool HasListeners() const; - size_t GetListenerCount() const - { + + /** 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 { return m_Listeners.size(); } - SfxListener* GetListener( size_t nNo ) const - { + + /** Get a listener by its position in the internally stored vector. + * Note that this method may return NULL + */ + SfxListener* GetListener( size_t nNo ) const { return m_Listeners[nNo]; } |