From ad1557f5d775739230e0e2252c293948977b42a0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 30 Sep 2021 13:54:26 +0200 Subject: 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 Reviewed-by: Stephan Bergmann --- unotest/source/cpp/gettestargument.cxx | 2 +- unotest/source/cpp/macros_test.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'unotest/source') diff --git a/unotest/source/cpp/gettestargument.cxx b/unotest/source/cpp/gettestargument.cxx index 4423ec3a6bb2..0fa181678b40 100644 --- a/unotest/source/cpp/gettestargument.cxx +++ b/unotest/source/cpp/gettestargument.cxx @@ -27,7 +27,7 @@ namespace test { bool getTestArgument(std::u16string_view name, OUString* value) { - return getArgument(OUString(OUString::Concat("testarg.") + name), value); + return getArgument(OUStringConcatenation(OUString::Concat("testarg.") + name), value); } } diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index f94f0704c243..f44180738197 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -88,8 +88,8 @@ void MacrosTest::dispatchCommand(const uno::Reference& xCompon void MacrosTest::setUpNssGpg(const test::Directories& rDirectories, const OUString& rTestName) { OUString aSourceDir = rDirectories.getURLFromSrc(u"/test/signing-keys/"); - OUString aTargetDir - = rDirectories.getURLFromWorkdir(OUString("CppunitTest/" + rTestName + ".test.user")); + OUString aTargetDir = rDirectories.getURLFromWorkdir( + OUStringConcatenation("CppunitTest/" + rTestName + ".test.user")); // Set up cert8.db in workdir/CppunitTest/ osl::File::copy(aSourceDir + "cert8.db", aTargetDir + "/cert8.db"); -- cgit