diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-12-18 14:45:37 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-12-18 17:21:28 +0100 |
commit | 91f571a2d6b0db016342fa2f2e5b7b83a23ae873 (patch) | |
tree | fdc892a1d30cec68e07223266bc8b868c97c6a27 /sc | |
parent | 8795dff9199ed52c226a86c877cc6c9e48b62341 (diff) |
sc: replace boost::ptr_map with std::map<std::unique_ptr>
Change-Id: I5abc1d6fae7186342e45a83253d56c2311ec5139
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpobject.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 30 |
2 files changed, 17 insertions, 17 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 646817e350dc..0af7348eff14 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -297,8 +297,8 @@ public: class NameCaches { friend class ScDPCollection; - typedef ::boost::ptr_map<OUString, ScDPCache> CachesType; - CachesType maCaches; + typedef ::std::map<OUString, std::unique_ptr<ScDPCache>> CachesType; + CachesType m_Caches; ScDocument* mpDoc; public: NameCaches(ScDocument* pDoc); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 8ff905961d41..f6fee9f8d2b4 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3024,49 +3024,49 @@ ScDPCollection::NameCaches::NameCaches(ScDocument* pDoc) : mpDoc(pDoc) {} bool ScDPCollection::NameCaches::hasCache(const OUString& rName) const { - return maCaches.count(rName) != 0; + return m_Caches.count(rName) != 0; } const ScDPCache* ScDPCollection::NameCaches::getCache( const OUString& rName, const ScRange& rRange, const ScDPDimensionSaveData* pDimData) { - CachesType::const_iterator itr = maCaches.find(rName); - if (itr != maCaches.end()) + CachesType::const_iterator const itr = m_Caches.find(rName); + if (itr != m_Caches.end()) // already cached. - return itr->second; + return itr->second.get(); ::std::unique_ptr<ScDPCache> pCache(new ScDPCache(mpDoc)); pCache->InitFromDoc(mpDoc, rRange); if (pDimData) pDimData->WriteToCache(*pCache); - const ScDPCache* p = pCache.get(); - o3tl::ptr_container::insert(maCaches, rName, std::move(pCache)); + const ScDPCache *const p = pCache.get(); + m_Caches.insert(std::make_pair(rName, std::move(pCache))); return p; } ScDPCache* ScDPCollection::NameCaches::getExistingCache(const OUString& rName) { - CachesType::iterator itr = maCaches.find(rName); - return itr != maCaches.end() ? itr->second : nullptr; + CachesType::iterator const itr = m_Caches.find(rName); + return itr != m_Caches.end() ? itr->second.get() : nullptr; } size_t ScDPCollection::NameCaches::size() const { - return maCaches.size(); + return m_Caches.size(); } void ScDPCollection::NameCaches::updateCache( const OUString& rName, const ScRange& rRange, std::set<ScDPObject*>& rRefs) { - CachesType::iterator itr = maCaches.find(rName); - if (itr == maCaches.end()) + CachesType::iterator const itr = m_Caches.find(rName); + if (itr == m_Caches.end()) { rRefs.clear(); return; } - ScDPCache& rCache = *itr->second; + ScDPCache& rCache = *itr->second.get(); // Update the cache with new cell values. This will clear all group dimension info. rCache.InitFromDoc(mpDoc, rRange); @@ -3079,12 +3079,12 @@ void ScDPCollection::NameCaches::updateCache( bool ScDPCollection::NameCaches::remove(const ScDPCache* p) { - CachesType::iterator it = maCaches.begin(), itEnd = maCaches.end(); + CachesType::iterator it = m_Caches.begin(), itEnd = m_Caches.end(); for (; it != itEnd; ++it) { - if (it->second == p) + if (it->second.get() == p) { - maCaches.erase(it); + m_Caches.erase(it); return true; } } |