UDK 3.2.7 C/C++ API Reference
rtl/oustringostreaminserter.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00004 *
00005 * Copyright 2000, 2010 Oracle and/or its affiliates.
00006 *
00007 * OpenOffice.org - a multi-platform office productivity suite
00008 *
00009 * This file is part of OpenOffice.org.
00010 *
00011 * OpenOffice.org is free software: you can redistribute it and/or modify
00012 * it under the terms of the GNU Lesser General Public License version 3
00013 * only, as published by the Free Software Foundation.
00014 *
00015 * OpenOffice.org is distributed in the hope that it will be useful,
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 * GNU Lesser General Public License version 3 for more details
00019 * (a copy is included in the LICENSE file that accompanied this code).
00020 *
00021 * You should have received a copy of the GNU Lesser General Public License
00022 * version 3 along with OpenOffice.org.  If not, see
00023 * <http://www.openoffice.org/license.html>
00024 * for a copy of the LGPLv3 License.
00025 ************************************************************************/
00026 
00027 #ifndef INCLUDED_RTL_OUSTRINGOSTREAMINSERTER_HXX
00028 #define INCLUDED_RTL_OUSTRINGOSTREAMINSERTER_HXX
00029 
00030 #include "sal/config.h"
00031 
00032 #include <ostream>
00033 
00034 #include "rtl/textenc.h"
00035 #include "rtl/ustring.hxx"
00036 
00037 // The unittest uses slightly different code to help check that the proper
00038 // calls are made. The class is put into a different namespace to make
00039 // sure the compiler generates a different (if generating also non-inline)
00040 // copy of the function and does not merge them together. The class
00041 // is "brought" into the proper rtl namespace by a typedef below.
00042 #ifdef RTL_STRING_UNITTEST
00043 #define rtl rtlunittest
00044 #endif
00045 
00046 namespace rtl {
00047 
00048 #ifdef RTL_STRING_UNITTEST
00049 #undef rtl
00050 #endif
00051 
00060 template< typename charT, typename traits > std::basic_ostream<charT, traits> &
00061 operator <<(
00062     std::basic_ostream<charT, traits> & stream, rtl::OUString const & string)
00063 {
00064     return stream <<
00065         rtl::OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr();
00066         // best effort; potentially loses data due to conversion failures
00067         // (stray surrogate halves) and embedded null characters
00068 }
00069 
00070 }
00071 
00072 #endif
00073 
00074 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines