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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 26 15:52:29 UTC 2019


 include/com/sun/star/uno/Sequence.h |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit b5317b2a41e6369e2804462e2ab73f1447f1533a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Aug 26 15:04:47 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Aug 26 17:51:01 2019 +0200

    Introduce Sequence::size() instead of specialization of std::size
    
    Change-Id: Id0889a1b51449f3812ba875919595a241f4ec56f
    Reviewed-on: https://gerrit.libreoffice.org/78139
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
index 78d1124ba504..2ba8c71f8be8 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -27,6 +27,7 @@
 #include <new>
 
 #if defined LIBO_INTERNAL_ONLY
+#include <cassert>
 #include <initializer_list>
 #endif
 
@@ -151,6 +152,15 @@ public:
     bool SAL_CALL hasElements() const
         { return (_pSequence->nElements > 0); }
 
+#if defined LIBO_INTERNAL_ONLY
+    /** This function allows to use Sequence in cases where  std::size is needed, and the like.
+
+        @since LibreOffice 6.4
+    */
+    sal_uInt32 size() const
+        { assert(getLength() >= 0); return static_cast<sal_uInt32>(getLength()); }
+#endif
+
     /** Gets a pointer to elements array for reading.
         If the sequence has a length of 0, then the returned pointer is
         undefined.
@@ -272,16 +282,6 @@ inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
 }
 }
 
-#if defined LIBO_INTERNAL_ONLY
-namespace std
-{
-template <class E> sal_Int32 size(const ::com::sun::star::uno::Sequence<E>& s)
-{
-    return s.getLength();
-}
-}
-#endif
-
 /** Gets the meta type of IDL sequence.
 
     There are cases (involving templates) where uses of getCppuType are known to


More information about the Libreoffice-commits mailing list