diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 11:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-01 08:30:18 +0200 |
commit | 5200a73627d13e2997f81b53f61e143e77e328ee (patch) | |
tree | f95c8346d061ecd0ad33d574895d18e169662785 /editeng | |
parent | b90d3d316dd9c720c83180b31f6bbd7003fead78 (diff) |
use more string_view in various
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 4 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 129c4d9f6a0e..83eb93066baf 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1971,8 +1971,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te { // TODO: handle all alternative hyphenations (see hyphen-1.2.8/tests/unicode.*) OUString aAlt( xHyphWord->getHyphenatedWord() ); - OUString aAltLeft(aAlt.copy(0, _nWordLen)); - OUString aAltRight(aAlt.copy(_nWordLen)); + std::u16string_view aAltLeft(aAlt.subView(0, _nWordLen)); + std::u16string_view aAltRight(aAlt.subView(_nWordLen)); bAltFullLeft = aWord.startsWith(aAltLeft); bAltFullRight = aWord.endsWith(aAltRight); nAltDelChar = aWord.getLength() - aAlt.getLength() + static_cast<int>(!bAltFullLeft) + static_cast<int>(!bAltFullRight); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index d969b09c0015..fba4bddce8c6 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -519,7 +519,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); for (OUString const & sSuffix : aSuffixes) { - OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1); + std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); if (sSuffix == sEnd) { @@ -2971,7 +2971,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p if (bWasWordDelim) rStt++; OUString left_pattern = rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard); // avoid double spaces before simple "word" replacement - left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().copy(1) : pFnd->GetLong(); + left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().subView(1) : pFnd->GetLong(); if( const SvxAutocorrWord* pNew = Insert( SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), left_pattern) ) ) return pNew; } @@ -3018,7 +3018,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p if ( !left_wildcard ) { sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength(); - aLong = pFnd->GetLong() + (siz > 0 ? rTxt.copy(nFndPos + sTmp.getLength(), siz) : ""); + aLong = pFnd->GetLong() + (siz > 0 ? rTxt.subView(nFndPos + sTmp.getLength(), siz) : u""); } else { OUStringBuffer buf; do { |