summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-09-30 13:54:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-10-03 19:50:44 +0200
commitad1557f5d775739230e0e2252c293948977b42a0 (patch)
tree610e2e849d87583888c0c658088044d6dc3966a5 /chart2
parent7e7dd7f152bc7457437f541e7ff88d69e9f8e765 (diff)
A more lightweight O[U]StringConcatenation
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2dump/chart2dump.cxx4
-rw-r--r--chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx2
-rw-r--r--chart2/source/tools/PolynomialRegressionCurveCalculator.cxx2
3 files changed, 4 insertions, 4 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index fc3944f494e3..4d40c9cc3f8b 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -125,7 +125,7 @@ protected:
{
if (m_aReferenceFile.is_open())
m_aReferenceFile.close();
- OString sReferenceFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8);
+ OString sReferenceFile = OUStringToOString(OUStringConcatenation(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8);
m_aReferenceFile.open(sReferenceFile.getStr(), std::ios_base::in);
CPPUNIT_ASSERT_MESSAGE(OString("Can't open reference file: " + sReferenceFile).getStr(), m_aReferenceFile.is_open());
}
@@ -133,7 +133,7 @@ protected:
{
if (m_aDumpFile.is_open())
m_aDumpFile.close();
- OString sDumpFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8);
+ OString sDumpFile = OUStringToOString(OUStringConcatenation(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8);
m_aDumpFile.open(sDumpFile.getStr(), std::ios_base::out | std::ofstream::binary | std::ofstream::trunc);
CPPUNIT_ASSERT_MESSAGE(OString("Can't open dump file: " + sDumpFile).getStr(), m_aDumpFile.is_open());
}
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index c9e000e0243e..1e84ed81d42d 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -178,7 +178,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
}
- if ( aBuf.toString() == (mYName + " = ") )
+ if ( aBuf.toString() == OUStringConcatenation(mYName + " = ") )
aBuf.append( "0" );
return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index d6b22c1635f5..2c2e6be4b5bf 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -381,7 +381,7 @@ OUString PolynomialRegressionCurveCalculator::ImplGetRepresentation(
}
addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
}
- if ( aBuf.toString() == ( mYName + " = ") )
+ if ( aBuf.toString() == OUStringConcatenation( mYName + " = ") )
aBuf.append( "0" );
return aBuf.makeStringAndClear();