[857] | 1 | // (C) Copyright Gennadiy Rozental 2004-2005.
|
---|
| 2 | // Distributed under the Boost Software License, Version 1.0.
|
---|
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 |
|
---|
| 6 | // See http://www.boost.org/libs/test for the library home page.
|
---|
| 7 | //
|
---|
| 8 | // File : $RCSfile: io.hpp,v $
|
---|
| 9 | //
|
---|
| 10 | // Version : $Revision: 1.4 $
|
---|
| 11 | //
|
---|
| 12 | // Description : basic_cstring i/o implementation
|
---|
| 13 | // ***************************************************************************
|
---|
| 14 |
|
---|
| 15 | #ifndef BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER
|
---|
| 16 | #define BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER
|
---|
| 17 |
|
---|
| 18 | // Boost.Test
|
---|
| 19 | #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
---|
| 20 |
|
---|
| 21 | // STL
|
---|
| 22 | #include <iosfwd>
|
---|
| 23 | #include <string>
|
---|
| 24 |
|
---|
| 25 | #include <boost/test/detail/suppress_warnings.hpp>
|
---|
| 26 |
|
---|
| 27 | //____________________________________________________________________________//
|
---|
| 28 |
|
---|
| 29 | namespace boost {
|
---|
| 30 |
|
---|
| 31 | namespace unit_test {
|
---|
| 32 |
|
---|
| 33 | #ifdef BOOST_CLASSIC_IOSTREAMS
|
---|
| 34 |
|
---|
| 35 | template<typename CharT>
|
---|
| 36 | inline std::ostream&
|
---|
| 37 | operator<<( std::ostream& os, basic_cstring<CharT> const& str )
|
---|
| 38 | {
|
---|
| 39 | typedef typename ut_detail::bcs_base_char<CharT>::type char_type;
|
---|
| 40 | char_type const* const beg = reinterpret_cast<char_type const* const>( str.begin() );
|
---|
| 41 | char_type const* const end = reinterpret_cast<char_type const* const>( str.end() );
|
---|
| 42 | os << std::basic_string<char_type>( beg, end - beg );
|
---|
| 43 |
|
---|
| 44 | return os;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | #else
|
---|
| 48 |
|
---|
| 49 | template<typename CharT1, typename Tr,typename CharT2>
|
---|
| 50 | inline std::basic_ostream<CharT1,Tr>&
|
---|
| 51 | operator<<( std::basic_ostream<CharT1,Tr>& os, basic_cstring<CharT2> const& str )
|
---|
| 52 | {
|
---|
| 53 | CharT1 const* const beg = reinterpret_cast<CharT1 const*>( str.begin() ); //!!
|
---|
| 54 | CharT1 const* const end = reinterpret_cast<CharT1 const*>( str.end() );
|
---|
| 55 | os << std::basic_string<CharT1,Tr>( beg, end - beg );
|
---|
| 56 |
|
---|
| 57 | return os;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | #endif
|
---|
| 61 |
|
---|
| 62 | //____________________________________________________________________________//
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | } // namespace unit_test
|
---|
| 66 |
|
---|
| 67 | } // namespace boost
|
---|
| 68 |
|
---|
| 69 | //____________________________________________________________________________//
|
---|
| 70 |
|
---|
| 71 | #include <boost/test/detail/enable_warnings.hpp>
|
---|
| 72 |
|
---|
| 73 | // ***************************************************************************
|
---|
| 74 | // Revision History :
|
---|
| 75 | //
|
---|
| 76 | // $Log: io.hpp,v $
|
---|
| 77 | // Revision 1.4 2005/02/20 08:27:09 rogeeff
|
---|
| 78 | // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
---|
| 79 | //
|
---|
| 80 | // Revision 1.3 2005/02/01 06:40:08 rogeeff
|
---|
| 81 | // copyright update
|
---|
| 82 | // old log entries removed
|
---|
| 83 | // minor stilistic changes
|
---|
| 84 | // depricated tools removed
|
---|
| 85 | //
|
---|
| 86 | // Revision 1.2 2005/01/22 19:22:13 rogeeff
|
---|
| 87 | // implementation moved into headers section to eliminate dependency of included/minimal component on src directory
|
---|
| 88 | //
|
---|
| 89 | // Revision 1.1 2005/01/22 18:21:40 rogeeff
|
---|
| 90 | // moved sharable staff into utils
|
---|
| 91 | //
|
---|
| 92 | // ***************************************************************************
|
---|
| 93 |
|
---|
| 94 | #endif // BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER
|
---|