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 /fpicker | |
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 'fpicker')
-rw-r--r-- | fpicker/qa/unit/fpicker-dialogs-test.cxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 16 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.hxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/iodlgimp.cxx | 8 |
4 files changed, 18 insertions, 12 deletions
diff --git a/fpicker/qa/unit/fpicker-dialogs-test.cxx b/fpicker/qa/unit/fpicker-dialogs-test.cxx index 8c8a78df00e5..dfce816df62d 100644 --- a/fpicker/qa/unit/fpicker-dialogs-test.cxx +++ b/fpicker/qa/unit/fpicker-dialogs-test.cxx @@ -51,7 +51,7 @@ VclPtr<VclAbstractDialog> FpickerDialogsTest::createDialogByID(sal_uInt32 /*nID* void FpickerDialogsTest::openAnyDialog() { /// process input file containing the UXMLDescriptions of the dialogs to dump - processDialogBatchFile("fpicker/qa/unit/data/fpicker-dialogs-test.txt"); + processDialogBatchFile(u"fpicker/qa/unit/data/fpicker-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(FpickerDialogsTest); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index cabdd16af71d..cbb354ecf585 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -75,6 +75,7 @@ #include <algorithm> #include <memory> +#include <string_view> using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; @@ -142,20 +143,21 @@ namespace } - void SetFsysExtension_Impl( OUString& rFile, const OUString& rExtension ) + void SetFsysExtension_Impl( OUString& rFile, std::u16string_view rExtension ) { const sal_Int32 nDotPos{ rFile.lastIndexOf('.') }; if (nDotPos>=0) { - if (!rExtension.isEmpty()) - rFile = rFile.subView(0, nDotPos) + rExtension; // replace old extension with new (not empty) one + if (!rExtension.empty()) + rFile = OUString::Concat(rFile.subView(0, nDotPos)) + rExtension; // replace old extension with new (not empty) one else if (nDotPos) rFile = rFile.copy(0, nDotPos-1); // truncate extension (new one is empty) else rFile.clear(); // Filename was just an extension } - else if (!rExtension.isEmpty()) - rFile += "." + rExtension; // no extension was present, append new one if not empty + else if (!rExtension.empty()) + rFile += OUString::Concat(".") + rExtension; + // no extension was present, append new one if not empty } void lcl_autoUpdateFileExtension( SvtFileDialog* _pDialog, const OUString& _rLastFilterExt ) @@ -2252,7 +2254,7 @@ bool SvtFileDialog::ContentGetTitle( const OUString& rURL, OUString& rTitle ) } void SvtFileDialog::appendDefaultExtension(OUString& rFileName, - const OUString& rFilterDefaultExtension, + std::u16string_view rFilterDefaultExtension, const OUString& rFilterExtensions) { const OUString aType(rFilterExtensions.toAsciiLowerCase()); @@ -2275,7 +2277,7 @@ void SvtFileDialog::appendDefaultExtension(OUString& rFileName, } while (nPos>=0); - rFileName += "." + rFilterDefaultExtension; + rFileName += OUString::Concat(".") + rFilterDefaultExtension; } void SvtFileDialog::initDefaultPlaces( ) diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 12f1d1bd7ca2..32ff56462151 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -33,7 +33,7 @@ #include <vcl/timer.hxx> #include <set> - +#include <string_view> class SvtFileView; class SvtFileDialogFilter_Impl; @@ -256,7 +256,7 @@ private: */ static void appendDefaultExtension( OUString& _rFileName, - const OUString& _rFilterDefaultExtension, + std::u16string_view _rFilterDefaultExtension, const OUString& _rFilterExtensions); void initDefaultPlaces( ); diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index eef79a9a2233..86b43c038a5b 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "fileview.hxx" #include "iodlgimp.hxx" #include <tools/debug.hxx> @@ -136,9 +140,9 @@ void SvtExpFileDlg_Impl::SetStandardDir( const OUString& _rDir ) } namespace { - OUString lcl_DecoratedFilter( const OUString& _rOriginalFilter ) + OUString lcl_DecoratedFilter( std::u16string_view _rOriginalFilter ) { - return "<" + _rOriginalFilter + ">"; + return "<" + OUString::Concat(_rOriginalFilter) + ">"; } } |