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

Stephan Bergmann sbergman at redhat.com
Fri Apr 28 12:11:34 UTC 2017


 include/com/sun/star/uno/Reference.hxx |   14 ++++++++++++++
 include/com/sun/star/uno/Type.hxx      |   13 +++++++++++++
 2 files changed, 27 insertions(+)

New commits:
commit 06c1dc4c09ba816affb8b65e8215bcd56a81df91
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Apr 28 14:09:57 2017 +0200

    LIBO_INTERNAL_ONLY: printing of css::uno::Reference/Type
    
    ...as will be needed by some upcoming replacements of CPPUNIT_ASSERT with
    CPPUNIT_ASSERT_EQUAL
    
    Change-Id: Ie2b2b982b02f2bf48e2e8be7ba642198029c8698

diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx
index c4708f1956b9..f197007cb8ff 100644
--- a/include/com/sun/star/uno/Reference.hxx
+++ b/include/com/sun/star/uno/Reference.hxx
@@ -22,6 +22,7 @@
 #include <sal/config.h>
 
 #include <cstddef>
+#include <ostream>
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/RuntimeException.hpp>
@@ -432,6 +433,19 @@ inline bool BaseReference::operator != ( const BaseReference & rRef ) const
     return (! operator == ( rRef._pInterface ));
 }
 
+#if defined LIBO_INTERNAL_ONLY
+/**
+   Support for BaseReference in std::ostream (and thus in CPPUNIT_ASSERT or
+   SAL_INFO macros, for example).
+
+   @since LibreOffice 5.4
+*/
+template<typename charT, typename traits> std::basic_ostream<charT, traits> &
+operator <<(
+    std::basic_ostream<charT, traits> & stream, BaseReference const & ref)
+{ return stream << ref.get(); }
+#endif
+
 }
 }
 }
diff --git a/include/com/sun/star/uno/Type.hxx b/include/com/sun/star/uno/Type.hxx
index 36800ce7be78..4a7b86e72c05 100644
--- a/include/com/sun/star/uno/Type.hxx
+++ b/include/com/sun/star/uno/Type.hxx
@@ -22,6 +22,7 @@
 #include <sal/config.h>
 
 #include <cstddef>
+#include <ostream>
 
 #include <com/sun/star/uno/Type.h>
 #include <cppu/unotype.hxx>
@@ -92,6 +93,18 @@ inline Type & Type::operator = ( const Type & rType )
 template< class T >
 typelib_TypeDescriptionReference * Array< T >::s_pType = NULL;
 
+#if defined LIBO_INTERNAL_ONLY
+/**
+   Support for Type in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
+   macros, for example).
+
+   @since LibreOffice 5.4
+*/
+template<typename charT, typename traits> std::basic_ostream<charT, traits> &
+operator <<(std::basic_ostream<charT, traits> & stream, Type const & type)
+{ return stream << type.getTypeName(); }
+#endif
+
 }
 }
 }


More information about the Libreoffice-commits mailing list