summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-01-11 11:21:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-01-11 13:55:14 +0100
commit70519a43e0d89a6b5d89859a6851f8c757c6b0c7 (patch)
treebc1f4a6b6510e3bff75e9dc54eb71e2fa6cfc3c8 /vcl
parenta0210c5c5e8fd47b55567a8b18788d57d2b7decb (diff)
Replace OUStringBuffer::appendCopy with append(std::u16string_view)
...which is more general Change-Id: I94f28f8eda887120cf5f143b4549e0339b60e6a7 Reviewed-on: https://gerrit.libreoffice.org/66155 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-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
5 files changed, 23 insertions, 13 deletions
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();
}
}