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 /svtools | |
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 'svtools')
-rw-r--r-- | svtools/source/dialogs/PlaceEditDialog.cxx | 2 | ||||
-rw-r--r-- | svtools/source/dialogs/ServerDetailsControls.cxx | 2 | ||||
-rw-r--r-- | svtools/source/svhtml/HtmlWriter.cxx | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index f006f82c84a7..359d0d0f5327 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -194,7 +194,7 @@ void PlaceEditDialog::InitDetails( ) auto nSize = std::min(aTypesUrlsList.getLength(), aTypesNamesList.getLength()); for ( sal_Int32 i = 0; i < nSize; ++i ) { - OUString sUrl = aTypesUrlsList[i].replaceFirst("<host", OUString("<" + SvtResId(STR_SVT_HOST))).replaceFirst("port>", OUString(SvtResId(STR_SVT_PORT) + ">")); + OUString sUrl = aTypesUrlsList[i].replaceFirst("<host", OUStringConcatenation("<" + SvtResId(STR_SVT_HOST))).replaceFirst("port>", OUStringConcatenation(SvtResId(STR_SVT_PORT) + ">")); if ((sUrl == GDRIVE_BASE_URL && bSkipGDrive) || (sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL) && bSkipAlfresco) || diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 08a81cdc36a6..b4afe9bb2d5c 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -145,7 +145,7 @@ bool HostDetailsContainer::setUrl( const INetURLObject& rUrl ) bool HostDetailsContainer::verifyScheme( const OUString& sScheme ) { - return sScheme == ( m_sScheme + "://" ); + return sScheme == OUStringConcatenation( m_sScheme + "://" ); } DavDetailsContainer::DavDetailsContainer(PlaceEditDialog* pBuilder) diff --git a/svtools/source/svhtml/HtmlWriter.cxx b/svtools/source/svhtml/HtmlWriter.cxx index 8cd7dc8705b4..f7c35a644706 100644 --- a/svtools/source/svhtml/HtmlWriter.cxx +++ b/svtools/source/svhtml/HtmlWriter.cxx @@ -52,7 +52,7 @@ void HtmlWriter::start(const OString& aElement) } mrStream.WriteChar('<'); - mrStream.WriteOString(OString(maNamespace + aElement)); + mrStream.WriteOString(OStringConcatenation(maNamespace + aElement)); mbElementOpen = true; } @@ -107,7 +107,7 @@ void HtmlWriter::end() } } mrStream.WriteCharPtr("</"); - mrStream.WriteOString(OString(maNamespace + maElementStack.back())); + mrStream.WriteOString(OStringConcatenation(maNamespace + maElementStack.back())); mrStream.WriteCharPtr(">"); if (mbPrettyPrint) mrStream.WriteCharPtr("\n"); |