[PATCH] sal_bool and String conversions
Noel Grandin
noel at peralex.com
Tue Oct 2 07:22:47 PDT 2012
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
More information about the LibreOffice
mailing list