From fdfd517a6f75e394ddcb1e195decbfed33ba56b9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2022 12:43:11 +0200 Subject: loplugin:stringviewparam whitelist some more functions for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/draw/animationimport.cxx | 20 ++++++++++---------- xmloff/source/draw/ximpcustomshape.cxx | 9 +++++---- xmloff/source/style/xmlnumfe.cxx | 11 ++++++----- 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 236131ac8bb9..094dc94f52c5 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -110,13 +110,13 @@ public: explicit AnimationsImportHelperImpl( SvXMLImport& rImport ); Any convertValue( XMLTokenEnum eAttributeName, const OUString& rValue ); - Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue ); + Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, std::u16string_view rValue ); Any convertTarget( const OUString& rValue ); static Any convertPath( const OUString& rValue ); Any convertTiming( const OUString& rValue ); static Sequence< double > convertKeyTimes( std::u16string_view rValue ); - static Sequence< TimeFilterPair > convertTimeFilter( const OUString& rValue ); + static Sequence< TimeFilterPair > convertTimeFilter( std::u16string_view rValue ); }; AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport& rImport ) @@ -283,7 +283,7 @@ Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const } } -Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue ) +Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, std::u16string_view rValue ) { Sequence< Any > aValues; @@ -296,7 +296,7 @@ Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum e // fill the sequence Any* pValues = aValues.getArray(); for (sal_Int32 nIndex = 0; nIndex >= 0; ) - *pValues++ = convertValue( eAttributeName, rValue.getToken( 0, ';', nIndex ) ); + *pValues++ = convertValue( eAttributeName, OUString(o3tl::getToken(rValue, 0, ';', nIndex )) ); } return aValues; @@ -394,7 +394,7 @@ Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::u16string_v return aKeyTimes; } -Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const OUString& rValue ) +Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( std::u16string_view rValue ) { const sal_Int32 nElements { comphelper::string::getTokenCount(rValue, ';') }; @@ -405,15 +405,15 @@ Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const TimeFilterPair* pValues = aTimeFilter.getArray(); for (sal_Int32 nIndex = 0; nIndex >= 0; ) { - const OUString aToken( rValue.getToken( 0, ';', nIndex ) ); + const std::u16string_view aToken( o3tl::getToken(rValue, 0, ';', nIndex ) ); - sal_Int32 nPos = aToken.indexOf( ',' ); - if( nPos >= 0 ) + size_t nPos = aToken.find( ',' ); + if( nPos != std::u16string_view::npos ) { pValues->Time = rtl_math_uStringToDouble( - aToken.getStr(), aToken.getStr() + nPos, '.', 0, nullptr, nullptr); + aToken.data(), aToken.data() + nPos, '.', 0, nullptr, nullptr); pValues->Progress = rtl_math_uStringToDouble( - aToken.getStr() + nPos + 1, aToken.getStr() + aToken.getLength(), '.', 0, + aToken.data() + nPos + 1, aToken.data() + aToken.size(), '.', 0, nullptr, nullptr); } pValues++; diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index ab567b6bd178..5e32cdba6763 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -440,14 +441,14 @@ static void GetPosition3D( std::vector< css::beans::PropertyValue >& rDest, } static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions - const OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< double > vDirection; sal_Int32 nIndex = 0; do { double fAttrDouble; - OUString aToken( rValue.getToken( 0, ',', nIndex ) ); + std::u16string_view aToken( o3tl::getToken(rValue, 0, ',', nIndex ) ); if (!::sax::Converter::convertDouble( fAttrDouble, aToken )) break; else @@ -465,14 +466,14 @@ static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, } static void GetSizeSequence( std::vector< css::beans::PropertyValue >& rDest, - const OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< sal_Int32 > vNum; sal_Int32 nIndex = 0; do { sal_Int32 n; - OUString aToken( rValue.getToken( 0, ' ', nIndex ) ); + std::u16string_view aToken( o3tl::getToken(rValue, 0, ' ', nIndex ) ); if (!::sax::Converter::convertNumber( n, aToken )) break; else diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 4c313538b0df..52b286dd50a9 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -348,16 +349,16 @@ void SvXMLNumFmtExport::WriteColorElement_Impl( const Color& rColor ) } void SvXMLNumFmtExport::WriteCurrencyElement_Impl( const OUString& rString, - const OUString& rExt ) + std::u16string_view rExt ) { FinishTextElement_Impl(); - if ( !rExt.isEmpty() ) + if ( !rExt.empty() ) { // rExt should be a 16-bit hex value max FFFF which may contain a // leading "-" separator (that is not a minus sign, but toInt32 can be // used to parse it, with post-processing as necessary): - sal_Int32 nLang = rExt.toInt32(16); + sal_Int32 nLang = o3tl::toInt32(rExt, 16); if ( nLang < 0 ) nLang = -nLang; AddLanguageAttr_Impl( LanguageType(nLang) ); // adds to pAttrList @@ -903,7 +904,7 @@ bool SvXMLNumFmtExport::WriteTextWithCurrency_Impl( const OUString& rString, AddToTextElement_Impl( rString.subView( 0, nPos ) ); } // currency symbol (empty string -> default) - WriteCurrencyElement_Impl( "", "" ); + WriteCurrencyElement_Impl( "", u"" ); bRet = true; // text after currency symbol @@ -1478,7 +1479,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt //! but should still be empty (meaning automatic) // pElemStr is "CCC" - WriteCurrencyElement_Impl( *pElemStr, OUString() ); + WriteCurrencyElement_Impl( *pElemStr, u"" ); bAnyContent = true; bCurrencyWritten = true; } -- cgit