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

Michael Stahl mstahl at redhat.com
Mon Nov 9 12:14:17 PST 2015


 sc/source/filter/xml/xmlimprt.cxx |   15 +++++++--------
 sc/source/filter/xml/xmlimprt.hxx |    9 +++++----
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 003ba90531b6ee5c3b3225298a1490ed9a7048a4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 9 20:55:59 2015 +0100

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

diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 62d128b..ad11e91 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -19,7 +19,6 @@
 
 #include <sal/config.h>
 
-#include <o3tl/ptr_container.hxx>
 #include <svl/zforlist.hxx>
 #include <sal/macros.h>
 
@@ -2398,12 +2397,13 @@ bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aVa
 void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp)
 {
     ::std::unique_ptr<ScMyNamedExpression> p(pNamedExp);
-    SheetNamedExpMap::iterator itr = maSheetNamedExpressions.find(nTab);
-    if (itr == maSheetNamedExpressions.end())
+    SheetNamedExpMap::iterator itr = m_SheetNamedExpressions.find(nTab);
+    if (itr == m_SheetNamedExpressions.end())
     {
         // No chain exists for this sheet.  Create one.
         ::std::unique_ptr<ScMyNamedExpressions> pNew(new ScMyNamedExpressions);
-        ::std::pair<SheetNamedExpMap::iterator, bool> r = o3tl::ptr_container::insert(maSheetNamedExpressions, nTab, std::move(pNew));
+        ::std::pair<SheetNamedExpMap::iterator, bool> r =
+            m_SheetNamedExpressions.insert(std::make_pair(nTab, std::move(pNew)));
         if (!r.second)
             // insertion failed.
             return;
@@ -3157,15 +3157,14 @@ void ScXMLImport::SetSheetNamedRanges()
     if (!pDoc)
         return;
 
-    SheetNamedExpMap::const_iterator itr = maSheetNamedExpressions.begin(), itrEnd = maSheetNamedExpressions.end();
-    for (; itr != itrEnd; ++itr)
+    for (auto const& itr : m_SheetNamedExpressions)
     {
-        SCTAB nTab = itr->first;
+        const SCTAB nTab = itr.first;
         ScRangeName* pRangeNames = pDoc->GetRangeName(nTab);
         if (!pRangeNames)
             continue;
 
-        const ScMyNamedExpressions& rNames = *itr->second;
+        const ScMyNamedExpressions& rNames = *itr.second;
         ::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(pDoc, *pRangeNames, *this));
     }
 }
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 4b562b8..b87e82a 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -42,12 +42,13 @@
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
 
+#include <boost/noncopyable.hpp>
+
 #include <memory>
 #include <unordered_map>
+#include <map>
 #include <vector>
 #include <list>
-#include <boost/ptr_container/ptr_map.hpp>
-#include <boost/noncopyable.hpp>
 
 class ScMyStyleNumberFormats;
 class XMLNumberFormatAttributesExportHelper;
@@ -823,7 +824,7 @@ class ScXMLEditAttributeMap;
 class ScXMLImport: public SvXMLImport, boost::noncopyable
 {
     typedef std::unordered_map< OUString, sal_Int16, OUStringHash >   CellTypeMap;
-    typedef ::boost::ptr_map<SCTAB, ScMyNamedExpressions> SheetNamedExpMap;
+    typedef ::std::map<SCTAB, std::unique_ptr<ScMyNamedExpressions>> SheetNamedExpMap;
 
     CellTypeMap             aCellTypeMap;
 
@@ -939,7 +940,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable
     ScMyTables              aTables;
 
     ScMyNamedExpressions*   m_pMyNamedExpressions;
-    SheetNamedExpMap maSheetNamedExpressions;
+    SheetNamedExpMap m_SheetNamedExpressions;
 
     ScMyLabelRanges*        pMyLabelRanges;
     ScMyImportValidations*  pValidations;


More information about the Libreoffice-commits mailing list