[Libreoffice-commits] core.git: chart2/source include/o3tl sc/source vcl/source writerfilter/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 25 07:29:07 UTC 2019


 chart2/source/controller/main/CommandDispatchContainer.cxx |    4 +++-
 include/o3tl/sorted_vector.hxx                             |   12 ++++++++++++
 sc/source/core/tool/token.cxx                              |    5 +++--
 vcl/source/font/PhysicalFontCollection.cxx                 |    2 +-
 writerfilter/source/dmapper/PropertyMap.cxx                |    4 ++--
 5 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit b13421011d9377676e1adc282634991d5064a866
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Sep 24 17:37:36 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 25 09:28:31 2019 +0200

    better data structures for some static const vars
    
    use compact, cache-friendly structures for some static const stuff
    
    and add a std::initialiser_list constructor to o3tl::sorted_vector
    
    Change-Id: I6a6049bf19a7f48dae1843a81cd2257944ada9d5
    Reviewed-on: https://gerrit.libreoffice.org/79470
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index 58fa1bcd04ce..5bc093282b4b 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -28,6 +28,8 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 
+#include <o3tl/sorted_vector.hxx>
+
 using namespace ::com::sun::star;
 
 using ::com::sun::star::uno::Reference;
@@ -67,7 +69,7 @@ void CommandDispatchContainer::setChartDispatch(
 Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
     const util::URL & rURL )
 {
-    static const std::set< OUString >  s_aContainerDocumentCommands {
+    static const o3tl::sorted_vector< OUString >  s_aContainerDocumentCommands {
         "AddDirect",    "NewDoc",             "Open",
         "Save",         "SaveAs",             "SendMail",
         "EditDoc",      "ExportDirectToPDF",  "PrintDefault"};
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
index 35882ab9afca..527f34e568c7 100644
--- a/include/o3tl/sorted_vector.hxx
+++ b/include/o3tl/sorted_vector.hxx
@@ -45,6 +45,18 @@ public:
     typedef typename std::vector<Value>::difference_type difference_type;
     typedef typename std::vector<Value>::size_type size_type;
 
+    sorted_vector( std::initializer_list<Value> init )
+        : m_vector(init)
+    {
+        Resort();
+    }
+    sorted_vector() = default;
+    sorted_vector(sorted_vector const&) = default;
+    sorted_vector(sorted_vector&&) = default;
+
+    sorted_vector& operator=(sorted_vector const&) = default;
+    sorted_vector& operator=(sorted_vector&&) = default;
+
     // MODIFIERS
 
     std::pair<const_iterator,bool> insert( Value&& x )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 14a39306eb5f..b9048dd25f19 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -61,6 +61,7 @@ using ::std::vector;
 #include <com/sun/star/sheet/ReferenceFlags.hpp>
 #include <com/sun/star/sheet/NameToken.hpp>
 #include <utility>
+#include <o3tl/sorted_vector.hxx>
 
 using namespace formula;
 using namespace com::sun::star;
@@ -1276,7 +1277,7 @@ bool ScTokenArray::AddFormulaToken(
 
 void ScTokenArray::CheckForThreading( const FormulaToken& r )
 {
-    static const std::set<OpCode> aThreadedCalcBlackList({
+    static const o3tl::sorted_vector<OpCode> aThreadedCalcBlackList({
         ocIndirect,
         ocMacro,
         ocOffset,
@@ -1319,7 +1320,7 @@ void ScTokenArray::CheckForThreading( const FormulaToken& r )
 
     OpCode eOp = r.GetOpCode();
 
-    if (aThreadedCalcBlackList.count(eOp))
+    if (aThreadedCalcBlackList.find(eOp) != aThreadedCalcBlackList.end())
     {
         SAL_INFO("sc.core.formulagroup", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
             << "(" << int(eOp) << ") disables threaded calculation of formula group");
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 1ca86d1fd884..00b06f589ad8 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -920,7 +920,7 @@ std::unique_ptr<ImplDeviceFontSizeList> PhysicalFontCollection::GetDeviceFontSiz
 // These are the metric-compatible replacement fonts that are bundled with
 // LibreOffice, we prefer them over generic substitutions that might be
 // provided by the system.
-static const std::map<OUString, OUString> aMetricCompatibleMap =
+static const std::vector<std::pair<OUString, OUString>> aMetricCompatibleMap =
 {
     { "Times New Roman", "Liberation Serif" },
     { "Arial",           "Liberation Sans" },
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 8755cfa20970..2c9b64d6e6e6 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -55,7 +55,7 @@
 #include <comphelper/propertyvalue.hxx>
 #include <tools/diagnose_ex.h>
 #include "PropertyMapHelper.hxx"
-#include <set>
+#include <o3tl/sorted_vector.hxx>
 
 using namespace com::sun::star;
 
@@ -1571,7 +1571,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
                 uno::Reference< beans::XPropertySetInfo > pagePropertiesInfo( pageProperties->getPropertySetInfo() );
                 const uno::Sequence< beans::Property > propertyList( pagePropertiesInfo->getProperties() );
                 // Ignore write-only properties.
-                static const std::set<OUString> aBlacklist
+                static const o3tl::sorted_vector<OUString> aBlacklist
                     = { "FooterBackGraphicURL", "BackGraphicURL", "HeaderBackGraphicURL" };
                 for ( const auto& rProperty : propertyList )
                 {


More information about the Libreoffice-commits mailing list