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

Michael Stahl mstahl at redhat.com
Fri Dec 18 03:57:26 PST 2015


 sc/source/filter/html/htmlpars.cxx |   39 ++++++++++++++++++-------------------
 sc/source/filter/inc/htmlpars.hxx  |   11 ++++------
 2 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 6f1e25133e31dbd8942e669bd658b43869f6dddc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 17 23:15:56 2015 +0100

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

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 36911c3..35a6072 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -20,7 +20,6 @@
 #include <sal/config.h>
 
 #include <comphelper/string.hxx>
-#include <o3tl/ptr_container.hxx>
 
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
@@ -83,19 +82,20 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla
         if (pClassName)
         {
             // Both element and class names given.
-            ElemsType::iterator itrElem = maElemProps.find(aElem);
-            if (itrElem == maElemProps.end())
+            ElemsType::iterator itrElem = m_ElemProps.find(aElem);
+            if (itrElem == m_ElemProps.end())
             {
                 // new element
                 std::unique_ptr<NamePropsType> p(new NamePropsType);
-                std::pair<ElemsType::iterator, bool> r = o3tl::ptr_container::insert(maElemProps, aElem, std::move(p));
+                std::pair<ElemsType::iterator, bool> r =
+                    m_ElemProps.insert(std::make_pair(aElem, std::move(p)));
                 if (!r.second)
                     // insertion failed.
                     return;
                 itrElem = r.first;
             }
 
-            NamePropsType* pClsProps = itrElem->second;
+            NamePropsType *const pClsProps = itrElem->second.get();
             OUString aClass(pClassName, nClassName, RTL_TEXTENCODING_UTF8);
             aClass = aClass.toAsciiLowerCase();
             insertProp(*pClsProps, aClass, aProp, aValue);
@@ -123,10 +123,10 @@ const OUString& ScHTMLStyles::getPropertyValue(
 {
     // First, look into the element-class storage.
     {
-        ElemsType::const_iterator itr = maElemProps.find(rElem);
-        if (itr != maElemProps.end())
+        auto const itr = m_ElemProps.find(rElem);
+        if (itr != m_ElemProps.end())
         {
-            const NamePropsType* pClasses = itr->second;
+            const NamePropsType *const pClasses = itr->second.get();
             NamePropsType::const_iterator itr2 = pClasses->find(rClass);
             if (itr2 != pClasses->end())
             {
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 305afda..a22be4e 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -27,7 +27,6 @@
 #include <unordered_map>
 #include <vector>
 #include <o3tl/sorted_vector.hxx>
-#include <boost/ptr_container/ptr_map.hpp>
 
 #include "rangelst.hxx"
 #include "eeparser.hxx"
@@ -50,11 +49,11 @@ class ScHTMLStyles
 {
     typedef std::unordered_map<OUString, OUString, OUStringHash> PropsType;
     typedef ::std::map<OUString, std::unique_ptr<PropsType>> NamePropsType;
-    typedef ::boost::ptr_map<OUString, NamePropsType> ElemsType;
+    typedef ::std::map<OUString, std::unique_ptr<NamePropsType>> ElemsType;
 
     NamePropsType m_GlobalProps;     /// global properties (for a given class for all elements)
     NamePropsType m_ElemGlobalProps; /// element global properties (no class specified)
-    ElemsType maElemProps;           /// element to class to properties (both element and class are given)
+    ElemsType m_ElemProps;           /// element to class to properties (both element and class are given)
     const OUString maEmpty;     /// just a persistent empty string.
 public:
     ScHTMLStyles();
commit fa90bbb79027c89a6178c21569157ca796b8fff4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 17 23:12:55 2015 +0100

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

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 5ecfeaa..36911c3 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -103,7 +103,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla
         else
         {
             // Element name only. Add it to the element global.
-            insertProp(maElemGlobalProps, aElem, aProp, aValue);
+            insertProp(m_ElemGlobalProps, aElem, aProp, aValue);
         }
     }
     else
@@ -113,7 +113,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla
             // Class name only. Add it to the global.
             OUString aClass(pClassName, nClassName, RTL_TEXTENCODING_UTF8);
             aClass = aClass.toAsciiLowerCase();
-            insertProp(maGlobalProps, aClass, aProp, aValue);
+            insertProp(m_GlobalProps, aClass, aProp, aValue);
         }
     }
 }
@@ -130,7 +130,7 @@ const OUString& ScHTMLStyles::getPropertyValue(
             NamePropsType::const_iterator itr2 = pClasses->find(rClass);
             if (itr2 != pClasses->end())
             {
-                const PropsType* pProps = itr2->second;
+                const PropsType *const pProps = itr2->second.get();
                 PropsType::const_iterator itr3 = pProps->find(rPropName);
                 if (itr3 != pProps->end())
                     return itr3->second;
@@ -139,10 +139,10 @@ const OUString& ScHTMLStyles::getPropertyValue(
     }
     // Next, look into the class global storage.
     {
-        NamePropsType::const_iterator itr = maGlobalProps.find(rClass);
-        if (itr != maGlobalProps.end())
+        auto const itr = m_GlobalProps.find(rClass);
+        if (itr != m_GlobalProps.end())
         {
-            const PropsType* pProps = itr->second;
+            const PropsType *const pProps = itr->second.get();
             PropsType::const_iterator itr2 = pProps->find(rPropName);
             if (itr2 != pProps->end())
                 return itr2->second;
@@ -150,10 +150,10 @@ const OUString& ScHTMLStyles::getPropertyValue(
     }
     // As the last resort, look into the element global storage.
     {
-        NamePropsType::const_iterator itr = maElemGlobalProps.find(rClass);
-        if (itr != maElemGlobalProps.end())
+        auto const itr = m_ElemGlobalProps.find(rClass);
+        if (itr != m_ElemGlobalProps.end())
         {
-            const PropsType* pProps = itr->second;
+            const PropsType *const pProps = itr->second.get();
             PropsType::const_iterator itr2 = pProps->find(rPropName);
             if (itr2 != pProps->end())
                 return itr2->second;
@@ -172,7 +172,8 @@ void ScHTMLStyles::insertProp(
     {
         // new element
         std::unique_ptr<PropsType> p(new PropsType);
-        std::pair<NamePropsType::iterator, bool> r = o3tl::ptr_container::insert(rStore, aName, std::move(p));
+        std::pair<NamePropsType::iterator, bool> r =
+            rStore.insert(std::make_pair(aName, std::move(p)));
         if (!r.second)
             // insertion failed.
             return;
@@ -180,7 +181,7 @@ void ScHTMLStyles::insertProp(
         itr = r.first;
     }
 
-    PropsType* pProps = itr->second;
+    PropsType *const pProps = itr->second.get();
     pProps->insert(PropsType::value_type(aProp, aValue));
 }
 
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 1e71c8b..305afda 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -49,11 +49,11 @@ class ScHTMLTable;
 class ScHTMLStyles
 {
     typedef std::unordered_map<OUString, OUString, OUStringHash> PropsType;
-    typedef ::boost::ptr_map<OUString, PropsType> NamePropsType;
+    typedef ::std::map<OUString, std::unique_ptr<PropsType>> NamePropsType;
     typedef ::boost::ptr_map<OUString, NamePropsType> ElemsType;
 
-    NamePropsType maGlobalProps;     /// global properties (for a given class for all elements)
-    NamePropsType maElemGlobalProps; /// element global properties (no class specified)
+    NamePropsType m_GlobalProps;     /// global properties (for a given class for all elements)
+    NamePropsType m_ElemGlobalProps; /// element global properties (no class specified)
     ElemsType maElemProps;           /// element to class to properties (both element and class are given)
     const OUString maEmpty;     /// just a persistent empty string.
 public:


More information about the Libreoffice-commits mailing list