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



On 2012-09-28 15:37, Michael Meeks wrote:
Hi Noel,

On Fri, 2012-09-28 at 14:17 +0200, Noel Grandin wrote:
It just seems to me that we could easily enough steal a bit from the
length field to indicate that the buffer is immutable, and then we could
reduce our complexity by eliminating OUStringBuffer.
        We already steal bits from the ref-count for magic like this: static
strings, and interned strings ;-)

        The question is - would it be more obvious if:

void method(rtl::OUString &rFoo, rtl::OUString &rBaa)
{
        rFoo += "foo"; // no exception it's mutable.
        rBaa += "baa"; // exception because it's immutable.
}

        :-) i assume not. OTOH - I too am not a huge fan of the sal string
classes for general usability - but I've not done a ton of work with
them recently to be fair.


So that idea is workable - great.

In your example, it wouldn't throw an exception, it would simply notice that it's internal buffer was immutable, allocate a new buffer, and append the string to that.

I'm asking because I'm starting to do XubString/UniString -> OUString cleanup work, and the work would be a lot simpler if we only had one target - OUString.



Disclaimer: http://www.peralex.com/disclaimer.html



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.