[Libreoffice-commits] .: sal/inc
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Sep 18 02:56:54 PDT 2012
sal/inc/rtl/oustringostreaminserter.hxx | 44 ++------------------------------
sal/inc/rtl/ustring.hxx | 36 ++++++++++++++++++++++----
2 files changed, 34 insertions(+), 46 deletions(-)
New commits:
commit 96b45756b46ceb06dbec5c241d09acc96891e121
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Sep 18 11:54:05 2012 +0200
move ostream OUString operator<< directly to ustring.hxx
It apparently works that way, so there's no need to have
an #include loop.
Change-Id: I58d4f0461c14637872a139f0fbfb78f2a99fe28a
diff --git a/sal/inc/rtl/oustringostreaminserter.hxx b/sal/inc/rtl/oustringostreaminserter.hxx
index c25998a..48dc79e 100644
--- a/sal/inc/rtl/oustringostreaminserter.hxx
+++ b/sal/inc/rtl/oustringostreaminserter.hxx
@@ -27,47 +27,9 @@
#ifndef INCLUDED_RTL_OUSTRINGOSTREAMINSERTER_HXX
#define INCLUDED_RTL_OUSTRINGOSTREAMINSERTER_HXX
-#include "sal/config.h"
-
-#include <ostream>
-
-#include "rtl/textenc.h"
-#include "rtl/ustring.hxx"
-
-// The unittest uses slightly different code to help check that the proper
-// calls are made. The class is put into a different namespace to make
-// sure the compiler generates a different (if generating also non-inline)
-// copy of the function and does not merge them together. The class
-// is "brought" into the proper rtl namespace by a typedef below.
-#ifdef RTL_STRING_UNITTEST
-#define rtl rtlunittest
-#endif
-
-namespace rtl {
-
-#ifdef RTL_STRING_UNITTEST
-#undef rtl
-#endif
-
-/**
- Support for rtl::OUString in std::ostream (and thus in
- CPPUNIT_ASSERT or SAL_INFO macros, for example).
-
- The rtl::OUString is converted to UTF-8.
-
- @since LibreOffice 3.5.
-*/
-template< typename charT, typename traits >
-inline std::basic_ostream<charT, traits> & operator <<(
- std::basic_ostream<charT, traits> & stream, rtl::OUString const & string)
-{
- return stream <<
- rtl::OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr();
- // best effort; potentially loses data due to conversion failures
- // (stray surrogate halves) and embedded null characters
-}
-
-}
+// File kept only for backwards compatibility, the inserter is now defined
+// together with OUString.
+#include <rtl/ustring.hxx>
#endif
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 4afb1d2..b008054 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -32,12 +32,14 @@
#include "sal/config.h"
#include <cassert>
+#include <ostream>
#include "osl/diagnose.h"
#include <rtl/ustring.h>
#include <rtl/string.hxx>
#include <rtl/stringutils.hxx>
#include <rtl/memory.h>
+#include <rtl/textenc.h>
#include "sal/log.hxx"
#if defined EXCEPTIONS_OFF
@@ -2141,6 +2143,35 @@ inline OString OUStringToOString( const OUString & rUnicode,
} /* Namespace */
+#ifdef RTL_STRING_UNITTEST
+#define rtl rtlunittest
+#endif
+namespace rtl
+{
+#ifdef RTL_STRING_UNITTEST
+#undef rtl
+#endif
+
+/**
+ Support for rtl::OUString in std::ostream (and thus in
+ CPPUNIT_ASSERT or SAL_INFO macros, for example).
+
+ The rtl::OUString is converted to UTF-8.
+
+ @since LibreOffice 3.5.
+*/
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, OUString const & string)
+{
+ return stream <<
+ rtl::OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr();
+ // best effort; potentially loses data due to conversion failures
+ // (stray surrogate halves) and embedded null characters
+}
+
+} // namespace
+
// RTL_USING is defined by gbuild for all modules except those with stable public API
// (as listed in ure/source/README). It allows to use classes like OUString without
// having to explicitly refer to the rtl namespace, which is kind of superfluous
@@ -2154,9 +2185,4 @@ using ::rtl::OUStringToOString;
#endif /* _RTL_USTRING_HXX */
-// Include the ostream << operator directly here, so that it's always available
-// for SAL_INFO etc. Make sure it's outside of #ifdef _RTL_USTRING_HXX, because
-// includes ustring.hxx back.
-#include <rtl/oustringostreaminserter.hxx>
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list