forked from boostorg/exception
Merging changes from trunk.
[SVN r58421]
This commit is contained in:
@ -47,7 +47,7 @@ boost
|
|||||||
<span class="RenoIncludeSPAN">void <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & ep );</span></span>
|
<span class="RenoIncludeSPAN">void <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & ep );</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
See also: <span class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp</a> | <a href="copy_exception.html">copy_exception</a> | <a href="current_exception.html">current_exception</a> | <a href="exception_ptr.html">exception_ptr</a> | <a href="original_exception_type.html">original_exception_type</a> | <a href="rethrow_exception.html">rethrow_exception</a> | <a href="synopsis.html">Synopsis</a> | <a href="unknown_exception.html">unknown_exception</a></span>
|
See also: <span class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp</a> | <a href="copy_exception.html">copy_exception</a> | <a href="current_exception.html">current_exception</a> | <a href="diagnostic_information.html">diagnostic_information</a> | <a href="exception_ptr.html">exception_ptr</a> | <a href="original_exception_type.html">original_exception_type</a> | <a href="rethrow_exception.html">rethrow_exception</a> | <a href="synopsis.html">Synopsis</a> | <a href="unknown_exception.html">unknown_exception</a></span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>diagnostic_information</h3>
|
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>diagnostic_information</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>><span class="RenoBR"> </span><br/><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_ptr_hpp.html">boost/exception_ptr.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||||
<pre>namespace
|
<pre>namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ boost
|
|||||||
</div><h4>Returns:</h4>
|
</div><h4>Returns:</h4>
|
||||||
<p>A string value that contains varying amount of implementation-specific diagnostic information about the passed object:</p>
|
<p>A string value that contains varying amount of implementation-specific diagnostic information about the passed object:</p>
|
||||||
<div><ul><li>If E can be statically converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, the returned value contains the string representations of all <span class="RenoLink"><a href="error_info.html">error_info</a></span> objects stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> through <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, along with other diagnostic information relevant to the exception. If e can be dynamically converted to std::exception, the returned value also contains the what() string.</li>
|
<div><ul><li>If E can be statically converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, the returned value contains the string representations of all <span class="RenoLink"><a href="error_info.html">error_info</a></span> objects stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> through <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, along with other diagnostic information relevant to the exception. If e can be dynamically converted to std::exception, the returned value also contains the what() string.</li>
|
||||||
<li>Otherwise, if E can be statically converted std::exception:<div><ul><li>if e can be dynamically converted to boost::exception, the returned value is the same as if E could be statically converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>;</li>
|
<li>Otherwise, if E can be statically converted to std::exception:<div><ul><li>if e can be dynamically converted to boost::exception, the returned value is the same as if E could be statically converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>;</li>
|
||||||
<li>otherwise the returned value contains the what() string.</li>
|
<li>otherwise the returned value contains the what() string.</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
|
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||||
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
|
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
#include <boost/exception/error_info.hpp>
|
#include <boost/exception/error_info.hpp>
|
||||||
@ -24,4 +30,7 @@
|
|||||||
#include <boost/exception_ptr.hpp>
|
#include <boost/exception_ptr.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_7E83C166200811DE885E826156D89593
|
#ifndef UUID_7E83C166200811DE885E826156D89593
|
||||||
#define UUID_7E83C166200811DE885E826156D89593
|
#define UUID_7E83C166200811DE885E826156D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
@ -31,4 +37,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
#ifndef UUID_61531AB0680611DEADD5846855D89593
|
#ifndef UUID_61531AB0680611DEADD5846855D89593
|
||||||
#define UUID_61531AB0680611DEADD5846855D89593
|
#define UUID_61531AB0680611DEADD5846855D89593
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
|
||||||
#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
|
#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
|
#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_CE6983AC753411DDA764247956D89593
|
#ifndef UUID_CE6983AC753411DDA764247956D89593
|
||||||
#define UUID_CE6983AC753411DDA764247956D89593
|
#define UUID_CE6983AC753411DDA764247956D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -24,7 +30,6 @@ boost
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual
|
|
||||||
~error_info_base() throw()
|
~error_info_base() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -64,4 +69,7 @@ boost
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
490
include/boost/exception/detail/exception_ptr.hpp
Normal file
490
include/boost/exception/detail/exception_ptr.hpp
Normal file
@ -0,0 +1,490 @@
|
|||||||
|
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||||
|
|
||||||
|
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#ifndef UUID_618474C2DE1511DEB74A388C56D89593
|
||||||
|
#define UUID_618474C2DE1511DEB74A388C56D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
|
#error This header requires exception handling to be enabled.
|
||||||
|
#endif
|
||||||
|
#include <boost/exception/exception.hpp>
|
||||||
|
#include <boost/exception/info.hpp>
|
||||||
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
|
#include <boost/exception/detail/type_info.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <new>
|
||||||
|
#include <ios>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
boost
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::string
|
||||||
|
to_string( original_exception_type const & x )
|
||||||
|
{
|
||||||
|
return x.value()->name();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class exception_ptr;
|
||||||
|
exception_ptr current_exception();
|
||||||
|
void rethrow_exception( exception_ptr const & );
|
||||||
|
|
||||||
|
class
|
||||||
|
exception_ptr
|
||||||
|
{
|
||||||
|
typedef bool exception_ptr::*unspecified_bool_type;
|
||||||
|
friend exception_ptr current_exception();
|
||||||
|
friend void rethrow_exception( exception_ptr const & );
|
||||||
|
|
||||||
|
shared_ptr<exception_detail::clone_base const> c_;
|
||||||
|
bool bad_alloc_;
|
||||||
|
|
||||||
|
struct
|
||||||
|
bad_alloc_tag
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit
|
||||||
|
exception_ptr( bad_alloc_tag ):
|
||||||
|
bad_alloc_(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit
|
||||||
|
exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
|
||||||
|
c_(c),
|
||||||
|
bad_alloc_(false)
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rethrow() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(*this);
|
||||||
|
if( bad_alloc_ )
|
||||||
|
throw enable_current_exception(std::bad_alloc());
|
||||||
|
else
|
||||||
|
c_->rethrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
empty() const
|
||||||
|
{
|
||||||
|
return !bad_alloc_ && !c_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
exception_ptr():
|
||||||
|
bad_alloc_(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~exception_ptr() throw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
operator unspecified_bool_type() const
|
||||||
|
{
|
||||||
|
return empty() ? 0 : &exception_ptr::bad_alloc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend
|
||||||
|
bool
|
||||||
|
operator==( exception_ptr const & a, exception_ptr const & b )
|
||||||
|
{
|
||||||
|
return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend
|
||||||
|
bool
|
||||||
|
operator!=( exception_ptr const & a, exception_ptr const & b )
|
||||||
|
{
|
||||||
|
return !(a==b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class
|
||||||
|
unknown_exception:
|
||||||
|
public exception,
|
||||||
|
public std::exception,
|
||||||
|
public exception_detail::clone_base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
unknown_exception()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit
|
||||||
|
unknown_exception( std::exception const & e )
|
||||||
|
{
|
||||||
|
add_original_type(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit
|
||||||
|
unknown_exception( boost::exception const & e ):
|
||||||
|
boost::exception(e)
|
||||||
|
{
|
||||||
|
add_original_type(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
~unknown_exception() throw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
exception_detail::clone_base const *
|
||||||
|
clone() const
|
||||||
|
{
|
||||||
|
return new unknown_exception(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rethrow() const
|
||||||
|
{
|
||||||
|
throw*this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
void
|
||||||
|
add_original_type( E const & e )
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
(*this) << original_exception_type(&typeid(e));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace
|
||||||
|
exception_detail
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
class
|
||||||
|
current_exception_std_exception_wrapper:
|
||||||
|
public T,
|
||||||
|
public boost::exception,
|
||||||
|
public clone_base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit
|
||||||
|
current_exception_std_exception_wrapper( T const & e1 ):
|
||||||
|
T(e1)
|
||||||
|
{
|
||||||
|
add_original_type(e1);
|
||||||
|
}
|
||||||
|
|
||||||
|
current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ):
|
||||||
|
T(e1),
|
||||||
|
boost::exception(e2)
|
||||||
|
{
|
||||||
|
add_original_type(e1);
|
||||||
|
}
|
||||||
|
|
||||||
|
~current_exception_std_exception_wrapper() throw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
clone_base const *
|
||||||
|
clone() const
|
||||||
|
{
|
||||||
|
return new current_exception_std_exception_wrapper(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rethrow() const
|
||||||
|
{
|
||||||
|
throw *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
void
|
||||||
|
add_original_type( E const & e )
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
(*this) << original_exception_type(&typeid(e));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_RTTI
|
||||||
|
template <class T>
|
||||||
|
exception const *
|
||||||
|
get_boost_exception( T const * )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
exception & x )
|
||||||
|
{
|
||||||
|
return &x;
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
template <class T>
|
||||||
|
exception const *
|
||||||
|
get_boost_exception( T const * x )
|
||||||
|
{
|
||||||
|
return dynamic_cast<exception const *>(x);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline
|
||||||
|
shared_ptr<clone_base const>
|
||||||
|
current_exception_std_exception( T const & e1 )
|
||||||
|
{
|
||||||
|
if( boost::exception const * e2 = get_boost_exception(&e1) )
|
||||||
|
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
|
||||||
|
else
|
||||||
|
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
shared_ptr<clone_base const>
|
||||||
|
current_exception_unknown_exception()
|
||||||
|
{
|
||||||
|
return shared_ptr<unknown_exception const>(new unknown_exception());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
shared_ptr<clone_base const>
|
||||||
|
current_exception_unknown_boost_exception( boost::exception const & e )
|
||||||
|
{
|
||||||
|
return shared_ptr<unknown_exception const>(new unknown_exception(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
shared_ptr<clone_base const>
|
||||||
|
current_exception_unknown_std_exception( std::exception const & e )
|
||||||
|
{
|
||||||
|
if( boost::exception const * be = get_boost_exception(&e) )
|
||||||
|
return current_exception_unknown_boost_exception(*be);
|
||||||
|
else
|
||||||
|
return shared_ptr<unknown_exception const>(new unknown_exception(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
shared_ptr<clone_base const>
|
||||||
|
current_exception_impl()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
exception_detail::clone_base & e )
|
||||||
|
{
|
||||||
|
return shared_ptr<exception_detail::clone_base const>(e.clone());
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::domain_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::invalid_argument & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::length_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::out_of_range & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::logic_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::range_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::overflow_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::underflow_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::ios_base::failure & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::runtime_error & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::bad_alloc & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
#ifndef BOOST_NO_TYPEID
|
||||||
|
catch(
|
||||||
|
std::bad_cast & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::bad_typeid & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
catch(
|
||||||
|
std::bad_exception & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::exception & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_unknown_std_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
boost::exception & e )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_unknown_boost_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
return exception_detail::current_exception_unknown_exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
exception_ptr
|
||||||
|
current_exception()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return exception_ptr(exception_detail::current_exception_impl());
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::bad_alloc & )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
std::bad_alloc & )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exception_ptr(exception_ptr::bad_alloc_tag());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline
|
||||||
|
exception_ptr
|
||||||
|
copy_exception( T const & e )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throw enable_current_exception(e);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
return current_exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
rethrow_exception( exception_ptr const & p )
|
||||||
|
{
|
||||||
|
p.rethrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::string
|
||||||
|
diagnostic_information( exception_ptr const & p )
|
||||||
|
{
|
||||||
|
if( p )
|
||||||
|
try
|
||||||
|
{
|
||||||
|
rethrow_exception(p);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
return current_exception_diagnostic_information();
|
||||||
|
}
|
||||||
|
return "<empty>";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::string
|
||||||
|
to_string( exception_ptr const & p )
|
||||||
|
{
|
||||||
|
std::string s='\n'+diagnostic_information(p);
|
||||||
|
std::string padding(" ");
|
||||||
|
std::string r;
|
||||||
|
bool f=false;
|
||||||
|
for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i )
|
||||||
|
{
|
||||||
|
if( f )
|
||||||
|
r+=padding;
|
||||||
|
char c=*i;
|
||||||
|
r+=c;
|
||||||
|
f=(c=='\n');
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
#endif
|
@ -1,33 +0,0 @@
|
|||||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
|
||||||
|
|
||||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#ifndef UUID_DC4208C6417811DEBF11E1EC55D89593
|
|
||||||
#define UUID_DC4208C6417811DEBF11E1EC55D89593
|
|
||||||
|
|
||||||
namespace
|
|
||||||
boost
|
|
||||||
{
|
|
||||||
namespace
|
|
||||||
exception_detail
|
|
||||||
{
|
|
||||||
class
|
|
||||||
exception_ptr_base
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual void _rethrow() const=0;
|
|
||||||
virtual bool _empty() const=0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual
|
|
||||||
~exception_ptr_base() throw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_898984B4076411DD973EDFA055D89593
|
#ifndef UUID_898984B4076411DD973EDFA055D89593
|
||||||
#define UUID_898984B4076411DD973EDFA055D89593
|
#define UUID_898984B4076411DD973EDFA055D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
@ -35,4 +41,7 @@ boost
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
|
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||||
#define UUID_6F463AC838DF11DDA3E6909F56D89593
|
#define UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/detail/type_info.hpp>
|
#include <boost/exception/detail/type_info.hpp>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -38,4 +44,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,9 +5,16 @@
|
|||||||
|
|
||||||
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
|
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
|
||||||
#define UUID_C3E1741C754311DDB2834CCA55D89593
|
#define UUID_C3E1741C754311DDB2834CCA55D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/detail/sp_typeinfo.hpp>
|
#include <boost/detail/sp_typeinfo.hpp>
|
||||||
#include <boost/current_function.hpp>
|
#include <boost/current_function.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
@ -39,92 +46,34 @@ boost
|
|||||||
namespace
|
namespace
|
||||||
exception_detail
|
exception_detail
|
||||||
{
|
{
|
||||||
#ifdef BOOST_NO_TYPEID
|
|
||||||
struct
|
struct
|
||||||
type_info_
|
type_info_
|
||||||
{
|
{
|
||||||
detail::sp_typeinfo const * type_;
|
detail::sp_typeinfo const & type_;
|
||||||
char const * name_;
|
|
||||||
|
|
||||||
explicit
|
|
||||||
type_info_( detail::sp_typeinfo const & type, char const * name ):
|
|
||||||
type_(&type),
|
|
||||||
name_(name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
operator==( type_info_ const & a, type_info_ const & b )
|
|
||||||
{
|
|
||||||
return (*a.type_)==(*b.type_);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
operator<( type_info_ const & a, type_info_ const & b )
|
|
||||||
{
|
|
||||||
return 0!=(a.type_->before(*b.type_));
|
|
||||||
}
|
|
||||||
|
|
||||||
char const *
|
|
||||||
name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
struct
|
|
||||||
type_info_
|
|
||||||
{
|
|
||||||
detail::sp_typeinfo const * type_;
|
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
type_info_( detail::sp_typeinfo const & type ):
|
type_info_( detail::sp_typeinfo const & type ):
|
||||||
type_(&type)
|
type_(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
type_info_( detail::sp_typeinfo const & type, char const * ):
|
|
||||||
type_(&type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
operator==( type_info_ const & a, type_info_ const & b )
|
|
||||||
{
|
|
||||||
return (*a.type_)==(*b.type_);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
operator<( type_info_ const & a, type_info_ const & b )
|
operator<( type_info_ const & a, type_info_ const & b )
|
||||||
{
|
{
|
||||||
return 0!=(a.type_->before(*b.type_));
|
return 0!=(a.type_.before(b.type_));
|
||||||
}
|
|
||||||
|
|
||||||
char const *
|
|
||||||
name() const
|
|
||||||
{
|
|
||||||
return type_->name();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
operator!=( type_info_ const & a, type_info_ const & b )
|
|
||||||
{
|
|
||||||
return !(a==b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
|
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
|
||||||
|
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,42 +5,79 @@
|
|||||||
|
|
||||||
#ifndef UUID_0552D49838DD11DD90146B8956D89593
|
#ifndef UUID_0552D49838DD11DD90146B8956D89593
|
||||||
#define UUID_0552D49838DD11DD90146B8956D89593
|
#define UUID_0552D49838DD11DD90146B8956D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/exception/get_error_info.hpp>
|
#include <boost/exception/get_error_info.hpp>
|
||||||
#include <boost/exception/detail/exception_ptr_base.hpp>
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
#include <boost/exception/current_exception_cast.hpp>
|
||||||
|
namespace
|
||||||
|
boost
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
exception_detail
|
||||||
|
{
|
||||||
|
std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::string
|
||||||
|
current_exception_diagnostic_information()
|
||||||
|
{
|
||||||
|
boost::exception const * be=current_exception_cast<boost::exception const>();
|
||||||
|
std::exception const * se=current_exception_cast<std::exception const>();
|
||||||
|
if( be || se )
|
||||||
|
return exception_detail::diagnostic_information_impl(be,se,true);
|
||||||
|
else
|
||||||
|
return "No diagnostic information available.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
exception_detail
|
exception_detail
|
||||||
{
|
{
|
||||||
template <class T>
|
inline
|
||||||
struct
|
exception const *
|
||||||
enable_boost_exception_overload
|
get_boost_exception( exception const * e )
|
||||||
{
|
{
|
||||||
struct yes { char q[100]; };
|
return e;
|
||||||
typedef char no;
|
}
|
||||||
static yes check(exception const *);
|
|
||||||
static no check(...);
|
|
||||||
enum e { value=sizeof(check((T*)0))==sizeof(yes) };
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
inline
|
||||||
struct
|
exception const *
|
||||||
enable_std_exception_overload
|
get_boost_exception( ... )
|
||||||
{
|
{
|
||||||
struct yes { char q[100]; };
|
return 0;
|
||||||
typedef char no;
|
}
|
||||||
static yes check(std::exception const *);
|
|
||||||
static no check(...);
|
inline
|
||||||
enum e { value = !enable_boost_exception_overload<T>::value && sizeof(check((T*)0))==sizeof(yes) };
|
std::exception const *
|
||||||
};
|
get_std_exception( std::exception const * e )
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::exception const *
|
||||||
|
get_std_exception( ... )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
char const *
|
char const *
|
||||||
@ -65,12 +102,13 @@ boost
|
|||||||
std::string
|
std::string
|
||||||
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
|
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(be||se);
|
if( !be && !se )
|
||||||
|
return "Unknown exception.";
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
if( !se )
|
|
||||||
se = dynamic_cast<std::exception const *>(be);
|
|
||||||
if( !be )
|
if( !be )
|
||||||
be = dynamic_cast<boost::exception const *>(se);
|
be=dynamic_cast<boost::exception const *>(se);
|
||||||
|
if( !se )
|
||||||
|
se=dynamic_cast<std::exception const *>(be);
|
||||||
#endif
|
#endif
|
||||||
char const * wh=0;
|
char const * wh=0;
|
||||||
if( with_what && se )
|
if( with_what && se )
|
||||||
@ -97,7 +135,7 @@ boost
|
|||||||
}
|
}
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
tmp << std::string("Dynamic exception type: ") <<
|
tmp << std::string("Dynamic exception type: ") <<
|
||||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n';
|
||||||
#endif
|
#endif
|
||||||
if( with_what && se )
|
if( with_what && se )
|
||||||
tmp << "std::exception::what: " << wh << '\n';
|
tmp << "std::exception::what: " << wh << '\n';
|
||||||
@ -110,19 +148,10 @@ boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline
|
std::string
|
||||||
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
|
|
||||||
diagnostic_information( T const & e )
|
diagnostic_information( T const & e )
|
||||||
{
|
{
|
||||||
return exception_detail::diagnostic_information_impl(&e,0,true);
|
return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline
|
|
||||||
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
|
|
||||||
diagnostic_information( T const & e )
|
|
||||||
{
|
|
||||||
return exception_detail::diagnostic_information_impl(0,&e,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -147,40 +176,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
#include <boost/exception/current_exception_cast.hpp>
|
#pragma warning(pop)
|
||||||
namespace
|
|
||||||
boost
|
|
||||||
{
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
current_exception_diagnostic_information()
|
|
||||||
{
|
|
||||||
boost::exception const * be=current_exception_cast<boost::exception const>();
|
|
||||||
std::exception const * se=current_exception_cast<std::exception const>();
|
|
||||||
if( be || se )
|
|
||||||
return exception_detail::diagnostic_information_impl(be,se,true);
|
|
||||||
else
|
|
||||||
return "No diagnostic information available.";
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
diagnostic_information( exception_detail::exception_ptr_base const & p )
|
|
||||||
{
|
|
||||||
if( !p._empty() )
|
|
||||||
try
|
|
||||||
{
|
|
||||||
p._rethrow();
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
return current_exception_diagnostic_information();
|
|
||||||
}
|
|
||||||
return "<empty>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
|
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||||
#define UUID_F0EE17BE6C1211DE87FF459155D89593
|
#define UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "boost/exception/info.hpp"
|
#include "boost/exception/info.hpp"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -32,4 +38,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
@ -129,6 +135,15 @@ boost
|
|||||||
template <class E,class Tag,class T>
|
template <class E,class Tag,class T>
|
||||||
E const & operator<<( E const &, error_info<Tag,T> const & );
|
E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & operator<<( E const &, throw_function const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & operator<<( E const &, throw_file const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & operator<<( E const &, throw_line const & );
|
||||||
|
|
||||||
class exception;
|
class exception;
|
||||||
|
|
||||||
template <class>
|
template <class>
|
||||||
@ -151,7 +166,6 @@ boost
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual
|
|
||||||
~error_info_container() throw()
|
~error_info_container() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -202,34 +216,19 @@ boost
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
#if defined(__MWERKS__) && __MWERKS__<=0x3207
|
||||||
|
public:
|
||||||
|
#else
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend
|
friend E const & operator<<( E const &, throw_function const & );
|
||||||
E const &
|
|
||||||
operator<<( E const & x, throw_function const & y )
|
|
||||||
{
|
|
||||||
x.throw_function_=y.v_;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend
|
friend E const & operator<<( E const &, throw_file const & );
|
||||||
E const &
|
|
||||||
operator<<( E const & x, throw_file const & y )
|
|
||||||
{
|
|
||||||
x.throw_file_=y.v_;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend
|
friend E const & operator<<( E const &, throw_line const & );
|
||||||
E const &
|
|
||||||
operator<<( E const & x, throw_line const & y )
|
|
||||||
{
|
|
||||||
x.throw_line_=y.v_;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
||||||
|
|
||||||
@ -241,7 +240,7 @@ boost
|
|||||||
friend struct exception_detail::get_info<throw_function>;
|
friend struct exception_detail::get_info<throw_function>;
|
||||||
friend struct exception_detail::get_info<throw_file>;
|
friend struct exception_detail::get_info<throw_file>;
|
||||||
friend struct exception_detail::get_info<throw_line>;
|
friend struct exception_detail::get_info<throw_line>;
|
||||||
|
#endif
|
||||||
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
||||||
mutable char const * throw_function_;
|
mutable char const * throw_function_;
|
||||||
mutable char const * throw_file_;
|
mutable char const * throw_file_;
|
||||||
@ -254,6 +253,30 @@ boost
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const &
|
||||||
|
operator<<( E const & x, throw_function const & y )
|
||||||
|
{
|
||||||
|
x.throw_function_=y.v_;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const &
|
||||||
|
operator<<( E const & x, throw_file const & y )
|
||||||
|
{
|
||||||
|
x.throw_file_=y.v_;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const &
|
||||||
|
operator<<( E const & x, throw_line const & y )
|
||||||
|
{
|
||||||
|
x.throw_line_=y.v_;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -393,4 +416,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_1A590226753311DD9E4CCF6156D89593
|
#ifndef UUID_1A590226753311DD9E4CCF6156D89593
|
||||||
#define UUID_1A590226753311DD9E4CCF6156D89593
|
#define UUID_1A590226753311DD9E4CCF6156D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/exception.hpp>
|
#include <boost/exception/exception.hpp>
|
||||||
#include <boost/exception/detail/error_info_impl.hpp>
|
#include <boost/exception/detail/error_info_impl.hpp>
|
||||||
@ -118,4 +124,7 @@ boost
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,11 +5,18 @@
|
|||||||
|
|
||||||
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
|
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||||
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
|
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/exception.hpp>
|
#include <boost/exception/exception.hpp>
|
||||||
#include <boost/exception/to_string_stub.hpp>
|
#include <boost/exception/to_string_stub.hpp>
|
||||||
#include <boost/exception/detail/error_info_impl.hpp>
|
#include <boost/exception/detail/error_info_impl.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -90,7 +97,7 @@ boost
|
|||||||
{
|
{
|
||||||
shared_ptr<error_info_base> const & p = i->second;
|
shared_ptr<error_info_base> const & p = i->second;
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
|
||||||
#endif
|
#endif
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -146,12 +153,15 @@ boost
|
|||||||
{
|
{
|
||||||
typedef error_info<Tag,T> error_info_tag_t;
|
typedef error_info<Tag,T> error_info_tag_t;
|
||||||
shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
|
shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
|
||||||
exception_detail::error_info_container * c;
|
exception_detail::error_info_container * c=x.data_.get();
|
||||||
if( !(c=x.data_.get()) )
|
if( !c )
|
||||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||||
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
|
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_63EE924290FB11DC87BB856555D89593
|
#ifndef UUID_63EE924290FB11DC87BB856555D89593
|
||||||
#define UUID_63EE924290FB11DC87BB856555D89593
|
#define UUID_63EE924290FB11DC87BB856555D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/info.hpp>
|
#include <boost/exception/info.hpp>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
@ -64,4 +70,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_7E48761AD92811DC9011477D56D89593
|
#ifndef UUID_7E48761AD92811DC9011477D56D89593
|
||||||
#define UUID_7E48761AD92811DC9011477D56D89593
|
#define UUID_7E48761AD92811DC9011477D56D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
#include <boost/exception/detail/is_output_streamable.hpp>
|
#include <boost/exception/detail/is_output_streamable.hpp>
|
||||||
@ -71,4 +77,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
#ifndef UUID_E788439ED9F011DCB181F25B55D89593
|
#ifndef UUID_E788439ED9F011DCB181F25B55D89593
|
||||||
#define UUID_E788439ED9F011DCB181F25B55D89593
|
#define UUID_E788439ED9F011DCB181F25B55D89593
|
||||||
|
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(push,1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/exception/to_string.hpp>
|
#include <boost/exception/to_string.hpp>
|
||||||
#include <boost/exception/detail/object_hex_dump.hpp>
|
#include <boost/exception/detail/object_hex_dump.hpp>
|
||||||
@ -97,4 +103,7 @@ boost
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,460 +6,6 @@
|
|||||||
#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
|
#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
|
||||||
#define UUID_FA5836A2CADA11DC8CD47C8555D89593
|
#define UUID_FA5836A2CADA11DC8CD47C8555D89593
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/exception/detail/exception_ptr.hpp>
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
|
||||||
#error This header requires exception handling to be enabled.
|
|
||||||
#endif
|
|
||||||
#include <boost/exception/exception.hpp>
|
|
||||||
#include <boost/exception/info.hpp>
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
|
||||||
#include <boost/exception/detail/type_info.hpp>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <new>
|
|
||||||
#include <ios>
|
|
||||||
|
|
||||||
namespace
|
|
||||||
boost
|
|
||||||
{
|
|
||||||
#ifndef BOOST_NO_RTTI
|
|
||||||
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
|
|
||||||
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
to_string( original_exception_type const & x )
|
|
||||||
{
|
|
||||||
return x.value()->name();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class exception_ptr;
|
|
||||||
exception_ptr current_exception();
|
|
||||||
void rethrow_exception( exception_ptr const & );
|
|
||||||
|
|
||||||
class
|
|
||||||
exception_ptr:
|
|
||||||
public exception_detail::exception_ptr_base
|
|
||||||
{
|
|
||||||
typedef bool exception_ptr::*unspecified_bool_type;
|
|
||||||
friend exception_ptr current_exception();
|
|
||||||
friend void rethrow_exception( exception_ptr const & );
|
|
||||||
|
|
||||||
shared_ptr<exception_detail::clone_base const> c_;
|
|
||||||
bool bad_alloc_;
|
|
||||||
|
|
||||||
struct
|
|
||||||
bad_alloc_tag
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit
|
|
||||||
exception_ptr( bad_alloc_tag ):
|
|
||||||
bad_alloc_(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit
|
|
||||||
exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
|
|
||||||
c_(c),
|
|
||||||
bad_alloc_(false)
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_rethrow() const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(*this);
|
|
||||||
if( bad_alloc_ )
|
|
||||||
throw enable_current_exception(std::bad_alloc());
|
|
||||||
else
|
|
||||||
c_->rethrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
_empty() const
|
|
||||||
{
|
|
||||||
return !bad_alloc_ && !c_;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
exception_ptr():
|
|
||||||
bad_alloc_(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~exception_ptr() throw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
operator unspecified_bool_type() const
|
|
||||||
{
|
|
||||||
return _empty() ? 0 : &exception_ptr::bad_alloc_;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
operator==( exception_ptr const & a, exception_ptr const & b )
|
|
||||||
{
|
|
||||||
return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool
|
|
||||||
operator!=( exception_ptr const & a, exception_ptr const & b )
|
|
||||||
{
|
|
||||||
return !(a==b);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class
|
|
||||||
unknown_exception:
|
|
||||||
public exception,
|
|
||||||
public std::exception,
|
|
||||||
public exception_detail::clone_base
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
unknown_exception()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit
|
|
||||||
unknown_exception( std::exception const & e )
|
|
||||||
{
|
|
||||||
add_original_type(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit
|
|
||||||
unknown_exception( boost::exception const & e ):
|
|
||||||
boost::exception(e)
|
|
||||||
{
|
|
||||||
add_original_type(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
~unknown_exception() throw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
exception_detail::clone_base const *
|
|
||||||
clone() const
|
|
||||||
{
|
|
||||||
return new unknown_exception(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
rethrow() const
|
|
||||||
{
|
|
||||||
throw*this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class E>
|
|
||||||
void
|
|
||||||
add_original_type( E const & e )
|
|
||||||
{
|
|
||||||
#ifndef BOOST_NO_RTTI
|
|
||||||
(*this) << original_exception_type(&typeid(e));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace
|
|
||||||
exception_detail
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
class
|
|
||||||
current_exception_std_exception_wrapper:
|
|
||||||
public T,
|
|
||||||
public boost::exception,
|
|
||||||
public clone_base
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit
|
|
||||||
current_exception_std_exception_wrapper( T const & e1 ):
|
|
||||||
T(e1)
|
|
||||||
{
|
|
||||||
add_original_type(e1);
|
|
||||||
}
|
|
||||||
|
|
||||||
current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ):
|
|
||||||
T(e1),
|
|
||||||
boost::exception(e2)
|
|
||||||
{
|
|
||||||
add_original_type(e1);
|
|
||||||
}
|
|
||||||
|
|
||||||
~current_exception_std_exception_wrapper() throw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
clone_base const *
|
|
||||||
clone() const
|
|
||||||
{
|
|
||||||
return new current_exception_std_exception_wrapper(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
rethrow() const
|
|
||||||
{
|
|
||||||
throw *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class E>
|
|
||||||
void
|
|
||||||
add_original_type( E const & e )
|
|
||||||
{
|
|
||||||
#ifndef BOOST_NO_RTTI
|
|
||||||
(*this) << original_exception_type(&typeid(e));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef BOOST_NO_RTTI
|
|
||||||
template <class T>
|
|
||||||
exception const *
|
|
||||||
get_boost_exception( T const * )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
exception & x )
|
|
||||||
{
|
|
||||||
return &x;
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <class T>
|
|
||||||
exception const *
|
|
||||||
get_boost_exception( T const * x )
|
|
||||||
{
|
|
||||||
return dynamic_cast<exception const *>(x);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline
|
|
||||||
shared_ptr<clone_base const>
|
|
||||||
current_exception_std_exception( T const & e1 )
|
|
||||||
{
|
|
||||||
if( boost::exception const * e2 = get_boost_exception(&e1) )
|
|
||||||
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
|
|
||||||
else
|
|
||||||
return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
shared_ptr<clone_base const>
|
|
||||||
current_exception_unknown_exception()
|
|
||||||
{
|
|
||||||
return shared_ptr<unknown_exception const>(new unknown_exception());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
shared_ptr<clone_base const>
|
|
||||||
current_exception_unknown_boost_exception( boost::exception const & e )
|
|
||||||
{
|
|
||||||
return shared_ptr<unknown_exception const>(new unknown_exception(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
shared_ptr<clone_base const>
|
|
||||||
current_exception_unknown_std_exception( std::exception const & e )
|
|
||||||
{
|
|
||||||
if( boost::exception const * be = get_boost_exception(&e) )
|
|
||||||
return current_exception_unknown_boost_exception(*be);
|
|
||||||
else
|
|
||||||
return shared_ptr<unknown_exception const>(new unknown_exception(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
shared_ptr<clone_base const>
|
|
||||||
current_exception_impl()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
exception_detail::clone_base & e )
|
|
||||||
{
|
|
||||||
return shared_ptr<exception_detail::clone_base const>(e.clone());
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::domain_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::invalid_argument & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::length_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::out_of_range & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::logic_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::range_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::overflow_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::underflow_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::ios_base::failure & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::runtime_error & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::bad_alloc & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
#ifndef BOOST_NO_TYPEID
|
|
||||||
catch(
|
|
||||||
std::bad_cast & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::bad_typeid & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
catch(
|
|
||||||
std::bad_exception & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::exception & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_unknown_std_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
boost::exception & e )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_unknown_boost_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
return exception_detail::current_exception_unknown_exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
exception_ptr
|
|
||||||
current_exception()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return exception_ptr(exception_detail::current_exception_impl());
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::bad_alloc & )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
std::bad_alloc & )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
BOOST_ASSERT(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return exception_ptr(exception_ptr::bad_alloc_tag());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline
|
|
||||||
exception_ptr
|
|
||||||
copy_exception( T const & e )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
throw enable_current_exception(e);
|
|
||||||
}
|
|
||||||
catch(
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
return current_exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
rethrow_exception( exception_ptr const & p )
|
|
||||||
{
|
|
||||||
p._rethrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
to_string( exception_ptr const & p )
|
|
||||||
{
|
|
||||||
std::string s='\n'+diagnostic_information(p);
|
|
||||||
std::string padding(" ");
|
|
||||||
std::string r;
|
|
||||||
bool f=false;
|
|
||||||
for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i )
|
|
||||||
{
|
|
||||||
if( f )
|
|
||||||
r+=padding;
|
|
||||||
char c=*i;
|
|
||||||
r+=c;
|
|
||||||
f=(c=='\n');
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <boost/exception/detail/attribute_noreturn.hpp>
|
#include <boost/exception/detail/attribute_noreturn.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
|
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
class my_exception: public std::exception { };
|
class my_exception: public std::exception { };
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -45,7 +45,6 @@ compile-fail error_info_const_fail.cpp ;
|
|||||||
compile exception_ptr_hpp_test.cpp ;
|
compile exception_ptr_hpp_test.cpp ;
|
||||||
compile diagnostic_information_hpp_test.cpp ;
|
compile diagnostic_information_hpp_test.cpp ;
|
||||||
compile error_info_hpp_test.cpp ;
|
compile error_info_hpp_test.cpp ;
|
||||||
compile exception_hpp_test.cpp ;
|
|
||||||
compile get_error_info_hpp_test.cpp ;
|
compile get_error_info_hpp_test.cpp ;
|
||||||
compile info_hpp_test.cpp ;
|
compile info_hpp_test.cpp ;
|
||||||
compile info_tuple_hpp_test.cpp ;
|
compile info_tuple_hpp_test.cpp ;
|
||||||
|
@ -10,10 +10,6 @@
|
|||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
|
||||||
struct my_tag {};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef boost::error_info<struct my_tag,int> my_info;
|
typedef boost::error_info<struct my_tag,int> my_info;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -43,7 +43,7 @@ main()
|
|||||||
#else
|
#else
|
||||||
BOOST_THROW_EXCEPTION(e<<errinfo_type_info_name(typeid(int).name()));
|
BOOST_THROW_EXCEPTION(e<<errinfo_type_info_name(typeid(int).name()));
|
||||||
#endif
|
#endif
|
||||||
BOOST_TEST(false);
|
BOOST_ERROR("BOOST_THROW_EXCEPTION failed to throw.");
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
boost::exception & e )
|
boost::exception & e )
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
|
||||||
struct tag_errno {};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef boost::error_info<struct tag_errno,int> info_errno;
|
typedef boost::error_info<struct tag_errno,int> info_errno;
|
||||||
|
|
||||||
class
|
class
|
||||||
@ -28,7 +24,6 @@ main()
|
|||||||
{
|
{
|
||||||
errno=1;
|
errno=1;
|
||||||
throw my_exception() << info_errno(errno);
|
throw my_exception() << info_errno(errno);
|
||||||
BOOST_TEST(false);
|
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
my_exception & x )
|
my_exception & x )
|
||||||
|
@ -35,16 +35,6 @@ user_data
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
|
||||||
struct tag_test_1 {};
|
|
||||||
struct tag_test_2 {};
|
|
||||||
struct tag_test_3 {};
|
|
||||||
struct tag_test_4 {};
|
|
||||||
struct tag_test_5 {};
|
|
||||||
struct tag_test_6 {};
|
|
||||||
struct tag_user_data {};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef boost::error_info<struct tag_test_1,int> test_1;
|
typedef boost::error_info<struct tag_test_1,int> test_1;
|
||||||
typedef boost::error_info<struct tag_test_2,unsigned int> test_2;
|
typedef boost::error_info<struct tag_test_2,unsigned int> test_2;
|
||||||
typedef boost::error_info<struct tag_test_3,float> test_3;
|
typedef boost::error_info<struct tag_test_3,float> test_3;
|
||||||
@ -318,7 +308,6 @@ test_lifetime()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
throw test_exception() << test_7(user_data(count));
|
throw test_exception() << test_7(user_data(count));
|
||||||
BOOST_TEST(false);
|
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
boost::exception & x )
|
boost::exception & x )
|
||||||
|
@ -9,9 +9,19 @@
|
|||||||
#include <boost/exception/info.hpp>
|
#include <boost/exception/info.hpp>
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
struct my_exception: boost::exception, std::exception { };
|
struct
|
||||||
|
my_exception:
|
||||||
|
boost::exception,
|
||||||
|
std::exception
|
||||||
|
{
|
||||||
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
return "my_exception";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef boost::error_info<struct my_tag,int> my_int;
|
typedef boost::error_info<struct my_tag,int> my_int;
|
||||||
|
|
||||||
bool called=false;
|
bool called=false;
|
||||||
|
@ -30,7 +30,7 @@ boost_throw_exception_test()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(exception1());
|
BOOST_THROW_EXCEPTION(exception1());
|
||||||
BOOST_TEST(false);
|
BOOST_ERROR("BOOST_THROW_EXCEPTION failed to throw.");
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
boost::exception & x )
|
boost::exception & x )
|
||||||
@ -50,7 +50,7 @@ boost_throw_exception_test()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(exception2() << test_data(42));
|
BOOST_THROW_EXCEPTION(exception2() << test_data(42));
|
||||||
BOOST_TEST(false);
|
BOOST_ERROR("BOOST_THROW_EXCEPTION failed to throw.");
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
boost::exception & x )
|
boost::exception & x )
|
||||||
|
Reference in New Issue
Block a user