[CLOSED] Re: OUString concatenation vs OUStringBuffer append

Matteo Casalin matteo.casalin at yahoo.com
Sat Jun 15 08:05:28 PDT 2013


----- Original Message -----

> From: Matteo Casalin <matteo.casalin at yahoo.com>
> To: libreoffice-dev <LibreOffice at lists.freedesktop.org>
> Cc: Noel Power <nopower at suse.com>
> Sent: Friday, June 14, 2013 3:19 PM
> Subject: OUString concatenation vs OUStringBuffer append
> 
> 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.

Found the answer in http://lists.freedesktop.org/archives/libreoffice/2012-December/042038.html
("All the other alternatives [to OUString concatenation], like explicit OUStringBuffer and repeated append() should be now worse in all possible aspects")
Sorry for the noise.

Cheers

Matteo

> 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;
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
> 


More information about the LibreOffice mailing list