summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-11-10 10:48:15 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-11-10 10:49:31 +0100
commit26364f4fd346c36f2c3ba4c2228d62de845fe13e (patch)
treea43e24f94c8c05b2fac6c20ebe5ddaafe8250917 /sal
parent7f97d3140735126d0b89a0675985776cf2acb6d4 (diff)
deduplicate OString std::basic_ostream operators
I wanted to add one, based on OUString one, and Stephan on IRC agreed it's a good idea. Then it turned out we already had it in sal unit tests, sdext and unodevtools as well. Get rid of all these, and have a single implementation in string.hxx, so it can be used everywhere. Change-Id: Ibb820f20a138d055fd87036253c627fb862a31fe
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/string.hxx14
-rw-r--r--sal/qa/rtl/strings/test_strings_replace.cxx12
2 files changed, 14 insertions, 12 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index a135d4ed400b..e45b837b7fe6 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -1479,6 +1479,20 @@ struct OStringHash
/* ======================================================================= */
+/**
+ Support for rtl::OString in std::ostream (and thus in
+ CPPUNIT_ASSERT or SAL_INFO macros, for example).
+
+ @since LibreOffice 3.7
+ */
+template< typename charT, typename traits > std::basic_ostream<charT, traits> &
+operator <<(
+ std::basic_ostream<charT, traits> & stream, rtl::OString const & string)
+{
+ return stream << string.getStr();
+ // best effort; potentially loses data due to embedded null characters
+}
+
} /* Namespace */
#ifdef RTL_USING
diff --git a/sal/qa/rtl/strings/test_strings_replace.cxx b/sal/qa/rtl/strings/test_strings_replace.cxx
index 5e1b0cfb9c74..a46245f3c0fa 100644
--- a/sal/qa/rtl/strings/test_strings_replace.cxx
+++ b/sal/qa/rtl/strings/test_strings_replace.cxx
@@ -37,18 +37,6 @@
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
-namespace rtl {
-
-template< typename charT, typename traits > std::basic_ostream<charT, traits> &
-operator <<(
- std::basic_ostream<charT, traits> & stream, rtl::OString const & string)
-{
- return stream << string.getStr();
- // best effort; potentially loses data due to embedded null characters
-}
-
-}
-
namespace {
class Test: public CppUnit::TestFixture {