[Libreoffice-commits] core.git: Branch 'private/tml/opencl-default-1' - 3 commits - comphelper/Library_comphelper.mk comphelper/qa comphelper/source include/comphelper officecfg/registry sc/inc sc/source sc/uiconfig
Tor Lillqvist
tml at collabora.com
Tue Nov 11 09:01:59 PST 2014
comphelper/Library_comphelper.mk | 1
comphelper/qa/string/test_string.cxx | 40 ++++++++
comphelper/source/misc/compareversionstrings.cxx | 70 +++++++++++++++
include/comphelper/string.hxx | 9 +
officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 2
sc/inc/calcconfig.hxx | 44 +++++----
sc/source/core/tool/calcconfig.cxx | 10 +-
sc/source/core/tool/formulaopt.cxx | 26 +++--
sc/source/ui/optdlg/calcoptionsdlg.cxx | 40 +++++---
sc/source/ui/optdlg/calcoptionsdlg.hxx | 7 -
sc/uiconfig/scalc/ui/formulacalculationoptions.ui | 40 ++++++--
11 files changed, 223 insertions(+), 66 deletions(-)
New commits:
commit 3bbaca82029419eb2cc34065b718d41c3083e826
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Nov 11 18:52:55 2014 +0200
Split driver version specification into a range
Change-Id: I1f26b47054e70e54ce81d3ec4cbc5ff58c1aeea3
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index d3c20cf..57bb66c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1401,7 +1401,7 @@
<info>
<desc>Like OpenCLWhiteList, but for combinations known to be bad.</desc>
</info>
- <value oor:separator=";">Windows/*/Intel(R) Corporation/*/9.17.10.2884;SuperOS/*/Big Corp, Inc./Whizz\Grafix/4.2%2Fbeta%3B3</value>
+ <value oor:separator=";">Windows/*/Intel(R) Corporation/*/9.17.10.2884/;SuperOS/*/Big Corp, Inc./Whizz\Grafix/4.2%2Fbeta%3B3/4.4</value>
</prop>
</group>
<group oor:name="Syntax">
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 9768af8..d46fa84 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -47,7 +47,8 @@ struct SC_DLLPUBLIC ScCalcConfig
OUString maOSVersion;
OUString maPlatformVendor;
OUString maDevice;
- OUString maDriverVersion;
+ OUString maDriverVersionMin;
+ OUString maDriverVersionMax;
OpenCLImplMatcher()
{
@@ -57,12 +58,14 @@ struct SC_DLLPUBLIC ScCalcConfig
const OUString& rOSVersion,
const OUString& rPlatformVendor,
const OUString& rDevice,
- const OUString& rDriverVersion)
+ const OUString& rDriverVersionMin,
+ const OUString& rDriverVersionMax)
: maOS(rOS),
maOSVersion(rOSVersion),
maPlatformVendor(rPlatformVendor),
maDevice(rDevice),
- maDriverVersion(rDriverVersion)
+ maDriverVersionMin(rDriverVersionMin),
+ maDriverVersionMax(rDriverVersionMax)
{
}
@@ -72,7 +75,8 @@ struct SC_DLLPUBLIC ScCalcConfig
maOSVersion == r.maOSVersion &&
maPlatformVendor == r.maPlatformVendor &&
maDevice == r.maDevice &&
- maDriverVersion == r.maDriverVersion;
+ maDriverVersionMin == r.maDriverVersionMin &&
+ maDriverVersionMax == r.maDriverVersionMax;
}
bool operator!=(const OpenCLImplMatcher& r) const
{
@@ -88,7 +92,9 @@ struct SC_DLLPUBLIC ScCalcConfig
(maPlatformVendor == r.maPlatformVendor &&
(maDevice < r.maDevice ||
(maDevice == r.maDevice &&
- (maDriverVersion < r.maDriverVersion)))))))));
+ (maDriverVersionMin < r.maDriverVersionMin ||
+ (maDriverVersionMin == r.maDriverVersionMin &&
+ maDriverVersionMax < r.maDriverVersionMax))))))))));
}
};
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index a3197a8..36d1fa5 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -44,8 +44,8 @@ void ScCalcConfig::setOpenCLConfigToDefault()
maOpenCLSubsetOpCodes.insert(ocSum);
maOpenCLSubsetOpCodes.insert(ocAverage);
maOpenCLSubsetOpCodes.insert(ocSumIfs);
- maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
- maOpenCLBlackList.insert(OpenCLImplMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
+ maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884", ""));
+ maOpenCLBlackList.insert(OpenCLImplMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3", "4.4"));
}
void ScCalcConfig::reset()
@@ -89,7 +89,7 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMa
"OSVersion=" << rImpl.maOSVersion << ","
"PlatformVendor=" << rImpl.maPlatformVendor << ","
"Device=" << rImpl.maDevice << ","
- "DriverVersion=" << rImpl.maDriverVersion <<
+ "DriverVersion=[" << rImpl.maDriverVersionMin << "," << rImpl.maDriverVersionMax << "]"
"}";
return rStream;
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index f2cd325e..ae79e75 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -292,7 +292,8 @@ css::uno::Sequence<OUString> SetOfOpenCLImplMatcherToStringSequence(std::set<ScC
(*i).maOSVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maPlatformVendor.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
(*i).maDevice.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
- (*i).maDriverVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B");
+ (*i).maDriverVersionMin.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
+ (*i).maDriverVersionMax.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B");
}
return result;
@@ -335,7 +336,8 @@ std::set<ScCalcConfig::OpenCLImplMatcher> StringSequenceToSetOfOpenCLImplMatcher
m.maOSVersion = getToken(*i, index);
m.maPlatformVendor = getToken(*i, index);
m.maDevice = getToken(*i, index);
- m.maDriverVersion = getToken(*i, index);
+ m.maDriverVersionMin = getToken(*i, index);
+ m.maDriverVersionMax = getToken(*i, index);
result.insert(m);
}
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index ac55d1a..59cec36 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -149,7 +149,8 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
get(mpOSVersion, "osversion");
get(mpPlatformVendor, "platformvendor");
get(mpDevice, "opencldevice");
- get(mpDriverVersion, "opencldriverversion");
+ get(mpDriverVersionMin, "opencldriverversionmin");
+ get(mpDriverVersionMax, "opencldriverversionmax");
get(mpListEditButton, "listbox-edit");
get(mpListNewButton, "listbox-new");
get(mpListDeleteButton, "listbox-delete");
@@ -166,7 +167,8 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
mpOSVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpPlatformVendor->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpDevice->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
- mpDriverVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+ mpDriverVersionMin->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+ mpDriverVersionMax->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
mpOpenCLWhiteAndBlackListBox->set_height_request(4* mpOpenCLWhiteAndBlackListBox->GetTextHeight());
mpOpenCLWhiteAndBlackListBox->SetStyle(mpOpenCLWhiteAndBlackListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@@ -314,7 +316,10 @@ OUString format(const ScCalcConfig::OpenCLImplMatcher& rImpl)
rImpl.maOSVersion + " " +
rImpl.maPlatformVendor + " " +
rImpl.maDevice + " " +
- rImpl.maDriverVersion);
+ (rImpl.maDriverVersionMax != "" ?
+ OUString("[") + rImpl.maDriverVersionMin + "," + rImpl.maDriverVersionMax + "]" :
+ rImpl.maDriverVersionMin)
+ );
}
void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
@@ -792,9 +797,13 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
{
newImpl.maDevice = sVal;
}
- else if (pEdit == mpDriverVersion)
+ else if (pEdit == mpDriverVersionMin)
{
- newImpl.maDriverVersion = sVal;
+ newImpl.maDriverVersionMin = sVal;
+ }
+ else if (pEdit == mpDriverVersionMax)
+ {
+ newImpl.maDriverVersionMax = sVal;
}
else
assert(false && "pEdit does not match any of the Edit fields");
@@ -906,7 +915,8 @@ IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
mpOSVersion->SetText(impl.maOSVersion);
mpPlatformVendor->SetText(impl.maPlatformVendor);
mpDevice->SetText(impl.maDevice);
- mpDriverVersion->SetText(impl.maDriverVersion);
+ mpDriverVersionMin->SetText(impl.maDriverVersionMin);
+ mpDriverVersionMax->SetText(impl.maDriverVersionMax);
return 0;
}
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 2269ab1..85a47fb 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -81,7 +81,8 @@ private:
Edit* mpOSVersion;
Edit* mpPlatformVendor;
Edit* mpDevice;
- Edit* mpDriverVersion;
+ Edit* mpDriverVersionMin;
+ Edit* mpDriverVersionMax;
PushButton* mpListEditButton;
PushButton* mpListNewButton;
PushButton* mpListDeleteButton;
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
index 513106c..312f3be 100644
--- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -214,8 +214,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_OS</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">OS</property>
<property name="mnemonic_widget">os:border</property>
</object>
<packing>
@@ -238,8 +237,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">OS _Version</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">OS Version</property>
<property name="mnemonic_widget">osversion:border</property>
</object>
<packing>
@@ -263,7 +261,6 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL Platform Vendor</property>
- <property name="use_underline">True</property>
<property name="mnemonic_widget">openclvendor:border</property>
</object>
<packing>
@@ -287,7 +284,6 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">OpenCL Device</property>
- <property name="use_underline">True</property>
<property name="mnemonic_widget">opencldevice:border</property>
</object>
<packing>
@@ -306,13 +302,12 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="opencldriverversionlabel">
+ <object class="GtkLabel" id="opencldriverversionminlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">OpenCL Driver Version</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">opencldriverversion:border</property>
+ <property name="label" translatable="yes">OpenCL Driver Version Lower Bound</property>
+ <property name="mnemonic_widget">opencldriverversionmin:border</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -320,7 +315,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="opencldriverversion:border">
+ <object class="GtkEntry" id="opencldriverversionmin:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@@ -329,6 +324,29 @@
<property name="top_attach">9</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="opencldriverversionmaxlabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">OpenCL Driver Version Upper Bound</property>
+ <property name="mnemonic_widget">opencldriverversionmax:border</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="opencldriverversionmax:border">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
commit 33c542b810b32d277d94e3a3a8cb3359857350cf
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Nov 11 18:50:11 2014 +0200
Add a function to compare version number strings
Change-Id: I88d3d9040f70e84752ade19001a699f60e9e7636
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 84bf698..271a95b 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/accimplaccess \
comphelper/source/misc/anytostring \
comphelper/source/misc/asyncnotification \
+ comphelper/source/misc/compareversionstrings \
comphelper/source/misc/comphelper_module \
comphelper/source/misc/comphelper_services \
comphelper/source/misc/componentbase \
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 78137a1..5e9f23f 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -44,6 +44,7 @@ public:
void testIsdigitAsciiString();
void testReverseString();
void testEqualsString();
+ void testCompareVersionStrings();
CPPUNIT_TEST_SUITE(TestString);
CPPUNIT_TEST(testNatural);
@@ -57,6 +58,7 @@ public:
CPPUNIT_TEST(testIsdigitAsciiString);
CPPUNIT_TEST(testReverseString);
CPPUNIT_TEST(testEqualsString);
+ CPPUNIT_TEST(testCompareVersionStrings);
CPPUNIT_TEST_SUITE_END();
};
@@ -407,6 +409,44 @@ void TestString::testEqualsString()
CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'A'));
}
+int sign(int n)
+{
+ if (n == 0)
+ return 0;
+ if (n < 0)
+ return -1;
+ else
+ return 1;
+}
+
+void TestString::testCompareVersionStrings()
+{
+#ifdef TEST
+#error TEST already defined
+#endif
+#define TEST(a,b,result) \
+ CPPUNIT_ASSERT(sign(::comphelper::string::compareVersionStrings(a, b)) == result); \
+ if ( result != 0 ) \
+ CPPUNIT_ASSERT(sign(::comphelper::string::compareVersionStrings(b, a)) == -(result))
+
+ TEST("", "", 0);
+ TEST("", "0", -1);
+ TEST("", "a", -1);
+ TEST("0", "1", -1);
+ TEST("1", "2", -1);
+ TEST("2", "10", -1);
+ TEST("01", "1", -1);
+ TEST("01", "001", 1);
+ TEST("1.00", "1", 1);
+ TEST("1.2", "1", 1);
+ TEST("1.01", "1.1", -1);
+ TEST("1.001", "1.1", -1);
+ TEST("1.001", "1.010", -1);
+ TEST("1.2.a", "1.2.b", -1);
+
+#undef TEST
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TestString);
}
diff --git a/comphelper/source/misc/compareversionstrings.cxx b/comphelper/source/misc/compareversionstrings.cxx
new file mode 100644
index 0000000..cc8cb44
--- /dev/null
+++ b/comphelper/source/misc/compareversionstrings.cxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <ctype.h>
+#include <ctype.h>
+#include <string.h>
+
+#include <comphelper/string.hxx>
+#include <rtl/ustring.hxx>
+
+namespace comphelper { namespace string {
+
+namespace {
+
+// BSD licensed, from http://git.musl-libc.org/cgit/musl/plain/src/string/strverscmp.c
+
+int strverscmp(const char *l, const char *r)
+{
+ int haszero=1;
+ while (*l==*r) {
+ if (!*l) return 0;
+
+ if (*l=='0') {
+ if (haszero==1) {
+ haszero=0;
+ }
+ } else if (isdigit(*l)) {
+ if (haszero==1) {
+ haszero=2;
+ }
+ } else {
+ haszero=1;
+ }
+ l++; r++;
+ }
+ if (haszero==1 && (*l=='0' || *r=='0')) {
+ haszero=0;
+ }
+ if ((isdigit(*l) && isdigit(*r) ) && haszero) {
+ size_t lenl=0, lenr=0;
+ while (isdigit(l[lenl]) ) lenl++;
+ while (isdigit(r[lenr]) ) lenr++;
+ if (lenl==lenr) {
+ return (*l - *r);
+ } else if (lenl>lenr) {
+ return 1;
+ } else {
+ return -1;
+ }
+ } else {
+ return (*l - *r);
+ }
+}
+
+} // anonymous namespace
+
+int compareVersionStrings(const OUString& a, const OUString& b)
+{
+ return strverscmp(OUStringToOString(a, RTL_TEXTENCODING_UTF8).getStr(), OUStringToOString(b, RTL_TEXTENCODING_UTF8).getStr());
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 74bc6a1..b062d7c 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -463,6 +463,15 @@ inline bool isalnumAscii(sal_Unicode c)
return isalphaAscii(c) || isdigitAscii(c);
}
+/** Compare two strings containing software version numbers
+
+ Inspired by the GNU strverscmp(), but there is no guarantee that the exact
+ same semantics are used, or that the semantics are stable between LibreOffice versions.
+
+ @return -1, 0 or 1
+*/
+COMPHELPER_DLLPUBLIC int compareVersionStrings(const OUString& a, const OUString& b);
+
} }
#endif
commit 9bb9d9d8feb8b27d24d00aa10ea8d780fc157d69
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Nov 11 11:23:45 2014 +0200
Rename OpenCLImpl to OpenCLImplMatcher to better match its purpose
Change-Id: If9b7052385a49df1403a5f652c67ca7c103a8be2
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 4b72dc8..9768af8 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -41,7 +41,7 @@ struct SC_DLLPUBLIC ScCalcConfig
STRING_CONVERSION_LOCALE_DEPENDENT ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
};
- struct OpenCLImpl
+ struct OpenCLImplMatcher
{
OUString maOS;
OUString maOSVersion;
@@ -49,15 +49,15 @@ struct SC_DLLPUBLIC ScCalcConfig
OUString maDevice;
OUString maDriverVersion;
- OpenCLImpl()
+ OpenCLImplMatcher()
{
}
- OpenCLImpl(const OUString& rOS,
- const OUString& rOSVersion,
- const OUString& rPlatformVendor,
- const OUString& rDevice,
- const OUString& rDriverVersion)
+ OpenCLImplMatcher(const OUString& rOS,
+ const OUString& rOSVersion,
+ const OUString& rPlatformVendor,
+ const OUString& rDevice,
+ const OUString& rDriverVersion)
: maOS(rOS),
maOSVersion(rOSVersion),
maPlatformVendor(rPlatformVendor),
@@ -66,7 +66,7 @@ struct SC_DLLPUBLIC ScCalcConfig
{
}
- bool operator==(const OpenCLImpl& r) const
+ bool operator==(const OpenCLImplMatcher& r) const
{
return maOS == r.maOS &&
maOSVersion == r.maOSVersion &&
@@ -74,11 +74,11 @@ struct SC_DLLPUBLIC ScCalcConfig
maDevice == r.maDevice &&
maDriverVersion == r.maDriverVersion;
}
- bool operator!=(const OpenCLImpl& r) const
+ bool operator!=(const OpenCLImplMatcher& r) const
{
return !operator==(r);
}
- bool operator<(const OpenCLImpl& r) const
+ bool operator<(const OpenCLImplMatcher& r) const
{
return (maOS < r.maOS ||
(maOS == r.maOS &&
@@ -106,10 +106,10 @@ struct SC_DLLPUBLIC ScCalcConfig
OpCodeSet maOpenCLSubsetOpCodes;
- typedef std::set<OpenCLImpl> OpenCLImplSet;
+ typedef std::set<OpenCLImplMatcher> OpenCLImplMatcherSet;
- OpenCLImplSet maOpenCLWhiteList;
- OpenCLImplSet maOpenCLBlackList;
+ OpenCLImplMatcherSet maOpenCLWhiteList;
+ OpenCLImplMatcherSet maOpenCLBlackList;
ScCalcConfig();
@@ -122,8 +122,8 @@ struct SC_DLLPUBLIC ScCalcConfig
bool operator!= (const ScCalcConfig& r) const;
};
-SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImpl& rImpl);
-SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplSet& rSet);
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcher& rImpl);
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcherSet& rSet);
SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig);
SC_DLLPUBLIC OUString ScOpCodeSetToNumberString(const ScCalcConfig::OpCodeSet& rOpCodes);
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 583c2a3..a3197a8 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -44,8 +44,8 @@ void ScCalcConfig::setOpenCLConfigToDefault()
maOpenCLSubsetOpCodes.insert(ocSum);
maOpenCLSubsetOpCodes.insert(ocAverage);
maOpenCLSubsetOpCodes.insert(ocSumIfs);
- maOpenCLBlackList.insert(OpenCLImpl("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
- maOpenCLBlackList.insert(OpenCLImpl("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
+ maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
+ maOpenCLBlackList.insert(OpenCLImplMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
}
void ScCalcConfig::reset()
@@ -82,7 +82,7 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
return !operator==(r);
}
-std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImpl& rImpl)
+std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcher& rImpl)
{
rStream << "{"
"OS=" << rImpl.maOS << ","
@@ -95,7 +95,7 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImpl&
return rStream;
}
-std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplSet& rSet)
+std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
{
rStream << "{";
for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index bcf7282..f2cd325e 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -280,7 +280,7 @@ ScFormulaCfg::ScFormulaCfg() :
namespace {
-css::uno::Sequence<OUString> SetOfOpenCLImplToStringSequence(std::set<ScCalcConfig::OpenCLImpl>& rSet)
+css::uno::Sequence<OUString> SetOfOpenCLImplMatcherToStringSequence(std::set<ScCalcConfig::OpenCLImplMatcher>& rSet)
{
css::uno::Sequence<OUString> result(rSet.size());
@@ -323,13 +323,13 @@ OUString getToken(const OUString& string, sal_Int32& index)
return result;
}
-std::set<ScCalcConfig::OpenCLImpl> StringSequenceToSetOfOpenCLImpl(css::uno::Sequence<OUString>& rSequence)
+std::set<ScCalcConfig::OpenCLImplMatcher> StringSequenceToSetOfOpenCLImplMatcher(css::uno::Sequence<OUString>& rSequence)
{
- std::set<ScCalcConfig::OpenCLImpl> result;
+ std::set<ScCalcConfig::OpenCLImplMatcher> result;
for (auto i = rSequence.begin(); i != rSequence.end(); ++i)
{
- ScCalcConfig::OpenCLImpl m;
+ ScCalcConfig::OpenCLImplMatcher m;
sal_Int32 index(0);
m.maOS = getToken(*i, index);
m.maOSVersion = getToken(*i, index);
@@ -589,16 +589,16 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
break;
case SCFORMULAOPT_OPENCL_WHITELIST:
{
- css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+ css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
pValues[nProp] >>= sVal;
- GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImpl(sVal);
+ GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImplMatcher(sVal);
}
break;
case SCFORMULAOPT_OPENCL_BLACKLIST:
{
- css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLBlackList);
+ css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
pValues[nProp] >>= sVal;
- GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImpl(sVal);
+ GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImplMatcher(sVal);
}
break;
}
@@ -756,13 +756,13 @@ void ScFormulaCfg::Commit()
break;
case SCFORMULAOPT_OPENCL_WHITELIST:
{
- css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+ css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
pValues[nProp] <<= sVal;
}
break;
case SCFORMULAOPT_OPENCL_BLACKLIST:
{
- css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLBlackList);
+ css::uno::Sequence<OUString> sVal = SetOfOpenCLImplMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
pValues[nProp] <<= sVal;
}
break;
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 051cd98..ac55d1a 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -308,7 +308,7 @@ void ScCalcOptionsDialog::fillOpenCLList()
namespace {
-OUString format(const ScCalcConfig::OpenCLImpl& rImpl)
+OUString format(const ScCalcConfig::OpenCLImplMatcher& rImpl)
{
return (rImpl.maOS + " " +
rImpl.maOSVersion + " " +
@@ -317,7 +317,7 @@ OUString format(const ScCalcConfig::OpenCLImpl& rImpl)
rImpl.maDriverVersion);
}
-void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplSet& rSet)
+void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
{
pListBox->SetUpdateMode(false);
pListBox->Clear();
@@ -734,14 +734,14 @@ void ScCalcOptionsDialog::SpinButtonValueChanged()
maConfig.mnOpenCLMinimumFormulaGroupSize = nVal;
}
-ScCalcConfig::OpenCLImplSet& ScCalcOptionsDialog::CurrentWhiteOrBlackList()
+ScCalcConfig::OpenCLImplMatcherSet& ScCalcOptionsDialog::CurrentWhiteOrBlackList()
{
return (mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
}
-const ScCalcConfig::OpenCLImpl& ScCalcOptionsDialog::CurrentWhiteOrBlackListEntry()
+const ScCalcConfig::OpenCLImplMatcher& ScCalcOptionsDialog::CurrentWhiteOrBlackListEntry()
{
- ScCalcConfig::OpenCLImplSet& rSet(CurrentWhiteOrBlackList());
+ ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
auto i = rSet.begin();
int n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
@@ -773,8 +773,8 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
// We know that this handler is otherwise currently used only
// for the OpenCL white/blacklists
- const ScCalcConfig::OpenCLImpl& impl(CurrentWhiteOrBlackListEntry());
- ScCalcConfig::OpenCLImpl newImpl(impl);
+ const ScCalcConfig::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
+ ScCalcConfig::OpenCLImplMatcher newImpl(impl);
if (pEdit == mpOS)
{
@@ -799,7 +799,7 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
else
assert(false && "pEdit does not match any of the Edit fields");
- ScCalcConfig::OpenCLImplSet& rSet(CurrentWhiteOrBlackList());
+ ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
rSet.erase(impl);
rSet.insert(newImpl);
@@ -900,7 +900,7 @@ IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
{
// We know this handler is used for the mpOpenCLWhiteAndBlackListBox
- const ScCalcConfig::OpenCLImpl& impl(CurrentWhiteOrBlackListEntry());
+ const ScCalcConfig::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
mpOS->SetText(impl.maOS);
mpOSVersion->SetText(impl.maOSVersion);
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index d8115c2..2269ab1 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -64,8 +64,8 @@ private:
OUString toString(sal_Int32 nVal) const;
SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const;
void setValueAt(size_t nPos, const OUString &rString);
- std::set<ScCalcConfig::OpenCLImpl>& CurrentWhiteOrBlackList();
- const ScCalcConfig::OpenCLImpl& CurrentWhiteOrBlackListEntry();
+ std::set<ScCalcConfig::OpenCLImplMatcher>& CurrentWhiteOrBlackList();
+ const ScCalcConfig::OpenCLImplMatcher& CurrentWhiteOrBlackListEntry();
private:
SvxCheckListBox* mpLbSettings;
More information about the Libreoffice-commits
mailing list