[PATCH] sal_bool and String conversions

Michael Stahl mstahl at redhat.com
Tue Oct 2 06:01:01 PDT 2012


On 02/10/12 08:33, Noel Grandin wrote:
> Hi
> 
> The first 4 patches perform sal_Bool->bool conversions in the SVL module.
> 
> The next 8 patches perform UniString->OUString conversions.

pushed about 8 of those.

> Patch 7 and 11 need careful checking because they add methods to 
> OUStringBuffer and OUString.

> 
> diff --git a/sal/inc/rtl/ustring.h b/sal/inc/rtl/ustring.h
> index 5b4982e..1595c0f 100644
> --- a/sal/inc/rtl/ustring.h
> +++ b/sal/inc/rtl/ustring.h
> @@ -1500,7 +1500,7 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceFirstAsciiLAsciiL(
>  */
>  SAL_DLLPUBLIC void SAL_CALL rtl_uString_newReplaceAll(
>      rtl_uString ** newStr, rtl_uString * str, rtl_uString const * from,
> -    rtl_uString const * to) SAL_THROW_EXTERN_C();
> +    rtl_uString const * to, sal_Int32 fromIndex) SAL_THROW_EXTERN_C();
>  
>  /** Create a new string by replacing all occurrences of a given substring with
>      another substring.

that is not ABI compatible.

> -    OUString replaceAll(OUString const & from, OUString const & to) const {
> +    OUString replaceAll(OUString const & from, OUString const & to, int fromIndex = 0) const {

this should be source and binary compatible i think, since it's inline
function?

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?

didn't push the 2 patches that depend on the sal changes.




More information about the LibreOffice mailing list