diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-23 10:34:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-24 08:46:39 +0200 |
commit | dd2d82cfb7c2f3fc5300bc6164608beaf7c3d0ba (patch) | |
tree | 6225fbef6b4f4ebe9c1582796b90e0d4e0eba423 /include/com | |
parent | 888d1e2a41d27eecf0064d4cd987a8e7ac32aacb (diff) |
uno::Type needs a move operator
speeds up some operations where Type is stored in a vector
Change-Id: Id7112e51d4e4707bc6d261313e994c6ffef54d31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117693
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Type.h | 8 | ||||
-rw-r--r-- | include/com/sun/star/uno/Type.hxx | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Type.h b/include/com/sun/star/uno/Type.h index c643e3c8de98..364d9eb5959e 100644 --- a/include/com/sun/star/uno/Type.h +++ b/include/com/sun/star/uno/Type.h @@ -119,6 +119,10 @@ public: */ inline Type( const Type & rType ); +#if defined LIBO_INTERNAL_ONLY + inline Type( Type && ); +#endif + /** Destructor: Releases acquired C type description reference. */ ~Type() @@ -131,6 +135,10 @@ public: */ inline Type & SAL_CALL operator = ( const Type & rType ); +#if defined LIBO_INTERNAL_ONLY + inline Type & SAL_CALL operator = ( Type && ); +#endif + /** Gets the type class of set type. @return type class of set type diff --git a/include/com/sun/star/uno/Type.hxx b/include/com/sun/star/uno/Type.hxx index 27fd7dd5149c..5c95adc3bd85 100644 --- a/include/com/sun/star/uno/Type.hxx +++ b/include/com/sun/star/uno/Type.hxx @@ -82,6 +82,16 @@ inline Type::Type( const Type & rType ) ::typelib_typedescriptionreference_acquire( _pType ); } +#if defined LIBO_INTERNAL_ONLY +inline Type::Type( Type && rType ) + : _pType( rType._pType ) +{ + rType._pType = reinterpret_cast< const ::com::sun::star::uno::Type * >( + ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) )->getTypeLibType(); + ::typelib_typedescriptionreference_acquire( rType._pType ); +} +#endif + inline ::rtl::OUString Type::getTypeName() const { return ::rtl::OUString( _pType->pTypeName ); @@ -93,6 +103,14 @@ inline Type & Type::operator = ( const Type & rType ) return *this; } +#if defined LIBO_INTERNAL_ONLY +inline Type & Type::operator = ( Type && rType ) +{ + std::swap(_pType, rType._pType); + return *this; +} +#endif + template< class T > typelib_TypeDescriptionReference * Array< T >::s_pType = NULL; |