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 /vcl | |
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 'vcl')
31 files changed, 264 insertions, 201 deletions
diff --git a/vcl/inc/unx/printerjob.hxx b/vcl/inc/unx/printerjob.hxx index 33f92abc7be8..c39bb1e3d2d2 100644 --- a/vcl/inc/unx/printerjob.hxx +++ b/vcl/inc/unx/printerjob.hxx @@ -23,6 +23,7 @@ #include <jobdata.hxx> #include <osl/file.hxx> +#include <string_view> #include <vector> namespace psp { @@ -68,8 +69,8 @@ private: bool m_bQuickJob; private: - std::unique_ptr<osl::File> CreateSpoolFile (const OUString& rName, - const OUString& rExtension); + std::unique_ptr<osl::File> CreateSpoolFile (std::u16string_view rName, + std::u16string_view rExtension); void InitPaperSize (const JobData& rJobSetup); bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup ); diff --git a/vcl/qa/api/XGraphicTest.cxx b/vcl/qa/api/XGraphicTest.cxx index 3694e52ce38f..2dfe4f132346 100644 --- a/vcl/qa/api/XGraphicTest.cxx +++ b/vcl/qa/api/XGraphicTest.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <test/bootstrapfixture.hxx> #include <com/sun/star/graphic/XGraphic.hpp> @@ -32,7 +36,7 @@ public: { } - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } @@ -113,7 +117,7 @@ void XGraphicTest::testGraphicDescriptor() void XGraphicTest::testGraphicProvider() { - OUString aGraphicURL = getFullUrl("TestGraphic.png"); + OUString aGraphicURL = getFullUrl(u"TestGraphic.png"); { // Load lazy uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx b/vcl/qa/cppunit/BitmapFilterTest.cxx index 4a697150c4e5..09831169e656 100644 --- a/vcl/qa/cppunit/BitmapFilterTest.cxx +++ b/vcl/qa/cppunit/BitmapFilterTest.cxx @@ -20,6 +20,7 @@ #include <BitmapSymmetryCheck.hxx> #include <chrono> +#include <string_view> namespace { @@ -47,12 +48,12 @@ public: CPPUNIT_TEST_SUITE_END(); private: - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { - return m_directories.getURLFromSrc("vcl/qa/cppunit/data/") + sFileName; + return m_directories.getURLFromSrc(u"vcl/qa/cppunit/data/") + sFileName; } - BitmapEx loadBitmap(const OUString& sFileName) + BitmapEx loadBitmap(std::u16string_view sFileName) { Graphic aGraphic; const OUString aURL(getFullUrl(sFileName)); @@ -136,11 +137,13 @@ void BitmapFilterTest::testBlurCorrectness() void BitmapFilterTest::testBasicMorphology() { - const BitmapEx aOrigBitmap = loadBitmap("testBasicMorphology.png"); - const BitmapEx aRefBitmapDilated1 = loadBitmap("testBasicMorphologyDilated1.png"); - const BitmapEx aRefBitmapDilated1Eroded1 = loadBitmap("testBasicMorphologyDilated1Eroded1.png"); - const BitmapEx aRefBitmapDilated2 = loadBitmap("testBasicMorphologyDilated2.png"); - const BitmapEx aRefBitmapDilated2Eroded1 = loadBitmap("testBasicMorphologyDilated2Eroded1.png"); + const BitmapEx aOrigBitmap = loadBitmap(u"testBasicMorphology.png"); + const BitmapEx aRefBitmapDilated1 = loadBitmap(u"testBasicMorphologyDilated1.png"); + const BitmapEx aRefBitmapDilated1Eroded1 + = loadBitmap(u"testBasicMorphologyDilated1Eroded1.png"); + const BitmapEx aRefBitmapDilated2 = loadBitmap(u"testBasicMorphologyDilated2.png"); + const BitmapEx aRefBitmapDilated2Eroded1 + = loadBitmap(u"testBasicMorphologyDilated2Eroded1.png"); BitmapEx aTransformBitmap = aOrigBitmap; BitmapFilter::Filter(aTransformBitmap, BitmapDilateFilter(1)); diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx index 1ce516bf52b3..f4f4698b28a9 100644 --- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx +++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <cppunit/TestAssert.h> #include <cppunit/extensions/HelperMacros.h> #include <unotest/bootstrapfixturebase.hxx> @@ -22,9 +26,9 @@ namespace { class GraphicFormatDetectorTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { - return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName; + return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/data/") + sFileName; } void testDetectMET(); @@ -70,7 +74,7 @@ class GraphicFormatDetectorTest : public test::BootstrapFixtureBase void GraphicFormatDetectorTest::testDetectMET() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.met"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.met"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "MET"); CPPUNIT_ASSERT(aDetector.detect()); @@ -85,7 +89,7 @@ void GraphicFormatDetectorTest::testDetectMET() void GraphicFormatDetectorTest::testDetectBMP() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.bmp"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.bmp"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "BMP"); CPPUNIT_ASSERT(aDetector.detect()); @@ -100,7 +104,7 @@ void GraphicFormatDetectorTest::testDetectBMP() void GraphicFormatDetectorTest::testDetectWMF() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.wmf"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.wmf"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "WMF"); CPPUNIT_ASSERT(aDetector.detect()); @@ -115,7 +119,7 @@ void GraphicFormatDetectorTest::testDetectWMF() void GraphicFormatDetectorTest::testDetectPCX() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.pcx"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.pcx"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "PCX"); CPPUNIT_ASSERT(aDetector.detect()); @@ -130,7 +134,7 @@ void GraphicFormatDetectorTest::testDetectPCX() void GraphicFormatDetectorTest::testDetectJPG() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.jpg"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "JPG"); CPPUNIT_ASSERT(aDetector.detect()); @@ -145,7 +149,7 @@ void GraphicFormatDetectorTest::testDetectJPG() void GraphicFormatDetectorTest::testDetectPNG() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.png"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.png"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "PNG"); CPPUNIT_ASSERT(aDetector.detect()); @@ -160,7 +164,7 @@ void GraphicFormatDetectorTest::testDetectPNG() void GraphicFormatDetectorTest::testDetectGIF() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.gif"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.gif"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "GIF"); CPPUNIT_ASSERT(aDetector.detect()); @@ -175,7 +179,7 @@ void GraphicFormatDetectorTest::testDetectGIF() void GraphicFormatDetectorTest::testDetectPSD() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.psd"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.psd"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "PSD"); CPPUNIT_ASSERT(aDetector.detect()); @@ -190,7 +194,7 @@ void GraphicFormatDetectorTest::testDetectPSD() void GraphicFormatDetectorTest::testDetectTGA() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.tga"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.tga"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "TGA"); CPPUNIT_ASSERT(aDetector.detect()); @@ -205,7 +209,7 @@ void GraphicFormatDetectorTest::testDetectTGA() void GraphicFormatDetectorTest::testDetectTIF() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.tif"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.tif"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "TIF"); CPPUNIT_ASSERT(aDetector.detect()); @@ -220,7 +224,7 @@ void GraphicFormatDetectorTest::testDetectTIF() void GraphicFormatDetectorTest::testDetectXBM() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.xbm"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.xbm"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "XBM"); CPPUNIT_ASSERT(aDetector.detect()); @@ -235,7 +239,7 @@ void GraphicFormatDetectorTest::testDetectXBM() void GraphicFormatDetectorTest::testDetectXPM() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.xpm"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.xpm"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "XPM"); CPPUNIT_ASSERT(aDetector.detect()); @@ -250,7 +254,7 @@ void GraphicFormatDetectorTest::testDetectXPM() void GraphicFormatDetectorTest::testDetectSVG() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.svg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.svg"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "SVG"); CPPUNIT_ASSERT(aDetector.detect()); @@ -265,7 +269,7 @@ void GraphicFormatDetectorTest::testDetectSVG() void GraphicFormatDetectorTest::testDetectSVGZ() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.svgz"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.svgz"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "SVG"); CPPUNIT_ASSERT(aDetector.detect()); @@ -280,7 +284,7 @@ void GraphicFormatDetectorTest::testDetectSVGZ() void GraphicFormatDetectorTest::testDetectPDF() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.pdf"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.pdf"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "PDF"); CPPUNIT_ASSERT(aDetector.detect()); @@ -295,7 +299,7 @@ void GraphicFormatDetectorTest::testDetectPDF() void GraphicFormatDetectorTest::testDetectEPS() { - SvFileStream aFileStream(getFullUrl("TypeDetectionExample.eps"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.eps"), StreamMode::READ); vcl::GraphicFormatDetector aDetector(aFileStream, "EPS"); CPPUNIT_ASSERT(aDetector.detect()); diff --git a/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx index 42683a1a3f06..49bf55fa9f4d 100644 --- a/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx +++ b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <cppunit/TestAssert.h> #include <cppunit/extensions/HelperMacros.h> #include <unotest/bootstrapfixturebase.hxx> @@ -21,9 +25,9 @@ namespace { class GraphicNativeMetadataTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { - return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName; + return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/data/") + sFileName; } void testReadFromGraphic(); @@ -37,7 +41,7 @@ class GraphicNativeMetadataTest : public test::BootstrapFixtureBase void GraphicNativeMetadataTest::testReadFromGraphic() { - SvFileStream aFileStream(getFullUrl("Exif1_180.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"Exif1_180.jpg"), StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); // don't load the graphic, but try to get the metadata @@ -66,28 +70,28 @@ void GraphicNativeMetadataTest::testExifRotationJpeg() { { // No rotation in metadata - SvFileStream aFileStream(getFullUrl("Exif1.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"Exif1.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aMetadata.getRotation().get()); } { // Rotation 90 degree clock-wise = 270 degree counter-clock-wise - SvFileStream aFileStream(getFullUrl("Exif1_090CW.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"Exif1_090CW.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); CPPUNIT_ASSERT_EQUAL(sal_Int16(2700), aMetadata.getRotation().get()); } { // Rotation 180 degree - SvFileStream aFileStream(getFullUrl("Exif1_180.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"Exif1_180.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), aMetadata.getRotation().get()); } { // Rotation 270 degree clock-wise = 90 degree counter-clock-wise - SvFileStream aFileStream(getFullUrl("Exif1_270CW.jpg"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"Exif1_270CW.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aMetadata.getRotation().get()); diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 538995ff5dd2..b1f6b77ef5c2 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -338,7 +338,7 @@ void GraphicTest::testWMFRoundtrip() { // Load a WMF file. test::Directories aDirectories; - OUString aURL = aDirectories.getURLFromSrc("vcl/qa/cppunit/data/roundtrip.wmf"); + OUString aURL = aDirectories.getURLFromSrc(u"vcl/qa/cppunit/data/roundtrip.wmf"); SvFileStream aStream(aURL, StreamMode::READ); sal_uInt64 nExpectedSize = aStream.TellEnd(); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index 577f73ed1130..88bbf9978da2 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -11,6 +11,8 @@ #if HAVE_FEATURE_PDFIUM +#include <string_view> + #include <cppunit/TestAssert.h> #include <cppunit/extensions/HelperMacros.h> @@ -28,9 +30,9 @@ class PDFiumLibraryTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { - return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName; + return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/data/") + sFileName; } void testDocument(); @@ -54,7 +56,7 @@ class PDFiumLibraryTest : public test::BootstrapFixtureBase void PDFiumLibraryTest::testDocument() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -82,7 +84,7 @@ void PDFiumLibraryTest::testDocument() void PDFiumLibraryTest::testPages() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -108,7 +110,7 @@ void PDFiumLibraryTest::testPages() void PDFiumLibraryTest::testPageObjects() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -158,7 +160,7 @@ void PDFiumLibraryTest::testPageObjects() void PDFiumLibraryTest::testAnnotationsMadeInEvince() { - OUString aURL = getFullUrl("PangramWithAnnotations.pdf"); + OUString aURL = getFullUrl(u"PangramWithAnnotations.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -215,7 +217,7 @@ void PDFiumLibraryTest::testAnnotationsMadeInEvince() void PDFiumLibraryTest::testAnnotationsMadeInAcrobat() { - OUString aURL = getFullUrl("PangramAcrobatAnnotations.pdf"); + OUString aURL = getFullUrl(u"PangramAcrobatAnnotations.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -293,7 +295,7 @@ void PDFiumLibraryTest::testAnnotationsMadeInAcrobat() void PDFiumLibraryTest::testAnnotationsDifferentTypes() { - OUString aURL = getFullUrl("PangramWithMultipleTypeOfAnnotations.pdf"); + OUString aURL = getFullUrl(u"PangramWithMultipleTypeOfAnnotations.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx index 0659e4e62dcf..e539c5a81636 100644 --- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx +++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx @@ -11,6 +11,8 @@ #if HAVE_FEATURE_PDFIUM +#include <string_view> + #include <cppunit/TestAssert.h> #include <cppunit/extensions/HelperMacros.h> @@ -24,9 +26,9 @@ class VectorGraphicSearchTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { - return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName; + return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/data/") + sFileName; } void test(); @@ -46,7 +48,7 @@ class VectorGraphicSearchTest : public test::BootstrapFixtureBase void VectorGraphicSearchTest::test() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -97,7 +99,7 @@ void VectorGraphicSearchTest::test() // between search matches. void VectorGraphicSearchTest::testNextPrevious() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -173,7 +175,7 @@ void VectorGraphicSearchTest::testNextPrevious() void VectorGraphicSearchTest::testSearchStringChange() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -204,7 +206,7 @@ void VectorGraphicSearchTest::testSearchStringChange() void VectorGraphicSearchTest::testSearchMatchWholeWord() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); @@ -243,7 +245,7 @@ void VectorGraphicSearchTest::testSearchMatchWholeWord() void VectorGraphicSearchTest::testSearchMatchCase() { - OUString aURL = getFullUrl("Pangram.pdf"); + OUString aURL = getFullUrl(u"Pangram.pdf"); SvFileStream aStream(aURL, StreamMode::READ); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index 10e6f82fc219..201d10e56fd3 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <test/bootstrapfixture.hxx> #include <vcl/virdev.hxx> @@ -25,7 +29,7 @@ constexpr OUStringLiteral gaDataUrl = u"/vcl/qa/cppunit/bitmaprender/data/"; class BitmapRenderTest : public test::BootstrapFixture { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } @@ -62,7 +66,7 @@ void BitmapRenderTest::testTdf104141() // Load animated GIF and draw it on green background GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; - const OUString aURL(getFullUrl("tdf104141.gif")); + const OUString aURL(getFullUrl(u"tdf104141.gif")); SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); @@ -85,7 +89,7 @@ void BitmapRenderTest::testTdf113918() GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; - const OUString aURL(getFullUrl("tdf113918.png")); + const OUString aURL(getFullUrl(u"tdf113918.png")); SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); @@ -128,7 +132,7 @@ void BitmapRenderTest::testDrawAlphaBitmapEx() CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(1, 1))); CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(2, 2))); - SvFileStream aFileStream(getFullUrl("ImageRGBA.png"), StreamMode::READ); + SvFileStream aFileStream(getFullUrl(u"ImageRGBA.png"), StreamMode::READ); vcl::PngImageReader aPngReader(aFileStream); BitmapEx aBitmapEx; @@ -238,7 +242,7 @@ void BitmapRenderTest::testTdf116888() // didn't properly release mpUserBuffer after ReadTexture() failure. GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); Graphic aGraphic; - const OUString aURL(getFullUrl("tdf116888.gif")); + const OUString aURL(getFullUrl(u"tdf116888.gif")); SvFileStream aFileStream(aURL, StreamMode::READ); ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult); diff --git a/vcl/qa/cppunit/blocklistparsertest.cxx b/vcl/qa/cppunit/blocklistparsertest.cxx index 0c221ba776a8..689e8d9c9e24 100644 --- a/vcl/qa/cppunit/blocklistparsertest.cxx +++ b/vcl/qa/cppunit/blocklistparsertest.cxx @@ -40,7 +40,7 @@ void BlocklistParserTest::testParse() { std::vector<DriverInfo> aDriveInfos; - Parser aBlocklistParser(m_directories.getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_parse.xml", + Parser aBlocklistParser(m_directories.getURLFromSrc(u"vcl/qa/cppunit/") + "test_blocklist_parse.xml", aDriveInfos, VersionType::OpenGL); aBlocklistParser.parse(); @@ -98,7 +98,7 @@ void BlocklistParserTest::testEvaluate() { std::vector<DriverInfo> aDriveInfos; - Parser aBlocklistParser(m_directories.getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_evaluate.xml", + Parser aBlocklistParser(m_directories.getURLFromSrc(u"vcl/qa/cppunit/") + "test_blocklist_evaluate.xml", aDriveInfos, VersionType::OpenGL); aBlocklistParser.parse(); @@ -150,7 +150,7 @@ void BlocklistParserTest::testVulkan() { std::vector<DriverInfo> aDriveInfos; - Parser aBlocklistParser(m_directories.getURLFromSrc("vcl/qa/cppunit/") + "test_blocklist_vulkan.xml", + Parser aBlocklistParser(m_directories.getURLFromSrc(u"vcl/qa/cppunit/") + "test_blocklist_vulkan.xml", aDriveInfos, VersionType::Vulkan); aBlocklistParser.parse(); diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index fe7485e3944a..5a4443f1075a 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -150,31 +150,31 @@ void VclFiltersTest::testCVEs() { #ifndef DISABLE_CVE_TESTS testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/wmf/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/wmf/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/emf/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/emf/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/png/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/png/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/jpg/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/jpg/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/gif/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/gif/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/bmp/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/bmp/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xbm/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/xbm/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/xpm/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/xpm/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/svm/")); + m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/svm/")); #endif } diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx index 2ed23db8dbeb..0900c02d4bb5 100644 --- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx @@ -8,6 +8,10 @@ * */ +#include <sal/config.h> + +#include <string_view> + #include <unotest/bootstrapfixturebase.hxx> #include <vcl/graphicfilter.hxx> #include <bitmap/BitmapWriteAccess.hxx> @@ -17,7 +21,7 @@ constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/"); class JpegReaderTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } @@ -112,7 +116,7 @@ Graphic JpegReaderTest::loadJPG(const OUString& aURL) void JpegReaderTest::testReadRGB() { - Graphic aGraphic = loadJPG(getFullUrl("JPEGTestRGB.jpeg")); + Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestRGB.jpeg")); Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); @@ -129,7 +133,7 @@ void JpegReaderTest::testReadRGB() void JpegReaderTest::testReadGray() { - Graphic aGraphic = loadJPG(getFullUrl("JPEGTestGray.jpeg")); + Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestGray.jpeg")); Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); @@ -149,7 +153,7 @@ void JpegReaderTest::testReadGray() void JpegReaderTest::testReadCMYK() { - Graphic aGraphic = loadJPG(getFullUrl("JPEGTestCMYK.jpeg")); + Graphic aGraphic = loadJPG(getFullUrl(u"JPEGTestCMYK.jpeg")); Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(12), aSize.Width()); @@ -166,7 +170,7 @@ void JpegReaderTest::testReadCMYK() void JpegReaderTest::testTdf138950() { - Graphic aGraphic = loadJPG(getFullUrl("tdf138950.jpeg")); + Graphic aGraphic = loadJPG(getFullUrl(u"tdf138950.jpeg")); Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap(); Size aSize = aBitmap.GetSizePixel(); CPPUNIT_ASSERT_EQUAL(tools::Long(720), aSize.Width()); diff --git a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx index 234b2ea14514..b2144fe3b47e 100644 --- a/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx +++ b/vcl/qa/cppunit/jpeg/JpegWriterTest.cxx @@ -8,6 +8,10 @@ * */ +#include <sal/config.h> + +#include <string_view> + #include <unotest/bootstrapfixturebase.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/BitmapReadAccess.hxx> @@ -17,7 +21,7 @@ constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/"); class JpegWriterTest : public test::BootstrapFixtureBase { - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } @@ -66,7 +70,7 @@ BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap) void JpegWriterTest::testWrite8BitGrayscale() { - Bitmap bitmap = roundtripJPG(getFullUrl("8BitGrayscale.jpg")).GetBitmap(); + Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitGrayscale.jpg")).GetBitmap(); Bitmap::ScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. @@ -82,7 +86,7 @@ void JpegWriterTest::testWrite8BitGrayscale() void JpegWriterTest::testWrite8BitNonGrayscale() { - Bitmap bitmap = roundtripJPG(getFullUrl("8BitNonGrayscale.gif")).GetBitmap(); + Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitNonGrayscale.gif")).GetBitmap(); Bitmap::ScopedReadAccess access(bitmap); const ScanlineFormat format = access->GetScanlineFormat(); // Check that it's still 8bit grayscale. diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 255a82553dfb..0236a6e73e5d 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -10,6 +10,7 @@ #include <sal/config.h> #include <memory> +#include <string_view> #include <type_traits> #include <config_features.h> @@ -72,8 +73,8 @@ public: PdfExportTest(); virtual void setUp() override; virtual void tearDown() override; - void saveAsPDF(const OUString& rFile); - void load(const OUString& rFile, vcl::filter::PDFDocument& rDocument); + void saveAsPDF(std::u16string_view rFile); + void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument); }; PdfExportTest::PdfExportTest() { maTempFile.EnableKillingFile(); } @@ -117,7 +118,7 @@ void PdfExportTest::tearDown() OUStringLiteral const DATA_DIRECTORY = u"/vcl/qa/cppunit/pdfexport/data/"; -void PdfExportTest::saveAsPDF(const OUString& rFile) +void PdfExportTest::saveAsPDF(std::u16string_view rFile) { // Import the bugdoc and export as PDF. OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + rFile; @@ -130,7 +131,7 @@ void PdfExportTest::saveAsPDF(const OUString& rFile) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); } -void PdfExportTest::load(const OUString& rFile, vcl::filter::PDFDocument& rDocument) +void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument) { saveAsPDF(rFile); @@ -184,7 +185,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693) { vcl::filter::PDFDocument aDocument; - load("tdf106693.odt", aDocument); + load(u"tdf106693.odt", aDocument); // Assert that the XObject in the page resources dictionary is a form XObject. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -328,7 +329,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107868) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093) { vcl::filter::PDFDocument aDocument; - load("tdf105093.odp", aDocument); + load(u"tdf105093.odp", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -602,7 +603,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testSofthyphenPos) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013) { vcl::filter::PDFDocument aDocument; - load("tdf107013.odt", aDocument); + load(u"tdf107013.odt", aDocument); // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -622,7 +623,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) { vcl::filter::PDFDocument aDocument; - load("tdf107018.odt", aDocument); + load(u"tdf107018.odt", aDocument); // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -677,7 +678,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) { vcl::filter::PDFDocument aDocument; - load("tdf107089.odt", aDocument); + load(u"tdf107089.odt", aDocument); // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -724,7 +725,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680) { vcl::filter::PDFDocument aDocument; - load("tdf99680.odt", aDocument); + load(u"tdf99680.odt", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -765,7 +766,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680_2) { vcl::filter::PDFDocument aDocument; - load("tdf99680-2.odt", aDocument); + load(u"tdf99680-2.odt", aDocument); // For each document page std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -901,7 +902,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf108963) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) { vcl::filter::PDFDocument aDocument; - load("tdf118244_radioButtonGroup.odt", aDocument); + load(u"tdf118244_radioButtonGroup.odt", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -943,7 +944,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) { #if HAVE_MORE_FONTS vcl::filter::PDFDocument aDocument; - load("tdf115117-1.odt", aDocument); + load(u"tdf115117-1.odt", aDocument); vcl::filter::PDFObjectElement* pToUnicode = nullptr; @@ -1010,7 +1011,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) // See the comments in testTdf115117_1() for explanation. vcl::filter::PDFDocument aDocument; - load("tdf115117-2.odt", aDocument); + load(u"tdf115117-2.odt", aDocument); vcl::filter::PDFObjectElement* pToUnicode = nullptr; @@ -1152,7 +1153,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) #if HAVE_MORE_FONTS // This requires Amiri font, if it is missing the test will fail. vcl::filter::PDFDocument aDocument; - load("tdf66597-1.odt", aDocument); + load(u"tdf66597-1.odt", aDocument); { // Get access to ToUnicode of the first font @@ -1249,7 +1250,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) { #if HAVE_MORE_FONTS vcl::filter::PDFDocument aDocument; - load("tdf66597-2.odt", aDocument); + load(u"tdf66597-2.odt", aDocument); { // Get access to ToUnicode of the first font @@ -1352,7 +1353,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) { #if HAVE_MORE_FONTS vcl::filter::PDFDocument aDocument; - load("tdf66597-3.odt", aDocument); + load(u"tdf66597-3.odt", aDocument); { // Get access to ToUnicode of the first font @@ -1620,7 +1621,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143) CPPUNIT_TEST_FIXTURE(PdfExportTest, testForcePoint71) { // I just care it doesn't crash - saveAsPDF("forcepoint71.key"); + saveAsPDF(u"forcepoint71.key"); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115262) @@ -1719,7 +1720,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115967) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf121615) { vcl::filter::PDFDocument aDocument; - load("tdf121615.odt", aDocument); + load(u"tdf121615.odt", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index d0d356f23702..42a25652134f 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <test/bootstrapfixture.hxx> #include <tools/stream.hxx> #include <vcl/filter/PngImageReader.hxx> @@ -29,7 +33,7 @@ class PngFilterTest : public test::BootstrapFixture { OUString maDataUrl; - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(maDataUrl) + sFileName; } diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 4460811ca306..f8a4c0a96734 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -8,6 +8,10 @@ * */ +#include <sal/config.h> + +#include <string_view> + #include <test/bootstrapfixture.hxx> #include <test/xmltesttools.hxx> #include <vcl/gdimtf.hxx> @@ -28,7 +32,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools { OUString maDataUrl; - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(maDataUrl) + sFileName; } @@ -37,11 +41,12 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools // write GDI Metafile to a file in data directory // only use this for new tests to create the svm file - void writeToFile(GDIMetaFile& rMetaFile, OUString const & rName); + void writeToFile(GDIMetaFile& rMetaFile, std::u16string_view rName); - GDIMetaFile writeAndReadStream(GDIMetaFile& rMetaFile, OUString const & rName = OUString()); + GDIMetaFile writeAndReadStream( + GDIMetaFile& rMetaFile, std::u16string_view rName = std::u16string_view()); - GDIMetaFile readFile(const OUString& sName); + GDIMetaFile readFile(std::u16string_view sName); xmlDocUniquePtr dumpMeta(const GDIMetaFile& rMetaFile); @@ -298,17 +303,17 @@ static void writeMetaFile(GDIMetaFile& rInputMetafile, const OUString& rUrl) aFileStream.Close(); } -void SvmTest::writeToFile(GDIMetaFile& rMetaFile, OUString const & rName) +void SvmTest::writeToFile(GDIMetaFile& rMetaFile, std::u16string_view rName) { - if (rName.isEmpty()) + if (rName.empty()) return; OUString sFilePath = getFullUrl(rName); writeMetaFile(rMetaFile, sFilePath); } -GDIMetaFile SvmTest::writeAndReadStream(GDIMetaFile& rMetaFile, OUString const & rName) +GDIMetaFile SvmTest::writeAndReadStream(GDIMetaFile& rMetaFile, std::u16string_view rName) { - if (!rName.isEmpty()) + if (!rName.empty()) writeToFile(rMetaFile, rName); SvMemoryStream aStream; @@ -320,7 +325,7 @@ GDIMetaFile SvmTest::writeAndReadStream(GDIMetaFile& rMetaFile, OUString const & return aResultMetafile; } -GDIMetaFile SvmTest::readFile(const OUString& sName) +GDIMetaFile SvmTest::readFile(std::u16string_view sName) { OUString sFilePath = getFullUrl(sName); return readMetafile(sFilePath); @@ -386,7 +391,7 @@ void SvmTest::testPixel() pVirtualDev->DrawPixel(Point(1, 8), COL_BLUE); checkPixel(writeAndReadStream(aGDIMetaFile)); - checkPixel(readFile("pixel.svm")); + checkPixel(readFile(u"pixel.svm")); } void SvmTest::checkPoint(const GDIMetaFile& rMetaFile) @@ -407,7 +412,7 @@ void SvmTest::testPoint() pVirtualDev->DrawPixel(Point(4, 4)); checkPoint(writeAndReadStream(aGDIMetaFile)); - checkPoint(readFile("point.svm")); + checkPoint(readFile(u"point.svm")); } void SvmTest::checkLine(const GDIMetaFile& rMetaFile) @@ -459,7 +464,7 @@ void SvmTest::testLine() pVirtualDev->DrawLine(Point(1, 8), Point(8, 1), aLineInfo); checkLine(writeAndReadStream(aGDIMetaFile)); - checkLine(readFile("line.svm")); + checkLine(readFile(u"line.svm")); } void SvmTest::checkRect(const GDIMetaFile& rMetaFile) @@ -488,7 +493,7 @@ void SvmTest::testRect() pVirtualDev->DrawRect(tools::Rectangle(Point(1, 2), Size(4, 4))); checkRect(writeAndReadStream(aGDIMetaFile)); - checkRect(readFile("rect.svm")); + checkRect(readFile(u"rect.svm")); } void SvmTest::checkRoundRect(const GDIMetaFile& rMetaFile) @@ -517,7 +522,7 @@ void SvmTest::testRoundRect() pVirtualDev->DrawRect(tools::Rectangle(Point(1, 2), Size(4, 4)), 1, 2); checkRoundRect(writeAndReadStream(aGDIMetaFile)); - checkRoundRect(readFile("roundrect.svm")); + checkRoundRect(readFile(u"roundrect.svm")); } void SvmTest::checkEllipse(const GDIMetaFile& rMetaFile) @@ -545,7 +550,7 @@ void SvmTest::testEllipse() pVirtualDev->DrawEllipse(tools::Rectangle(Point(1, 2), Size(4, 4))); checkEllipse(writeAndReadStream(aGDIMetaFile)); - checkEllipse(readFile("ellipse.svm")); + checkEllipse(readFile(u"ellipse.svm")); } void SvmTest::checkArc(const GDIMetaFile& rMetaFile) @@ -576,7 +581,7 @@ void SvmTest::testArc() pVirtualDev->DrawArc(tools::Rectangle(Point(1, 2), Size(4, 4)), Point(10, 11), Point(12, 13)); checkArc(writeAndReadStream(aGDIMetaFile)); - checkArc(readFile("arc.svm")); + checkArc(readFile(u"arc.svm")); } void SvmTest::checkPie(const GDIMetaFile& rMetaFile) @@ -607,7 +612,7 @@ void SvmTest::testPie() pVirtualDev->DrawPie(tools::Rectangle(Point(11, 12), Size(4, 4)), Point(20, 21), Point(22, 23)); checkPie(writeAndReadStream(aGDIMetaFile)); - checkPie(readFile("pie.svm")); + checkPie(readFile(u"pie.svm")); } void SvmTest::checkChord(const GDIMetaFile& rMetaFile) @@ -638,7 +643,7 @@ void SvmTest::testChord() pVirtualDev->DrawChord(tools::Rectangle(Point(21, 22), Size(4, 4)), Point(30, 31), Point(32, 33)); checkChord(writeAndReadStream(aGDIMetaFile)); - checkChord(readFile("chord.svm")); + checkChord(readFile(u"chord.svm")); } void SvmTest::checkPolyLine(const GDIMetaFile& rMetaFile) @@ -706,7 +711,7 @@ void SvmTest::testPolyLine() pVirtualDev->DrawPolyLine(aPolygonWithControl, aLineInfo); checkPolyLine(writeAndReadStream(aGDIMetaFile)); - checkPolyLine(readFile("polyline.svm")); + checkPolyLine(readFile(u"polyline.svm")); } void SvmTest::checkPolygon(const GDIMetaFile& rMetaFile) @@ -750,7 +755,7 @@ void SvmTest::testPolygon() pVirtualDev->DrawPolygon(aPolygonWithControl); checkPolygon(writeAndReadStream(aGDIMetaFile)); - checkPolygon(readFile("polygon.svm")); + checkPolygon(readFile(u"polygon.svm")); } void SvmTest::checkPolyPolygon(const GDIMetaFile& rMetaFile) @@ -796,7 +801,7 @@ void SvmTest::testPolyPolygon() pVirtualDev->DrawPolyPolygon(aPolyPolygon); checkPolyPolygon(writeAndReadStream(aGDIMetaFile)); - checkPolyPolygon(readFile("polypolygon.svm")); + checkPolyPolygon(readFile(u"polypolygon.svm")); } void SvmTest::checkText(const GDIMetaFile& rMetaFile) @@ -819,7 +824,7 @@ void SvmTest::testText() pVirtualDev->DrawText(Point(4,6), "xABC", 1, 2); checkText(writeAndReadStream(aGDIMetaFile)); - checkText(readFile("text.svm")); + checkText(readFile(u"text.svm")); } void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile) @@ -842,7 +847,7 @@ void SvmTest::testTextArray() pVirtualDev->DrawTextArray(Point(4,6), "123456", aDX, 1, 4); checkTextArray(writeAndReadStream(aGDIMetaFile)); - checkTextArray(readFile("textarray.svm")); + checkTextArray(readFile(u"textarray.svm")); } void SvmTest::checkstretchText(const GDIMetaFile& rMetaFile) @@ -864,7 +869,7 @@ void SvmTest::teststretchText() pVirtualDev->DrawStretchText(Point(4,6), 10, "123456", 1, 4); checkstretchText(writeAndReadStream(aGDIMetaFile)); - checkstretchText(readFile("strecthtext.svm")); + checkstretchText(readFile(u"strecthtext.svm")); } void SvmTest::checkTextRect(const GDIMetaFile& rMetaFile) @@ -886,7 +891,7 @@ void SvmTest::testTextRect() pVirtualDev->DrawText(tools::Rectangle(Point(0,0), Size(5,5)), "123456", DrawTextFlags::Center); checkTextRect(writeAndReadStream(aGDIMetaFile)); - checkTextRect(readFile("textrectangle.svm")); + checkTextRect(readFile(u"textrectangle.svm")); } void SvmTest::checkTextLine(const GDIMetaFile& rMetaFile) @@ -907,7 +912,7 @@ void SvmTest::testTextLine() pVirtualDev->DrawTextLine(Point(4,6), 10, STRIKEOUT_SINGLE, LINESTYLE_SINGLE, LINESTYLE_SINGLE); checkTextLine(writeAndReadStream(aGDIMetaFile)); - checkTextLine(readFile("textline.svm")); + checkTextLine(readFile(u"textline.svm")); } void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile) @@ -959,7 +964,7 @@ void SvmTest::testBitmaps() checkRendering(pVirtualDev, aReloadedGDIMetaFile); } { - GDIMetaFile aFileGDIMetaFile = readFile("bitmaps.svm"); + GDIMetaFile aFileGDIMetaFile = readFile(u"bitmaps.svm"); checkBitmaps(aFileGDIMetaFile); checkRendering(pVirtualDev, aFileGDIMetaFile); } @@ -1118,7 +1123,7 @@ void SvmTest::testBitmapExs() checkRendering(pVirtualDev, aReloadedGDIMetaFile); } { - GDIMetaFile aFileGDIMetaFile = readFile("bitmapexs.svm"); + GDIMetaFile aFileGDIMetaFile = readFile(u"bitmapexs.svm"); checkBitmapExs(aFileGDIMetaFile); checkRendering(pVirtualDev, aFileGDIMetaFile); } @@ -1173,7 +1178,7 @@ void SvmTest::testMasks() pVirtualDev->DrawMask(Point(1, 2), Size(3, 4), Point(2, 1), Size(4, 3), aBitmap3, COL_LIGHTRED, MetaActionType::MASKSCALEPART); checkMasks(writeAndReadStream(aGDIMetaFile)); - checkMasks(readFile("masks.svm")); + checkMasks(readFile(u"masks.svm")); } void SvmTest::checkGradient(const GDIMetaFile& rMetaFile) @@ -1246,7 +1251,7 @@ void SvmTest::testGradient() pVirtualDev->DrawGradient(aRectangle2, aGradient2); checkGradient(writeAndReadStream(aGDIMetaFile)); - checkGradient(readFile("gradient.svm")); + checkGradient(readFile(u"gradient.svm")); } void SvmTest::testGradientEx() @@ -1293,7 +1298,7 @@ void SvmTest::testHatch() pVirtualDev->DrawHatch(aPolyPolygon, aHatch); checkHatch(writeAndReadStream(aGDIMetaFile)); - checkHatch(readFile("hatch.svm")); + checkHatch(readFile(u"hatch.svm")); } void SvmTest::checkWallpaper(const GDIMetaFile& rMetaFile) @@ -1328,7 +1333,7 @@ void SvmTest::testWallpaper() pVirtualDev->DrawWallpaper(tools::Rectangle(Point(1, 1), Size(3, 3)), aWallpaper); checkWallpaper(writeAndReadStream(aGDIMetaFile)); - checkWallpaper(readFile("wallpaper.svm")); + checkWallpaper(readFile(u"wallpaper.svm")); } void SvmTest::checkClipRegion(const GDIMetaFile& rMetaFile) @@ -1358,7 +1363,7 @@ void SvmTest::testClipRegion() pVirtualDev->SetClipRegion(aRegion); checkClipRegion(writeAndReadStream(aGDIMetaFile)); - checkClipRegion(readFile("clipregion.svm")); + checkClipRegion(readFile(u"clipregion.svm")); } void SvmTest::testIntersectRectClipRegion() @@ -1388,7 +1393,7 @@ void SvmTest::testLineColor() pVirtualDev->Pop(); checkLineColor(writeAndReadStream(aGDIMetaFile)); - checkLineColor(readFile("linecolor.svm")); + checkLineColor(readFile(u"linecolor.svm")); } void SvmTest::checkFillColor(const GDIMetaFile& rMetaFile) @@ -1411,7 +1416,7 @@ void SvmTest::testFillColor() pVirtualDev->Pop(); checkFillColor(writeAndReadStream(aGDIMetaFile)); - checkFillColor(readFile("fillcolor.svm")); + checkFillColor(readFile(u"fillcolor.svm")); } void SvmTest::checkTextColor(const GDIMetaFile& rMetaFile) @@ -1432,7 +1437,7 @@ void SvmTest::testTextColor() pVirtualDev->SetTextColor(Color(0x123456)); checkTextColor(writeAndReadStream(aGDIMetaFile)); - checkTextColor(readFile("textcolor.svm")); + checkTextColor(readFile(u"textcolor.svm")); } void SvmTest::checkTextFillColor(const GDIMetaFile& rMetaFile) @@ -1453,7 +1458,7 @@ void SvmTest::testTextFillColor() pVirtualDev->SetTextFillColor(Color(0x234567)); checkTextFillColor(writeAndReadStream(aGDIMetaFile)); - checkTextFillColor(readFile("textfillecolor.svm")); + checkTextFillColor(readFile(u"textfillecolor.svm")); } void SvmTest::checkTextLineColor(const GDIMetaFile& rMetaFile) @@ -1474,7 +1479,7 @@ void SvmTest::testTextLineColor() pVirtualDev->SetTextLineColor(Color(0x345678)); checkTextLineColor(writeAndReadStream(aGDIMetaFile)); - checkTextLineColor(readFile("textlinecolor.svm")); + checkTextLineColor(readFile(u"textlinecolor.svm")); } void SvmTest::checkOverLineColor(const GDIMetaFile& rMetaFile) @@ -1497,7 +1502,7 @@ void SvmTest::testOverLineColor() pVirtualDev->Pop(); checkOverLineColor(writeAndReadStream(aGDIMetaFile)); - checkOverLineColor(readFile("overlinecolor.svm")); + checkOverLineColor(readFile(u"overlinecolor.svm")); } void SvmTest::checkTextAlign(const GDIMetaFile& rMetaFile) @@ -1518,7 +1523,7 @@ void SvmTest::testTextAlign() pVirtualDev->SetTextAlign(TextAlign::ALIGN_BOTTOM); checkTextAlign(writeAndReadStream(aGDIMetaFile)); - checkTextAlign(readFile("textalign.svm")); + checkTextAlign(readFile(u"textalign.svm")); } void SvmTest::testMapMode() @@ -1561,7 +1566,7 @@ void SvmTest::testPushPop() pVirtualDev->DrawLine(Point(1,1), Point(8,8)); checkPushPop(writeAndReadStream(aGDIMetaFile)); - checkPushPop(readFile("pushpop.svm")); + checkPushPop(readFile(u"pushpop.svm")); } void SvmTest::checkRasterOp(const GDIMetaFile& rMetaFile) @@ -1582,7 +1587,7 @@ void SvmTest::testRasterOp() pVirtualDev->SetRasterOp(RasterOp::Xor); checkRasterOp(writeAndReadStream(aGDIMetaFile)); - checkRasterOp(readFile("rasterop.svm")); + checkRasterOp(readFile(u"rasterop.svm")); } void SvmTest::checkTransparent(const GDIMetaFile& rMetaFile) @@ -1622,7 +1627,7 @@ void SvmTest::testTransparent() CPPUNIT_ASSERT(aGDIMetaFile.HasTransparentActions()); checkTransparent(writeAndReadStream(aGDIMetaFile)); - checkTransparent(readFile("transparent.svm")); + checkTransparent(readFile(u"transparent.svm")); } void SvmTest::testFloatTransparent() diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index ac5accc5c940..480ff411012f 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <cppunit/TestAssert.h> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/plugin/TestPlugIn.h> @@ -21,7 +25,7 @@ constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/widgetdraw/data/"); class WidgetDefinitionReaderTest : public test::BootstrapFixtureBase { private: - OUString getFullUrl(const OUString& sFileName) + OUString getFullUrl(std::u16string_view sFileName) { return m_directories.getURLFromSrc(gaDataUrl) + sFileName; } @@ -40,21 +44,24 @@ void WidgetDefinitionReaderTest::testReadSettings() { { vcl::WidgetDefinition aDefinition; - vcl::WidgetDefinitionReader aReader(getFullUrl("definitionSettings1.xml"), getFullUrl("")); + vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings1.xml"), + getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); CPPUNIT_ASSERT_EQUAL(OString(""), aDefinition.mpSettings->msCenteredTabs); } { vcl::WidgetDefinition aDefinition; - vcl::WidgetDefinitionReader aReader(getFullUrl("definitionSettings2.xml"), getFullUrl("")); + vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings2.xml"), + getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); CPPUNIT_ASSERT_EQUAL(OString("true"), aDefinition.mpSettings->msCenteredTabs); } { vcl::WidgetDefinition aDefinition; - vcl::WidgetDefinitionReader aReader(getFullUrl("definitionSettings3.xml"), getFullUrl("")); + vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings3.xml"), + getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); CPPUNIT_ASSERT_EQUAL(OString("true"), aDefinition.mpSettings->msNoActiveTabTextRaise); CPPUNIT_ASSERT_EQUAL(OString("false"), aDefinition.mpSettings->msCenteredTabs); @@ -73,7 +80,7 @@ void WidgetDefinitionReaderTest::testRead() { vcl::WidgetDefinition aDefinition; - vcl::WidgetDefinitionReader aReader(getFullUrl("definition1.xml"), getFullUrl("")); + vcl::WidgetDefinitionReader aReader(getFullUrl(u"definition1.xml"), getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); CPPUNIT_ASSERT_EQUAL(OUString("123456"), aDefinition.mpStyle->maFaceColor.AsRGBHexString()); diff --git a/vcl/qa/unit/vcl-dialogs-test.cxx b/vcl/qa/unit/vcl-dialogs-test.cxx index bca3437099f2..4f5016da2971 100644 --- a/vcl/qa/unit/vcl-dialogs-test.cxx +++ b/vcl/qa/unit/vcl-dialogs-test.cxx @@ -48,7 +48,7 @@ VclPtr<VclAbstractDialog> VclDialogsTest::createDialogByID(sal_uInt32 /*nID*/) { void VclDialogsTest::openAnyDialog() { /// process input file containing the UXMLDescriptions of the dialogs to dump - processDialogBatchFile("vcl/qa/unit/data/vcl-dialogs-test.txt"); + processDialogBatchFile(u"vcl/qa/unit/data/vcl-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(VclDialogsTest); diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx index 2906061061ca..269d141de3fe 100644 --- a/vcl/source/app/brand.cxx +++ b/vcl/source/app/brand.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <config_folders.h> #include <rtl/ustring.hxx> @@ -41,9 +45,9 @@ namespace { else return false; } - bool tryLoadPng( const OUString& rBaseDir, const OUString& rName, BitmapEx& rBitmap ) + bool tryLoadPng( std::u16string_view rBaseDir, std::u16string_view rName, BitmapEx& rBitmap ) { - return loadPng( rBaseDir + "/" LIBO_ETC_FOLDER + rName, rBitmap); + return loadPng( OUString::Concat(rBaseDir) + "/" LIBO_ETC_FOLDER + rName, rBitmap); } } @@ -63,11 +67,11 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap) ::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings( true)); for (const OUString & aFallback : aFallbacks) { - if (tryLoadPng( aBaseDir, aBaseName + "-" + aFallback + aPng, rBitmap)) + if (tryLoadPng( aBaseDir, OUString(aBaseName + "-" + aFallback + aPng), rBitmap)) return true; } - return tryLoadPng( aBaseDir, aBaseName + aPng, rBitmap); + return tryLoadPng( aBaseDir, OUString(aBaseName + aPng), rBitmap); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 20ad995de48d..2910c7e02604 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -209,14 +209,14 @@ namespace validation return ( END == eCurrentState ); } - bool NumberValidator::isValidNumericFragment( const OUString& _rText ) + bool NumberValidator::isValidNumericFragment( std::u16string_view _rText ) { - if ( _rText.isEmpty() ) + if ( _rText.empty() ) // empty strings are always allowed return true; // normalize the string - OUString sNormalized = "_" + _rText + "_"; + OUString sNormalized = OUString::Concat("_") + _rText + "_"; return implValidateNormalized( sNormalized ); } diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index 8feb96ee51fd..8506ce965273 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <vcl/layout.hxx> #include <vcl/notebookbar/notebookbar.hxx> #include <vcl/syswin.hxx> @@ -29,9 +33,9 @@ static OUString getCustomizedUIRootDir() return sShareLayer; } -static bool doesFileExist(const OUString& sUIDir, const OUString& sUIFile) +static bool doesFileExist(std::u16string_view sUIDir, std::u16string_view sUIFile) { - OUString sUri = sUIDir + sUIFile; + OUString sUri = OUString::Concat(sUIDir) + sUIFile; osl::File file(sUri); return( file.open(0) == osl::FileBase::E_None ); } diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index a81102321388..1514ab60dd72 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -96,7 +96,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP return bAvailable; } -void FilterConfigItem::ImpInitTree( const OUString& rSubTree ) +void FilterConfigItem::ImpInitTree( std::u16string_view rSubTree ) { bModified = false; @@ -104,7 +104,7 @@ void FilterConfigItem::ImpInitTree( const OUString& rSubTree ) Reference< XMultiServiceFactory > xCfgProv = theDefaultProvider::get( xContext ); - OUString sTree = "/org.openoffice." + rSubTree; + OUString sTree = OUString::Concat("/org.openoffice.") + rSubTree; if ( !ImpIsTreeAvailable(xCfgProv, sTree) ) return; @@ -130,7 +130,7 @@ void FilterConfigItem::ImpInitTree( const OUString& rSubTree ) } } -FilterConfigItem::FilterConfigItem( const OUString& rSubTree ) +FilterConfigItem::FilterConfigItem( std::u16string_view rSubTree ) { ImpInitTree( rSubTree ); } @@ -142,7 +142,7 @@ FilterConfigItem::FilterConfigItem( css::uno::Sequence< css::beans::PropertyValu aFilterData = *pFilterData; } -FilterConfigItem::FilterConfigItem( const OUString& rSubTree, +FilterConfigItem::FilterConfigItem( std::u16string_view rSubTree, css::uno::Sequence< css::beans::PropertyValue > const * pFilterData ) { ImpInitTree( rSubTree ); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 65ae12a65931..302c094b5071 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -482,7 +482,7 @@ ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rSt nBase = 1; else if ( pConfig->GetImportFilterType( rFormat ).equalsIgnoreAsciiCase( "pcd_Photo_CD_Base16" ) ) nBase = 0; - FilterConfigItem aFilterConfigItem( "Office.Common/Filter/Graphic/Import/PCD" ); + FilterConfigItem aFilterConfigItem( u"Office.Common/Filter/Graphic/Import/PCD" ); aFilterConfigItem.WriteInt32( "Resolution", nBase ); } } diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index bcc999a79eac..050cf657893e 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -8,10 +8,13 @@ * */ +#include <sal/config.h> + +#include <string_view> + #include <FileDefinitionWidgetDraw.hxx> #include <widgetdraw/WidgetDefinitionReader.hxx> -#include <sal/config.h> #include <svdata.hxx> #include <rtl/bootstrap.hxx> #include <config_folders.h> @@ -72,7 +75,8 @@ std::shared_ptr<WidgetDefinition> getWidgetDefinition(OUString const& rDefinitio return std::shared_ptr<WidgetDefinition>(); } -std::shared_ptr<WidgetDefinition> const& getWidgetDefinitionForTheme(OUString const& rThemenName) +std::shared_ptr<WidgetDefinition> const& +getWidgetDefinitionForTheme(std::u16string_view rThemenName) { static std::shared_ptr<WidgetDefinition> spDefinition; if (!spDefinition) @@ -110,7 +114,7 @@ FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics) : m_rGraphics(rGraphics) , m_bIsActive(false) { - m_pWidgetDefinition = getWidgetDefinitionForTheme("online"); + m_pWidgetDefinition = getWidgetDefinitionForTheme(u"online"); #ifdef IOS if (!m_pWidgetDefinition) m_pWidgetDefinition = getWidgetDefinitionForTheme("ios"); diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 3b929be452c3..7e242d640837 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -236,14 +236,14 @@ bool EmbeddedFontsHelper::sufficientTTFRights( const void* data, tools::Long siz return true; // no known restriction } -OUString EmbeddedFontsHelper::fontFileUrl( const OUString& familyName, FontFamily family, FontItalic italic, +OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontFamily family, FontItalic italic, FontWeight weight, FontPitch pitch, FontRights rights ) { OUString path = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; rtl::Bootstrap::expandMacros( path ); path += "/user/temp/embeddedfonts/fromsystem/"; osl::Directory::createPath( path ); - OUString filename = familyName + "_" + OUString::number( family ) + "_" + OUString::number( italic ) + OUString filename = OUString::Concat(familyName) + "_" + OUString::number( family ) + "_" + OUString::number( italic ) + "_" + OUString::number( weight ) + "_" + OUString::number( pitch ) + ".ttf"; // TODO is it always ttf? OUString url = path + filename; diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 6a9cd8f75628..92ef534467dc 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -99,12 +99,12 @@ OUString convertLcTo32Path(OUString const & rPath) return aResult; } -OUString createPath(std::u16string_view name, sal_Int32 pos, OUString const & locale) +OUString createPath(std::u16string_view name, sal_Int32 pos, std::u16string_view locale) { - return name.substr(0, pos + 1) + locale + name.substr(pos); + return OUString::Concat(name.substr(0, pos + 1)) + locale + name.substr(pos); } -OUString getIconCacheUrl(OUString const & sVariant, ImageRequestParameters const & rParameters) +OUString getIconCacheUrl(std::u16string_view sVariant, ImageRequestParameters const & rParameters) { OUString sUrl = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/cache/" + rParameters.msStyle + "/" + sVariant + "/" + rParameters.msName; @@ -112,7 +112,8 @@ OUString getIconCacheUrl(OUString const & sVariant, ImageRequestParameters const return sUrl; } -OUString createIconCacheUrl(OUString const & sVariant, ImageRequestParameters const & rParameters) +OUString createIconCacheUrl( + std::u16string_view sVariant, ImageRequestParameters const & rParameters) { OUString sUrl(getIconCacheUrl(sVariant, rParameters)); OUString sDir = sUrl.copy(0, sUrl.lastIndexOf('/')); @@ -359,7 +360,7 @@ OUString createVariant(ImageRequestParameters& rParameters) return aVariant; } -bool loadDiskCachedVersion(OUString const & sVariant, ImageRequestParameters& rParameters) +bool loadDiskCachedVersion(std::u16string_view sVariant, ImageRequestParameters& rParameters) { OUString sUrl(getIconCacheUrl(sVariant, rParameters)); if (!urlExists(sUrl)) @@ -370,7 +371,7 @@ bool loadDiskCachedVersion(OUString const & sVariant, ImageRequestParameters& rP return true; } -void cacheBitmapToDisk(OUString const & sVariant, ImageRequestParameters const & rParameters) +void cacheBitmapToDisk(std::u16string_view sVariant, ImageRequestParameters const & rParameters) { OUString sUrl(createIconCacheUrl(sVariant, rParameters)); vcl::PNGWriter aWriter(rParameters.mrBitmap); diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 3d2a978e1927..82e01da1dc8d 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -60,7 +60,7 @@ OUString getShaderFolder() return aUrl + "/opengl/"; } -OString loadShader(const OUString& rFilename) +OString loadShader(std::u16string_view rFilename) { OUString aFileURL = getShaderFolder() + rFilename +".glsl"; osl::File aFile(aFileURL); @@ -137,16 +137,16 @@ namespace { } } -static void addPreamble(OString& rShaderSource, const OString& rPreamble) +static void addPreamble(OString& rShaderSource, std::string_view rPreamble) { - if (rPreamble.isEmpty()) + if (rPreamble.empty()) return; int nVersionStrStartPos = rShaderSource.indexOf("#version"); if (nVersionStrStartPos == -1) { - rShaderSource = rPreamble + "\n" + rShaderSource; + rShaderSource = OString::Concat(rPreamble) + "\n" + rShaderSource; } else { @@ -222,7 +222,7 @@ namespace OString getStringDigest( const OUString& rVertexShaderName, const OUString& rFragmentShaderName, - const OString& rPreamble ) + std::string_view rPreamble ) { // read shaders source OString aVertexShaderSource = getShaderSource( rVertexShaderName ); @@ -305,14 +305,14 @@ namespace OString createFileName( std::u16string_view rVertexShaderName, std::u16string_view rFragmentShaderName, std::u16string_view rGeometryShaderName, - const OString& rDigest ) + std::string_view rDigest ) { OString aFileName = getCacheFolder() + OUStringToOString( rVertexShaderName, RTL_TEXTENCODING_UTF8 ) + "-" + OUStringToOString( rFragmentShaderName, RTL_TEXTENCODING_UTF8 ) + "-"; if (!rGeometryShaderName.empty()) aFileName += OUStringToOString( rGeometryShaderName, RTL_TEXTENCODING_UTF8 ) + "-"; - aFileName += rDigest + ".bin"; + aFileName += OString::Concat(rDigest) + ".bin"; return aFileName; } @@ -373,7 +373,7 @@ namespace OString OpenGLHelper::GetDigest( const OUString& rVertexShaderName, const OUString& rFragmentShaderName, - const OString& rPreamble ) + std::string_view rPreamble ) { return getStringDigest(rVertexShaderName, rFragmentShaderName, rPreamble); } @@ -381,8 +381,8 @@ OString OpenGLHelper::GetDigest( const OUString& rVertexShaderName, GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const OUString& rGeometryShaderName, - const OString& preamble, - const OString& rDigest) + std::string_view preamble, + std::string_view rDigest) { OpenGLZone aZone; @@ -401,7 +401,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, aGeometryShaderSource = getShaderSource(rGeometryShaderName); GLint bBinaryResult = GL_FALSE; - if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty()) + if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.empty()) { OString aFileName = createFileName(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, rDigest); @@ -426,7 +426,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, GLint Result = GL_FALSE; // Compile Vertex Shader - if( !preamble.isEmpty()) + if( !preamble.empty()) addPreamble( aVertexShaderSource, preamble ); char const * VertexSourcePointer = aVertexShaderSource.getStr(); glShaderSource(VertexShaderID, 1, &VertexSourcePointer , nullptr); @@ -439,7 +439,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, rVertexShaderName, true); // Compile Fragment Shader - if( !preamble.isEmpty()) + if( !preamble.empty()) addPreamble( aFragmentShaderSource, preamble ); char const * FragmentSourcePointer = aFragmentShaderSource.getStr(); glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , nullptr); @@ -454,7 +454,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, if (bHasGeometryShader) { // Compile Geometry Shader - if( !preamble.isEmpty()) + if( !preamble.empty()) addPreamble( aGeometryShaderSource, preamble ); char const * GeometrySourcePointer = aGeometryShaderSource.getStr(); glShaderSource(GeometryShaderID, 1, &GeometrySourcePointer , nullptr); @@ -473,7 +473,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, if (bHasGeometryShader) glAttachShader(ProgramID, GeometryShaderID); - if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty()) + if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.empty()) { glProgramParameteri(ProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); glLinkProgram(ProgramID); @@ -513,8 +513,8 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, - const OString& preamble, - const OString& rDigest) + std::string_view preamble, + std::string_view rDigest) { return LoadShaders(rVertexShaderName, rFragmentShaderName, OUString(), preamble, rDigest); } @@ -523,7 +523,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const OUString& rGeometryShaderName) { - return LoadShaders(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, OString(), OString()); + return LoadShaders(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, std::string_view(), std::string_view()); } GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx index 1afd827dfbb7..d83907038b25 100644 --- a/vcl/unx/generic/print/glyphset.cxx +++ b/vcl/unx/generic/print/glyphset.cxx @@ -141,17 +141,17 @@ GlyphSet::GetGlyphSetName (sal_Int32 nGlyphSetID) } OString -GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString &rFontName) +GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, std::string_view rFontName) { if ( nEnc == RTL_TEXTENCODING_MS_1252 || nEnc == RTL_TEXTENCODING_ISO_8859_1) { - return rFontName + "-iso1252"; + return OString::Concat(rFontName) + "-iso1252"; } else if (nEnc >= RTL_TEXTENCODING_USER_START && nEnc <= RTL_TEXTENCODING_USER_END) { - return rFontName + return OString::Concat(rFontName) + "-enc" + OString::number ((nEnc - RTL_TEXTENCODING_USER_START)); } diff --git a/vcl/unx/generic/print/glyphset.hxx b/vcl/unx/generic/print/glyphset.hxx index 33b928d759f9..e733846c58b5 100644 --- a/vcl/unx/generic/print/glyphset.hxx +++ b/vcl/unx/generic/print/glyphset.hxx @@ -25,6 +25,7 @@ #include <rtl/string.hxx> #include <vcl/glyphitem.hxx> +#include <string_view> #include <vector> #include <unordered_map> @@ -65,7 +66,7 @@ public: sal_Int32 GetFontID () const { return mnFontID;} static OString GetReencodedFontName (rtl_TextEncoding nEnc, - const OString &rFontName); + std::string_view rFontName); bool IsVertical () const { return mbVertical;} diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index de598f1f656d..1ce42b6e0d40 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -79,9 +79,9 @@ AppendPS (FILE* pDst, osl::File* pSrc, unsigned char* pBuffer) */ std::unique_ptr<osl::File> -PrinterJob::CreateSpoolFile (const OUString& rName, const OUString& rExtension) +PrinterJob::CreateSpoolFile (std::u16string_view rName, std::u16string_view rExtension) { - OUString aFile = rName + rExtension; + OUString aFile = OUString::Concat(rName) + rExtension; OUString aFileURL; osl::File::RC nError = osl::File::getFileURLFromSystemPath( aFile, aFileURL ); if (nError != osl::File::E_None) @@ -296,8 +296,8 @@ PrinterJob::StartJob ( maJobTitle = rJobName; OUString aExt(".ps"); - mpJobHeader = CreateSpoolFile ("psp_head", aExt); - mpJobTrailer = CreateSpoolFile ("psp_tail", aExt); + mpJobHeader = CreateSpoolFile (u"psp_head", aExt); + mpJobTrailer = CreateSpoolFile (u"psp_tail", aExt); if( ! (mpJobHeader && mpJobTrailer) ) // existing files are removed in destructor return false; @@ -551,8 +551,8 @@ PrinterJob::StartPage (const JobData& rJobSetup) OUString aPageNo = OUString::number (static_cast<sal_Int32>(maPageVector.size())+1); // sequential page number must start with 1 OUString aExt = aPageNo + ".ps"; - maHeaderVector.push_back( CreateSpoolFile ( "psp_pghead", aExt) ); - maPageVector.push_back( CreateSpoolFile ( "psp_pgbody", aExt) ); + maHeaderVector.push_back( CreateSpoolFile ( u"psp_pghead", aExt) ); + maPageVector.push_back( CreateSpoolFile ( u"psp_pgbody", aExt) ); osl::File* pPageHeader = maHeaderVector.back().get(); osl::File* pPageBody = maPageVector.back().get(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 18e735c4e9e9..b36d7d713e86 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -16751,7 +16751,7 @@ private: } public: - GtkInstanceBuilder(GtkWidget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + GtkInstanceBuilder(GtkWidget* pParent, std::u16string_view rUIRoot, const OUString& rUIFile, SystemChildWindow* pInterimGlue, bool bAllowCycleFocusOut) : weld::Builder() , m_pStringReplace(Translate::GetReadStringHook()) |