Efficient string concatenation

Stephan Bergmann sbergman at redhat.com
Mon Dec 3 06:28:32 PST 2012


On 12/02/2012 11:56 PM, Lubos Lunak wrote:
> From 9b6e150c83c43c51dbdc6a5075d110fcc6e25210 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?=<l.lunak at suse.cz>
> Date: Sun, 2 Dec 2012 22:33:47 +0100
> Subject: [PATCH 4/5] make sure uno::Any works with fast operator+
>
> The result of the operation needs to be first converted to O(U)String.
>
> Change-Id: I24dafeaebf68a0eff3edf1d1cf713bfc10bbd8f4
> ---
>   cppu/inc/com/sun/star/uno/Any.hxx |   42 +++++++++++++++++++++++++++++++++++++
>   1 file changed, 42 insertions(+)
>
> diff --git a/cppu/inc/com/sun/star/uno/Any.hxx b/cppu/inc/com/sun/star/uno/Any.hxx
> index beeed81..8f6dfc6 100644
> --- a/cppu/inc/com/sun/star/uno/Any.hxx
> +++ b/cppu/inc/com/sun/star/uno/Any.hxx
> @@ -188,6 +188,23 @@ inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW(())
>   }
>
>   //__________________________________________________________________________________________________
> +#ifdef RTL_FAST_STRING
> +template< class C1, class C2 >
> +inline Any SAL_CALL makeAny( const rtl::OStringConcat< C1, C2 >& value ) SAL_THROW(())
> +{
> +    const rtl::OString str( value );
> +    return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
> +}

There should be no support for OString in Any.

Stephan

> +//__________________________________________________________________________________________________
> +template< class C1, class C2 >
> +inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) SAL_THROW(())
> +{
> +    const rtl::OUString str( value );
> +    return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
> +}
> +#endif
> +//__________________________________________________________________________________________________
>   template< class C >
>   inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(())
>   {
> @@ -208,6 +225,31 @@ inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
>           (uno_AcquireFunc) cpp_acquire, (uno_ReleaseFunc) cpp_release );
>   }
>
> +//______________________________________________________________________________
> +#ifdef RTL_FAST_STRING
> +template< class C1, class C2 >
> +inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OStringConcat< C1, C2 >& value )
> +    SAL_THROW(())
> +{
> +    const rtl::OString str( value );
> +    const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
> +    ::uno_type_any_assign(
> +        &rAny, const_cast< rtl::OString * >( &str ), rType.getTypeLibType(),
> +        (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
> +}
> +
> +//______________________________________________________________________________
> +template< class C1, class C2 >
> +inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C2 >& value )
> +    SAL_THROW(())
> +{
> +    const rtl::OUString str( value );
> +    const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
> +    ::uno_type_any_assign(
> +        &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
> +        (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
> +}
> +#endif
>   //__________________________________________________________________________________________________
>   template< class C >
>   inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
> -- 1.7.10.4



More information about the LibreOffice mailing list