diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-28 17:56:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-29 16:42:33 +0100 |
commit | 042033f1e6da22616cb76c8d950c20c9efecbad5 (patch) | |
tree | 26b3f1f42d067506f44550b410f3fb9640616a5b /desktop | |
parent | ccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff) |
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop')
36 files changed, 233 insertions, 193 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 26e4691ab53c..e2ecf5920aa0 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/uno/Reference.h> #include <memory> +#include <string_view> #include <thread> namespace com::sun::star::uno { class XComponentContext; } @@ -135,7 +136,7 @@ class Desktop final : public Application static void FlushConfiguration(); static bool InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); - static void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg ); + static void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, std::u16string_view aMsg ); // Create an error message depending on bootstrap failure code and an optional file url static OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode, diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index 84d9d5299fd4..e47c92cc5c0a 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -13,6 +13,7 @@ #include <unordered_map> #include <memory> #include <mutex> +#include <string_view> #include <boost/property_tree/ptree.hpp> #include <boost/variant.hpp> @@ -177,7 +178,7 @@ namespace desktop { /// Helper function to extract the value from parameters delimited by /// comma, like: Name1=Value1,Name2=Value2,Name3=Value3. /// @param rOptions When extracted, the Param=Value is removed from it. - DESKTOP_DLLPUBLIC OUString extractParameter(OUString& aOptions, const OUString& rName); + DESKTOP_DLLPUBLIC OUString extractParameter(OUString& aOptions, std::u16string_view rName); /// Helper function to convert JSON to a vector of PropertyValues. /// Public to be unit-test-able. diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 82586de384b1..99fba50f14bb 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -8,6 +8,8 @@ */ #include <memory> +#include <string_view> + #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/text/XTextDocument.hpp> @@ -94,7 +96,8 @@ public: { } - void readFileIntoByteVector(OUString const & sFilename, std::vector<sal_uInt8> & rByteVector); + void readFileIntoByteVector( + std::u16string_view sFilename, std::vector<sal_uInt8> & rByteVector); virtual void setUp() override { @@ -696,7 +699,7 @@ void DesktopLOKTest::testPasteWriterJPEG() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); OUString aFileURL; - createFileURL("paste.jpg", aFileURL); + createFileURL(u"paste.jpg", aFileURL); std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr()); std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>()); @@ -2418,32 +2421,32 @@ void DesktopLOKTest::testRunMacro() void DesktopLOKTest::testExtractParameter() { OUString aOptions("Language=de-DE"); - OUString aValue = extractParameter(aOptions, "Language"); + OUString aValue = extractParameter(aOptions, u"Language"); CPPUNIT_ASSERT_EQUAL(OUString("de-DE"), aValue); CPPUNIT_ASSERT_EQUAL(OUString(), aOptions); aOptions = "Language=en-US,Something"; - aValue = extractParameter(aOptions, "Language"); + aValue = extractParameter(aOptions, u"Language"); CPPUNIT_ASSERT_EQUAL(OUString("en-US"), aValue); CPPUNIT_ASSERT_EQUAL(OUString("Something"), aOptions); aOptions = "SomethingElse,Language=cs-CZ"; - aValue = extractParameter(aOptions, "Language"); + aValue = extractParameter(aOptions, u"Language"); CPPUNIT_ASSERT_EQUAL(OUString("cs-CZ"), aValue); CPPUNIT_ASSERT_EQUAL(OUString("SomethingElse"), aOptions); aOptions = "Something1,Language=hu-HU,Something2"; - aValue = extractParameter(aOptions, "Language"); + aValue = extractParameter(aOptions, u"Language"); CPPUNIT_ASSERT_EQUAL(OUString("hu-HU"), aValue); CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2"), aOptions); aOptions = "Something1,Something2=blah,Something3"; - aValue = extractParameter(aOptions, "Language"); + aValue = extractParameter(aOptions, u"Language"); CPPUNIT_ASSERT_EQUAL(OUString(), aValue); CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2=blah,Something3"), aOptions); } -void DesktopLOKTest::readFileIntoByteVector(OUString const & sFilename, std::vector<unsigned char> & rByteVector) +void DesktopLOKTest::readFileIntoByteVector(std::u16string_view sFilename, std::vector<unsigned char> & rByteVector) { rByteVector.clear(); OUString aURL; @@ -2469,14 +2472,14 @@ void DesktopLOKTest::testGetSignatureState_Signed() std::vector<unsigned char> aCertificate; { - readFileIntoByteVector("rootCA.der", aCertificate); + readFileIntoByteVector(u"rootCA.der", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); CPPUNIT_ASSERT(bResult); } { - readFileIntoByteVector("intermediateRootCA.der", aCertificate); + readFileIntoByteVector(u"intermediateRootCA.der", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); CPPUNIT_ASSERT(bResult); @@ -2515,7 +2518,7 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT() std::vector<unsigned char> aPrivateKey; { - readFileIntoByteVector("rootCA.der", aCertificate); + readFileIntoByteVector(u"rootCA.der", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2523,7 +2526,7 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT() } { - readFileIntoByteVector("intermediateRootCA.der", aCertificate); + readFileIntoByteVector(u"intermediateRootCA.der", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2531,8 +2534,8 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT() } { - readFileIntoByteVector("certificate.der", aCertificate); - readFileIntoByteVector("certificatePrivateKey.der", aPrivateKey); + readFileIntoByteVector(u"certificate.der", aCertificate); + readFileIntoByteVector(u"certificatePrivateKey.der", aPrivateKey); bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument, aCertificate.data(), int(aCertificate.size()), @@ -2565,7 +2568,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() std::vector<unsigned char> aPrivateKey; { - readFileIntoByteVector("test-cert-chain-1.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-1.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2573,7 +2576,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() } { - readFileIntoByteVector("test-cert-chain-2.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-2.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2581,7 +2584,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() } { - readFileIntoByteVector("test-cert-chain-3.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-3.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2589,8 +2592,8 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() } { - readFileIntoByteVector("test-cert-signing.pem", aCertificate); - readFileIntoByteVector("test-PK-signing.pem", aPrivateKey); + readFileIntoByteVector(u"test-cert-signing.pem", aCertificate); + readFileIntoByteVector(u"test-PK-signing.pem", aPrivateKey); bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument, aCertificate.data(), int(aCertificate.size()), @@ -2622,7 +2625,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() std::vector<unsigned char> aPrivateKey; { - readFileIntoByteVector("test-cert-chain-1.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-1.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2630,7 +2633,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() } { - readFileIntoByteVector("test-cert-chain-2.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-2.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2638,7 +2641,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() } { - readFileIntoByteVector("test-cert-chain-3.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-3.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2646,8 +2649,8 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() } { - readFileIntoByteVector("test-cert-signing.pem", aCertificate); - readFileIntoByteVector("test-PK-signing.pem", aPrivateKey); + readFileIntoByteVector(u"test-cert-signing.pem", aCertificate); + readFileIntoByteVector(u"test-PK-signing.pem", aPrivateKey); bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument, aCertificate.data(), int(aCertificate.size()), @@ -2675,7 +2678,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() std::vector<unsigned char> aPrivateKey; { - readFileIntoByteVector("test-cert-chain-1.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-1.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2683,7 +2686,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() } { - readFileIntoByteVector("test-cert-chain-2.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-2.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2691,7 +2694,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() } { - readFileIntoByteVector("test-cert-chain-3.pem", aCertificate); + readFileIntoByteVector(u"test-cert-chain-3.pem", aCertificate); bool bResult = pDocument->m_pDocumentClass->addCertificate( pDocument, aCertificate.data(), int(aCertificate.size())); @@ -2704,8 +2707,8 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() Scheduler::ProcessEventsToIdle(); - readFileIntoByteVector("test-cert-signing.pem", aCertificate); - readFileIntoByteVector("test-PK-signing.pem", aPrivateKey); + readFileIntoByteVector(u"test-cert-signing.pem", aCertificate); + readFileIntoByteVector(u"test-PK-signing.pem", aPrivateKey); LibLibreOffice_Impl aOffice; bool bResult = aOffice.m_pOfficeClass->signDocument(&aOffice, aTempFile.GetURL().toUtf8().getStr(), @@ -2821,7 +2824,7 @@ void DesktopLOKTest::testComplexSelection() // Paste an image. OUString aFileURL; - createFileURL("paste.jpg", aFileURL); + createFileURL(u"paste.jpg", aFileURL); std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr()); std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>()); CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "image/jpeg", aImageContents.data(), aImageContents.size())); diff --git a/desktop/qa/unit/desktop-dialogs-test.cxx b/desktop/qa/unit/desktop-dialogs-test.cxx index 54cadc33794c..56c39eb7108a 100644 --- a/desktop/qa/unit/desktop-dialogs-test.cxx +++ b/desktop/qa/unit/desktop-dialogs-test.cxx @@ -51,7 +51,7 @@ VclPtr<VclAbstractDialog> DesktopDialogsTest::createDialogByID(sal_uInt32 /*nID* void DesktopDialogsTest::openAnyDialog() { /// process input file containing the UXMLDescriptions of the dialogs to dump - processDialogBatchFile("desktop/qa/unit/data/desktop-dialogs-test.txt"); + processDialogBatchFile(u"desktop/qa/unit/data/desktop-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopDialogsTest); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 596e83b14ebf..2f4fcdc6904b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -28,6 +28,7 @@ #include <sal/config.h> #include <iostream> +#include <string_view> #include <app.hxx> #include <dp_shared.hxx> @@ -335,7 +336,7 @@ void RemoveIconCacheDirectory() namespace { -OUString MakeStartupErrorMessage(OUString const & aErrorMessage) +OUString MakeStartupErrorMessage(std::u16string_view aErrorMessage) { return DpResId(STR_BOOTSTRAP_ERR_CANNOT_START) + "\n" + aErrorMessage; } @@ -597,7 +598,7 @@ void Desktop::Shutdown() framework::getDesktop(::comphelper::getProcessComponentContext())->shutdown(); } -void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStatus, const OUString& aDiagnosticMessage ) +void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStatus, std::u16string_view aDiagnosticMessage ) { if ( aBootstrapStatus == ::utl::Bootstrap::DATA_OK ) return; @@ -614,7 +615,7 @@ void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStat if ( !aTemp.isEmpty() ) aProductKey = aTemp; - OUString const aMessage(aDiagnosticMessage + "\n"); + OUString const aMessage(OUString::Concat(aDiagnosticMessage) + "\n"); std::unique_ptr<weld::MessageDialog> xBootstrapFailedBox(Application::CreateMessageDialog(nullptr, VclMessageType::Warning, VclButtonsType::Ok, aMessage)); diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index bf15f687f0dd..5983313de51b 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -52,6 +52,7 @@ #include <com/sun/star/uno/Sequence.h> #include <comphelper/anytostring.hxx> +#include <string_view> #include <vector> using dp_misc::StrTitle; @@ -233,7 +234,7 @@ void UpdateInstallDialog::updateDone() // make sure the solar mutex is locked before calling //sets an error message in the text area void UpdateInstallDialog::setError(INSTALL_ERROR err, std::u16string_view sExtension, - OUString const & exceptionMessage) + std::u16string_view exceptionMessage) { OUString sError; m_bError = true; @@ -264,7 +265,7 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, std::u16string_view sExten sMsg += "\n"; sMsg += sError; //Insert more information about the error - if (!exceptionMessage.isEmpty()) + if (!exceptionMessage.empty()) sMsg += m_sThisErrorOccurred + exceptionMessage + "\n"; sMsg += m_sNoInstall + "\n"; @@ -272,7 +273,7 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, std::u16string_view sExten m_xMle_info->set_text(sMsg); } -void UpdateInstallDialog::setError(OUString const & exceptionMessage) +void UpdateInstallDialog::setError(std::u16string_view exceptionMessage) { m_bError = true; m_xMle_info->set_text(m_xMle_info->get_text() + exceptionMessage + "\n"); @@ -493,7 +494,7 @@ void UpdateInstallDialog::Thread::installExtensions() return; } m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED, - updateData.aInstalledPackage->getDisplayName(), OUString()); + updateData.aInstalledPackage->getDisplayName(), std::u16string_view()); } else if (!xExtension.is() || bError) { diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx index 7e970f7b346c..224307f71b30 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx @@ -22,6 +22,8 @@ #include <sal/config.h> #include <vcl/weld.hxx> #include <rtl/ref.hxx> + +#include <string_view> #include <vector> /// @HTML @@ -78,8 +80,8 @@ private: ERROR_INSTALLATION, ERROR_LICENSE_DECLINED }; - void setError(INSTALL_ERROR err, std::u16string_view sExtension, OUString const & exceptionMessage); - void setError(OUString const & exceptionMessage); + void setError(INSTALL_ERROR err, std::u16string_view sExtension, std::u16string_view exceptionMessage); + void setError(std::u16string_view exceptionMessage); const css::uno::Reference< css::deployment::XExtensionManager >& getExtensionManager() const { return m_xExtensionManager; } diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index ef2b64b91101..34fa924b8128 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -29,6 +29,7 @@ #include "license_dialog.hxx" #include <functional> +#include <string_view> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -64,7 +65,7 @@ struct LicenseDialogImpl : public weld::GenericDialogController DECL_LINK(SizeAllocHdl, const Size&, void); LicenseDialogImpl(weld::Window * pParent, - const OUString & sExtensionName, + std::u16string_view sExtensionName, const OUString & sLicenseText); bool IsEndReached() const; @@ -74,7 +75,7 @@ struct LicenseDialogImpl : public weld::GenericDialogController LicenseDialogImpl::LicenseDialogImpl( weld::Window * pParent, - const OUString & sExtensionName, + std::u16string_view sExtensionName, const OUString & sLicenseText) : GenericDialogController(pParent, "desktop/ui/licensedialog.ui", "LicenseDialog") , m_bLicenseRead(false) diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index 40197f7efb7c..08d533a79d3a 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -22,6 +22,8 @@ #include <sal/config.h> #include <optional> +#include <string_view> + #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <sal/types.h> @@ -225,7 +227,7 @@ private: SAL_DLLPRIVATE css::uno::Reference< css::xml::dom::XNode> matchLanguageTag( css::uno::Reference< css::xml::dom::XNode > const & xParent, - OUString const & rTag) const; + std::u16string_view rTag) const; /** If there is no child element with a locale matching the office locale, then we use the first child. In the case of the simple-license we also use the former default locale, which @@ -279,7 +281,7 @@ inline bool DescriptionInfoset::hasDescription() const the description.xml. */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -DescriptionInfoset getDescriptionInfoset(OUString const & sExtensionFolderURL); +DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/deployment/inc/dp_identifier.hxx b/desktop/source/deployment/inc/dp_identifier.hxx index 85735c659357..bd11170b6a7e 100644 --- a/desktop/source/deployment/inc/dp_identifier.hxx +++ b/desktop/source/deployment/inc/dp_identifier.hxx @@ -22,6 +22,8 @@ #include <sal/config.h> #include <optional> +#include <string_view> + #include <com/sun/star/uno/Reference.hxx> #include "dp_misc_api.hxx" @@ -47,7 +49,7 @@ namespace dp_misc { */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString generateIdentifier( ::std::optional< OUString > const & optional, - OUString const & fileName); + std::u16string_view fileName); /** Gets the identifier of a package. @@ -75,7 +77,7 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getIdentifier( a legacy identifier based on the given file name */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString generateLegacyIdentifier( - OUString const & fileName); + std::u16string_view fileName); } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 62063f81e148..2a17e2d6860c 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -54,6 +54,7 @@ #include <vector> #include <algorithm> #include <set> +#include <string_view> namespace lang = com::sun::star::lang; namespace task = com::sun::star::task; @@ -566,7 +567,7 @@ bool ExtensionManager::doChecksForAddExtension( } //Prevent showing the license if requested. Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); - ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>(), m_xContext); + ExtensionProperties props(std::u16string_view(), properties, Reference<ucb::XCommandEnvironment>(), m_xContext); dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); const ::std::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 22fd91370f11..5ff55abe6b33 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -974,7 +974,7 @@ Reference<deployment::XPackage> PackageManagerImpl::getDeployedPackage_( Reference<deployment::XPackage> PackageManagerImpl::getDeployedPackage_( - OUString const & id, ActivePackages::Data const & data, + std::u16string_view id, ActivePackages::Data const & data, Reference<XCommandEnvironment> const & xCmdEnv, bool ignoreAlienPlatforms ) { if (ignoreAlienPlatforms) diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h index 335099d3215d..ec34461aa6f7 100644 --- a/desktop/source/deployment/manager/dp_manager.h +++ b/desktop/source/deployment/manager/dp_manager.h @@ -27,7 +27,7 @@ #include <com/sun/star/deployment/XPackageRegistry.hpp> #include <com/sun/star/deployment/XPackageManager.hpp> #include <memory> - +#include <string_view> namespace dp_manager { @@ -173,7 +173,7 @@ public: OUString const & id, OUString const & fileName, css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv ); css::uno::Reference<css::deployment::XPackage> getDeployedPackage_( - OUString const & id, ActivePackages::Data const & data, + std::u16string_view id, ActivePackages::Data const & data, css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv, bool ignoreAlienPlatforms = false ); virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx index ab5ccc7eb5c7..92d7191111d3 100644 --- a/desktop/source/deployment/manager/dp_properties.cxx +++ b/desktop/source/deployment/manager/dp_properties.cxx @@ -41,12 +41,12 @@ namespace dp_manager { //Reading the file ExtensionProperties::ExtensionProperties( - OUString const & urlExtension, + std::u16string_view urlExtension, Reference<ucb::XCommandEnvironment> const & xCmdEnv, Reference<uno::XComponentContext> const & xContext) : m_xCmdEnv(xCmdEnv), m_xContext(xContext) { - m_propFileUrl = urlExtension + "properties"; + m_propFileUrl = OUString::Concat(urlExtension) + "properties"; std::vector< std::pair< OUString, OUString> > props; if (! dp_misc::create_ucb_content(nullptr, m_propFileUrl, nullptr, false)) @@ -64,13 +64,13 @@ ExtensionProperties::ExtensionProperties( //Writing the file ExtensionProperties::ExtensionProperties( - OUString const & urlExtension, + std::u16string_view urlExtension, uno::Sequence<css::beans::NamedValue> const & properties, Reference<ucb::XCommandEnvironment> const & xCmdEnv, Reference<uno::XComponentContext> const & xContext) : m_xCmdEnv(xCmdEnv), m_xContext(xContext) { - m_propFileUrl = urlExtension + "properties"; + m_propFileUrl = OUString::Concat(urlExtension) + "properties"; for (css::beans::NamedValue const & v : properties) { diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx index d87e2951ccb2..06139ece3c7d 100644 --- a/desktop/source/deployment/manager/dp_properties.hxx +++ b/desktop/source/deployment/manager/dp_properties.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <optional> +#include <string_view> namespace dp_manager { @@ -37,11 +38,11 @@ class ExtensionProperties final static OUString getPropertyValue(css::beans::NamedValue const& v); public: - ExtensionProperties(OUString const& urlExtension, + ExtensionProperties(std::u16string_view urlExtension, css::uno::Reference<css::ucb::XCommandEnvironment> const& xCmdEnv, css::uno::Reference<css::uno::XComponentContext> const& xContext); - ExtensionProperties(OUString const& urlExtension, + ExtensionProperties(std::u16string_view urlExtension, css::uno::Sequence<css::beans::NamedValue> const& properties, css::uno::Reference<css::ucb::XCommandEnvironment> const& xCmdEnv, css::uno::Reference<css::uno::XComponentContext> const& xContext); diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 183434efba24..2db2145070fc 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <dp_descriptioninfoset.hxx> #include <dp_resource.h> @@ -118,7 +122,7 @@ public: */ ExtensionDescription( const css::uno::Reference<css::uno::XComponentContext>& xContext, - const OUString& installDir, + std::u16string_view installDir, const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv); const css::uno::Reference<css::xml::dom::XNode>& getRootElement() const @@ -160,7 +164,7 @@ public: ExtensionDescription::ExtensionDescription( const Reference<css::uno::XComponentContext>& xContext, - const OUString& installDir, + std::u16string_view installDir, const Reference< css::ucb::XCommandEnvironment >& xCmdEnv) { try { @@ -168,7 +172,7 @@ ExtensionDescription::ExtensionDescription( //If there is no description.xml then ucb will start an interaction which //brings up a dialog.We want to prevent this. Therefore we wrap the xCmdEnv //and filter the respective exception out. - OUString sDescriptionUri(installDir + "/description.xml"); + OUString sDescriptionUri(OUString::Concat(installDir) + "/description.xml"); Reference<css::ucb::XCommandEnvironment> xFilter = new FileDoesNotExistFilter(xCmdEnv); ::ucbhelper::Content descContent(sDescriptionUri, xFilter, xContext); @@ -289,7 +293,7 @@ void FileDoesNotExistFilter::handle( namespace dp_misc { -DescriptionInfoset getDescriptionInfoset(OUString const & sExtensionFolderURL) +DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL) { Reference< css::xml::dom::XNode > root; Reference<css::uno::XComponentContext> context( @@ -706,13 +710,13 @@ DescriptionInfoset::getLocalizedChild( const OUString & sParent) const css::uno::Reference<css::xml::dom::XNode> DescriptionInfoset::matchLanguageTag( - css::uno::Reference< css::xml::dom::XNode > const & xParent, OUString const & rTag) const + css::uno::Reference< css::xml::dom::XNode > const & xParent, std::u16string_view rTag) const { OSL_ASSERT(xParent.is()); css::uno::Reference<css::xml::dom::XNode> nodeMatch; //first try exact match for lang - const OUString exp1("*[@lang=\"" + rTag + "\"]"); + const OUString exp1(OUString::Concat("*[@lang=\"") + rTag + "\"]"); try { nodeMatch = m_xpath->selectSingleNode(xParent, exp1); } catch (const css::xml::xpath::XPathException &) { @@ -724,7 +728,7 @@ DescriptionInfoset::matchLanguageTag( if (!nodeMatch.is()) { const OUString exp2( - "*[starts-with(@lang,\"" + rTag + "-\")]"); + OUString::Concat("*[starts-with(@lang,\"") + rTag + "-\")]"); try { nodeMatch = m_xpath->selectSingleNode(xParent, exp2); } catch (const css::xml::xpath::XPathException &) { diff --git a/desktop/source/deployment/misc/dp_identifier.cxx b/desktop/source/deployment/misc/dp_identifier.cxx index 350f9a1f0541..8669710c7b16 100644 --- a/desktop/source/deployment/misc/dp_identifier.cxx +++ b/desktop/source/deployment/misc/dp_identifier.cxx @@ -33,7 +33,7 @@ namespace dp_misc { OUString generateIdentifier( ::std::optional< OUString > const & optional, - OUString const & fileName) + std::u16string_view fileName) { return optional ? *optional : generateLegacyIdentifier(fileName); } @@ -47,8 +47,8 @@ OUString getIdentifier( ? id.Value : generateLegacyIdentifier(package->getName()); } -OUString generateLegacyIdentifier(OUString const & fileName) { - return "org.openoffice.legacy." + fileName; +OUString generateLegacyIdentifier(std::u16string_view fileName) { + return OUString::Concat("org.openoffice.legacy.") + fileName; } } diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx index 05f265404f55..37356fd78333 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx @@ -67,22 +67,22 @@ void ComponentBackendDb::addEntry(OUString const & url, Data const & data) if (!activateEntry(url)) { Reference<css::xml::dom::XNode> componentNode = writeKeyElement(url); - writeSimpleElement("java-type-library", + writeSimpleElement(u"java-type-library", OUString::boolean(data.javaTypeLibrary), componentNode); writeSimpleList( data.implementationNames, - "implementation-names", - "name", + u"implementation-names", + u"name", componentNode); writeVectorOfPair( data.singletons, - "singletons", - "item", - "key", - "value", + u"singletons", + u"item", + u"key", + u"value", componentNode); save(); @@ -97,7 +97,7 @@ void ComponentBackendDb::addEntry(OUString const & url, Data const & data) } } -ComponentBackendDb::Data ComponentBackendDb::getEntry(OUString const & url) +ComponentBackendDb::Data ComponentBackendDb::getEntry(std::u16string_view url) { try { @@ -105,14 +105,14 @@ ComponentBackendDb::Data ComponentBackendDb::getEntry(OUString const & url) Reference<css::xml::dom::XNode> aNode = getKeyElement(url); if (aNode.is()) { - bool bJava = readSimpleElement("java-type-library", aNode) == "true"; + bool bJava = readSimpleElement(u"java-type-library", aNode) == "true"; retData.javaTypeLibrary = bJava; retData.implementationNames = - readList( aNode, "implementation-names", "name"); + readList( aNode, u"implementation-names", u"name"); retData.singletons = - readVectorOfPair( aNode, "singletons", "item", "key", "value"); + readVectorOfPair( aNode, u"singletons", u"item", u"key", u"value"); } return retData; } diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx index e1797056d498..84153b6fa259 100644 --- a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx +++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx @@ -23,6 +23,8 @@ #include <rtl/string.hxx> #include <vector> #include <deque> +#include <string_view> + #include <dp_backenddb.hxx> namespace com::sun::star::uno { class XComponentContext; } @@ -81,7 +83,7 @@ public: void addEntry(OUString const & url, Data const & data); - Data getEntry(OUString const & url); + Data getEntry(std::u16string_view url); }; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 3ff6d653477a..5bf230c17f68 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -287,8 +287,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend std::unique_ptr<ComponentBackendDb> m_backendDb; void addDataToDb(OUString const & url, ComponentBackendDb::Data const & data); - ComponentBackendDb::Data readDataFromDb(OUString const & url); - void revokeEntryFromDb(OUString const & url); + ComponentBackendDb::Data readDataFromDb(std::u16string_view url); + void revokeEntryFromDb(std::u16string_view url); Reference<registry::XSimpleRegistry> m_xCommonRDB; Reference<registry::XSimpleRegistry> m_xNativeRDB; @@ -576,7 +576,7 @@ void BackendImpl::addDataToDb( m_backendDb->addEntry(url, data); } -ComponentBackendDb::Data BackendImpl::readDataFromDb(OUString const & url) +ComponentBackendDb::Data BackendImpl::readDataFromDb(std::u16string_view url) { ComponentBackendDb::Data data; if (m_backendDb) @@ -584,7 +584,7 @@ ComponentBackendDb::Data BackendImpl::readDataFromDb(OUString const & url) return data; } -void BackendImpl::revokeEntryFromDb(OUString const & url) +void BackendImpl::revokeEntryFromDb(std::u16string_view url) { if (m_backendDb) m_backendDb->revokeEntry(url); diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 578e164f13b7..7949ab353b0a 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <deque> #include <memory> +#include <string_view> #include <utility> #include "dp_configurationbackenddb.hxx" @@ -129,10 +130,10 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XCommandEnvironment> const & xCmdEnv ); #endif void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); - ::std::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url); - void revokeEntryFromDb(OUString const & url); - bool hasActiveEntry(OUString const & url); - bool activateEntry(OUString const & url); + ::std::optional<ConfigurationBackendDb::Data> readDataFromDb(std::u16string_view url); + void revokeEntryFromDb(std::u16string_view url); + bool hasActiveEntry(std::u16string_view url); + bool activateEntry(std::u16string_view url); public: BackendImpl( Sequence<Any> const & args, @@ -261,7 +262,7 @@ void BackendImpl::addDataToDb( } ::std::optional<ConfigurationBackendDb::Data> BackendImpl::readDataFromDb( - OUString const & url) + std::u16string_view url) { ::std::optional<ConfigurationBackendDb::Data> data; if (m_backendDb) @@ -269,20 +270,20 @@ void BackendImpl::addDataToDb( return data; } -void BackendImpl::revokeEntryFromDb(OUString const & url) +void BackendImpl::revokeEntryFromDb(std::u16string_view url) { if (m_backendDb) m_backendDb->revokeEntry(url); } -bool BackendImpl::hasActiveEntry(OUString const & url) +bool BackendImpl::hasActiveEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->hasActiveEntry(url); return false; } -bool BackendImpl::activateEntry(OUString const & url) +bool BackendImpl::activateEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->activateEntry(url); @@ -600,7 +601,7 @@ OUString encodeForXml( OUString const & text ) OUString replaceOrigin( - OUString const & url, OUString const & destFolder, Reference< XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & xContext, bool & out_replaced) + OUString const & url, std::u16string_view destFolder, Reference< XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & xContext, bool & out_replaced) { // looking for %origin%: ::ucbhelper::Content ucb_content( url, xCmdEnv, xContext ); @@ -671,11 +672,11 @@ OUString replaceOrigin( if (write_pos < filtered.size()) filtered.resize( write_pos ); OUString newUrl(url); - if (!destFolder.isEmpty()) + if (!destFolder.empty()) { //get the file name of the xcu and add it to the url of the temporary folder sal_Int32 i = url.lastIndexOf('/'); - newUrl = destFolder + url.subView(i); + newUrl = OUString::Concat(destFolder) + url.subView(i); } ucbhelper::Content(newUrl, xCmdEnv, xContext).writeStream( diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx index fd5d3b3c4833..0028f32ce352 100644 --- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx @@ -71,8 +71,8 @@ void ConfigurationBackendDb::addEntry(OUString const & url, Data const & data) Reference<css::xml::dom::XNode> helpNode = writeKeyElement(url); - writeSimpleElement("data-url", data.dataUrl, helpNode); - writeSimpleElement("ini-entry", data.iniEntry, helpNode); + writeSimpleElement(u"data-url", data.dataUrl, helpNode); + writeSimpleElement(u"ini-entry", data.iniEntry, helpNode); save(); } } @@ -91,7 +91,7 @@ void ConfigurationBackendDb::addEntry(OUString const & url, Data const & data) ::std::optional<ConfigurationBackendDb::Data> -ConfigurationBackendDb::getEntry(OUString const & url) +ConfigurationBackendDb::getEntry(std::u16string_view url) { try { @@ -99,8 +99,8 @@ ConfigurationBackendDb::getEntry(OUString const & url) Reference<css::xml::dom::XNode> aNode = getKeyElement(url); if (aNode.is()) { - retData.dataUrl = readSimpleElement("data-url", aNode); - retData.iniEntry = readSimpleElement("ini-entry", aNode); + retData.dataUrl = readSimpleElement(u"data-url", aNode); + retData.iniEntry = readSimpleElement(u"ini-entry", aNode); } else { diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx index 15ac91853019..bd48aab7b2f8 100644 --- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx @@ -23,6 +23,8 @@ #include <rtl/string.hxx> #include <vector> #include <optional> +#include <string_view> + #include <dp_backenddb.hxx> namespace com::sun::star::uno @@ -64,7 +66,7 @@ public: void addEntry(OUString const& url, Data const& data); - ::std::optional<Data> getEntry(OUString const& url); + ::std::optional<Data> getEntry(std::u16string_view url); std::vector<OUString> getAllDataUrls(); }; } diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index edc64b1996ef..1cd3007b25a3 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -147,7 +147,7 @@ void BackendDb::removeElement(OUString const & sXPathExpression) } } -void BackendDb::removeEntry(OUString const & url) +void BackendDb::removeEntry(std::u16string_view url) { const OUString sKeyElement = getKeyElementName(); const OUString sPrefix = getNSPrefix(); @@ -162,7 +162,7 @@ void BackendDb::removeEntry(OUString const & url) removeElement(sExpression); } -void BackendDb::revokeEntry(OUString const & url) +void BackendDb::revokeEntry(std::u16string_view url) { try { @@ -182,7 +182,7 @@ void BackendDb::revokeEntry(OUString const & url) } } -bool BackendDb::activateEntry(OUString const & url) +bool BackendDb::activateEntry(std::u16string_view url) { try { @@ -206,7 +206,7 @@ bool BackendDb::activateEntry(OUString const & url) } } -bool BackendDb::hasActiveEntry(OUString const & url) +bool BackendDb::hasActiveEntry(std::u16string_view url) { try { @@ -231,7 +231,7 @@ bool BackendDb::hasActiveEntry(OUString const & url) } Reference<css::xml::dom::XNode> BackendDb::getKeyElement( - OUString const & url) + std::u16string_view url) { try { @@ -262,10 +262,10 @@ Reference<css::xml::dom::XNode> BackendDb::getKeyElement( //Only writes the data if there is at least one entry void BackendDb::writeVectorOfPair( std::vector< std::pair< OUString, OUString > > const & vecPairs, - OUString const & sVectorTagName, - OUString const & sPairTagName, - OUString const & sFirstTagName, - OUString const & sSecondTagName, + std::u16string_view sVectorTagName, + std::u16string_view sPairTagName, + std::u16string_view sFirstTagName, + std::u16string_view sSecondTagName, css::uno::Reference<css::xml::dom::XNode> const & xParent) { try{ @@ -332,10 +332,10 @@ void BackendDb::writeVectorOfPair( std::vector< std::pair< OUString, OUString > > BackendDb::readVectorOfPair( Reference<css::xml::dom::XNode> const & parent, - OUString const & sListTagName, - OUString const & sPairTagName, - OUString const & sFirstTagName, - OUString const & sSecondTagName) + std::u16string_view sListTagName, + std::u16string_view sPairTagName, + std::u16string_view sFirstTagName, + std::u16string_view sSecondTagName) { try { @@ -378,8 +378,8 @@ BackendDb::readVectorOfPair( //Only writes the data if there is at least one entry void BackendDb::writeSimpleList( std::deque< OUString> const & list, - OUString const & sListTagName, - OUString const & sMemberTagName, + std::u16string_view sListTagName, + std::u16string_view sMemberTagName, Reference<css::xml::dom::XNode> const & xParent) { try @@ -422,7 +422,7 @@ void BackendDb::writeSimpleList( //Writes only the element if is has a value. //The prefix is automatically added to the element name void BackendDb::writeSimpleElement( - OUString const & sElementName, OUString const & value, + std::u16string_view sElementName, OUString const & value, Reference<css::xml::dom::XNode> const & xParent) { try @@ -501,7 +501,7 @@ Reference<css::xml::dom::XNode> BackendDb::writeKeyElement( } OUString BackendDb::readSimpleElement( - OUString const & sElementName, Reference<css::xml::dom::XNode> const & xParent) + std::u16string_view sElementName, Reference<css::xml::dom::XNode> const & xParent) { try { @@ -526,8 +526,8 @@ OUString BackendDb::readSimpleElement( std::deque< OUString> BackendDb::readList( Reference<css::xml::dom::XNode> const & parent, - OUString const & sListTagName, - OUString const & sMemberTagName) + std::u16string_view sListTagName, + std::u16string_view sMemberTagName) { try { @@ -558,7 +558,7 @@ std::deque< OUString> BackendDb::readList( } std::vector<OUString> BackendDb::getOneChildFromAllEntries( - OUString const & name) + std::u16string_view name) { try { diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 7631c6402a9a..f41836f8e4d0 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -19,6 +19,8 @@ #include <memory> +#include <string_view> + #include <dp_misc.h> #include <dp_backend.h> #include <dp_ucb.h> @@ -77,8 +79,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv ) override; void addDataToDb(OUString const & url); - bool hasActiveEntry(OUString const & url); - void revokeEntryFromDb(OUString const & url); + bool hasActiveEntry(std::u16string_view url); + void revokeEntryFromDb(std::u16string_view url); Reference<deployment::XPackageTypeInfo> m_xExecutableTypeInfo; std::unique_ptr<ExecutableBackendDb> m_backendDb; @@ -137,13 +139,13 @@ void BackendImpl::addDataToDb(OUString const & url) m_backendDb->addEntry(url); } -void BackendImpl::revokeEntryFromDb(OUString const & url) +void BackendImpl::revokeEntryFromDb(std::u16string_view url) { if (m_backendDb) m_backendDb->revokeEntry(url); } -bool BackendImpl::hasActiveEntry(OUString const & url) +bool BackendImpl::hasActiveEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->hasActiveEntry(url); diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 49be2a23f87d..1f1eb5f2fe90 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/util/XMacroExpander.hpp> #include <optional> +#include <string_view> using namespace ::dp_misc; using namespace ::com::sun::star; @@ -94,9 +95,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void implCollectXhpFiles( const OUString& aDir, std::vector< OUString >& o_rXhpFileVector ); - ::std::optional<HelpBackendDb::Data> readDataFromDb(OUString const & url); - bool hasActiveEntry(OUString const & url); - bool activateEntry(OUString const & url); + ::std::optional<HelpBackendDb::Data> readDataFromDb(std::u16string_view url); + bool hasActiveEntry(std::u16string_view url); + bool activateEntry(std::u16string_view url); Reference< ucb::XSimpleFileAccess3 > const & getFileAccess(); Reference< ucb::XSimpleFileAccess3 > m_xSFA; @@ -221,7 +222,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( } ::std::optional<HelpBackendDb::Data> BackendImpl::readDataFromDb( - OUString const & url) + std::u16string_view url) { ::std::optional<HelpBackendDb::Data> data; if (m_backendDb) @@ -229,14 +230,14 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( return data; } -bool BackendImpl::hasActiveEntry(OUString const & url) +bool BackendImpl::hasActiveEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->hasActiveEntry(url); return false; } -bool BackendImpl::activateEntry(OUString const & url) +bool BackendImpl::activateEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->activateEntry(url); diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index 73b7279d13de..5d208d821e07 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -70,7 +70,7 @@ void HelpBackendDb::addEntry(OUString const & url, Data const & data) Reference<css::xml::dom::XNode> helpNode = writeKeyElement(url); - writeSimpleElement("data-url", data.dataUrl, helpNode); + writeSimpleElement(u"data-url", data.dataUrl, helpNode); save(); } } @@ -88,7 +88,7 @@ void HelpBackendDb::addEntry(OUString const & url, Data const & data) ::std::optional<HelpBackendDb::Data> -HelpBackendDb::getEntry(OUString const & url) +HelpBackendDb::getEntry(std::u16string_view url) { try { @@ -96,7 +96,7 @@ HelpBackendDb::getEntry(OUString const & url) Reference<css::xml::dom::XNode> aNode = getKeyElement(url); if (aNode.is()) { - retData.dataUrl = readSimpleElement("data-url", aNode); + retData.dataUrl = readSimpleElement(u"data-url", aNode); } else { @@ -118,7 +118,7 @@ HelpBackendDb::getEntry(OUString const & url) std::vector<OUString> HelpBackendDb::getAllDataUrls() { - return getOneChildFromAllEntries("data-url"); + return getOneChildFromAllEntries(u"data-url"); } } // namespace dp_registry::backend::help diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx index 60172f32e6f3..a46bd8663cd7 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -21,6 +21,8 @@ #include <rtl/ustring.hxx> #include <optional> +#include <string_view> + #include <dp_backenddb.hxx> namespace com::sun::star::uno @@ -58,7 +60,7 @@ public: void addEntry(OUString const& url, Data const& data); - ::std::optional<Data> getEntry(OUString const& url); + ::std::optional<Data> getEntry(std::u16string_view url); //must also return the data urls for entries with @active="false". That is, //those are currently revoked. std::vector<OUString> getAllDataUrls(); diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx index 7c8d5397fb1d..785201466772 100644 --- a/desktop/source/deployment/registry/inc/dp_backenddb.hxx +++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <rtl/ustring.hxx> #include <deque> +#include <string_view> #include <vector> namespace com::sun::star { @@ -66,50 +67,50 @@ protected: void removeElement(OUString const & sXPathExpression); css::uno::Reference<css::xml::dom::XNode> getKeyElement( - OUString const & url); + std::u16string_view url); void writeSimpleList( std::deque< OUString> const & list, - OUString const & sListTagName, - OUString const & sMemberTagName, + std::u16string_view sListTagName, + std::u16string_view sMemberTagName, css::uno::Reference<css::xml::dom::XNode> const & xParent); void writeVectorOfPair( std::vector< std::pair< OUString, OUString > > const & vecPairs, - OUString const & sVectorTagName, - OUString const & sPairTagName, - OUString const & sFirstTagName, - OUString const & sSecondTagName, + std::u16string_view sVectorTagName, + std::u16string_view sPairTagName, + std::u16string_view sFirstTagName, + std::u16string_view sSecondTagName, css::uno::Reference<css::xml::dom::XNode> const & xParent); void writeSimpleElement( - OUString const & sElementName, OUString const & value, + std::u16string_view sElementName, OUString const & value, css::uno::Reference<css::xml::dom::XNode> const & xParent); css::uno::Reference<css::xml::dom::XNode> writeKeyElement( OUString const & url); OUString readSimpleElement( - OUString const & sElementName, + std::u16string_view sElementName, css::uno::Reference<css::xml::dom::XNode> const & xParent); std::vector< std::pair< OUString, OUString > > readVectorOfPair( css::uno::Reference<css::xml::dom::XNode> const & parent, - OUString const & sListTagName, - OUString const & sPairTagName, - OUString const & sFirstTagName, - OUString const & sSecondTagName); + std::u16string_view sListTagName, + std::u16string_view sPairTagName, + std::u16string_view sFirstTagName, + std::u16string_view sSecondTagName); std::deque< OUString> readList( css::uno::Reference<css::xml::dom::XNode> const & parent, - OUString const & sListTagName, - OUString const & sMemberTagName); + std::u16string_view sListTagName, + std::u16string_view sMemberTagName); /* returns the values of one particularly child element of all key elements. */ std::vector< OUString> getOneChildFromAllEntries( - OUString const & sElementName); + std::u16string_view sElementName); /* returns the namespace which is to be written as xmlns attribute @@ -133,18 +134,18 @@ public: OUString const & url); virtual ~BackendDb() {}; - void removeEntry(OUString const & url); + void removeEntry(std::u16string_view url); /* This is called to write the "revoked" attribute to the entry. This is done when XPackage::revokePackage is called. */ - void revokeEntry(OUString const & url); + void revokeEntry(std::u16string_view url); /* returns false if the entry does not exist yet. */ - bool activateEntry(OUString const & url); + bool activateEntry(std::u16string_view url); - bool hasActiveEntry(OUString const & url); + bool hasActiveEntry(std::u16string_view url); }; diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx index c96d1466b51f..ac4180f87f70 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx @@ -68,8 +68,8 @@ void ExtensionBackendDb::addEntry(OUString const & url, Data const & data) if (!activateEntry(url)) { Reference<css::xml::dom::XNode> extensionNodeNode = writeKeyElement(url); - writeVectorOfPair( data.items, "extension-items", "item", - "url", "media-type", extensionNodeNode); + writeVectorOfPair( data.items, u"extension-items", u"item", + u"url", u"media-type", extensionNodeNode); save(); } } @@ -82,7 +82,7 @@ void ExtensionBackendDb::addEntry(OUString const & url, Data const & data) } } -ExtensionBackendDb::Data ExtensionBackendDb::getEntry(OUString const & url) +ExtensionBackendDb::Data ExtensionBackendDb::getEntry(std::u16string_view url) { try { @@ -92,8 +92,8 @@ ExtensionBackendDb::Data ExtensionBackendDb::getEntry(OUString const & url) if (aNode.is()) { retData.items = - readVectorOfPair( aNode, "extension-items", "item", - "url", "media-type"); + readVectorOfPair( aNode, u"extension-items", u"item", + u"url", u"media-type"); } return retData; } diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx index c9a607e7a8c0..fb736e6e260c 100644 --- a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx +++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx @@ -19,6 +19,9 @@ #pragma once +#include <sal/config.h> + +#include <string_view> #include <utility> #include <vector> @@ -59,7 +62,7 @@ public: void addEntry(OUString const& url, Data const& data); - Data getEntry(OUString const& url); + Data getEntry(std::u16string_view url); }; } diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index e0adb4395f4c..0f20a9203ea6 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -69,6 +69,7 @@ #include <algorithm> #include <memory> +#include <string_view> #include <vector> #include "dp_extbackenddb.hxx" @@ -214,8 +215,8 @@ class BackendImpl : public ImplBaseT std::unique_ptr<ExtensionBackendDb> m_backendDb; void addDataToDb(OUString const & url, ExtensionBackendDb::Data const & data); - ExtensionBackendDb::Data readDataFromDb(OUString const & url); - void revokeEntryFromDb(OUString const & url); + ExtensionBackendDb::Data readDataFromDb(std::u16string_view url); + void revokeEntryFromDb(std::u16string_view url); // PackageRegistryBackend virtual Reference<deployment::XPackage> bindPackage_( @@ -419,7 +420,7 @@ void BackendImpl::addDataToDb( } ExtensionBackendDb::Data BackendImpl::readDataFromDb( - OUString const & url) + std::u16string_view url) { ExtensionBackendDb::Data data; if (m_backendDb) @@ -427,7 +428,7 @@ ExtensionBackendDb::Data BackendImpl::readDataFromDb( return data; } -void BackendImpl::revokeEntryFromDb(OUString const & url) +void BackendImpl::revokeEntryFromDb(std::u16string_view url) { if (m_backendDb) m_backendDb->revokeEntry(url); diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index e4fd8e07fead..fa0cc83d0618 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -28,6 +28,8 @@ #include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/script/XLibraryContainer3.hpp> #include <memory> +#include <string_view> + #include "dp_scriptbackenddb.hxx" #include <cppuhelper/supportsservice.hxx> @@ -81,8 +83,8 @@ class BackendImpl : public t_helper Reference<XCommandEnvironment> const & xCmdEnv ) override; void addDataToDb(OUString const & url); - bool hasActiveEntry(OUString const & url); - void revokeEntryFromDb(OUString const & url); + bool hasActiveEntry(std::u16string_view url); + void revokeEntryFromDb(std::u16string_view url); const Reference<deployment::XPackageTypeInfo> m_xBasicLibTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xDialogLibTypeInfo; @@ -189,7 +191,7 @@ void BackendImpl::addDataToDb(OUString const & url) m_backendDb->addEntry(url); } -bool BackendImpl::hasActiveEntry(OUString const & url) +bool BackendImpl::hasActiveEntry(std::u16string_view url) { if (m_backendDb) return m_backendDb->hasActiveEntry(url); @@ -210,7 +212,7 @@ BackendImpl::getSupportedPackageTypes() { return m_typeInfos; } -void BackendImpl::revokeEntryFromDb(OUString const & url) +void BackendImpl::revokeEntryFromDb(std::u16string_view url) { if (m_backendDb) m_backendDb->revokeEntry(url); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2b87faecc677..a512f33868ac 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -946,12 +946,12 @@ VclPtr<Window> getSidebarWindow() // Could be anonymous in principle, but for the unit testing purposes, we // declare it in init.hxx. -OUString desktop::extractParameter(OUString& rOptions, const OUString& rName) +OUString desktop::extractParameter(OUString& rOptions, std::u16string_view rName) { OUString aValue; - OUString aNameEquals(rName + "="); - OUString aCommaNameEquals("," + rName + "="); + OUString aNameEquals(OUString::Concat(rName) + "="); + OUString aCommaNameEquals(OUString::Concat(",") + rName + "="); int nIndex = -1; if (rOptions.startsWith(aNameEquals)) @@ -2212,7 +2212,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, // 'Language=...' is an option that LOK consumes by itself, and does // not pass it as a parameter to the filter OUString aOptions = getUString(pOptions); - const OUString aLanguage = extractParameter(aOptions, "Language"); + const OUString aLanguage = extractParameter(aOptions, u"Language"); bool isValidLangTag = LanguageTag::isValidBcp47(aLanguage, nullptr); if (!aLanguage.isEmpty() && isValidLangTag) @@ -2230,7 +2230,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, SvNumberFormatter::resetTheCurrencyTable(); } - const OUString aDeviceFormFactor = extractParameter(aOptions, "DeviceFormFactor"); + const OUString aDeviceFormFactor = extractParameter(aOptions, u"DeviceFormFactor"); SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor); uno::Sequence<css::beans::PropertyValue> aFilterOptions(3); @@ -5128,7 +5128,7 @@ static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis, SetLastExceptionMsg(); OUString aOptions = getUString(pOptions); - const OUString aLanguage = extractParameter(aOptions, "Language"); + const OUString aLanguage = extractParameter(aOptions, u"Language"); if (!aLanguage.isEmpty()) { @@ -5137,7 +5137,7 @@ static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis, comphelper::LibreOfficeKit::setLocale(LanguageTag(aLanguage)); } - const OUString aDeviceFormFactor = extractParameter(aOptions, "DeviceFormFactor"); + const OUString aDeviceFormFactor = extractParameter(aOptions, u"DeviceFormFactor"); SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor); LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); @@ -6028,9 +6028,9 @@ public: } }; -static void activateNotebookbar(const OUString& rApp) +static void activateNotebookbar(std::u16string_view rApp) { - OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" + rApp; + OUString aPath = OUString::Concat("org.openoffice.Office.UI.ToolbarMode/Applications/") + rApp; const utl::OConfigurationTreeRoot aAppNode(xContext, aPath, true); @@ -6354,9 +6354,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (bNotebookbar) { - activateNotebookbar("Writer"); - activateNotebookbar("Calc"); - activateNotebookbar("Impress"); + activateNotebookbar(u"Writer"); + activateNotebookbar(u"Calc"); + activateNotebookbar(u"Impress"); } return bInitialized; diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 1d4907b9a263..2180695d85b7 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> #include <strings.hrc> #include <dp_misc.h> @@ -64,7 +67,7 @@ class CommandEnvironmentImpl /// @throws RuntimeException void update_( Any const & Status ); - void printLicense(std::u16string_view sName,const OUString& sLicense, + void printLicense(std::u16string_view sName,std::u16string_view sLicense, bool & accept, bool & decline); public: @@ -125,7 +128,7 @@ CommandEnvironmentImpl::~CommandEnvironmentImpl() //May throw exceptions void CommandEnvironmentImpl::printLicense( - std::u16string_view sName, const OUString& sLicense, bool & accept, bool &decline) + std::u16string_view sName, std::u16string_view sLicense, bool & accept, bool &decline) { OUString s1tmp(DpResId(RID_STR_UNOPKG_ACCEPT_LIC_1)); OUString s1(s1tmp.replaceAll("$NAME", sName)); diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 3b16dc59855e..6861f6459cc0 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -232,10 +232,10 @@ void printf_space( sal_Int32 space ) void printf_line( - OUString const & name, OUString const & value, sal_Int32 level ) + std::u16string_view name, std::u16string_view value, sal_Int32 level ) { printf_space( level ); - dp_misc::writeConsole(OUString(name + ": " + value + "\n")); + dp_misc::writeConsole(OUString(OUString::Concat(name) + ": " + value + "\n")); } @@ -249,11 +249,11 @@ void printf_package( true, dp_misc::getIdentifier( xPackage ) ) : xPackage->getIdentifier() ); if (id.IsPresent) - printf_line( "Identifier", id.Value, level ); + printf_line( u"Identifier", id.Value, level ); OUString version(xPackage->getVersion()); if (!version.isEmpty()) - printf_line( "Version", version, level + 1 ); - printf_line( "URL", xPackage->getURL(), level + 1 ); + printf_line( u"Version", version, level + 1 ); + printf_line( u"URL", xPackage->getURL(), level + 1 ); beans::Optional< beans::Ambiguous<sal_Bool> > option( xPackage->isRegistered( Reference<task::XAbortChannel>(), xCmdEnv ) ); @@ -267,15 +267,15 @@ void printf_package( } else value = "n/a"; - printf_line( "is registered", value, level + 1 ); + printf_line( u"is registered", value, level + 1 ); const Reference<deployment::XPackageTypeInfo> xPackageType( xPackage->getPackageType() ); OSL_ASSERT( xPackageType.is() ); if (xPackageType.is()) { - printf_line( "Media-Type", xPackageType->getMediaType(), level + 1 ); + printf_line( u"Media-Type", xPackageType->getMediaType(), level + 1 ); } - printf_line( "Description", xPackage->getDescription(), level + 1 ); + printf_line( u"Description", xPackage->getDescription(), level + 1 ); if (!xPackage->isBundle()) return; @@ -298,7 +298,7 @@ static void printf_unaccepted_licenses( { OUString id( dp_misc::getIdentifier(ext) ); - printf_line( "Identifier", id, 0 ); + printf_line( u"Identifier", id, 0 ); printf_space(1); dp_misc::writeConsole(u"License not accepted\n\n"); } |