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 /drawinglayer/source | |
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 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/dumper/EnhancedShapeDumper.cxx | 2 | ||||
-rw-r--r-- | drawinglayer/source/dumper/EnhancedShapeDumper.hxx | 6 | ||||
-rw-r--r-- | drawinglayer/source/dumper/XShapeDumper.cxx | 49 |
3 files changed, 32 insertions, 25 deletions
diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx index 84fbc58dbb3b..611ac87cd33d 100644 --- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx @@ -429,7 +429,7 @@ void EnhancedShapeDumper::dumpEnhancedCustomShapeGeometryService(const uno::Refe dumpHandlesAsElement(aHandles); } } -void EnhancedShapeDumper::dumpTypeAsAttribute(const OUString& sType) +void EnhancedShapeDumper::dumpTypeAsAttribute(std::u16string_view sType) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr()); diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx index 2949bb95448f..f6c8453e9087 100644 --- a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx @@ -8,6 +8,10 @@ */ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <libxml/xmlwriter.h> #include <com/sun/star/beans/XPropertySet.hpp> @@ -73,7 +77,7 @@ public: // EnhancedCustomShapeGeometry.idl void dumpEnhancedCustomShapeGeometryService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet); - void dumpTypeAsAttribute(const OUString& sType); + void dumpTypeAsAttribute(std::u16string_view sType); void dumpViewBoxAsElement(css::awt::Rectangle aViewBox); void dumpMirroredXAsAttribute(bool bMirroredX); // also used in EnhancedCustomShapeHandle void dumpMirroredYAsAttribute(bool bMirroredY); // also used in EnhancedCustomShapeHandle diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx index be72eeb2b8a9..5ea63dccc323 100644 --- a/drawinglayer/source/dumper/XShapeDumper.cxx +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -42,6 +42,7 @@ #include <rtl/strbuf.hxx> #include <libxml/xmlwriter.h> #include <iostream> +#include <string_view> #include <rtl/ustring.hxx> #define DEBUG_DUMPER 0 @@ -62,9 +63,9 @@ void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlT void dumpFillStyleAsAttribute(css::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter); void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter); void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter); -void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter); +void dumpFillTransparenceGradientNameAsAttribute(std::u16string_view sTranspGradName, xmlTextWriterPtr xmlWriter); void dumpFillTransparenceGradientAsElement(const css::awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter); -void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter); +void dumpFillGradientNameAsAttribute(std::u16string_view sGradName, xmlTextWriterPtr xmlWriter); void dumpFillGradientAsElement(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter); void dumpFillHatchAsElement(const css::drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter); void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter); @@ -84,13 +85,13 @@ void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter) // LineProperties.idl void dumpLineStyleAsAttribute(css::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter); void dumpLineDashAsElement(const css::drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter); -void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter); +void dumpLineDashNameAsAttribute(std::u16string_view sLineDashName, xmlTextWriterPtr xmlWriter); void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter); void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter); void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter); void dumpLineJointAsAttribute(css::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter); -void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter); -void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter); +void dumpLineStartNameAsAttribute(std::u16string_view sLineStartName, xmlTextWriterPtr xmlWriter); +void dumpLineEndNameAsAttribute(std::u16string_view sLineEndName, xmlTextWriterPtr xmlWriter); void dumpLineStartAsElement(const css::drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter); void dumpLineEndAsElement(const css::drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter); void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter); @@ -142,23 +143,24 @@ void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr //Shape.idl void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter); void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter); -void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter); +void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter); void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter); void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter); void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter); -void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter); +void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter); void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter); void dumpHomogenMatrixLine3(const css::drawing::HomogenMatrixLine3& rLine, xmlTextWriterPtr xmlWriter); void dumpTransformationAsElement(const css::drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter); void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter); -void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter); +void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter); void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter); // CustomShape.idl -void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter); -void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeDataAsAttribute( + std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter); void dumpCustomShapeGeometryAsElement(const css::uno::Sequence< css::beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter); -void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter); // XShape.idl void dumpPositionAsAttribute(const css::awt::Point& rPoint, xmlTextWriterPtr xmlWriter); @@ -229,7 +231,7 @@ void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr x xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence); } -void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter) +void dumpFillTransparenceGradientNameAsAttribute(std::u16string_view sTranspGradName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s", OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr()); @@ -279,7 +281,7 @@ void dumpFillTransparenceGradientAsElement(const awt::Gradient& rTranspGrad, xml xmlTextWriterEndElement( xmlWriter ); } -void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter) +void dumpFillGradientNameAsAttribute(std::u16string_view sGradName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s", OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr()); @@ -493,7 +495,7 @@ void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr xmlTextWriterEndElement( xmlWriter ); } -void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter) +void dumpLineDashNameAsAttribute(std::u16string_view sLineDashName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s", OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr()); @@ -538,13 +540,13 @@ void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xm } } -void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter) +void dumpLineStartNameAsAttribute(std::u16string_view sLineStartName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s", OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr()); } -void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter) +void dumpLineEndNameAsAttribute(std::u16string_view sLineEndName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s", OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr()); @@ -989,7 +991,7 @@ void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter) xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID); } -void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter) +void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s", OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr()); @@ -1019,9 +1021,9 @@ void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter) xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false"); } -void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter) +void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter) { - if(!sName.isEmpty() && !m_bNameDumped) + if(!sName.empty() && !m_bNameDumped) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); m_bNameDumped = true; @@ -1065,7 +1067,7 @@ void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder); } -void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter) +void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s", OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr()); @@ -1108,13 +1110,14 @@ void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescri // ---------- CustomShape.idl ---------- -void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s", OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr()); } -void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeDataAsAttribute( + std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s", OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr()); @@ -1220,7 +1223,7 @@ void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue> xmlTextWriterEndElement( xmlWriter ); } -void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter) +void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter) { xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s", OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr()); |