Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:42

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Distributed under the Boost Software License, Version 1.0.
0003 //  (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 //  File        : $RCSfile$
0009 //
0010 //  Version     : $Revision$
0011 //
0012 //  Description : simple helpers for creating cusom output manipulators
0013 // ***************************************************************************
0014 
0015 #ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
0016 #define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
0017 
0018 // STL
0019 #include <iosfwd>
0020 
0021 #include <boost/test/detail/suppress_warnings.hpp>
0022 
0023 //____________________________________________________________________________//
0024 
0025 namespace boost {
0026 namespace unit_test {
0027 namespace utils {
0028 
0029 // ************************************************************************** //
0030 // **************          custom manipulators helpers         ************** //
0031 // ************************************************************************** //
0032 
0033 template<typename Manip>
0034 struct custom_printer {
0035     explicit custom_printer( std::ostream& ostr ) : m_ostr( &ostr ) {}
0036 
0037     std::ostream& operator*() const { return *m_ostr; }
0038 
0039 private:
0040     std::ostream* const m_ostr;
0041 };
0042 
0043 //____________________________________________________________________________//
0044 
0045 template<typename Uniq> struct custom_manip {};
0046 
0047 //____________________________________________________________________________//
0048 
0049 template<typename Uniq>
0050 inline custom_printer<custom_manip<Uniq> >
0051 operator<<( std::ostream& ostr, custom_manip<Uniq> const& ) { return custom_printer<custom_manip<Uniq> >( ostr ); }
0052 
0053 //____________________________________________________________________________//
0054 
0055 } // namespace utils
0056 } // namespace unit_test
0057 } // namespace boost
0058 
0059 #include <boost/test/detail/enable_warnings.hpp>
0060 
0061 #endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP