os/ossrv/ossrv_pub/boost_apis/boost/test/utils/nullstream.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/test/utils/nullstream.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,121 @@
     1.4 +//  (C) Copyright Gennadiy Rozental 2002-2005.
     1.5 +//  (C) Copyright Daryle Walker 2000-2001. 
     1.6 +//  Distributed under the Boost Software License, Version 1.0.
     1.7 +//  (See accompanying file LICENSE_1_0.txt or copy at 
     1.8 +//  http://www.boost.org/LICENSE_1_0.txt)
     1.9 +
    1.10 +//  See http://www.boost.org/libs/test for the library home page.
    1.11 +//
    1.12 +//  File        : $RCSfile: nullstream.hpp,v $
    1.13 +//
    1.14 +//  Version     : $Revision: 1.4 $
    1.15 +//
    1.16 +//  Description : simulate /dev/null stream
    1.17 +// ***************************************************************************
    1.18 +
    1.19 +#ifndef BOOST_NULLSTREAM_HPP_071894GER
    1.20 +#define BOOST_NULLSTREAM_HPP_071894GER
    1.21 +
    1.22 +#include <ostream>    // for std::basic_ostream
    1.23 +#include <streambuf>  // for std::basic_streambuf
    1.24 +#include <string>     // for std::char_traits
    1.25 +
    1.26 +#include <boost/utility/base_from_member.hpp>
    1.27 +
    1.28 +#include <boost/test/detail/suppress_warnings.hpp>
    1.29 +
    1.30 +//____________________________________________________________________________//
    1.31 +
    1.32 +namespace boost {
    1.33 +
    1.34 +// ************************************************************************** //
    1.35 +// **************                 basic_nullbuf                ************** //
    1.36 +// ************************************************************************** //
    1.37 +//  Class for a buffer that reads nothing and writes to nothing.
    1.38 +//  Idea from an Usenet post by Tom <the_wid@my-deja.com> at
    1.39 +//  27 Oct 2000 14:06:21 GMT on comp.lang.c++.
    1.40 +
    1.41 +template<typename CharType, class CharTraits = ::std::char_traits<CharType> >
    1.42 +class basic_nullbuf : public ::std::basic_streambuf<CharType, CharTraits> {
    1.43 +    typedef ::std::basic_streambuf<CharType, CharTraits>  base_type;
    1.44 +public:
    1.45 +    // Types
    1.46 +    typedef typename base_type::char_type    char_type;
    1.47 +    typedef typename base_type::traits_type  traits_type;
    1.48 +    typedef typename base_type::int_type     int_type;
    1.49 +    typedef typename base_type::pos_type     pos_type;
    1.50 +    typedef typename base_type::off_type     off_type;
    1.51 +
    1.52 +    // Use automatic default constructor and destructor
    1.53 +
    1.54 +protected:
    1.55 +    // The default implementations of the miscellaneous virtual
    1.56 +    // member functions are sufficient.
    1.57 +
    1.58 +    // The default implementations of the input & putback virtual
    1.59 +    // member functions, being nowhere but EOF, are sufficient.
    1.60 +
    1.61 +    // The output virtual member functions need to be changed to
    1.62 +    // accept anything without any problems, instead of being at EOF.
    1.63 +    virtual  ::std::streamsize  xsputn( char_type const* /*s*/, ::std::streamsize n )   { return n; } // "s" is unused
    1.64 +    virtual  int_type           overflow( int_type c = traits_type::eof() )         { return traits_type::not_eof( c ); }
    1.65 +};
    1.66 +
    1.67 +typedef basic_nullbuf<char>      nullbuf;
    1.68 +typedef basic_nullbuf<wchar_t>  wnullbuf;
    1.69 +
    1.70 +// ************************************************************************** //
    1.71 +// **************               basic_onullstream              ************** //
    1.72 +// ************************************************************************** //
    1.73 +//  Output streams based on basic_nullbuf.
    1.74 +
    1.75 +#ifdef BOOST_MSVC
    1.76 +# pragma warning(push)
    1.77 +# pragma warning(disable: 4355) // 'this' : used in base member initializer list
    1.78 +#endif
    1.79 +
    1.80 +template< typename CharType, class CharTraits = ::std::char_traits<CharType> >
    1.81 +class basic_onullstream : private boost::base_from_member<basic_nullbuf<CharType, CharTraits> >
    1.82 +                        , public ::std::basic_ostream<CharType, CharTraits> {
    1.83 +    typedef boost::base_from_member<basic_nullbuf<CharType, CharTraits> >   pbase_type;
    1.84 +    typedef ::std::basic_ostream<CharType, CharTraits>                      base_type;
    1.85 +public:
    1.86 +    // Constructor
    1.87 +    basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {}
    1.88 +};
    1.89 +
    1.90 +#ifdef BOOST_MSVC
    1.91 +# pragma warning(default: 4355)
    1.92 +#endif
    1.93 +
    1.94 +typedef basic_onullstream<char>      onullstream;
    1.95 +typedef basic_onullstream<wchar_t>  wonullstream;
    1.96 +
    1.97 +}  // namespace boost
    1.98 +
    1.99 +//____________________________________________________________________________//
   1.100 +
   1.101 +#include <boost/test/detail/enable_warnings.hpp>
   1.102 +
   1.103 +// ***************************************************************************
   1.104 +//  Revision History :
   1.105 +//  
   1.106 +//  $Log: nullstream.hpp,v $
   1.107 +//  Revision 1.4  2005/02/20 08:27:08  rogeeff
   1.108 +//  This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
   1.109 +//
   1.110 +//  Revision 1.3  2005/02/01 06:40:07  rogeeff
   1.111 +//  copyright update
   1.112 +//  old log entries removed
   1.113 +//  minor stilistic changes
   1.114 +//  depricated tools removed
   1.115 +//
   1.116 +//  Revision 1.2  2005/01/30 01:42:49  rogeeff
   1.117 +//  warnings suppressed
   1.118 +//
   1.119 +//  Revision 1.1  2005/01/22 18:21:40  rogeeff
   1.120 +//  moved sharable staff into utils
   1.121 +//
   1.122 +// ***************************************************************************
   1.123 +
   1.124 +#endif  // BOOST_NULLSTREAM_HPP_071894GER