fix doc example typo
[boost.git] / boost / test / unit_test_log_formatter.hpp
blobce5ea8c4005bd017d8d4b9ae11465eb9fe490475
1 // (C) Copyright Gennadiy Rozental 2003-2008.
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)
6 // See http://www.boost.org/libs/test for the library home page.
7 //
8 // File : $RCSfile$
9 //
10 // Version : $Revision$
12 // Description :
13 // ***************************************************************************
15 #ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
16 #define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER
18 // Boost.Test
19 #include <boost/test/detail/global_typedef.hpp>
20 #include <boost/test/detail/log_level.hpp>
21 #include <boost/test/detail/fwd_decl.hpp>
23 // STL
24 #include <iosfwd>
25 #include <string> // for std::string
27 #include <boost/test/detail/suppress_warnings.hpp>
29 //____________________________________________________________________________//
31 namespace boost {
33 namespace unit_test {
35 // ************************************************************************** //
36 // ************** log_entry_data ************** //
37 // ************************************************************************** //
39 struct BOOST_TEST_DECL log_entry_data {
40 log_entry_data()
42 m_file_name.reserve( 200 );
45 std::string m_file_name;
46 std::size_t m_line_num;
47 log_level m_level;
49 void clear()
51 m_file_name.erase();
52 m_line_num = 0;
53 m_level = log_nothing;
57 // ************************************************************************** //
58 // ************** checkpoint_data ************** //
59 // ************************************************************************** //
61 struct BOOST_TEST_DECL log_checkpoint_data
63 const_string m_file_name;
64 std::size_t m_line_num;
65 std::string m_message;
67 void clear()
69 m_file_name.clear();
70 m_line_num = 0;
71 m_message = std::string();
75 // ************************************************************************** //
76 // ************** unit_test_log_formatter ************** //
77 // ************************************************************************** //
79 class BOOST_TEST_DECL unit_test_log_formatter {
80 public:
81 enum log_entry_types { BOOST_UTL_ET_INFO,
82 BOOST_UTL_ET_MESSAGE,
83 BOOST_UTL_ET_WARNING,
84 BOOST_UTL_ET_ERROR,
85 BOOST_UTL_ET_FATAL_ERROR };
87 // Destructor
88 virtual ~unit_test_log_formatter() {}
90 // Formatter interface
91 virtual void log_start( std::ostream&, counter_t test_cases_amount ) = 0;
92 virtual void log_finish( std::ostream& ) = 0;
93 virtual void log_build_info( std::ostream& ) = 0;
95 virtual void test_unit_start( std::ostream&, test_unit const& tu ) = 0;
96 virtual void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) = 0;
97 virtual void test_unit_skipped( std::ostream&, test_unit const& ) = 0;
99 virtual void log_exception( std::ostream&, log_checkpoint_data const&, const_string explanation ) = 0;
101 virtual void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) = 0;
102 virtual void log_entry_value( std::ostream&, const_string value ) = 0;
103 virtual void log_entry_value( std::ostream&, lazy_ostream const& value ); // there is a default impl
104 virtual void log_entry_finish( std::ostream& ) = 0;
107 } // namespace unit_test
109 } // namespace boost
111 //____________________________________________________________________________//
113 #include <boost/test/detail/enable_warnings.hpp>
115 #endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER