From 4f5b3e4bd53d6d61df1f65f496f7bc8dc525c8a1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 1 Oct 2021 09:09:45 +0200 Subject: In O[U]StringBuffer, make string_view params replacements for OUString ones ...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- xmloff/source/style/xmlnumfi.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xmloff/source/style') diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 39d6c2763c6a..823cdf79e904 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1027,7 +1027,7 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 ) // add integer part only if min-integer-digits attribute is there aNumInfo.nDecimals = 0; rParent.AddNumber( aNumInfo ); // number without decimals - OUStringBuffer sIntegerFractionDelimiter = aNumInfo.aIntegerFractionDelimiter; + OUStringBuffer sIntegerFractionDelimiter(aNumInfo.aIntegerFractionDelimiter); lcl_EnquoteIfNecessary( sIntegerFractionDelimiter, rParent ); rParent.AddToCode( sIntegerFractionDelimiter.makeStringAndClear() ); // default is ' ' } @@ -1704,8 +1704,8 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo ) bGrouping = false; // grouping and embedded characters can't be used together sal_uInt32 nStdIndex = pFormatter->GetStandardIndex( nFormatLang ); - OUStringBuffer aNumStr = pFormatter->GenerateFormat( nStdIndex, nFormatLang, - bGrouping, false, nGenPrec, nLeading ); + OUStringBuffer aNumStr(pFormatter->GenerateFormat( nStdIndex, nFormatLang, + bGrouping, false, nGenPrec, nLeading )); if ( rInfo.nExpDigits >= 0 && nLeading == 0 && !bGrouping && nEmbeddedCount == 0 ) { -- cgit v1.2.3