[Libreoffice-commits] core.git: 3 commits - connectivity/source dbaccess/source include/comphelper include/filter sc/inc sc/source sw/source xmloff/source

Michael Stahl mstahl at redhat.com
Wed Aug 19 10:39:59 PDT 2015


 connectivity/source/inc/file/fcode.hxx                 |    2 +
 dbaccess/source/core/recovery/subcomponentrecovery.cxx |    2 +
 include/comphelper/stl_types.hxx                       |   16 +++++++++-
 include/filter/msfilter/msdffimp.hxx                   |   12 ++------
 sc/inc/rangenam.hxx                                    |    3 --
 sc/source/core/tool/rangenam.cxx                       |    2 -
 sc/source/filter/inc/sheetdatabuffer.hxx               |    2 +
 sc/source/ui/inc/namedlg.hxx                           |    1 
 sw/source/core/inc/blink.hxx                           |   13 ++------
 sw/source/filter/html/wrthtml.hxx                      |   13 ++------
 xmloff/source/forms/layerexport.cxx                    |    1 
 xmloff/source/style/impastpl.hxx                       |   25 ++++-------------
 12 files changed, 40 insertions(+), 52 deletions(-)

New commits:
commit a4de770bab5e05af42dcd790b1e4a54fcc758e6c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 19 13:21:18 2015 +0200

    comphelper: reduce copypasta with UniquePtrValueLess functor
    
    Change-Id: Ib93b818eeebc2f370535d1b061beabf7e8c65257

diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
index 251137b..f5c58fd 100644
--- a/include/comphelper/stl_types.hxx
+++ b/include/comphelper/stl_types.hxx
@@ -23,6 +23,7 @@
 
 #include <math.h>
 #include <functional>
+#include <memory>
 
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -86,6 +87,19 @@ public:
     }
 };
 
+/// by-value less functor for std::set<std::unique_ptr<T>>
+template<class T> struct UniquePtrValueLess
+    : public ::std::binary_function<std::unique_ptr<T>, std::unique_ptr<T>, bool>
+{
+        bool operator()(std::unique_ptr<T> const& lhs,
+                        std::unique_ptr<T> const& rhs) const
+        {
+            assert(lhs.get());
+            assert(rhs.get());
+            return (*lhs) < (*rhs);
+        }
+};
+
 /** STL-compliant structure for comparing Reference< <iface> > instances
 */
 template < class IAFCE >
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 5c256e8..42328e0 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -31,6 +31,8 @@
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
+#include <comphelper/stl_types.hxx>
+
 #include <tools/solar.h>
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
@@ -266,15 +268,9 @@ private:
     SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) SAL_DELETED_FUNCTION;
 };
 
-struct MSDffImportRecords_Less
-{
-    bool operator()(std::unique_ptr<SvxMSDffImportRec> const& left,
-                    std::unique_ptr<SvxMSDffImportRec> const& right) const
-    { return (*left) < (*right); }
-};
 /** list of all SvxMSDffImportRec instances of/for a group */
-typedef std::set<std::unique_ptr<SvxMSDffImportRec>, MSDffImportRecords_Less>
-    MSDffImportRecords;
+typedef std::set<std::unique_ptr<SvxMSDffImportRec>,
+        comphelper::UniquePtrValueLess<SvxMSDffImportRec>> MSDffImportRecords;
 
 /** block of parameters for import/export for a single call of
     ImportObjAtCurrentStreamPos() */
diff --git a/sw/source/core/inc/blink.hxx b/sw/source/core/inc/blink.hxx
index 6c14225..8b9fc5d 100644
--- a/sw/source/core/inc/blink.hxx
+++ b/sw/source/core/inc/blink.hxx
@@ -26,6 +26,7 @@ class SwTextFrm;
 
 #include <vcl/timer.hxx>
 #include <tools/gen.hxx>
+#include <comphelper/stl_types.hxx>
 
 #include <set>
 #include <memory>
@@ -63,16 +64,8 @@ public:
     { return reinterpret_cast<sal_IntPtr>(pPor) == reinterpret_cast<sal_IntPtr>(rBlinkPortion.pPor); }
 };
 
-struct SwBlinkPortion_Less
-{
-    bool operator()(std::unique_ptr<SwBlinkPortion> const& lhs,
-                    std::unique_ptr<SwBlinkPortion> const& rhs)
-    {
-        return (*lhs) < (*rhs);
-    }
-};
-
-typedef std::set<std::unique_ptr<SwBlinkPortion>, SwBlinkPortion_Less> SwBlinkSet;
+typedef std::set<std::unique_ptr<SwBlinkPortion>,
+            comphelper::UniquePtrValueLess<SwBlinkPortion>> SwBlinkSet;
 
 class SwBlink
 {
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index df11e3e..f032329 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -29,6 +29,7 @@
 #include <vcl/field.hxx>
 #include <i18nlangtag/lang.h>
 #include <tools/stream.hxx>
+#include <comphelper/stl_types.hxx>
 #include <o3tl/sorted_vector.hxx>
 
 #include "shellio.hxx"
@@ -262,16 +263,8 @@ struct SwHTMLFormatInfo
 
 };
 
