diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 17:44:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 21:25:10 +0100 |
commit | 35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch) | |
tree | bb78f4f13f131f0cb206a9707cc3cfc495a3876a /chart2 | |
parent | 0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff) |
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by
1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).
This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).
The improvement to loplugin:stringadd became necessary to fix
> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.
Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2dump/chart2dump.cxx | 4 | ||||
-rw-r--r-- | chart2/qa/extras/chart2geometry.cxx | 3 | ||||
-rw-r--r-- | chart2/qa/extras/xshape/chart2xshape.cxx | 3 | ||||
-rw-r--r-- | chart2/source/controller/inc/ChartController.hxx | 3 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Properties.cxx | 2 |
5 files changed, 9 insertions, 6 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 7fd7c4a8da61..a3ad005ea0e7 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -124,7 +124,7 @@ protected: { if (m_aReferenceFile.is_open()) m_aReferenceFile.close(); - OString sReferenceFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sReferenceFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aReferenceFile.open(sReferenceFile.getStr(), std::ios_base::in); CPPUNIT_ASSERT_MESSAGE(OString("Can't open reference file: " + sReferenceFile).getStr(), m_aReferenceFile.is_open()); } @@ -132,7 +132,7 @@ protected: { if (m_aDumpFile.is_open()) m_aDumpFile.close(); - OString sDumpFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sDumpFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aDumpFile.open(sDumpFile.getStr(), std::ios_base::out | std::ofstream::binary | std::ofstream::trunc); CPPUNIT_ASSERT_MESSAGE(OString("Can't open dump file: " + sDumpFile).getStr(), m_aDumpFile.is_open()); } diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx index 6ded1a5e76ab..c15f15f66864 100644 --- a/chart2/qa/extras/chart2geometry.cxx +++ b/chart2/qa/extras/chart2geometry.cxx @@ -23,6 +23,7 @@ #include <libxml/xpathInternals.h> #include <algorithm> +#include <string_view> using uno::Reference; using beans::XPropertySet; @@ -170,7 +171,7 @@ void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) } } -static OString OU2O(const OUString& sOUSource) +static OString OU2O(std::u16string_view sOUSource) { return rtl::OUStringToOString(sOUSource, RTL_TEXTENCODING_UTF8); } diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index a1a0032effc3..3acb981cb78d 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -16,6 +16,7 @@ #include <test/xmltesttools.hxx> #include <fstream> +#include <string_view> class Chart2XShapeTest : public ChartTest, public XmlTestTools { @@ -49,7 +50,7 @@ private: namespace { -bool checkDumpAgainstFile(const OUString& rDump, const OUString& aFilePath) +bool checkDumpAgainstFile(const OUString& rDump, std::u16string_view aFilePath) { OString aOFile = OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index aa399f2164b3..cecef8f81f0d 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <memory> +#include <string_view> namespace com::sun::star::accessibility { class XAccessible; } namespace com::sun::star::accessibility { class XAccessibleContext; } @@ -426,7 +427,7 @@ private: //executeDispatch methods void executeDispatch_ObjectProperties(); - void executeDispatch_FormatObject( const OUString& rDispatchCommand ); + void executeDispatch_FormatObject( std::u16string_view rDispatchCommand ); void executeDlg_ObjectProperties( const OUString& rObjectCID ); bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 687625b89c51..666c9979830e 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -650,7 +650,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un } // anonymous namespace -void ChartController::executeDispatch_FormatObject(const OUString& rDispatchCommand) +void ChartController::executeDispatch_FormatObject(std::u16string_view rDispatchCommand) { uno::Reference< XChartDocument > xChartDocument( getModel(), uno::UNO_QUERY ); OString aCommand( OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) ); |