[Libreoffice-commits] .: tools/inc
Lubos Lunak
llunak at kemper.freedesktop.org
Thu Apr 12 07:41:46 PDT 2012
tools/inc/tools/string.hxx | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 2110e5e838648ae4054ca74cdc587c12370223a5
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Thu Apr 12 16:34:16 2012 +0200
operator<< for ostream + UniString
This should make even String be easily usable with SAL_DEBUG
stuff (the same like 2ac5b08361bf0c7c98ff9bc10869e2b41c9d85fd for OUString).
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index edecd2f..0d6b26b 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -343,6 +343,16 @@ inline UniString UniString::GetQuotedToken( xub_StrLen nToken, const UniString&
return GetQuotedToken( nToken, rQuotedPairs, cTok, nTempPos );
}
+template< typename charT, typename traits > std::basic_ostream<charT, traits> &
+operator <<(
+ std::basic_ostream<charT, traits> & stream, UniString 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
+}
+
#endif // _STRING_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list