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



On 2012-10-02 16:00, Stephan Bergmann wrote:

am unsure about this:

+    OUStringBuffer & operator+=( const OUString &str )
+    {
+        return append( str.getStr(), str.getLength() );
+    }
+
+    /**
+ Appends the string representation of the <code>char</code> array
+        argument to this string buffer.
+
+ The characters of the array argument are appended, in order, to
+        the contents of this string buffer. The length of this string
+        buffer increases by the length of the argument.
+
+        @param   str   the characters to be appended.
+        @return  this string buffer.
+        @since LibreOffice 3.7
+     */
+    OUStringBuffer & operator+=( const sal_Unicode * str )
+    {
+        return append( str, rtl_ustr_getLength( str ) );
+    }

      /**
+ Appends the string representation of the ASCII <code>char</code>
+        argument to this string buffer.
+
+ The argument is appended to the contents of this string buffer.
+        The length of this string buffer increases by <code>1</code>.
+
+        @param   c   an ASCII <code>char</code>.
+        @return  this string buffer.
+
+        @since LibreOffice 3.7
+     */
+    OUStringBuffer & operator+=(char c)
+    {
+        return append(c);
+    }

hmmm... do we really want to have 2 sets of methods append() and
operator+= that do the same thing, possibly with different overloads?

perhaps we should deprecate the append methods... but those often have
addition radix etc, parameters... and is it possible to chain += like
append() in a single statement?

I would just stick to append-only for OUStringBuffer.

(Also, in general, it makes sense to keep changes to oustring/oustrbuf in sync with changes to ostring/ostrbuf.)


Part of my motivation for adding this, besides making String->OUString conversion easier, was that OUString already has the operator+= methods.



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.