diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-07 10:34:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-14 08:35:00 +0200 |
commit | cd66852f6dd08631a25d15a1527a647e69ab8ce3 (patch) | |
tree | 0ac1fab1d063046376e31e21d6656ee05eebb627 /i18npool/source | |
parent | 095e1ca4372d90da7fc56051f1271ddd975a9e3a (diff) |
create appendCopy method in OUStringBuffer
so we can avoid temporary copies when appending a substring of an
OUString to the buffer. I would have preferred to call the method just
"append" but that results in ambiguous method errors when the callsite
is something like
sal_Int32 n;
OUStringBuffer s;
s.append(n, 10);
I'm not sure why
Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f
Reviewed-on: https://gerrit.libreoffice.org/58666
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source')
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode_parser.cxx | 12 | ||||
-rw-r--r-- | i18npool/source/nativenumber/nativenumbersupplier.cxx | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index cdf9821776c2..8192d7ddab16 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -880,13 +880,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 { if ( cLast == '\\' ) { // escaped - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 2); + aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 2); aSymbol.append(OUString(¤t, 1)); } else { eState = ssStop; - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1); + aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 1); } postSymbolIndex = nextCharIndex; } @@ -905,13 +905,13 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 { if ( cLast == '\\' ) { // escaped - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 2); + aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 2); aSymbol.append(OUString(¤t, 1)); } else if (current == nextChar && !(nContTypes & KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING) ) { // "" => literal " escaped - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex); + aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex); nextCharIndex = index; if (index < rText.getLength()) { ++nCodePoints; } nextChar = (index < rText.getLength()) ? rText.iterateCodePoints(&index) : 0; @@ -919,7 +919,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 else { eState = ssStop; - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1); + aSymbol.appendCopy(rText, postSymbolIndex, nextCharIndex - postSymbolIndex - 1); } postSymbolIndex = nextCharIndex; } @@ -1028,7 +1028,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 { if (postSymbolIndex < nextCharIndex) { //! open quote - aSymbol.append(rText.getStr() + postSymbolIndex, nextCharIndex - postSymbolIndex - 1); + aSymbol.appendCopy(rText, 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 869ff60df4aa..5272954ecaad 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -1072,7 +1072,7 @@ OUString getHebrewNativeNumberString(const OUString& aNumberString, bool useGere makeHebrewNumber(value, output, true, useGeresh); if (i < len) - output.append(aNumberString.copy(i)); + output.appendCopy(aNumberString,i); return output.makeStringAndClear(); } @@ -1191,7 +1191,7 @@ OUString getCyrillicNativeNumberString(const OUString& aNumberString) makeCyrillicNumber(value, output, true); if (i < len) - output.append(aNumberString.copy(i)); + output.appendCopy(aNumberString,i); return output.makeStringAndClear(); } |