-struct SwHTMLFormatInfo_Less
-{
-    bool operator()(std::unique_ptr<SwHTMLFormatInfo> const& lhs,
-                    std::unique_ptr<SwHTMLFormatInfo> const& rhs)
-    {
-        return (*lhs) < (*rhs);
-    }
-};
-
-typedef std::set<std::unique_ptr<SwHTMLFormatInfo>, SwHTMLFormatInfo_Less> SwHTMLFormatInfos;
+typedef std::set<std::unique_ptr<SwHTMLFormatInfo>,
+        comphelper::UniquePtrValueLess<SwHTMLFormatInfo>> SwHTMLFormatInfos;
 
 class IDocumentStylePoolAccess;
 
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 4dbce49..d7a8240 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -28,6 +28,9 @@
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+
+#include <comphelper/stl_types.hxx>
+
 #include <xmloff/maptype.hxx>
 #include <xmloff/xmlexppr.hxx>
 
@@ -102,15 +105,8 @@ public:
 
 struct XMLAutoStyleFamily : boost::noncopyable
 {
-    struct XMLAutoStylePoolParent_Less
-    {
-        bool operator()(std::unique_ptr<XMLAutoStylePoolParent> const& lhs,
-                        std::unique_ptr<XMLAutoStylePoolParent> const& rhs) const
-        {
-            return (*lhs) < (*rhs);
-        }
-    };
-    typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>, XMLAutoStylePoolParent_Less> ParentSetType;
+    typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>,
+        comphelper::UniquePtrValueLess<XMLAutoStylePoolParent>> ParentSetType;
     typedef std::set<OUString> NameSetType;
 
     sal_uInt32 mnFamily;
@@ -140,16 +136,9 @@ struct XMLAutoStyleFamily : boost::noncopyable
 
 class SvXMLAutoStylePoolP_Impl
 {
-    struct XMLAutoStyleFamily_Less
-    {
-        bool operator()(std::unique_ptr<XMLAutoStyleFamily> const& lhs,
-                        std::unique_ptr<XMLAutoStyleFamily> const& rhs) const
-        {
-            return (*lhs) < (*rhs);
-        }
-    };
     // A set that finds and sorts based only on mnFamily
-    typedef std::set<std::unique_ptr<XMLAutoStyleFamily>, XMLAutoStyleFamily_Less> FamilySetType;
+    typedef std::set<std::unique_ptr<XMLAutoStyleFamily>,
+            comphelper::UniquePtrValueLess<XMLAutoStyleFamily>> FamilySetType;
 
     SvXMLExport& rExport;
     FamilySetType m_FamilySet;
commit 58c3bbfd467b93d133e00789afcd7a00a3f53895
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 19 12:55:59 2015 +0200

    comphelper: remove unnecessary include <stack>
    
    Change-Id: I39295d69dd8a48f0f40275830cb6fda4ca0b69f3

diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index 725e0f2..98a240e 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -29,6 +29,8 @@
 #include <connectivity/FValue.hxx>
 #include "file/filedllapi.hxx"
 
+#include <stack>
+
 namespace connectivity
 {
     class OSQLParseNode;
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
index c438a26..8d8b5a3 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
@@ -40,6 +40,8 @@
 #include <xmloff/XMLSettingsExportContext.hxx>
 #include <xmloff/SettingsExportHelper.hxx>
 
+#include <stack>
+
 namespace dbaccess
 {
 
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
index df6922c..251137b 100644
--- a/include/comphelper/stl_types.hxx
+++ b/include/comphelper/stl_types.hxx
@@ -21,8 +21,6 @@
 
 #include <sal/config.h>
 
-#include <stack>
-
 #include <math.h>
 #include <functional>
 
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index 9787b92..861c21f 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -50,6 +50,7 @@
 
 #include <com/sun/star/text/XText.hpp>
 
+#include <stack>
 #include <numeric>
 
 namespace xmloff
commit 37039980981355fc65c5b871d07b336486baa7d6
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 19 12:25:38 2015 +0200

    sc: these are ptr_map not ptr_set
    
    Change-Id: I55848b3fedae79d714c8341fd84d505cb83a7c2c

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 53e2449..5d01b31 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -28,7 +28,6 @@
 
 #include <map>
 #include <vector>
-#include <boost/ptr_container/ptr_set.hpp>
 #include <boost/ptr_container/ptr_map.hpp>
 
 class ScDocument;
@@ -211,7 +210,7 @@ public:
     bool empty() const;
 
     /** Insert object into set.
-        @ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes
+        @ATTENTION: The underlying ::boost::ptr_map_adapter::insert(p) takes
         ownership of p and if it can't insert it deletes the object! So, if
         this insert here returns false the object where p pointed to is gone!
      */
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index c021dc2..ebad873 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -680,7 +680,7 @@ ScRangeName::ScRangeName() {}
 ScRangeName::ScRangeName(const ScRangeName& r) :
     maData(r.maData)
 {
-    // boost::ptr_set clones and deletes, so each collection needs its own
+    // boost::ptr_map clones and deletes, so each collection needs its own
     // index to data.
     maIndexToData.resize( r.maIndexToData.size(), NULL);
     DataType::const_iterator itr = maData.begin(), itrEnd = maData.end();
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index 35832b2..c703bb6 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -22,6 +22,8 @@
 
 #include <list>
 #include <map>
+#include <set>
+
 #include "richstring.hxx"
 #include "worksheethelper.hxx"
 
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index aa4b8c4..5b6edb1 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -31,7 +31,6 @@
 #include "namemgrtable.hxx"
 
 #include <boost/ptr_container/ptr_map.hpp>
-#include <boost/ptr_container/ptr_set.hpp>
 
 #include <stack>
 #include <map>


More information about the Libreoffice-commits mailing list