[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source

Michael Stahl mstahl at redhat.com
Fri Dec 18 08:25:30 PST 2015


 sc/inc/dpobject.hxx                  |   15 ++---
 sc/source/core/data/dpobject.cxx     |   93 +++++++++++++++++------------------
 sc/source/filter/xml/pivotsource.cxx |    2 
 3 files changed, 55 insertions(+), 55 deletions(-)

New commits:
commit def6b1dd14b7d7dbf776e3de9e2f2d5a0cd1fc2c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 18 17:20:56 2015 +0100

    sc: replace boost::ptr_map with std::map<std::unique_ptr>
    
    Change-Id: Ia9d061d9f5fb07e07fd6253a6493a4e9b1f9c975

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 0af7348..610cf8e 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -35,8 +35,6 @@
 #include <vector>
 #include <map>
 
-#include <boost/ptr_container/ptr_map.hpp>
-
 namespace com { namespace sun { namespace star {
 
     namespace container {
@@ -337,8 +335,8 @@ public:
     class DBCaches
     {
         friend class ScDPCollection;
-        typedef ::boost::ptr_map<DBType, ScDPCache, DBType::less> CachesType;
-        CachesType maCaches;
+        typedef ::std::map<DBType, std::unique_ptr<ScDPCache>, DBType::less> CachesType;
+        CachesType m_Caches;
         ScDocument* mpDoc;
     public:
         DBCaches(ScDocument* pDoc);
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index f6fee9f..59dcd61 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -68,7 +68,6 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/types.hxx>
-#include <o3tl/ptr_container.hxx>
 #include <sal/macros.h>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
@@ -3104,8 +3103,8 @@ ScDPCollection::DBCaches::DBCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
 bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) const
 {
     DBType aType(nSdbType, rDBName, rCommand);
-    CachesType::const_iterator itr = maCaches.find(aType);
-    return itr != maCaches.end();
+    CachesType::const_iterator const itr = m_Caches.find(aType);
+    return itr != m_Caches.end();
 }
 
 const ScDPCache* ScDPCollection::DBCaches::getCache(
@@ -3113,10 +3112,10 @@ const ScDPCache* ScDPCollection::DBCaches::getCache(
     const ScDPDimensionSaveData* pDimData)
 {
     DBType aType(nSdbType, rDBName, rCommand);
-    CachesType::const_iterator itr = maCaches.find(aType);
-    if (itr != maCaches.end())
+    CachesType::const_iterator const itr = m_Caches.find(aType);
+    if (itr != m_Caches.end())
         // already cached.
-        return itr->second;
+        return itr->second.get();
 
     uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
     if (!xRowSet.is())
@@ -3140,7 +3139,7 @@ const ScDPCache* ScDPCollection::DBCaches::getCache(
 
     ::comphelper::disposeComponent(xRowSet);
     const ScDPCache* p = pCache.get();
-    o3tl::ptr_container::insert(maCaches, aType, std::move(pCache));
+    m_Caches.insert(std::make_pair(aType, std::move(pCache)));
     return p;
 }
 
@@ -3148,8 +3147,8 @@ ScDPCache* ScDPCollection::DBCaches::getExistingCache(
     sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand)
 {
     DBType aType(nSdbType, rDBName, rCommand);
-    CachesType::iterator itr = maCaches.find(aType);
-    return itr != maCaches.end() ? itr->second : nullptr;
+    CachesType::iterator const itr = m_Caches.find(aType);
+    return itr != m_Caches.end() ? itr->second.get() : nullptr;
 }
 
 uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet(
@@ -3215,8 +3214,8 @@ void ScDPCollection::DBCaches::updateCache(
     std::set<ScDPObject*>& rRefs)
 {
     DBType aType(nSdbType, rDBName, rCommand);
-    CachesType::iterator it = maCaches.find(aType);
-    if (it == maCaches.end())
+    CachesType::iterator const it = m_Caches.find(aType);
+    if (it == m_Caches.end())
     {
         // not cached.
         rRefs.clear();
@@ -3255,12 +3254,12 @@ void ScDPCollection::DBCaches::updateCache(
 
 bool ScDPCollection::DBCaches::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;
         }
     }
diff --git a/sc/source/filter/xml/pivotsource.cxx b/sc/source/filter/xml/pivotsource.cxx
index 43b5a4d..633b8c5 100644
--- a/sc/source/filter/xml/pivotsource.cxx
+++ b/sc/source/filter/xml/pivotsource.cxx
@@ -11,6 +11,8 @@
 
 #include <dpsave.hxx>
 
+#include <algorithm>
+
 namespace sc {
 
 PivotTableSources::SelectedPages::SelectedPages( ScDPObject* pObj, const SelectedPagesType& rSelected ) :
commit 91f571a2d6b0db016342fa2f2e5b7b83a23ae873
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 18 14:45:37 2015 +0100

    sc: replace boost::ptr_map with std::map<std::unique_ptr>
    
    Change-Id: I5abc1d6fae7186342e45a83253d56c2311ec5139

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 646817e..0af7348 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 8ff9059..f6fee9f 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;
         }
     }
commit 8795dff9199ed52c226a86c877cc6c9e48b62341
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 18 14:42:17 2015 +0100

    sc: replace boost::ptr_map with std::map<std::unique_ptr>
    
    Change-Id: Iaaf8e5f14691cde32058a78842b9c411f2b92d93

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index c31031b..646817e 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -33,6 +33,7 @@
 #include <memory>
 #include <set>
 #include <vector>
+#include <map>
 
 #include <boost/ptr_container/ptr_map.hpp>
 
@@ -267,9 +268,9 @@ public:
     class SheetCaches
     {
         friend class ScDPCollection;
-        typedef boost::ptr_map<size_t, ScDPCache> CachesType;
+        typedef std::map<size_t, std::unique_ptr<ScDPCache>> CachesType;
         typedef std::vector<ScRange> RangeIndexType;
-        CachesType maCaches;
+        CachesType m_Caches;
         RangeIndexType maRanges;
         ScDocument* mpDoc;
     public:
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index ed1c7d4..8ff9059 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2841,8 +2841,8 @@ bool ScDPCollection::SheetCaches::hasCache(const ScRange& rRange) const
 
     // Already cached.
     size_t nIndex = std::distance(maRanges.begin(), it);
-    CachesType::const_iterator itCache = maCaches.find(nIndex);
-    return itCache != maCaches.end();
+    CachesType::const_iterator const itCache = m_Caches.find(nIndex);
+    return itCache != m_Caches.end();
 }
 
 const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, const ScDPDimensionSaveData* pDimData)
@@ -2852,8 +2852,8 @@ const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
     {
         // Already cached.
         size_t nIndex = std::distance(maRanges.begin(), it);
-        CachesType::iterator itCache = maCaches.find(nIndex);
-        if (itCache == maCaches.end())
+        CachesType::iterator const itCache = m_Caches.find(nIndex);
+        if (itCache == m_Caches.end())
         {
             OSL_FAIL("Cache pool and index pool out-of-sync !!!");
             return nullptr;
@@ -2862,7 +2862,7 @@ const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
         if (pDimData)
             pDimData->WriteToCache(*itCache->second);
 
-        return itCache->second;
+        return itCache->second.get();
     }
 
     // Not cached.  Create a new cache.
@@ -2888,7 +2888,7 @@ const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
     }
 
     const ScDPCache* p = pCache.get();
-    o3tl::ptr_container::insert(maCaches, nIndex, std::move(pCache));
+    m_Caches.insert(std::make_pair(nIndex, std::move(pCache)));
     return p;
 }
 
@@ -2901,14 +2901,14 @@ ScDPCache* ScDPCollection::SheetCaches::getExistingCache(const ScRange& rRange)
 
     // Already cached.
     size_t nIndex = std::distance(maRanges.begin(), it);
-    CachesType::iterator itCache = maCaches.find(nIndex);
-    if (itCache == maCaches.end())
+    CachesType::iterator const itCache = m_Caches.find(nIndex);
+    if (itCache == m_Caches.end())
     {
         OSL_FAIL("Cache pool and index pool out-of-sync !!!");
         return nullptr;
     }
 
-    return itCache->second;
+    return itCache->second.get();
 }
 
 const ScDPCache* ScDPCollection::SheetCaches::getExistingCache(const ScRange& rRange) const
@@ -2920,19 +2920,19 @@ const ScDPCache* ScDPCollection::SheetCaches::getExistingCache(const ScRange& rR
 
     // Already cached.
     size_t nIndex = std::distance(maRanges.begin(), it);
-    CachesType::const_iterator itCache = maCaches.find(nIndex);
-    if (itCache == maCaches.end())
+    CachesType::const_iterator const itCache = m_Caches.find(nIndex);
+    if (itCache == m_Caches.end())
     {
         OSL_FAIL("Cache pool and index pool out-of-sync !!!");
         return nullptr;
     }
 
-    return itCache->second;
+    return itCache->second.get();
 }
 
 size_t ScDPCollection::SheetCaches::size() const
 {
-    return maCaches.size();
+    return m_Caches.size();
 }
 
 void ScDPCollection::SheetCaches::updateReference(
@@ -2979,8 +2979,8 @@ void ScDPCollection::SheetCaches::updateCache(const ScRange& rRange, std::set<Sc
     }
 
     size_t nIndex = std::distance(maRanges.begin(), it);
-    CachesType::iterator itCache = maCaches.find(nIndex);
-    if (itCache == maCaches.end())
+    CachesType::iterator const itCache = m_Caches.find(nIndex);
+    if (itCache == m_Caches.end())
     {
         OSL_FAIL("Cache pool and index pool out-of-sync !!!");
         rRefs.clear();
@@ -3001,13 +3001,13 @@ void ScDPCollection::SheetCaches::updateCache(const ScRange& rRange, std::set<Sc
 
 bool ScDPCollection::SheetCaches::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)
         {
             size_t idx = it->first;
-            maCaches.erase(it);
+            m_Caches.erase(it);
             maRanges[idx].SetInvalid();
             return true;
         }


More information about the Libreoffice-commits mailing list