starmath/inc/parse5.hxx | 2 +- starmath/source/node.cxx | 6 +++--- starmath/source/parse5.cxx | 6 +++--- starmath/source/rect.cxx | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-)
New commits: commit 9ec9ace3f010dc654ac831cf66d9589a16b07931 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 30 09:06:25 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 30 10:47:56 2022 +0200 use more string_view in starmath Change-Id: I3569d8dd41bf1c2db6a1fd379ca5596342922e45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140786 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/starmath/inc/parse5.hxx b/starmath/inc/parse5.hxx index 5b72378676ee..92fc2a02917b 100644 --- a/starmath/inc/parse5.hxx +++ b/starmath/inc/parse5.hxx @@ -55,7 +55,7 @@ class SmParser5 final : public AbstractSmParser void NextTokenColor(SmTokenType dvipload); void NextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } - void Replace(sal_Int32 nPos, sal_Int32 nLen, const OUString& rText); + void Replace(sal_Int32 nPos, sal_Int32 nLen, std::u16string_view aText); inline bool TokenInGroup(TG nGroup); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 008ea0d3cc7d..421c9e03955e 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2162,14 +2162,14 @@ void SmMathSymbolNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) /**************************************************************************/ -static bool lcl_IsFromGreekSymbolSet( const OUString &rTokenText ) +static bool lcl_IsFromGreekSymbolSet( std::u16string_view aTokenText ) { bool bRes = false; // valid symbol name needs to have a '%' at pos 0 and at least an additional char - if (rTokenText.getLength() > 2 && rTokenText[0] == u'%') + if (aTokenText.size() > 2 && aTokenText[0] == u'%') { - OUString aName( rTokenText.copy(1) ); + OUString aName( aTokenText.substr(1) ); SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName ); if (pSymbol && SmLocalizedSymbolData::GetExportSymbolSetName(pSymbol->GetSymbolSetName()) == "Greek") bRes = true; diff --git a/starmath/source/parse5.cxx b/starmath/source/parse5.cxx index 06aa373aa037..13f3701db26a 100644 --- a/starmath/source/parse5.cxx +++ b/starmath/source/parse5.cxx @@ -374,12 +374,12 @@ static bool lcl_IsNotWholeNumber16(const OUString& rText) } //Text replace onto m_aBufferString -void SmParser5::Replace(sal_Int32 nPos, sal_Int32 nLen, const OUString& rText) +void SmParser5::Replace(sal_Int32 nPos, sal_Int32 nLen, std::u16string_view aText) { assert(nPos + nLen <= m_aBufferString.getLength()); //checks if length allows text replace - m_aBufferString = m_aBufferString.replaceAt(nPos, nLen, rText); //replace and reindex - sal_Int32 nChg = rText.getLength() - nLen; + m_aBufferString = m_aBufferString.replaceAt(nPos, nLen, aText); //replace and reindex + sal_Int32 nChg = aText.size() - nLen; m_nBufferIndex = m_nBufferIndex + nChg; m_nTokenIndex = m_nTokenIndex + nChg; } diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index e7b761a46729..807ab7d0c0fc 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -108,7 +108,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev, return bSuccess; } -bool SmIsMathAlpha(const OUString &rText) +bool SmIsMathAlpha(std::u16string_view aText) // true iff symbol (from StarMath Font) should be treated as letter { // Set of symbols, which should be treated as letters in StarMath Font @@ -125,11 +125,11 @@ bool SmIsMathAlpha(const OUString &rText) u'\x2130', u'\x2131' }); - if (rText.isEmpty()) + if (aText.empty()) return false; - OSL_ENSURE(rText.getLength() == 1, "Sm : string must be exactly one character long"); - sal_Unicode cChar = rText[0]; + OSL_ENSURE(aText.size() == 1, "Sm : string must be exactly one character long"); + sal_Unicode cChar = aText[0]; // is it a greek symbol? if (u'\xE0AC' <= cChar && cChar <= u'\xE0D4')