diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-28 15:09:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 09:05:18 +0200 |
commit | 4c91b89d8ce9c34179f31854dc88bd0a9fa84cba (patch) | |
tree | 1fe9cc9db455779d33c24320fedc1e25888b3e5c /chart2 | |
parent | a1f31211920bfae1a21ea375fa5280c9c6595e15 (diff) |
new loplugin:oustringbuffer
look for places where we are appending the temporary result of adding
strings together, to an OUStringBuffer, where we could rather call
append repeatedly and avoid the temporary creation
Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82
Reviewed-on: https://gerrit.libreoffice.org/59708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
6 files changed, 17 insertions, 17 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index ceb818c70e0f..e06ce2f76415 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -230,7 +230,7 @@ protected: OUStringBuffer aBufer; for (const OUString& seqItem : rSeq) { - aBufer.append(seqItem + ";"); + aBufer.append(seqItem).append(";"); } return aBufer.makeStringAndClear(); } @@ -240,7 +240,7 @@ protected: OUStringBuffer aBufer; for (const double& vectorItem : rVector) { - aBufer.append(OUString::number(vectorItem) + ";"); + aBufer.append(OUString::number(vectorItem)).append(";"); } return aBufer.makeStringAndClear(); } diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx index db59250b76b0..42d0480d6b73 100644 --- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx @@ -179,13 +179,13 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation( // if nValueLength not calculated then nullptr sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr; if ( m_fSign < 0.0 ) - aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " ); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " ); if ( bHasIntercept ) { OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fIntercept, pValueLength ); if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small { - aTmpBuf.append( aValueString + " " ); + aTmpBuf.append( aValueString ).append( " " ); addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth ); aTmpBuf.truncate(); } @@ -199,21 +199,21 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation( OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept, pValueLength ); if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small { - aTmpBuf.append( aValueString + ( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") ) ); + aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") ); } } } if ( m_fLogSlope < 0.0 ) - aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " ); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " ); if ( bHasLogSlope ) { OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fLogSlope), pValueLength ); if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small { - aTmpBuf.append( aValueString + " " ); + aTmpBuf.append( aValueString ).append( " " ); } } - aTmpBuf.append( mXName + " )"); + aTmpBuf.append( mXName ).append(" )"); addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth ); return aBuf.makeStringAndClear(); diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx index 377c1ccfe102..aecbc4ed39c9 100644 --- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx +++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx @@ -156,17 +156,17 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation( { if( m_fSlope < 0.0 ) { - aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " ); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " ); } if( bHasSlope ) { OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fSlope), pValueLength ); if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small { - aTmpBuf.append( aValueString + " " ); + aTmpBuf.append( aValueString ).append( " " ); } } - aTmpBuf.append( "ln(" + mXName + ") " ); + aTmpBuf.append( "ln(" ).append( mXName ).append( ") " ); addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth ); aTmpBuf.truncate(); @@ -175,7 +175,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation( } // add intercept value if( m_fIntercept < 0.0 ) - aTmpBuf.append( OUStringLiteral1(aMinusSign)+" " ); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " ); OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength ); if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small { diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx index ab67bbd09e36..3727e38806ef 100644 --- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx @@ -274,7 +274,7 @@ OUString PolynomialRegressionCurveCalculator::ImplGetRepresentation( { if ( bFindValue ) // if it is not the first aValue aTmpBuf.append( " " ); - aTmpBuf.append( OUStringLiteral1(aMinusSign) + " "); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append(" "); aValue = - aValue; } else diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx index d4901d843279..6f4f507d039f 100644 --- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx @@ -170,18 +170,18 @@ OUString PotentialRegressionCurveCalculator::ImplGetRepresentation( // if nValueLength not calculated then nullptr sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr; if ( m_fIntercept < 0.0 ) // add intercept value - aTmpBuf.append( OUStringLiteral1(aMinusSign)+" " ); + aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " ); if( bHasIntercept ) { OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength ); if ( aValueString != "1" ) // aValueString may be rounded to 1 if nValueLength is small { - aTmpBuf.append( aValueString + " " ); + aTmpBuf.append( aValueString ).append( " " ); } } if( m_fSlope != 0.0 ) // add slope value { - aTmpBuf.append( mXName + "^" ); + aTmpBuf.append( mXName ).append( "^" ); aTmpBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope, pValueLength )); } addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth ); diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index bad0d71432da..4b4602af7589 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1352,7 +1352,7 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( } if( bShowCorrCoeff ) { - aFormula.append( "R" + OUStringLiteral1( aSuperscriptFigures[2] ) + " = " ); + aFormula.append( "R" ).append( OUStringLiteral1( aSuperscriptFigures[2] ) ).append( " = " ); double fR( xRegressionCurveCalculator->getCorrelationCoefficient()); if( m_apNumberFormatterWrapper.get()) { |