Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 28/09/12 13:46, Noel Grandin wrote:
Hi

I don't really understand the point of not being able to mutate OUString 
in-place, but being able to overwrite it via the assignment operator?

It seems to me it should be one or the other.
Either OUString is immutable, and it cannot be assigned to, except via a 
constructor, or it is mutable, and we can pretty much throw away 
OUStringBuffer.

[accidentally sent this first to Noel only instead of the list]

the point you are missing is that OUString is a sort of "smart pointer"
to an immutable buffer.  it works similarly to "String" in Java, e.g. in
Java "String s = "foo"; s = "bar"" is legal but you cannot modify the
content of whatever value is assigned to "s".

that's why OUString has an operator= that makes it point at a different
buffer but offers no way to write into the buffer (at least i hope it
doesn't...).




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.