throw_exception.hpp
Go to the documentation of this file.
00001 #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
00002 #define BOOST_THROW_EXCEPTION_HPP_INCLUDED
00003 
00004 // MS compatible compilers support #pragma once
00005 
00006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
00007 # pragma once
00008 #endif
00009 
00010 //
00011 //  boost/throw_exception.hpp
00012 //
00013 //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
00014 //  Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc.
00015 //
00016 //  Distributed under the Boost Software License, Version 1.0. (See
00017 //  accompanying file LICENSE_1_0.txt or copy at
00018 //  http://www.boost.org/LICENSE_1_0.txt)
00019 //
00020 //  http://www.boost.org/libs/utility/throw_exception.html
00021 //
00022 
00023 #include <boost/config.hpp>
00024 #include <boost/detail/workaround.hpp>
00025 #include <exception>
00026 
00027 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
00028 # define BOOST_EXCEPTION_DISABLE
00029 #endif
00030 
00031 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 )
00032 # define BOOST_EXCEPTION_DISABLE
00033 #endif
00034 
00035 #if !defined( BOOST_EXCEPTION_DISABLE )
00036 # include <boost/exception/exception.hpp>
00037 # include <boost/current_function.hpp>
00038 # define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
00039     ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
00040     ::boost::throw_file(__FILE__) <<\
00041     ::boost::throw_line((int)__LINE__))
00042 #else
00043 # define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
00044 #endif
00045 
00046 namespace boost
00047 {
00048 
00049 #ifdef BOOST_NO_EXCEPTIONS
00050 
00051 void throw_exception( std::exception const & e ); // user defined
00052 
00053 #else
00054 
00055 inline void throw_exception_assert_compatibility( std::exception const & ) { }
00056 
00057 template<class E> inline void throw_exception( E const & e )
00058 {
00059     //All boost exceptions are required to derive std::exception,
00060     //to ensure compatibility with BOOST_NO_EXCEPTIONS.
00061     throw_exception_assert_compatibility(e);
00062 
00063 #ifndef BOOST_EXCEPTION_DISABLE
00064     throw enable_current_exception(enable_error_info(e));
00065 #else
00066     throw e;
00067 #endif
00068 }
00069 
00070 #endif
00071 
00072 } // namespace boost
00073 
00074 #endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29