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 /dbaccess/source/ui | |
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 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/dlg/dbwizsetup.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/directsql.cxx | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 7707408f4288..c04218620e9c 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -815,7 +815,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() if (bFolderExists) { i++; - pURL->setName(OUString(sLastSegmentName + OUString::number(i))); + pURL->setName(OUStringConcatenation(sLastSegmentName + OUString::number(i))); } } } @@ -833,7 +833,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() bElementExists = xSimpleFileAccess->exists( aExistenceCheck.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); if ( bElementExists ) { - aExistenceCheck.setBase( OUString(BaseName + OUString::number( i ) )); + aExistenceCheck.setBase( OUStringConcatenation(BaseName + OUString::number( i ) )); ++i; } } diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index 7a59a1d2c76d..604cb1716d02 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -211,7 +211,7 @@ namespace dbaui } else addOutputText( - OUString(OUString::number(xMR->getUpdateCount()) + " rows updated\n")); + OUStringConcatenation(OUString::number(xMR->getUpdateCount()) + " rows updated\n")); for (;;) { hasRS = xMR->getMoreResults(); @@ -231,17 +231,17 @@ namespace dbaui if (upperStatement.startsWith("UPDATE")) { sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); - addOutputText(OUString(OUString::number(resultCount) + " rows updated\n")); + addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows updated\n")); } else if (upperStatement.startsWith("INSERT")) { sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); - addOutputText(OUString(OUString::number(resultCount) + " rows inserted\n")); + addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows inserted\n")); } else if (upperStatement.startsWith("DELETE")) { sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); - addOutputText(OUString(OUString::number(resultCount) + " rows deleted\n")); + addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows deleted\n")); } else if (upperStatement.startsWith("CREATE")) { @@ -257,7 +257,7 @@ namespace dbaui else { sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); - addOutputText(OUString(OUString::number(resultCount) + " rows updated\n")); + addOutputText(OUStringConcatenation(OUString::number(resultCount) + " rows updated\n")); } } // successful |