diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-09-13 15:13:55 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-09-24 12:58:14 +0200 |
commit | 2f5f45921b05904a4be1ff633be09c62cb44ff08 (patch) | |
tree | ddd0cd5ef0349706f935d8360db88343347639a3 /svl/source/numbers | |
parent | a7d40f575463467698df76f041e558cb3bea7c85 (diff) |
support O(U)String::number() for fast string concatenation
When I did the fast string concatenation, I didn't add any support
for number(), which simply returned a O(U)String, and so it did
the extra allocation/deallocation, although that could be avoided.
In order to support this, number() now returns a special temporary
return type, similarly to O(U)StringConcat, which allows delaying
the concatenation the same way.
Also similarly, the change of the return type in some cases requires
explicit cast to the actual string type. Usage of OString::getStr()
is so extensive in the codebase that I actually added it to the helper
class, after that it's only relatively few cases.
Change-Id: Iba6e158010e1e458089698c426803052b6f46031
Reviewed-on: https://gerrit.libreoffice.org/78873
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'svl/source/numbers')
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 7a558bd015df..04fcc99a9772 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -4210,7 +4210,7 @@ OUString NfCurrencyEntry::BuildSymbolString(bool bBank, if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM ) { sal_Int32 nLang = static_cast<sal_uInt16>(eLanguage); - aBuf.append('-').append( OUString::number(nLang, 16).toAsciiUpperCase()); + aBuf.append('-').append( OUString( OUString::number(nLang, 16)).toAsciiUpperCase()); } } aBuf.append(']'); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 092d6b2b5908..64505adab290 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1165,7 +1165,7 @@ SvNumberformat::SvNumberformat(OUString& rString, ((eLanguage = MsLangId::getRealLanguage( eLan)) == LANGUAGE_THAI) && NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW) { - sStr = "[$-" + OUString::number( sal_uInt16(eLanguage), 16 ).toAsciiUpperCase() + "]" + sStr; + sStr = "[$-" + OUString(OUString::number( sal_uInt16(eLanguage), 16 )).toAsciiUpperCase() + "]" + sStr; NumFor[nIndex].SetNatNumLang( eLanguage); } sBuff.remove(nPosOld, nPos - nPosOld); @@ -5085,7 +5085,7 @@ static void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_In // No format code, no locale. return; - OUStringBuffer aLCIDString = OUString::number( nLCID , 16 ).toAsciiUpperCase(); + OUStringBuffer aLCIDString = OUString(OUString::number( nLCID , 16 )).toAsciiUpperCase(); // Search for only last DBNum which is the last element before insertion position if ( bDBNumInserted && nPosInsertLCID >= 8 && aLCIDString.getLength() > 4 |