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 /writerfilter | |
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 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/LoggedResources.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/LoggedResources.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TagLogger.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TagLogger.hxx | 5 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 |
6 files changed, 18 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/LoggedResources.cxx b/writerfilter/source/dmapper/LoggedResources.cxx index c604019e0e2c..4a0886e44812 100644 --- a/writerfilter/source/dmapper/LoggedResources.cxx +++ b/writerfilter/source/dmapper/LoggedResources.cxx @@ -41,7 +41,7 @@ void LoggedResourcesHelper::startElement(const std::string& sElement) void LoggedResourcesHelper::endElement() { TagLogger::getInstance().endElement(); } -void LoggedResourcesHelper::chars(const OUString& rChars) +void LoggedResourcesHelper::chars(std::u16string_view rChars) { TagLogger::getInstance().chars(rChars); } diff --git a/writerfilter/source/dmapper/LoggedResources.hxx b/writerfilter/source/dmapper/LoggedResources.hxx index cb940800d949..52ef6a43e9d2 100644 --- a/writerfilter/source/dmapper/LoggedResources.hxx +++ b/writerfilter/source/dmapper/LoggedResources.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX +#include <sal/config.h> + +#include <string_view> + #include <dmapper/resourcemodel.hxx> namespace writerfilter @@ -33,7 +37,7 @@ public: void startElement(const std::string& sElement); static void endElement(); - static void chars(const OUString& rChars); + static void chars(std::u16string_view rChars); static void chars(const std::string& rChars); static void attribute(const std::string& rName, const std::string& rValue); static void attribute(const std::string& rName, sal_uInt32 nValue); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index a29693683555..3bb0167678b8 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -16,6 +16,11 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +#include <sal/config.h> + +#include <string_view> + #include "PropertyMap.hxx" #include "TagLogger.hxx" #include <ooxml/resourceids.hxx> @@ -316,7 +321,7 @@ void PropertyMap::dumpXml() const TagLogger::getInstance().attribute( "floatValue", aFloat ); rPropPair.second.getValue() >>= auInt; - TagLogger::getInstance().attribute( "stringValue", OUString() ); + TagLogger::getInstance().attribute( "stringValue", std::u16string_view() ); } catch ( ... ) { diff --git a/writerfilter/source/dmapper/TagLogger.cxx b/writerfilter/source/dmapper/TagLogger.cxx index 6c655589d8cc..a7443f056d29 100644 --- a/writerfilter/source/dmapper/TagLogger.cxx +++ b/writerfilter/source/dmapper/TagLogger.cxx @@ -167,7 +167,7 @@ struct TheTagLogger: } #ifdef DBG_UTIL - void TagLogger::attribute(const std::string & name, const OUString & value) + void TagLogger::attribute(const std::string & name, std::u16string_view value) { attribute( name, OUStringToOString( value, RTL_TEXTENCODING_ASCII_US ).getStr() ); } @@ -218,7 +218,7 @@ struct TheTagLogger: xmlFree( xmlChars ); } - void TagLogger::chars(const OUString & rChars) + void TagLogger::chars(std::u16string_view rChars) { chars(OUStringToOString(rChars, RTL_TEXTENCODING_ASCII_US).getStr()); } diff --git a/writerfilter/source/dmapper/TagLogger.hxx b/writerfilter/source/dmapper/TagLogger.hxx index b1bba8f6166e..f28b58b59f26 100644 --- a/writerfilter/source/dmapper/TagLogger.hxx +++ b/writerfilter/source/dmapper/TagLogger.hxx @@ -24,6 +24,7 @@ #include <tools/ref.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <string> +#include <string_view> #include <libxml/xmlwriter.h> namespace writerfilter @@ -52,11 +53,11 @@ namespace writerfilter #endif void attribute(const std::string & name, const std::string & value); #ifdef DBG_UTIL - void attribute(const std::string & name, const OUString & value); + void attribute(const std::string & name, std::u16string_view value); void attribute(const std::string & name, sal_uInt32 value); void attribute(const std::string & name, const css::uno::Any& aAny); void chars(const std::string & chars); - void chars(const OUString & chars); + void chars(std::u16string_view chars); void endElement(); #endif }; diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 418498f98df3..fea4d7dac0a6 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -80,7 +80,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } if (cCh > 0) { - OUString aStr(OStringToOUString(OString(char(cCh)), RTL_TEXTENCODING_MS_1252)); + OUString aStr(OStringToOUString(OStringChar(char(cCh)), RTL_TEXTENCODING_MS_1252)); text(aStr); return RTFError::OK; } |