diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-06 11:58:03 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-07 08:27:25 +0200 |
commit | e7311cbaba988f96104dcbd96151436a6873e356 (patch) | |
tree | e363b0f5e0b5fe98c57abf757c61b9483d4bb441 | |
parent | 05e61719e2f4456fab8f5f9875fd96c70c07c4cd (diff) |
loplugin:mergeclasses
Change-Id: Ia3b63df5e8752690e3350f8a13445a096a839952
-rw-r--r-- | comphelper/source/container/enumerablemap.cxx | 55 | ||||
-rw-r--r-- | compilerplugins/clang/mergeclasses.results | 1 |
2 files changed, 18 insertions, 38 deletions
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 5b5f3a197a44..0f9f679e04ca 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -83,8 +83,7 @@ namespace comphelper using ::com::sun::star::lang::WrappedTargetException; using ::com::sun::star::lang::DisposedException; - class IMapModificationListener; - typedef ::std::vector< IMapModificationListener* > MapListeners; + class MapEnumerator; typedef ::std::map< Any, Any, LessPredicateAdapter > KeyedValues; struct MapData @@ -94,7 +93,7 @@ namespace comphelper ::std::unique_ptr< KeyedValues > m_pValues; ::std::shared_ptr< IKeyPredicateLess > m_pKeyCompare; bool m_bMutable; - MapListeners m_aModListeners; + ::std::vector< MapEnumerator* > m_aModListeners; MapData() :m_bMutable( true ) @@ -115,36 +114,21 @@ namespace comphelper }; - /** implemented by components who want to be notified of modifications in the MapData they work with - */ - class SAL_NO_VTABLE IMapModificationListener - { - public: - /// called when the map was modified - virtual void mapModified() = 0; - virtual ~IMapModificationListener() - { - } - }; - - static void lcl_registerMapModificationListener( MapData& _mapData, IMapModificationListener& _listener ) + static void lcl_registerMapModificationListener( MapData& _mapData, MapEnumerator& _listener ) { #if OSL_DEBUG_LEVEL > 0 - for ( MapListeners::const_iterator lookup = _mapData.m_aModListeners.begin(); - lookup != _mapData.m_aModListeners.end(); - ++lookup - ) + for ( const MapEnumerator* lookup : _mapData.m_aModListeners ) { - OSL_ENSURE( *lookup != &_listener, "lcl_registerMapModificationListener: this listener is already registered!" ); + OSL_ENSURE( lookup != &_listener, "lcl_registerMapModificationListener: this listener is already registered!" ); } #endif _mapData.m_aModListeners.push_back( &_listener ); } - static void lcl_revokeMapModificationListener( MapData& _mapData, IMapModificationListener& _listener ) + static void lcl_revokeMapModificationListener( MapData& _mapData, MapEnumerator& _listener ) { - for ( MapListeners::iterator lookup = _mapData.m_aModListeners.begin(); + for ( ::std::vector< MapEnumerator* >::iterator lookup = _mapData.m_aModListeners.begin(); lookup != _mapData.m_aModListeners.end(); ++lookup ) @@ -159,16 +143,7 @@ namespace comphelper } - static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData ) - { - for ( MapListeners::const_iterator loop = _mapData.m_aModListeners.begin(); - loop != _mapData.m_aModListeners.end(); - ++loop - ) - { - (*loop)->mapModified(); - } - } + static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData ); // EnumerableMap @@ -242,8 +217,7 @@ namespace comphelper }; - class MapEnumerator: - public IMapModificationListener, private boost::noncopyable + class MapEnumerator: private boost::noncopyable { public: MapEnumerator( ::cppu::OWeakObject& _rParent, MapData& _mapData, const EnumerationType _type ) @@ -274,8 +248,8 @@ namespace comphelper bool hasMoreElements(); Any nextElement(); - // IMapModificationListener - virtual void mapModified() SAL_OVERRIDE; + /// called when the map was modified + void mapModified(); private: ::cppu::OWeakObject& m_rParent; @@ -285,6 +259,13 @@ namespace comphelper bool m_disposed; }; + static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData ) + { + for ( MapEnumerator* loop : _mapData.m_aModListeners ) + { + loop->mapModified(); + } + } typedef ::cppu::WeakImplHelper < XEnumeration > MapEnumeration_Base; diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index f7d14994fc2c..adcd73dbe837 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -134,7 +134,6 @@ merge chart::LegendEntryProvider with chart::VSeriesPlotter merge chart::MarkHandleProvider with chart::SelectionHelper merge chart::ResourceChangeListener with chart::ChartTypeTabPage merge chart::WindowController with chart::ChartController -merge comphelper::IMapModificationListener with comphelper::MapEnumerator merge comphelper::IPropertyInfoService with frm::ConcreteInfoService merge comphelper::NameContainerImpl with comphelper::NameContainer merge comphelper::OInteractionSelect with comphelper::OInteraction |