[Libreoffice-commits] core.git: include/com

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 24 06:47:34 UTC 2021


 include/com/sun/star/uno/Type.h   |    8 ++++++++
 include/com/sun/star/uno/Type.hxx |   18 ++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit dd2d82cfb7c2f3fc5300bc6164608beaf7c3d0ba
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jun 23 10:34:06 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jun 24 08:46:39 2021 +0200

    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 at collabora.co.uk>

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;


More information about the Libreoffice-commits mailing list