annotate DEPENDENCIES/generic/include/boost/test/utils/runtime/validation.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // (C) Copyright Gennadiy Rozental 2005-2008.
Chris@16 2 // Distributed under the Boost Software License, Version 1.0.
Chris@16 3 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5
Chris@16 6 // See http://www.boost.org/libs/test for the library home page.
Chris@16 7 //
Chris@16 8 // File : $RCSfile$
Chris@16 9 //
Chris@101 10 // Version : $Revision$
Chris@16 11 //
Chris@16 12 // Description : defines exceptions and validation tools
Chris@16 13 // ***************************************************************************
Chris@16 14
Chris@16 15 #ifndef BOOST_RT_VALIDATION_HPP_062604GER
Chris@16 16 #define BOOST_RT_VALIDATION_HPP_062604GER
Chris@16 17
Chris@16 18 // Boost.Runtime.Parameter
Chris@16 19 #include <boost/test/utils/runtime/config.hpp>
Chris@16 20
Chris@16 21 // Boost.Test
Chris@16 22 #include <boost/test/utils/class_properties.hpp>
Chris@16 23
Chris@16 24 // Boost
Chris@16 25 #include <boost/shared_ptr.hpp>
Chris@16 26
Chris@16 27 // STL
Chris@16 28 #ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
Chris@16 29 #include <stdexcept>
Chris@16 30 #endif
Chris@16 31
Chris@16 32 namespace boost {
Chris@16 33
Chris@16 34 namespace BOOST_RT_PARAM_NAMESPACE {
Chris@16 35
Chris@16 36 // ************************************************************************** //
Chris@16 37 // ************** runtime::logic_error ************** //
Chris@16 38 // ************************************************************************** //
Chris@16 39
Chris@16 40 class logic_error
Chris@16 41 #ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
Chris@16 42 : public std::exception
Chris@16 43 #endif
Chris@16 44 {
Chris@16 45 typedef shared_ptr<dstring> dstring_ptr;
Chris@16 46 public:
Chris@16 47 // Constructor // !! could we eliminate shared_ptr
Chris@16 48 explicit logic_error( cstring msg ) : m_msg( new dstring( msg.begin(), msg.size() ) ) {}
Chris@16 49 ~logic_error() throw() {}
Chris@16 50
Chris@16 51 dstring const& msg() const { return *m_msg; }
Chris@16 52 virtual char_type const* what() const throw() { return m_msg->c_str(); }
Chris@16 53
Chris@16 54 private:
Chris@16 55 dstring_ptr m_msg;
Chris@16 56 };
Chris@16 57
Chris@16 58 // ************************************************************************** //
Chris@16 59 // ************** runtime::report_logic_error ************** //
Chris@16 60 // ************************************************************************** //
Chris@16 61
Chris@16 62 inline void
Chris@16 63 report_logic_error( format_stream& msg )
Chris@16 64 {
Chris@16 65 throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() );
Chris@16 66 }
Chris@16 67
Chris@16 68 //____________________________________________________________________________//
Chris@16 69
Chris@16 70 #define BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg ) \
Chris@16 71 boost::BOOST_RT_PARAM_NAMESPACE::report_logic_error( format_stream().ref() << msg )
Chris@16 72
Chris@16 73 #define BOOST_RT_PARAM_VALIDATE_LOGIC( b, msg ) \
Chris@16 74 if( b ) {} else BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg )
Chris@16 75
Chris@16 76 //____________________________________________________________________________//
Chris@16 77
Chris@16 78 } // namespace BOOST_RT_PARAM_NAMESPACE
Chris@16 79
Chris@16 80 } // namespace boost
Chris@16 81
Chris@16 82 #endif // BOOST_RT_VALIDATION_HPP_062604GER