diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-30 13:54:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-10-03 19:50:44 +0200 |
commit | ad1557f5d775739230e0e2252c293948977b42a0 (patch) | |
tree | 610e2e849d87583888c0c658088044d6dc3966a5 /sc | |
parent | 7e7dd7f152bc7457437f541e7ff88d69e9f8e765 (diff) |
A more lightweight O[U]StringConcatenation
...compared to a full-blown O[U]String, for temporary objects holding an
O[U]StringConcat result that can then be used as a std::[u16]string_view.
It's instructive to see how some invocations of operator ==, operator !=, and
O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit
materialization of an O[U]String temporary, and how that expensive operation has
now been made explicit with the explicit O[U]StringConcatenation ctor.
(The additional operator == and operator != overloads are necessary because the
overloads taking two std::[u16]string_view parameters wouldn't even be found
here with ADL. And the OUString-related ones would cause ambiguities in at
least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with
RTL_STRING_UNITTEST, so have simply been disabled for that special test-code
case.)
Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xelink.cxx | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 50eba8cbc7b6..128b4b57df42 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -358,7 +358,7 @@ void ScMacrosTest::testVba() for (const auto& rTestInfo : testInfo) { OUString aFileName; - createFileURL(OUString(rTestInfo.sFileBaseName + "xls"), aFileName); + createFileURL(OUStringConcatenation(rTestInfo.sFileBaseName + "xls"), aFileName); uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); // process all events such as OnLoad events etc. diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index a4a2d87819e5..4baa6c00e9ad 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -456,7 +456,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU mnFlags |= EXC_HLINK_MARK; OUString location = XclXmlUtils::ToOUString(*mxTextMark); - if (!location.isEmpty() && msTarget.endsWith(OUString("#" + location))) + if (!location.isEmpty() && msTarget.endsWith(OUStringConcatenation("#" + location))) msTarget = msTarget.copy(0, msTarget.getLength() - location.getLength() - 1); } diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 4e30a29e9867..90a46120974e 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -1466,7 +1466,7 @@ XclExpExternSheet::XclExpExternSheet( const XclExpRoot& rRoot, std::u16string_vi XclExpExternSheetBase( rRoot, EXC_ID_EXTERNSHEET ) { // reference to own sheet: \03<sheetname> - Init(OUString(OUStringChar(EXC_EXTSH_TABNAME) + rTabName)); + Init(OUStringConcatenation(OUStringChar(EXC_EXTSH_TABNAME) + rTabName)); } void XclExpExternSheet::Save( XclExpStream& rStrm ) |