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 /svl/source | |
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 'svl/source')
-rw-r--r-- | svl/source/misc/lockfilecommon.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/msodocumentlockfile.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index 7cff508f3290..844b446397c7 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -73,7 +73,7 @@ OUString LockFileCommon::GenerateOwnLockFileURL( const OUString& aOrigURL, std::u16string_view aPrefix) { INetURLObject aURL = ResolveLinks(INetURLObject(aOrigURL)); - aURL.setName(OUString(aPrefix + aURL.GetLastName() + "%23" /*'#'*/)); + aURL.setName(OUStringConcatenation(aPrefix + aURL.GetLastName() + "%23" /*'#'*/)); return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); } diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx index fa104dcfbbe2..e8b24e8cbe33 100644 --- a/svl/source/misc/msodocumentlockfile.cxx +++ b/svl/source/misc/msodocumentlockfile.cxx @@ -56,7 +56,7 @@ OUString GenerateMSOLockFileURL(const OUString& aOrigURL) else if (nFileNameLength == 7) sFileName = sFileName.copy(1); } - aURL.setName(OUString("~$" + sFileName)); + aURL.setName(OUStringConcatenation("~$" + sFileName)); return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); } } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 53eb8181c2d6..cac944b321c4 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -706,7 +706,7 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString, if ( nNumeralID >= 0x02 && nNumeralID <= 0x13 ) nNatNum = 1; if ( nNatNum ) - rString.insert( nPos, "[NatNum"+OUString::number(nNatNum)+"]"); + rString.insert( nPos, OUStringConcatenation("[NatNum"+OUString::number(nNatNum)+"]")); return sCalendar; } @@ -5638,7 +5638,7 @@ OUString SvNumberformat::impTransliterateImpl(const OUString& rStr, sal_Int32 nField = -1; do { - nField = rNum.GetParams().indexOf(OUString(rKeywords[nDateKey] + "="), ++nField); + nField = rNum.GetParams().indexOf(OUStringConcatenation(rKeywords[nDateKey] + "="), ++nField); } while (nField != -1 && nField != 0 && (rNum.GetParams()[nField - 1] != ',' && |