diff options
author | Juan Picca <jumapico@gmail.com> | 2014-11-17 10:48:32 -0200 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-11-25 03:08:04 +0000 |
commit | ee42495de1279f9966dd2305966ab96711403463 (patch) | |
tree | d006a24fffd9cc2c805556fd7d793ff468679793 | |
parent | 46e6f78f2b7595e7009975a2365395a74ca2df83 (diff) |
fdo#75757: remove inheritance to std::map
Change-Id: I9dfabddf4b51994c1ae078582dec3f385e7d1a5c
Reviewed-on: https://gerrit.libreoffice.org/12513
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Tested-by: Takeshi Abe <tabe@fixedpoint.jp>
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx | 15 | ||||
-rw-r--r-- | sw/inc/unocrsrhelper.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/access/accframe.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/access/accfrmobjmap.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/access/accfrmobjmap.hxx | 24 | ||||
-rw-r--r-- | sw/source/core/access/acchypertextdata.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/acchypertextdata.hxx | 17 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 22 |
8 files changed, 69 insertions, 41 deletions
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx index 23abe792dd6f..feb4f02753ac 100644 --- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx +++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx @@ -135,10 +135,21 @@ public: /** The recently used caches are stored in one queue for each document. */ class PageCacheManager::RecentlyUsedPageCaches - : public ::std::map<DocumentKey,RecentlyUsedQueue> { public: - RecentlyUsedPageCaches (void) {}; + typedef DocumentKey key_type; + typedef RecentlyUsedQueue mapped_type; + typedef std::pair<const key_type,mapped_type> value_type; + typedef std::map<key_type,mapped_type>::iterator iterator; +private: + std::map<key_type,mapped_type> maMap; +public: + RecentlyUsedPageCaches () {}; + + iterator end() { return maMap.end(); } + void clear() { maMap.clear(); } + iterator find(const key_type& key) { return maMap.find(key); } + std::pair<iterator,bool> insert(const value_type& value) { return maMap.insert(value); } }; class PageCacheManager::Deleter diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index ade29a1abe88..f5949ddec1b5 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SW_INC_UNOCRSRHELPER_HXX #define INCLUDED_SW_INC_UNOCRSRHELPER_HXX -#include <map> +#include <boost/ptr_container/ptr_map.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -66,13 +66,11 @@ enum SwGetPropertyStatesCaller namespace SwUnoCursorHelper { - // keep Any's mapped by (WhichId << 16 ) + (MemberId) - typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t; - class SwAnyMapHelper : public AnyMapHelper_t + class SwAnyMapHelper { + // keep Any's mapped by (WhichId << 16 ) + (MemberId) + boost::ptr_map<sal_uInt32,com::sun::star::uno::Any> maMap; public: - ~SwAnyMapHelper(); - void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any& rAny ); bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const com::sun::star::uno::Any*& pAny ); }; diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx index e292df928746..9a34ec721236 100644 --- a/sw/source/core/access/accframe.cxx +++ b/sw/source/core/access/accframe.cxx @@ -89,8 +89,8 @@ SwAccessibleChild SwAccessibleFrame::GetChild( { // We need a sorted list here const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); - SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() ); - while( aIter != aVisMap.end() && !aRet.IsValid() ) + SwAccessibleChildMap::const_iterator aIter( aVisMap.cbegin() ); + while( aIter != aVisMap.cend() && !aRet.IsValid() ) { const SwAccessibleChild& rLower = (*aIter).second; if( rLower.IsAccessible( bInPagePreview ) ) @@ -155,8 +155,8 @@ bool SwAccessibleFrame::GetChildIndex( { // We need a sorted list here const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); - SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() ); - while( aIter != aVisMap.end() && !bFound ) + SwAccessibleChildMap::const_iterator aIter( aVisMap.cbegin() ); + while( aIter != aVisMap.cend() && !bFound ) { const SwAccessibleChild& rLower = (*aIter).second; if( rLower.IsAccessible( bInPagePreview ) ) @@ -220,8 +220,8 @@ SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea, // We need a sorted list here, and we have to reverse iterate, // because objects in front should be returned. const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); - SwAccessibleChildMap::const_reverse_iterator aRIter( aVisMap.rbegin() ); - while( aRIter != aVisMap.rend() && !aRet.IsValid() ) + SwAccessibleChildMap::const_reverse_iterator aRIter( aVisMap.crbegin() ); + while( aRIter != aVisMap.crend() && !aRet.IsValid() ) { const SwAccessibleChild& rLower = (*aRIter).second; // A frame is returned if it's frame size is inside the visarea @@ -290,8 +290,8 @@ void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap, { // We need a sorted list here const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap ); - SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() ); - while( aIter != aVisMap.end() ) + SwAccessibleChildMap::const_iterator aIter( aVisMap.cbegin() ); + while( aIter != aVisMap.cend() ) { const SwAccessibleChild& rLower = (*aIter).second; if( rLower.IsAccessible( bInPagePreview ) ) diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx index e0eb248cd25c..773e1baa4beb 100644 --- a/sw/source/core/access/accfrmobjmap.cxx +++ b/sw/source/core/access/accfrmobjmap.cxx @@ -130,7 +130,7 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea, { SwAccessibleChildMapKey aKey( eLayerId, nPos ); value_type aEntry( aKey, rLower ); - return _SwAccessibleChildMap::insert( aEntry ); + return insert( aEntry ); } ::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert( @@ -146,7 +146,7 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea, : SwAccessibleChildMapKey::HEAVEN ); SwAccessibleChildMapKey aKey( eLayerId, pObj->GetOrdNum() ); value_type aEntry( aKey, rLower ); - return _SwAccessibleChildMap::insert( aEntry ); + return insert( aEntry ); } bool SwAccessibleChildMap::IsSortingRequired( const SwFrm& rFrm ) diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx index bedd811f001a..2ace69de054f 100644 --- a/sw/source/core/access/accfrmobjmap.hxx +++ b/sw/source/core/access/accfrmobjmap.hxx @@ -88,13 +88,22 @@ private: Point nPosNum; }; -typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey > - _SwAccessibleChildMap; -class SwAccessibleChildMap : public _SwAccessibleChildMap +class SwAccessibleChildMap { +public: + typedef SwAccessibleChildMapKey key_type; + typedef sw::access::SwAccessibleChild mapped_type; + typedef std::pair<const key_type,mapped_type> value_type; + typedef SwAccessibleChildMapKey key_compare; + typedef std::map<key_type,mapped_type,key_compare>::iterator iterator; + typedef std::map<key_type,mapped_type,key_compare>::const_iterator const_iterator; + typedef std::map<key_type,mapped_type,key_compare>::const_reverse_iterator const_reverse_iterator; + +private: const SdrLayerID nHellId; const SdrLayerID nControlsId; + std::map<key_type,mapped_type,key_compare> maMap; ::std::pair< iterator, bool > insert( const sal_uInt32 nPos, const SwAccessibleChildMapKey::LayerId eLayerId, @@ -108,6 +117,15 @@ public: SwAccessibleMap& rAccMap ); static bool IsSortingRequired( const SwFrm& rFrm ); + + iterator begin() { return maMap.begin(); } + const_iterator cbegin() const noexcept { return maMap.cbegin(); } + iterator end() { return maMap.end(); } + const_iterator cend() const noexcept { return maMap.cend(); } + const_reverse_iterator crbegin() const noexcept { return maMap.crbegin(); } + const_reverse_iterator crend() const noexcept { return maMap.crend(); } + + std::pair<iterator,bool> insert(const value_type& value) { return maMap.insert(value); } }; #endif diff --git a/sw/source/core/access/acchypertextdata.cxx b/sw/source/core/access/acchypertextdata.cxx index 0c5b045d1787..d77bca8f57de 100644 --- a/sw/source/core/access/acchypertextdata.cxx +++ b/sw/source/core/access/acchypertextdata.cxx @@ -24,7 +24,7 @@ using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::uno; SwAccessibleHyperTextData::SwAccessibleHyperTextData() : - _SwAccessibleHyperlinkMap_Impl() + maMap() { } diff --git a/sw/source/core/access/acchypertextdata.hxx b/sw/source/core/access/acchypertextdata.hxx index 639fb3acc664..eb081e77c9ba 100644 --- a/sw/source/core/access/acchypertextdata.hxx +++ b/sw/source/core/access/acchypertextdata.hxx @@ -29,13 +29,26 @@ namespace com { namespace sun { namespace star { } } } typedef ::std::less< const SwTxtAttr * > SwTxtAttrPtrLess; -typedef ::std::map < const SwTxtAttr *, ::com::sun::star::uno::WeakReference < com::sun::star::accessibility::XAccessibleHyperlink >, SwTxtAttrPtrLess > _SwAccessibleHyperlinkMap_Impl; -class SwAccessibleHyperTextData : public _SwAccessibleHyperlinkMap_Impl +class SwAccessibleHyperTextData { public: + typedef const SwTxtAttr * key_type; + typedef ::com::sun::star::uno::WeakReference< + com::sun::star::accessibility::XAccessibleHyperlink > mapped_type; + typedef std::pair<const key_type,mapped_type> value_type; + typedef SwTxtAttrPtrLess key_compare; + typedef std::map<key_type,mapped_type,key_compare>::iterator iterator; +private: + std::map<key_type,mapped_type,key_compare> maMap; +public: SwAccessibleHyperTextData(); ~SwAccessibleHyperTextData(); + + iterator begin() { return maMap.begin(); } + iterator end() { return maMap.end(); } + iterator find(const key_type& key) { return maMap.find(key); } + std::pair<iterator,bool> insert(const value_type& value ) { return maMap.insert(value); } }; #endif diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index efe476afc1cf..a16b4bd8fd1a 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1399,34 +1399,22 @@ void makeTableCellRedline( SwTableBox& rTableBox, throw lang::IllegalArgumentException(); } -SwAnyMapHelper::~SwAnyMapHelper() -{ - AnyMapHelper_t::iterator aIt = begin(); - while( aIt != end() ) - { - delete ( aIt->second ); - ++aIt; - } -} - void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny ) { sal_uInt32 nKey = (nWhichId << 16) + nMemberId; - AnyMapHelper_t::iterator aIt = find( nKey ); - if( aIt != end() ) - { + auto aIt = maMap.find( nKey ); + if( aIt != maMap.end() ) *(aIt->second) = rAny; - } else - insert( value_type(nKey, new uno::Any( rAny )) ); + maMap.insert( nKey, new uno::Any(rAny) ); } bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny ) { bool bRet = false; sal_uInt32 nKey = (nWhichId << 16) + nMemberId; - AnyMapHelper_t::iterator aIt = find( nKey ); - if( aIt != end() ) + auto aIt = maMap.find( nKey ); + if( aIt != maMap.end() ) { pAny = aIt->second; bRet = true; |