On 14/06/13 14:19, Matteo Casalin wrote:
Hi all,
in a recent patch [1] for String to OUString conversion I replaced the construction of an
OUString from a sequence of OUStringBuffer.append to a single concatenation of OUString/constant
strings [2].
Noel Power (whom I thank for the careful review, and is here in copy), correctly asks which way is
preferred for such an operation: I don't know the answer, can some expert provide me an insight on
this? I find OUString concatenation easier to read, but this could be not as efficient as the
original code, or just undesired.
Thanks and kind regards
Matteo
[1]
https://gerrit.libreoffice.org/#/c/4280/
[2]
- OUStringBuffer aString;
- aString.append('(');
- aString.append(static_cast<sal_Int32>(nColMerge));
- aString.append(',');
- aString.append(static_cast<sal_Int32>(nRowMerge));
- aString.append(')');
- return aString.makeStringAndClear();
+ OUString aRet = "("
+ + OUString::number(static_cast<sal_Int32>(nColMerge))
+ + ","
+ + OUString::number(static_cast<sal_Int32>(nRowMerge))
+ + ")";
+ return aRet;
just a note, I don't find the changed code offensive or anything :-) in
fact the opposite I find it easier on the eye than OUStringBuffer But..
in this case the OUStringBuffer usage was the result of previous
rework. Prior to the OUStringBuffer rework the code looked quite like
the new OUString change, I know Lubos/Stephan have done lots of stuff
around strings and honestly ( although I am sure it probably is
mentioned somewhere in the mailing list ) I don't know what the current
preferred way is. I seem to remember something about OUString
concatenation now being as efficient as OUStringBuffer these days and
that the advantage of OUStringBuffer ( in such cases as above ) is not
as great. but really I can't recall
Noel
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.