summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basic/source/comp/codegen.cxx3
-rw-r--r--basic/source/runtime/runtime.cxx4
-rw-r--r--comphelper/source/misc/string.cxx3
-rw-r--r--configmgr/qa/unit/test.cxx3
-rw-r--r--connectivity/source/commontools/dbtools2.cxx5
-rw-r--r--connectivity/source/drivers/firebird/Clob.cxx8
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx9
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx15
-rw-r--r--editeng/source/editeng/editdoc.cxx3
-rw-r--r--editeng/source/misc/svxacorr.cxx5
-rw-r--r--forms/source/component/Filter.cxx6
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx5
-rw-r--r--i18npool/source/characterclassification/cclass_unicode_parser.cxx13
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx5
-rw-r--r--include/rtl/ustrbuf.hxx52
-rw-r--r--oox/source/core/relationshandler.cxx6
-rw-r--r--oox/source/dump/dumperbase.cxx8
-rw-r--r--opencl/source/openclconfig.cxx8
-rw-r--r--registry/source/keyimpl.cxx3
-rw-r--r--sax/source/tools/converter.cxx3
-rw-r--r--sc/source/core/tool/address.cxx6
-rw-r--r--sc/source/filter/excel/xehelper.cxx6
-rw-r--r--sc/source/ui/app/inputhdl.cxx6
-rw-r--r--sdext/source/pdfimport/tree/style.cxx3
-rw-r--r--sdext/source/presenter/PresenterController.cxx8
-rw-r--r--stoc/source/uriproc/ExternalUriReferenceTranslator.cxx8
-rw-r--r--stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx7
-rw-r--r--svl/source/misc/urihelper.cxx6
-rw-r--r--svl/source/numbers/zformat.cxx12
-rw-r--r--sw/source/core/access/accportions.cxx6
-rw-r--r--sw/source/core/bastyp/calc.cxx9
-rw-r--r--sw/source/core/crsr/pam.cxx6
-rw-r--r--sw/source/core/fields/cellfml.cxx8
-rw-r--r--sw/source/core/text/redlnitr.cxx8
-rw-r--r--sw/source/filter/xml/xmltexte.cxx6
-rw-r--r--toolkit/source/awt/animatedimagespeer.cxx6
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx6
-rw-r--r--unotools/source/config/configpaths.cxx8
-rw-r--r--unotools/source/i18n/textsearch.cxx5
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.cxx5
-rw-r--r--vcl/source/control/field.cxx17
-rw-r--r--vcl/source/control/field2.cxx3
-rw-r--r--vcl/source/control/longcurr.cxx6
-rw-r--r--vcl/source/edit/texteng.cxx5
-rw-r--r--vcl/source/window/menu.cxx5
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx3
-rw-r--r--xmloff/source/core/xmluconv.cxx5
-rw-r--r--xmloff/source/meta/xmlmetai.cxx8
-rw-r--r--xmloff/source/style/fonthdl.cxx6
-rw-r--r--xmloff/source/style/xmlexppr.cxx3
51 files changed, 228 insertions, 138 deletions
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 6daa6dde378d..eeb610bbed99 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -25,6 +25,7 @@
#include <cstddef>
#include <limits>
#include <algorithm>
+#include <string_view>
#include <osl/diagnose.h>
#include <com/sun/star/script/ModuleType.hpp>
@@ -212,7 +213,7 @@ void SbiCodeGen::Save()
{
aIfaceProcName.append(aPropPrefix);
}
- aIfaceProcName.appendCopy(aPureProcName, rIfaceName.getLength() + 1 );
+ aIfaceProcName.append(std::u16string_view(aPureProcName).substr(rIfaceName.getLength() + 1) );
aIfaceName = rIfaceName;
nPassCount = 2;
break;
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index c8d3ccbd5699..ea0d9ae69379 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <algorithm>
-
+#include <string_view>
#include <unordered_map>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -2050,7 +2050,7 @@ void SbiRuntime::StepRSET()
}
else
{
- aNewStr.appendCopy(aRefValString, 0, nVarStrLen);
+ aNewStr.append(std::u16string_view(aRefValString).substr(0, nVarStrLen));
}
refVar->PutString(aNewStr.makeStringAndClear());
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 89d72a3a1cf2..0822d39d5d78 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -21,6 +21,7 @@
#include <cstddef>
#include <string.h>
+#include <string_view>
#include <vector>
#include <algorithm>
@@ -443,7 +444,7 @@ OUString removeAny(OUString const& rIn,
{
if (i > 0)
{
- buf.appendCopy(rIn, 0, i);
+ buf.append(std::u16string_view(rIn).substr(0, i));
}
isFound = true;
}
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index 1ea04c4081f1..f98fa730f58c 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <cstddef>
+#include <string_view>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
@@ -553,7 +554,7 @@ void normalize(
} else {
OUStringBuffer buf(path);
buf.append('/');
- buf.appendCopy(relative, 0, i);
+ buf.append(std::u16string_view(relative).substr(0, i));
*normalizedPath = buf.makeStringAndClear();
*name = relative.copy(i + 1);
}
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index b8643e642efd..9134f02df358 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -47,6 +47,7 @@
#include <tools/diagnose_ex.h>
#include <unotools/sharedunocomponent.hxx>
#include <algorithm>
+#include <string_view>
namespace dbtools
{
@@ -132,7 +133,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
}
else
{
- aSql.appendCopy(sTypeName, 0, ++nParenPos);
+ aSql.append(std::u16string_view(sTypeName).substr(0, ++nParenPos));
}
if ( nPrecision > 0 && nDataType != DataType::TIMESTAMP )
@@ -149,7 +150,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
else
{
nParenPos = sTypeName.indexOf(')',nParenPos);
- aSql.appendCopy(sTypeName, nParenPos);
+ aSql.append(std::u16string_view(sTypeName).substr(nParenPos));
}
}
else
diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx
index 2d150da912f1..6fb7092457d7 100644
--- a/connectivity/source/drivers/firebird/Clob.cxx
+++ b/connectivity/source/drivers/firebird/Clob.cxx
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "Clob.hxx"
#include "Blob.hxx"
#include "Connection.hxx"
@@ -99,7 +103,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition,
if( nCharsToCopy > nLength )
nCharsToCopy = nLength;
// append relevant part of first segment
- sSegmentBuffer.appendCopy( sSegment, 0, nCharsToCopy );
+ sSegmentBuffer.append( std::u16string_view(sSegment).substr(0, nCharsToCopy) );
nActLen += sSegmentBuffer.getLength();
}
}
@@ -115,7 +119,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition,
RTL_TEXTENCODING_UTF8 );
sal_Int32 nStrLen = sSegment.getLength();
if( nActLen + nStrLen > nLength )
- sSegmentBuffer.appendCopy(sSegment, 0, nLength - nActLen);
+ sSegmentBuffer.append(std::u16string_view(sSegment).substr(0, nLength - nActLen));
else
sSegmentBuffer.append(sSegment);
nActLen += nStrLen;
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 648f3f678ff4..cf44aa4d238d 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -16,6 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+
+#include <sal/config.h>
+
+#include <string_view>
+
#include "Connection.hxx"
#include "PreparedStatement.hxx"
#include "ResultSet.hxx"
@@ -333,9 +338,9 @@ sal_Int64 toNumericWithoutDecimalPlace(const OUString& sSource)
OUStringBuffer sBuffer(15);
if(nDotIndex > 0)
{
- sBuffer.appendCopy(sNumber, 0, nDotIndex);
+ sBuffer.append(std::u16string_view(sNumber).substr(0, nDotIndex));
}
- sBuffer.appendCopy(sNumber, nDotIndex + 1);
+ sBuffer.append(std::u16string_view(sNumber).substr(nDotIndex + 1));
return sBuffer.makeStringAndClear().toInt64();
}
}
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 031d599050f2..568ab79d4ec1 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <com/sun/star/task/OfficeRestartManager.hpp>
#include <memory>
+#include <string_view>
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <salhelper/linkhelper.hxx>
@@ -266,7 +267,7 @@ OUString makeURL( OUString const & baseURL, OUString const & relPath_ )
{
OUStringBuffer buf;
if (baseURL.getLength() > 1 && baseURL[ baseURL.getLength() - 1 ] == '/')
- buf.appendCopy( baseURL, 0, baseURL.getLength() - 1 );
+ buf.append( std::u16string_view(baseURL).substr(0, baseURL.getLength() - 1) );
else
buf.append( baseURL );
OUString relPath(relPath_);
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 75bbbe843142..35be6bb90918 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
#include <dp_misc.h>
#include <dp_ucb.h>
@@ -216,18 +219,18 @@ bool readLine( OUString * res, OUString const & startingWith,
{
pos = file.indexOf( LF, pos );
if (pos < 0) { // EOF
- buf.appendCopy( file, start );
+ buf.append( std::u16string_view(file).substr(start) );
}
else
{
if (pos > 0 && file[ pos - 1 ] == CR)
{
// consume extra CR
- buf.appendCopy( file, start, pos - start - 1 );
+ buf.append( std::u16string_view(file).substr(start, pos - start - 1) );
++pos;
}
else
- buf.appendCopy( file, start, pos - start );
+ buf.append( std::u16string_view(file).substr(start, pos - start) );
++pos; // consume LF
// check next line:
if (pos < file.getLength() &&
@@ -271,16 +274,16 @@ bool readProperties( std::vector< std::pair< OUString, OUString> > & out_result,
bool bEOF = false;
pos = file.indexOf( LF, pos );
if (pos < 0) { // EOF
- buf.appendCopy( file, start );
+ buf.append( std::u16string_view(file).substr(start) );
bEOF = true;
}
else
{
if (pos > 0 && file[ pos - 1 ] == CR)
// consume extra CR
- buf.appendCopy( file, start, pos - start - 1 );
+ buf.append( std::u16string_view(file).substr(start, pos - start - 1) );
else
- buf.appendCopy( file, start, pos - start );
+ buf.append( std::u16string_view(file).substr(start, pos - start) );
pos++;
}
OUString aLine = buf.makeStringAndClear();
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 86e4b53fced9..d19542ddc056 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -65,6 +65,7 @@
#include <limits>
#include <memory>
#include <set>
+#include <string_view>
using namespace ::com::sun::star;
@@ -1642,7 +1643,7 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) co
DBG_ASSERT( nEnd >= nIndex, "End in front of the index?" );
//!! beware of sub string length of -1
if (nEnd > nIndex)
- aStr.appendCopy( GetString(), nIndex, nEnd - nIndex );
+ aStr.append( std::u16string_view(GetString()).substr(nIndex, nEnd - nIndex) );
if ( pNextFeature )
{
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index c6cb322d58b0..2ef3ab48523a 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -18,6 +18,7 @@
*/
#include <memory>
+#include <string_view>
#include <sal/config.h>
#include <com/sun/star/io/IOException.hpp>
@@ -2810,12 +2811,12 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
nTmp++;
if (nTmp < nSttWdPos)
break; // word delimiter found
- buf.appendCopy(rTxt, nFndPos, nSttWdPos - nFndPos).append(pFnd->GetLong());
+ buf.append(std::u16string_view(rTxt).substr(nFndPos, nSttWdPos - nFndPos)).append(pFnd->GetLong());
nFndPos = nSttWdPos + sTmp.getLength();
}
} while (nSttWdPos != -1);
if (nEndPos - nFndPos > extra_repl)
- buf.appendCopy(rTxt, nFndPos, nEndPos - nFndPos);
+ buf.append(std::u16string_view(rTxt).substr(nFndPos, nEndPos - nFndPos));
aLong = buf.makeStringAndClear();
}
SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong);
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index d15df8535313..99f43e25d2c2 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "Filter.hxx"
#include <FormComponent.hxx>
#include <strings.hrc>
@@ -307,7 +311,7 @@ namespace frm
// To fix this, we would probably have to revert here to always return "1" or "0" as normalized
// filter, and change our client code to properly translate this (which could be some effort).
if ( nMarkerPos == 0 )
- aText.appendCopy( sText, sExpressionMarker.getLength() );
+ aText.append( std::u16string_view(sText).substr(sExpressionMarker.getLength()) );
else
{
// fallback
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index c5f554488800..11870476e294 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -20,6 +20,7 @@
#include <uielement/toolbarsmenucontroller.hxx>
#include <algorithm>
+#include <string_view>
#include <services.h>
#include <strings.hrc>
@@ -394,7 +395,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
sal_Int32 n = aSortedTbs[i].aCommand.lastIndexOf( '/' );
if (( n > 0 ) && (( n+1 ) < aSortedTbs[i].aCommand.getLength() ))
- aStrBuf.appendCopy( aSortedTbs[i].aCommand, n+1 );
+ aStrBuf.append( std::u16string_view(aSortedTbs[i].aCommand).substr(n+1) );
OUString aCmd( aStrBuf.makeStringAndClear() );
@@ -666,7 +667,7 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r
if (( nIndex > 0 ) && (( nIndex+1 ) < aCmd.getLength() ))
{
OUStringBuffer aBuf( "private:resource/toolbar/" );
- aBuf.appendCopy( aCmd, nIndex+1 );
+ aBuf.append( std::u16string_view(aCmd).substr(nIndex+1) );
bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId ));
OUString aToolBarResName( aBuf.makeStringAndClear() );
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index cc7107e355a2..29d69521954e 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/i18n/NativeNumberSupplier.hpp>
#include <string.h>
+#include <string_view>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::i18n;
@@ -902,13 +903,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex - 2));
aSymbol.append(OUString(&current, 1));
}
else
{
eState = ssStop;
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex - 1));
}
postSymbolIndex = nextCharIndex;
}
@@ -927,13 +928,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 2);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex - 2));
aSymbol.append(OUString(&current, 1));
}
else if (current == nextChar &&
!(nContTypes & KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING) )
{ // "" => literal " escaped
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex));
nextCharIndex = index;
if (index < rText.getLength()) { ++nCodePoints; }
nextChar = (index < rText.getLength()) ? rText.iterateCodePoints(&index) : 0;
@@ -941,7 +942,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
else
{
eState = ssStop;
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex - 1));
}
postSymbolIndex = nextCharIndex;
}
@@ -1050,7 +1051,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if (postSymbolIndex < nextCharIndex)
{ //! open quote
- aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 1);
+ aSymbol.append(std::u16string_view(rText).substr(postSymbolIndex, nextCharIndex - postSymbolIndex - 1));
r.TokenType |= KParseType::MISSING_QUOTE;
}
r.DequotedNameOrString = aSymbol.toString();
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 4e6f176edbb2..80fd575e115d 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -28,6 +28,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <map>
#include <memory>
+#include <string_view>
#include <unordered_map>
#include <com/sun/star/linguistic2/NumberText.hpp>
@@ -1070,7 +1071,7 @@ OUString getHebrewNativeNumberString(const OUString& aNumberString, bool useGere
makeHebrewNumber(value, output, true, useGeresh);
if (i < len)
- output.appendCopy(aNumberString,i);
+ output.append(std::u16string_view(aNumberString).substr(i));
return output.makeStringAndClear();
}
@@ -1189,7 +1190,7 @@ OUString getCyrillicNativeNumberString(const OUString& aNumberString)
makeCyrillicNumber(value, output, true);
if (i < len)
- output.appendCopy(aNumberString,i);
+ output.append(std::u16string_view(aNumberString).substr(i));
return output.makeStringAndClear();
}
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index e504cb894755..62ba9f6b2cd7 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -24,6 +24,12 @@
#include <cassert>
#include <cstring>
+#include <limits>
+#include <new>
+
+#if defined LIBO_INTERNAL_ONLY
+#include <string_view>
+#endif
#include "rtl/ustrbuf.h"
#include "rtl/ustring.hxx"
@@ -530,46 +536,14 @@ public:
return append( str.getStr(), str.getLength() );
}
-#ifdef LIBO_INTERNAL_ONLY
- /**
- Appends a substring of an OUString, starting at position beginIndex.
-
- The characters of the <code>OUString</code> argument are appended, in
- order, to the contents of this string buffer.
-
- @param str a string.
- @param beginIndex the beginning index, inclusive. Must be >= 0 and <= the length of str.
- @return this string buffer.
-
- @since LibreOffice 6.2
- */
- OUStringBuffer & appendCopy(const OUString &str, sal_Int32 beginIndex)
- {
- assert(beginIndex >=0 && beginIndex <= str.getLength());
- return append( str.getStr() + beginIndex, str.getLength() - beginIndex );
- }
-
- /**
- Appends a substring of an OUString, starting at position beginIndex,
- running for count characters.
-
- The characters of the <code>OUString</code> argument are appended, in
- order, to the contents of this string buffer.
-
- @param str a string.
- @param beginIndex the beginning index, inclusive. Must be >= 0 and <= the length of str.
- @param count must be >= 0 and <= (str.length() - beginIndex).
- @return this string buffer.
-
- @since LibreOffice 6.2
- */
- OUStringBuffer & appendCopy(const OUString &str, sal_Int32 beginIndex, sal_Int32 count)
- {
- assert(beginIndex >=0 && beginIndex <= str.getLength());
- assert(count >=0 && count <= (str.getLength() - beginIndex));
- return append( str.getStr() + beginIndex, count );
+#if defined LIBO_INTERNAL_ONLY
+ OUStringBuffer & append(std::u16string_view sv) {
+ if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
+ throw std::bad_alloc();
+ }
+ return append(sv.data(), sv.size());
}
-#endif // LIBO_INTERNAL_ONLY
+#endif
/**
Appends the content of a stringbuffer to this string buffer.
diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx
index 16eb928ded2a..9b7675ff2cb1 100644
--- a/oox/source/core/relationshandler.cxx
+++ b/oox/source/core/relationshandler.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <oox/core/relationshandler.hxx>
#include <rtl/ustrbuf.hxx>
@@ -44,7 +48,7 @@ OUString lclGetRelationsPath( const OUString& rFragmentPath )
return
OUStringBuffer( rFragmentPath.copy( 0, nPathLen ) ). // file path including slash
append( "_rels/" ). // additional '_rels/' path
- appendCopy( rFragmentPath, nPathLen ). // file name after path
+ append( std::u16string_view(rFragmentPath).substr(nPathLen) ). // file name after path
append( ".rels" ). // '.rels' suffix
makeStringAndClear();
}
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index d754c6fa9cd9..77b964b43b1e 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -20,6 +20,8 @@
#include <oox/dump/dumperbase.hxx>
#include <algorithm>
+#include <string_view>
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/TextOutputStream.hpp>
@@ -496,7 +498,7 @@ void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData,
if( (nBeg == 0) && (nIdx == nEnd) )
rStr.append( rData );
else
- rStr.appendCopy( rData, nBeg, nIdx - nBeg );
+ rStr.append( std::u16string_view(rData).substr(nBeg, nIdx - nBeg) );
}
// append characters to be encoded
while( (nIdx < nEnd) && (rData[ nIdx ] < 0x20) )
@@ -562,7 +564,7 @@ OUString lclTrimQuotedStringList( const OUString& rStr )
{
// seek to next quote character and add text portion to token buffer
sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_QUOTE, nPos );
- aToken.appendCopy( rStr, nPos, nEnd - nPos );
+ aToken.append( std::u16string_view(rStr).substr(nPos, nEnd - nPos) );
// process literal quotes
while( (nEnd + 1 < nLen) && (rStr[ nEnd ] == OOX_DUMP_CFG_QUOTE) && (rStr[ nEnd + 1 ] == OOX_DUMP_CFG_QUOTE) )
{
@@ -585,7 +587,7 @@ OUString lclTrimQuotedStringList( const OUString& rStr )
{
// find list separator, add token text to buffer
sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
- aBuffer.appendCopy( rStr, nPos, nEnd - nPos );
+ aBuffer.append( std::u16string_view(rStr).substr(nPos, nEnd - nPos) );
if( nEnd < nLen )
aBuffer.append( OOX_DUMP_LF );
// set current position behind list separator
diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx
index 7517cf3fecdf..cf067de5aac3 100644
--- a/opencl/source/openclconfig.cxx
+++ b/opencl/source/openclconfig.cxx
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <unicode/regex.h>
#include <comphelper/configuration.hxx>
@@ -76,7 +80,7 @@ OUString getToken(const OUString& string, sal_Int32& index)
while ((p = token.indexOf('%', i)) >= 0)
{
if (p > i)
- result.appendCopy(token, i, p - i);
+ result.append(std::u16string_view(token).substr(i, p - i));
if (p < token.getLength() - 2)
{
result.append(OUStringLiteral1(token.copy(p+1, 2).toInt32(16)));
@@ -87,7 +91,7 @@ OUString getToken(const OUString& string, sal_Int32& index)
i = token.getLength();
}
}
- result.appendCopy(token,i);
+ result.append(std::u16string_view(token).substr(i));
return result.makeStringAndClear();
}
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 508d36ea3a66..06bbda584c33 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -19,6 +19,7 @@
#include <string.h>
+#include <string_view>
#include "keyimpl.hxx"
@@ -987,7 +988,7 @@ OUString ORegKey::getFullPath(OUString const & path) const {
OUStringBuffer b(m_name);
if (!b.isEmpty() && b[b.getLength() - 1] == '/') {
if (path[0] == '/') {
- b.appendCopy(path,1);
+ b.append(std::u16string_view(path).substr(1));
} else {
b.append(path);
}
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index e1dbac1355e5..dce277b3e464 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -35,6 +35,7 @@
#include <osl/diagnose.h>
#include <algorithm>
+#include <string_view>
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -755,7 +756,7 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
if ( aNS.getLength() > 2 )
{
rBuffer.append( '.');
- rBuffer.appendCopy( aNS, 2 ); // strip "0."
+ rBuffer.append( std::u16string_view(aNS).substr(2) ); // strip "0."
}
}
rBuffer.append( 'S');
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 2b053d5e3d43..9d076053df6b 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <address.hxx>
#include <global.hxx>
#include <compiler.hxx>
@@ -2157,7 +2161,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange
{
if (!aDocName.isEmpty())
{
- rString.append("'[").append(aDocName).append("]").appendCopy(aTabName, 1);
+ rString.append("'[").append(aDocName).append("]").append(std::u16string_view(aTabName).substr(1));
}
else
{
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index c6475572f477..de1292feb7e6 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <sfx2/objsh.hxx>
@@ -921,7 +925,7 @@ OUString lclEncodeDosUrl(
// Excel seems confused by this token).
aBuf.append(EXC_URL_PARENTDIR);
else
- aBuf.appendCopy(aOldUrl,0,nPos).append(EXC_URL_SUBDIR);
+ aBuf.append(std::u16string_view(aOldUrl).substr(0,nPos)).append(EXC_URL_SUBDIR);
aOldUrl = aOldUrl.copy(nPos + 1);
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index dbe34d3fc937..377495e609d1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -18,6 +18,8 @@
*/
#include <memory>
+#include <string_view>
+
#include <inputhdl.hxx>
#include <scitems.hxx>
#include <editeng/eeitem.hxx>
@@ -1001,9 +1003,9 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText )
if (nStartPosition > 0)
{
OUStringBuffer aBuf;
- aBuf.appendCopy(aNew, 0, nStartPosition);
+ aBuf.append(std::u16string_view(aNew).substr(0, nStartPosition));
aBuf.append(u'\x25BA');
- aBuf.appendCopy(aNew, nStartPosition);
+ aBuf.append(std::u16string_view(aNew).substr(nStartPosition));
nArgs = ppFDesc->getParameterCount();
sal_Int16 nVarArgsSet = 0;
if ( nArgs >= PAIRED_VAR_ARGS )
diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx
index 87d0479a564a..b00920a62f93 100644
--- a/sdext/source/pdfimport/tree/style.cxx
+++ b/sdext/source/pdfimport/tree/style.cxx
@@ -25,6 +25,7 @@
#include <rtl/ustrbuf.hxx>
#include <algorithm>
+#include <string_view>
using namespace pdfi;
@@ -167,7 +168,7 @@ OUString StyleContainer::getStyleName( sal_Int32 nStyle ) const
else
aStyleName = OStringToOUString( rStyle.Name, RTL_TEXTENCODING_ASCII_US );
sal_Int32 nIndex = aStyleName.lastIndexOf( ':' );
- aRet.appendCopy( aStyleName, nIndex+1 );
+ aRet.append( std::u16string_view(aStyleName).substr(nIndex+1) );
aRet.append( nStyle );
}
}
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index 1a1c6bbc9b08..313a34cef216 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "PresenterController.hxx"
#include "PresenterAccessibility.hxx"
@@ -381,13 +385,13 @@ void PresenterController::UpdatePaneTitles()
if (nStartIndex < 0)
{
// Add the remaining part of the string.
- sResult.appendCopy(sTemplate, nIndex);
+ sResult.append(std::u16string_view(sTemplate).substr(nIndex));
break;
}
else
{
// Add the part preceding the next %.
- sResult.appendCopy(sTemplate, nIndex, nStartIndex-nIndex);
+ sResult.append(std::u16string_view(sTemplate).substr(nIndex, nStartIndex-nIndex));
// Get the placeholder
++nStartIndex;
diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx
index f1f102311c7e..c945c1a92c78 100644
--- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx
+++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -91,7 +95,7 @@ OUString Translator::translateToInternal(
}
sal_Int32 i = RTL_CONSTASCII_LENGTH("file:");
OUStringBuffer buf;
- buf.appendCopy(externalUriReference, 0, i);
+ buf.append(std::u16string_view(externalUriReference).substr(0, i));
// Some environments (e.g., Java) produce illegal file URLs without an
// authority part; treat them as having an empty authority part:
if (!externalUriReference.match("//", i))
@@ -139,7 +143,7 @@ OUString Translator::translateToExternal(
}
sal_Int32 i = RTL_CONSTASCII_LENGTH("file://");
OUStringBuffer buf;
- buf.appendCopy(internalUriReference, 0, i);
+ buf.append(std::u16string_view(internalUriReference).substr(0, i));
rtl_TextEncoding encoding = osl_getThreadTextEncoding();
for (bool path = true;;) {
sal_Int32 j = i;
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
index af7b25c57264..7fdc07b922e7 100644
--- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
+++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx
@@ -40,6 +40,7 @@
#include <sal/types.h>
#include <exception>
+#include <string_view>
namespace {
@@ -284,7 +285,7 @@ void SAL_CALL UrlReference::setName(OUString const & name)
OUStringBuffer newPath;
newPath.append(encodeNameOrParamFragment(name));
- newPath.appendCopy(m_base.m_path, i);
+ newPath.append(std::u16string_view(m_base.m_path).substr(i));
m_base.m_path = newPath.makeStringAndClear();
}
@@ -315,7 +316,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value)
}
OUStringBuffer newPath;
- newPath.appendCopy(m_base.m_path, 0, i);
+ newPath.append(std::u16string_view(m_base.m_path).substr(0, i));
if (!bExistent) {
newPath.append( m_base.m_path.indexOf('?') < 0 ? '?' : '&' );
newPath.append(encodeNameOrParamFragment(key));
@@ -325,7 +326,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value)
if (bExistent) {
/*oldValue = */
parsePart(m_base.m_path, false, &i); // skip key
- newPath.appendCopy(m_base.m_path, i);
+ newPath.append(std::u16string_view(m_base.m_path).substr(i));
}
m_base.m_path = newPath.makeStringAndClear();
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index a424653679e8..dc60dee5f73f 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -18,6 +18,8 @@
*/
#include <memory>
+#include <string_view>
+
#include <sal/config.h>
#include <unicode/idna.h>
@@ -783,11 +785,11 @@ OUString URIHelper::resolveIdnaHost(OUString const & url) {
return url;
}
OUStringBuffer buf(uri->getScheme());
- buf.append("://").appendCopy(auth, 0, hostStart);
+ buf.append("://").append(std::u16string_view(auth).substr(0, hostStart));
buf.append(
reinterpret_cast<sal_Unicode const *>(ascii.getBuffer()),
ascii.length());
- buf.appendCopy(auth, hostEnd).append(uri->getPath());
+ buf.append(std::u16string_view(auth).substr(hostEnd)).append(uri->getPath());
if (uri->hasQuery()) {
buf.append('?').append(uri->getQuery());
}
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 903fd9960200..94a6ed27bb16 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -21,6 +21,8 @@
#include <float.h>
#include <errno.h>
#include <stdlib.h>
+#include <string_view>
+
#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <tools/debug.hxx>
@@ -1734,7 +1736,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
0 <= nNatNumNum && nNatNumNum <= 19 )
{
sBuffSymbol.stripStart('[');
- sBuffSymbol.appendCopy( aBufStr, --nPos, aNatNum.getLength()+1 );
+ sBuffSymbol.append( std::u16string_view(aBufStr).substr(--nPos, aNatNum.getLength()+1) );
nPos += aNatNum.getLength()+1;
//! SymbolType is negative
eSymbolType = static_cast<short>(BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum);
@@ -1744,7 +1746,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
1 <= nDBNum && nDBNum <= 9 )
{
sBuffSymbol.stripStart('[');
- sBuffSymbol.appendCopy( aBufStr, --nPos, aDBNum.getLength()+1 );
+ sBuffSymbol.append( std::u16string_view(aBufStr).substr(--nPos, aDBNum.getLength()+1) );
nPos += aDBNum.getLength()+1;
//! SymbolType is negative
eSymbolType = sal::static_int_cast< short >( BRACKET_SYMBOLTYPE_DBNUM1 - (nDBNum - 1) );
@@ -1972,7 +1974,7 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr )
}
else
{
- aTmp.appendCopy(rStr, nStartPos, nPos - nStartPos );
+ aTmp.append(std::u16string_view(rStr).substr(nStartPos, nPos - nStartPos) );
nStartPos = nPos + 2;
sal_Int32 nDash;
nEnd = nStartPos - 1;
@@ -2003,13 +2005,13 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr )
{
nPos = nDash;
}
- aTmp.appendCopy(rStr, nStartPos, nPos - nStartPos );
+ aTmp.append(std::u16string_view(rStr).substr(nStartPos, nPos - nStartPos) );
nStartPos = nClose + 1;
}
}
if ( nLen > nStartPos )
{
- aTmp.appendCopy(rStr, nStartPos, nLen - nStartPos );
+ aTmp.append(std::u16string_view(rStr).substr(nStartPos, nLen - nStartPos) );
}
return aTmp.makeStringAndClear();
}
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 3cb904eaa634..a5cac3f6f6b6 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "accportions.hxx"
#include <rtl/ustring.hxx>
#include <com/sun/star/i18n/Boundary.hpp>
@@ -125,7 +129,7 @@ void SwAccessiblePortionData::Text(TextFrameIndex const nLength,
m_aPortionAttrs.push_back( nAttr );
// update buffer + nViewPosition
- m_aBuffer.appendCopy(m_pTextFrame->GetText(), sal_Int32(m_nViewPosition), sal_Int32(nLength));
+ m_aBuffer.append(std::u16string_view(m_pTextFrame->GetText()).substr(sal_Int32(m_nViewPosition), sal_Int32(nLength)));
m_nViewPosition += nLength;
}
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 982abef78a34..0ba681813caa 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -23,6 +23,7 @@
#include <cfloat>
#include <climits>
#include <memory>
+#include <string_view>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <cstdlib>
@@ -758,8 +759,8 @@ SwCalcOper SwCalc::GetToken()
// ignore the ]
if ('\\' == m_sCommand[nFndPos-1])
{
- m_aVarName.appendCopy(m_sCommand, nSttPos,
- nFndPos - nSttPos - 1 );
+ m_aVarName.append(std::u16string_view(m_sCommand).substr(nSttPos,
+ nFndPos - nSttPos - 1) );
nSttPos = ++nFndPos;
}
else
@@ -770,8 +771,8 @@ SwCalcOper SwCalc::GetToken()
if( nFndPos != -1 )
{
if( nSttPos != nFndPos )
- m_aVarName.appendCopy(m_sCommand, nSttPos,
- nFndPos - nSttPos );
+ m_aVarName.append(std::u16string_view(m_sCommand).substr(nSttPos,
+ nFndPos - nSttPos) );
aRes.EndPos = nFndPos + 1;
m_eCurrOper = CALC_NAME;
}
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0d888149e6d0..f188f65f5791 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <tools/gen.hxx>
#include <hintids.hxx>
#include <editeng/protitem.hxx>
@@ -1026,7 +1030,7 @@ OUString SwPaM::GetText() const
? End()->nContent.GetIndex()
: aTmpStr.getLength();
- aResult.appendCopy(aTmpStr, nStart, nEnd-nStart);
+ aResult.append(std::u16string_view(aTmpStr).substr(nStart, nEnd-nStart));
}
else
{
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index e5971f552bfb..bb0aad922518 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <float.h>
#include <hintids.hxx>
#include <hints.hxx>
@@ -640,12 +644,12 @@ OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTa
if (nStt<0 || nEnd<0 )
{
// set the rest and finish
- aStr.appendCopy(m_sFormula, nFormula);
+ aStr.append(std::u16string_view(m_sFormula).substr(nFormula));
break;
}
// write beginning
- aStr.appendCopy(m_sFormula, nFormula, nStt - nFormula);
+ aStr.append(std::u16string_view(m_sFormula).substr(nFormula, nStt - nFormula));
if (fnFormula)
{
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index f948d0de950b..c66465ab953b 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <hintids.hxx>
#include <o3tl/make_unique.hxx>
#include <svl/whiter.hxx>
@@ -92,7 +96,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
if (pStart->nContent != nLastEnd) // not 0 so we eliminate adjacent deletes
{
extents.emplace_back(pNode, nLastEnd, pStart->nContent.GetIndex());
- mergedText.appendCopy(pNode->GetText(), nLastEnd, pStart->nContent.GetIndex() - nLastEnd);
+ mergedText.append(std::u16string_view(pNode->GetText()).substr(nLastEnd, pStart->nContent.GetIndex() - nLastEnd));
}
if (&pEnd->nNode.GetNode() != pNode)
{
@@ -213,7 +217,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
if (nLastEnd != pNode->Len())
{
extents.emplace_back(pNode, nLastEnd, pNode->Len());
- mergedText.appendCopy(pNode->GetText(), nLastEnd, pNode->Len() - nLastEnd);
+ mergedText.append(std::u16string_view(pNode->GetText()).substr(nLastEnd, pNode->Len() - nLastEnd));
}
if (extents.empty()) // there was no text anywhere
{
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index d20f484c1b6e..5d12115e023c 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <comphelper/classids.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
@@ -367,7 +371,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
if( aBuffer.isEmpty() )
{
aBuffer.append( '\'' );
- aBuffer.appendCopy( sRange, 0, i );
+ aBuffer.append( std::u16string_view(sRange).substr(0, i) );
}
if( '\'' == c || '\\' == c )
aBuffer.append( '\\' );
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
index 8221d5a21082..4d1be4be96e7 100644
--- a/toolkit/source/awt/animatedimagespeer.cxx
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -39,7 +39,7 @@
#include <vcl/settings.hxx>
#include <limits>
-
+#include <string_view>
namespace toolkit
{
@@ -117,9 +117,9 @@ namespace toolkit
ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsupported URL scheme - cannot automatically determine HC version!", i_imageURL );
OUStringBuffer composer;
- composer.appendCopy( i_imageURL, 0, separatorPos );
+ composer.append( std::u16string_view(i_imageURL).substr(0, separatorPos) );
composer.append( "/sifr" );
- composer.appendCopy( i_imageURL, separatorPos );
+ composer.append( std::u16string_view(i_imageURL).substr(separatorPos) );
return composer.makeStringAndClear();
}
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index 1cf7fbdaa222..688662e30a95 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -24,6 +24,10 @@
*************************************************************************/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/beans/IllegalTypeException.hpp>
@@ -1729,7 +1733,7 @@ Content::queryChildContent( const OUString & rRelativeChildUri )
if ( !rRelativeChildUri.startsWith("/") )
aBuf.append( rRelativeChildUri );
else
- aBuf.appendCopy( rRelativeChildUri, 1 );
+ aBuf.append( std::u16string_view(rRelativeChildUri).substr(1) );
uno::Reference< ucb::XContentIdentifier > xChildId
= new ::ucbhelper::ContentIdentifier( aBuf.makeStringAndClear() );
diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx
index 6625b3d382d4..81d8cb828c6e 100644
--- a/unotools/source/config/configpaths.cxx
+++ b/unotools/source/config/configpaths.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <unotools/configpaths.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
@@ -49,7 +53,7 @@ void lcl_resolveCharEntities(OUString & aLocalString)
OSL_ENSURE(ch,"Configuration path contains '&' that is not part of a valid character escape");
if (ch)
{
- aResult.appendCopy(aLocalString, nStart,nEscapePos-nStart).append(ch);
+ aResult.append(std::u16string_view(aLocalString).substr(nStart,nEscapePos-nStart)).append(ch);
sal_Int32 nEscapeEnd=aLocalString.indexOf(';',nEscapePos);
nStart = nEscapeEnd+1;
@@ -62,7 +66,7 @@ void lcl_resolveCharEntities(OUString & aLocalString)
}
while ( nEscapePos > 0);
- aResult.appendCopy(aLocalString, nStart);
+ aResult.append(std::u16string_view(aLocalString).substr(nStart));
aLocalString = aResult.makeStringAndClear();
}
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 81768e9d021e..bd0f3f9bcb2e 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <cstdlib>
+#include <string_view>
#include <i18nlangtag/languagetag.hxx>
#include <i18nutil/searchopt.hxx>
@@ -316,7 +317,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &r
{
sal_Int32 nStart = rResult.startOffset[0];
sal_Int32 nLength = rResult.endOffset[0] - rResult.startOffset[0];
- sBuff.appendCopy(rStr, nStart, nLength);
+ sBuff.append(std::u16string_view(rStr).substr(nStart, nLength));
}
else if((i < rReplaceStr.getLength() - 1) && rReplaceStr[i] == '$')
{
@@ -353,7 +354,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &r
nSttReg = rResult.endOffset[j];
}
// Copy reference from found string
- sBuff.appendCopy(rStr, nSttReg, nRegLen);
+ sBuff.append(std::u16string_view(rStr).substr(nSttReg, nRegLen));
}
i += 1;
}
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index 708b59a0da41..961288463c63 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -33,6 +33,7 @@
#include <sal/log.hxx>
#include <time.h>
#include <map>
+#include <string_view>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -223,10 +224,10 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css
}
else
{
- aBuffer.appendCopy( sLabel, 0, index );
+ aBuffer.append( std::u16string_view(sLabel).substr(0, index) );
if( bMenu )
aBuffer.append( '&' );
- aBuffer.appendCopy( sLabel, index + 1 );
+ aBuffer.append( std::u16string_view(sLabel).substr(index + 1) );
}
OUString sNewLabel = aBuffer.makeStringAndClear();
SAL_INFO("vbahelper", "VbaCommandBarHelper::findControlByName, control name: " << sNewLabel);
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 6801c0a7a5d8..d444bc8c678e 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -18,6 +18,9 @@
*/
#include <sal/config.h>
+
+#include <string_view>
+
#include <sal/log.hxx>
#include <osl/diagnose.h>
@@ -113,23 +116,23 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
// If in "a b/c" format.
if(nFracNumPos != -1 )
{
- aStr1.appendCopy(aStr, 0, nFracNumPos);
- aStrNum.appendCopy(aStr, nFracNumPos+1, nFracDivPos-nFracNumPos-1);
- aStrDenom.appendCopy(aStr, nFracDivPos+1);
+ aStr1.append(std::u16string_view(aStr).substr(0, nFracNumPos));
+ aStrNum.append(std::u16string_view(aStr).substr(nFracNumPos+1, nFracDivPos-nFracNumPos-1));
+ aStrDenom.append(std::u16string_view(aStr).substr(nFracDivPos+1));
}
// "a/b" format, or not a fraction at all
else
{
- aStrNum.appendCopy(aStr, 0, nFracDivPos);
- aStrDenom.appendCopy(aStr, nFracDivPos+1);
+ aStrNum.append(std::u16string_view(aStr).substr(0, nFracDivPos));
+ aStrDenom.append(std::u16string_view(aStr).substr(nFracDivPos+1));
}
}
// parse decimal strings
else if ( nDecPos >= 0)
{
- aStr1.appendCopy(aStr, 0, nDecPos);
- aStr2.appendCopy(aStr, nDecPos+1);
+ aStr1.append(std::u16string_view(aStr).substr(0, nDecPos));
+ aStr2.append(std::u16string_view(aStr).substr(nDecPos+1));
}
else
aStr1 = aStr;
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index cfef2ecdc002..71029a830cb5 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <algorithm>
+#include <string_view>
#include <tools/diagnose_ex.h>
#include <comphelper/processfactory.hxx>
@@ -678,7 +679,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
{
// possibly extend string until cursor position
if ( aStr.getLength() < nNewPos )
- aStr.appendCopy( rLiteralMask, aStr.getLength(), nNewPos-aStr.getLength() );
+ aStr.append( std::u16string_view(rLiteralMask).substr(aStr.getLength(), nNewPos-aStr.getLength()) );
if ( nNewPos < aStr.getLength() )
aStr.insert( cChar, nNewPos );
else if ( nNewPos < rEditMask.getLength() )
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 03820f9792fa..77453650d9a9 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <comphelper/string.hxx>
#include <tools/bigint.hxx>
#include <sal/log.hxx>
@@ -117,7 +121,7 @@ bool ImplCurrencyGetValue( const OUString& rStr, BigInt& rValue,
if ( nDecPos != -1 )
{
aStr1 = aStr.copy( 0, nDecPos );
- aStr2.appendCopy(aStr, nDecPos+1);
+ aStr2.append(std::u16string_view(aStr).substr(nDecPos+1));
}
else
aStr1 = aStr;
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index cdc1d4cbd11a..c4402d48924b 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -63,6 +63,7 @@
#include <cstdlib>
#include <memory>
#include <set>
+#include <string_view>
#include <vector>
using namespace ::com::sun::star;
@@ -272,7 +273,7 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const
for ( size_t nL = 0; nL < nLines; ++nL )
{
TextLine& rLine = pTEParaPortion->GetLines()[nL];
- aText.appendCopy( pTEParaPortion->GetNode()->GetText(), rLine.GetStart(), rLine.GetEnd() - rLine.GetStart() );
+ aText.append( std::u16string_view(pTEParaPortion->GetNode()->GetText()).substr(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()) );
if ( pSep && ( ( (nP+1) < nParas ) || ( (nL+1) < nLines ) ) )
aText.append(pSep);
}
@@ -409,7 +410,7 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co
if ( nNode == nEndPara ) // may also be == nStart!
nEndPos = aSel.GetEnd().GetIndex();
- aText.appendCopy(pNode->GetText(), nStartPos, nEndPos-nStartPos);
+ aText.append(std::u16string_view(pNode->GetText()).substr(nStartPos, nEndPos-nStartPos));
if ( nNode < nEndPara )
aText.append(pSep);
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index bc310e55cd37..24b0c04abc88 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -69,6 +69,7 @@
#include <vcl/vcllayout.hxx>
#include <map>
+#include <string_view>
#include <vector>
namespace vcl
@@ -1669,9 +1670,9 @@ static OUString getShortenedString( const OUString& i_rLong, vcl::RenderContext
if (nPos < aNonMnem.getLength() && i_rLong[nPos+1] == aNonMnem[nPos])
{
OUStringBuffer aBuf( i_rLong.getLength() );
- aBuf.appendCopy( aNonMnem, 0, nPos );
+ aBuf.append( std::u16string_view(aNonMnem).substr(0, nPos) );
aBuf.append( '~' );
- aBuf.appendCopy( aNonMnem, nPos );
+ aBuf.append( std::u16string_view(aNonMnem).substr(nPos) );
aNonMnem = aBuf.makeStringAndClear();
}
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9ed80c64d34e..fca398968320 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -9,6 +9,7 @@
#include "rtfdocumentimpl.hxx"
#include <memory>
+#include <string_view>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/io/WrongFormatException.hpp>
@@ -2236,7 +2237,7 @@ RTFError RTFDocumentImpl::popState()
- aState.aLevelNumbers.size()));
}
else
- aBuf.appendCopy(aOrig, i, 1);
+ aBuf.append(std::u16string_view(aOrig).substr(i, 1));
}
pValue->setString(aBuf.makeStringAndClear());
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 804265efb022..2f0f4017e6da 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
#include <xmloff/xmluconv.hxx>
@@ -393,7 +396,7 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer,
// Truncate nFractionDecimals+1 digit if it was not rounded to zero.
const sal_Int32 nCount = nLen - 2 - static_cast<int>(nLen > nFractionDecimals + 2);
rBuffer.append( '.');
- rBuffer.appendCopy( aFraction, 2, nCount); // strip 0.
+ rBuffer.append( std::u16string_view(aFraction).substr(2, nCount)); // strip 0.
}
}
}
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 21f634fe50e5..c64e2f7cd068 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
@@ -236,8 +240,8 @@ void SvXMLMetaDocumentContext::setBuildId(OUString const& i_rBuildId, const uno:
if ( nBegin != -1 )
{
sBuffer.append( '$' );
- sBuffer.appendCopy( i_rBuildId,
- nBegin + sBuildCompare.getLength() );
+ sBuffer.append( std::u16string_view(i_rBuildId).substr(
+ nBegin + sBuildCompare.getLength()) );
sBuildId = sBuffer.makeStringAndClear();
}
}
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
index 60da2fca83e1..e446aab5b437 100644
--- a/xmloff/source/style/fonthdl.cxx
+++ b/xmloff/source/style/fonthdl.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include "fonthdl.hxx"
#include <sax/tools/converter.hxx>
@@ -93,7 +97,7 @@ bool XMLFontFamilyNamePropHdl::importXML( const OUString& rStrImpValue, uno::Any
if( !sValue.isEmpty() )
sValue.append(';');
- sValue.appendCopy(rStrImpValue, nFirst, nLast-nFirst+1);
+ sValue.append(std::u16string_view(rStrImpValue).substr(nFirst, nLast-nFirst+1));
}
if( -1 != nPos )
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 7f85710cc1cf..be0f9de521df 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -18,6 +18,7 @@
*/
#include <memory>
+#include <string_view>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -937,7 +938,7 @@ void SvXMLExportPropertyMapper::_exportXML(
sPrefix = pNamespaceMap->GetPrefixByKey( nKey );
}
// In any case, the attribute name has to be adapted.
- sNameBuffer.append(sPrefix).append(":").appendCopy(*pAttribName, nColonPos+1 );
+ sNameBuffer.append(sPrefix).append(":").append(std::u16string_view(*pAttribName).substr(nColonPos+1) );
sAttribName = sNameBuffer.makeStringAndClear();
}