diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-28 11:01:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-28 11:11:28 +0100 |
commit | 1da69081732c8a429840edaaf10cfb789ea68df8 (patch) | |
tree | f343c9559e9dfb0263f7e33fe4306f81ec60e3fa /sw | |
parent | b3737c638671ab39c5e6aaeaf5426d102392cc0a (diff) |
add string_view variants of methods to O[U]StringBuffer
and update the stringview loplugin to detect cases where we can
use these new methods.
Change-Id: I998efe02e35c8efcb3abfb4d7186165bbe6dfb2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110046
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ascii/ascatr.cxx | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index c06ea3ef2713..6a63cc26500b 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -918,7 +918,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, if (it->nStart <= nIndex && nIndex <= it->nEnd) { // note: this can happen only once text.insert(nTFIndex + (nIndex - it->nStart), - rNode.GetText().copy(nIndex, nLen)); + rNode.GetText().subView(nIndex, nLen)); it->nEnd += nLen; nInserted = nLen; assert(!bInserted); @@ -945,7 +945,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, if (nIndex < it->nStart) { text.insert(nTFIndex, - rNode.GetText().copy(nIndex, it->nStart - nIndex)); + rNode.GetText().subView(nIndex, it->nStart - nIndex)); nInserted += it->nStart - nIndex; it->nStart = nIndex; bInserted = true; @@ -963,7 +963,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, if (pNext && pNext->nStart <= nIndex + nLen) { text.insert(nTFIndex, - rNode.GetText().copy(it->nEnd, pNext->nStart - it->nEnd)); + rNode.GetText().subView(it->nEnd, pNext->nStart - it->nEnd)); nTFIndex += pNext->nStart - it->nEnd; nInserted += pNext->nStart - it->nEnd; pNext->nStart = it->nStart; @@ -972,7 +972,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, else { text.insert(nTFIndex, - rNode.GetText().copy(it->nEnd, nIndex + nLen - it->nEnd)); + rNode.GetText().subView(it->nEnd, nIndex + nLen - it->nEnd)); nTFIndex += nIndex + nLen - it->nEnd; nInserted += nIndex + nLen - it->nEnd; it->nEnd = nIndex + nLen; @@ -1000,7 +1000,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, if (!bInserted) { // must be in a gap rMerged.extents.emplace(itInsert, const_cast<SwTextNode*>(&rNode), nIndex, nIndex + nLen); - text.insert(nTFIndex, rNode.GetText().copy(nIndex, nLen)); + text.insert(nTFIndex, rNode.GetText().subView(nIndex, nLen)); nInserted = nLen; if (rMerged.extents.size() == 1 // also if it was empty! || rMerged.pParaPropsNode->GetIndex() < rNode.GetIndex()) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 57b30d59cb45..9575652feec1 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3355,7 +3355,7 @@ OUString SwTextNode::GetExpandText(SwRootFrame const*const pLayout, const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx ); sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen; const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd ); - OUStringBuffer aText(aExpandText.copy(nExpandBegin, nExpandEnd-nExpandBegin)); + OUStringBuffer aText(aExpandText.subView(nExpandBegin, nExpandEnd-nExpandBegin)); // remove dummy characters of Input Fields comphelper::string::remove(aText, CH_TXT_ATR_INPUTFIELDSTART); diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index da433d4272e0..4b5086983d1e 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -316,14 +316,14 @@ static Writer& OutASC_SwTextNode( Writer& rWrt, SwContentNode& rNode ) { if (nNextAttr <= curRedline.first) { - buf.append(aStr.copy(nStrPos, nNextAttr - nStrPos)); + buf.append(aStr.subView(nStrPos, nNextAttr - nStrPos)); break; } else if (nStrPos < curRedline.second) { if (nStrPos < curRedline.first) { - buf.append(aStr.copy(nStrPos, curRedline.first - nStrPos)); + buf.append(aStr.subView(nStrPos, curRedline.first - nStrPos)); } if (curRedline.second <= nNextAttr) { |