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 /cui | |
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 'cui')
-rw-r--r-- | cui/source/dialogs/cuicharmap.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index dba595d5dd21..3f0ace55a9b4 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -873,7 +873,7 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void) OUString charValue = rView->GetText(); sal_Int32 tmp = 1; sal_UCS4 cChar = charValue.iterateCodePoints(&tmp, -1); - OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase(); + OUString aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase(); // Get the decimal code OUString aDecimalText = OUString::number(cChar); @@ -961,7 +961,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void) // using the new UCS4 constructor aText = OUString( &cChar, 1 ); // Get the hexadecimal code - aHexText = OUString::number(cChar, 16).toAsciiUpperCase(); + aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase(); // Get the decimal code aDecimalText = OUString::number(cChar); setCharName(cChar); @@ -1001,7 +1001,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void) { aText = OUString( &cChar, 1 ); // Get the hexadecimal code - aHexText = OUString::number(cChar, 16).toAsciiUpperCase(); + aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase(); // Get the decimal code aDecimalText = OUString::number(cChar); setCharName(cChar); |