mirror of
https://github.com/boostorg/exception.git
synced 2025-07-04 16:26:36 +02:00
Compare commits
3 Commits
boost-1.36
...
boost-1.37
Author | SHA1 | Date | |
---|---|---|---|
1676ce7ba8 | |||
aaf8fff6fb | |||
a9b5723d0d |
57
doc/BOOST_THROW_EXCEPTION.html
Normal file
57
doc/BOOST_THROW_EXCEPTION.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
||||
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>BOOST_THROW_EXCEPTION</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="body-0">
|
||||
<div class="body-1">
|
||||
<div class="body-2">
|
||||
<div>
|
||||
<div id="boost_logo">
|
||||
<a href="http://www.boost.org"><img style="border:0" src="http://www.boost.org/boost.png" alt="Boost" width="277" height="86"/></a>
|
||||
</div>
|
||||
<h1>Boost Exception</h1>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>BOOST_THROW_EXCEPTION</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>></p>
|
||||
<div class="RenoIncludeDIV"><pre>#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
|
||||
#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
#include <boost/current_function.hpp>
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x)\
|
||||
::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( ::boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(x) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_function</a></span>(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_file</a></span>(__FILE__) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_line</a></span>((int)__LINE__) )
|
||||
#else
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x) ::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(x)
|
||||
#endif</pre>
|
||||
</div></div><p>This macro takes an exception object, records BOOST_CURRENT_FUNCTION, __FILE__ and __LINE__ in it, and forwards it to <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>. To recover this information at the catch site, use <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>; the information is also included in the message returned by <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>.</p>
|
||||
</div><div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a></div>
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div id="footer">
|
||||
<p> </p>
|
||||
<hr/>
|
||||
<p>
|
||||
<a class="logo" href="http://jigsaw.w3.org/css-validator/validator?uri=http://revergestudios.com/boost-exception/reno.css"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a>
|
||||
<a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a>
|
||||
<small>Copyright (c) 2006-2008 by Emil Dotchevski and Reverge Studios, Inc.<br/>
|
||||
Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -33,11 +33,10 @@
|
||||
</li>
|
||||
<li>Documentation<div><ol><li>Class <span class="RenoLink"><a href="exception.html">exception</a></span></li>
|
||||
<li>Transporting of Arbitrary Data to the Catch Site<div><ol><li><span class="RenoLink"><a href="error_info.html">error_info</a></span></li>
|
||||
<li><span class="RenoLink"><a href="operator_shl_exception.html">operator<</exception</a></span></li>
|
||||
<li><span class="RenoLink"><a href="operator_shl_tuple.html">operator<</tuple</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_operator_shl.html">exception/operator<<</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tuple_operator_shl.html">tuple/operator<<</a></span></li>
|
||||
<li><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span></li>
|
||||
<li><span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span></li>
|
||||
<li><span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li><span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span> Transporting of Exceptions between Threads<div><ol><li><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></li>
|
||||
@ -49,13 +48,15 @@
|
||||
</ol></div>
|
||||
</li>
|
||||
<li><span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span></li>
|
||||
<li><span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span></li>
|
||||
<li><span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>, <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span></li>
|
||||
<li><span class="RenoLink"><a href="configuration_macros.html">Configuration Macros</a></span></li>
|
||||
<li>Headers<div><ol><li><span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span></li>
|
||||
<li><span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></span></li>
|
||||
@ -74,16 +75,19 @@ boost
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">class
|
||||
<span class="RenoLink"><a href="exception.html">exception</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
<span class="RenoIncludeSPAN"> virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</span>
|
||||
|
||||
protected:
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
<span class="RenoLink"><a href="exception_constructors.html">exception</a></span>( <span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span>
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_destructor.html">~exception</a></span>();</span>
|
||||
};</span></span>
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class Tag,class T>
|
||||
class <span class="RenoLink"><a href="error_info.html">error_info</a></span>;</span>
|
||||
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class Tag,class T>
|
||||
class
|
||||
@ -96,23 +100,11 @@ boost
|
||||
error_info( value_type const & );
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span><typename ErrorInfo::value_type const> <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E const & x );</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;
|
||||
|
||||
#define <span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span>\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__)</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span></span>
|
||||
E const & <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span></span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_tuple.html">operator<<</a></span>( E const & x,
|
||||
E const & <span class="RenoLink"><a href="tuple_operator_shl.html">operator<<</a></span>( E const & x,
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span><
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1>,
|
||||
...,
|
||||
@ -121,7 +113,7 @@ boost
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T const & x );</span></span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( std::exception const & x );</span></span>
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span></span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">class
|
||||
<span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>:
|
||||
@ -142,18 +134,30 @@ boost
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>( T const & e );</span></span>
|
||||
}</pre>
|
||||
<p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>></p>
|
||||
<pre><span class="RenoIncludeSPAN"><span class="RenoIncludeSPAN">#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
|
||||
#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
#include <boost/current_function.hpp>
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x)\
|
||||
::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( ::boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(x) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_function</a></span>(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_file</a></span>(__FILE__) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_line</a></span>((int)__LINE__) )
|
||||
#else
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x) ::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(x)
|
||||
#endif</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
#else
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
|
||||
#endif</span></span>
|
||||
}</pre>
|
||||
#endif</span>
|
||||
}</span></pre>
|
||||
<h2>Class exception</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception</h3>
|
||||
</div>
|
||||
@ -164,10 +168,6 @@ boost
|
||||
<span class="RenoIncludeSPAN"> class
|
||||
<span class="RenoLink"><a href="exception.html">exception</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
<span class="RenoIncludeSPAN"> virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</span>
|
||||
|
||||
protected:
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
@ -176,37 +176,9 @@ boost
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>Class boost::<span class="RenoLink"><a href="exception.html">exception</a></span> is designed to be used as a universal base for user-defined exception types.</p>
|
||||
<p>An object of any type deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> can store data of arbitrary types, using the <span class="RenoLink"><a href="error_info.html">error_info</a></span> wrapper and <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>.</p>
|
||||
<p>An object of any type deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> can store data of arbitrary types, using the <span class="RenoLink"><a href="error_info.html">error_info</a></span> wrapper and <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>.</p>
|
||||
<p>To retrieve data from a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object, use the <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
<span class="RenoLink"><a href="exception_constructors.html">exception</a></span>( <span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<div><ul><li> Default constructor: initializes an empty boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object.</li>
|
||||
<li> Copy constructor: initializes a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object which shares with x all data added through <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::~exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoLink"><a href="exception_destructor.html">~exception</a></span>();</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<p>Frees all resources associated with a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::diagnostic_information</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
<div><ul><li>The return value remains valid until the exception object from which it was obtained is destroyed or modified.</li>
|
||||
<li>The header <span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span> provides a namespace-scope function <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> which takes a std::exception. It calls <span class="RenoLink"><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></span> if its argument can be converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>; otherwise it returns a string that combines the value of std::exception::what and the exception's dynamic type.</li>
|
||||
</ul></div>
|
||||
</div></div><h2>Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
</div><h2>Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>error_info</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||
@ -227,21 +199,21 @@ boost
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.)</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This class template is used to associate a Tag type with a value type T. Objects of type <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> can be passed to <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to be stored in objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<p>This class template is used to associate a Tag type with a value type T. Objects of type <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> can be passed to <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to be stored in objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The header <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>> provides a declaration of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;</pre>
|
||||
<p>Of course, to actually add an <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to <span class="RenoLink"><a href="exception.html">exceptions</a></span> using <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>, or to retrieve it using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>, you must first #include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>operator<</exception</h3>
|
||||
<p>Of course, to actually add an <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to <span class="RenoLink"><a href="exception.html">exceptions</a></span> using <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, or to retrieve it using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>, you must first #include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception/operator<<</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag, class T>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span>
|
||||
E const & <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>E must be boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, or a type that derives (indirectly) from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
@ -251,14 +223,14 @@ boost
|
||||
<p>x.</p>
|
||||
<div class="RenoIncludeDIV"><h4>Throws:</h4>
|
||||
<p>std::bad_alloc, or any exception emitted by the T copy constructor.</p>
|
||||
</div></div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>operator<</tuple</h3>
|
||||
</div></div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>tuple/operator<<</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_tuple.html">operator<<</a></span>( E const & x,
|
||||
E const & <span class="RenoLink"><a href="tuple_operator_shl.html">operator<<</a></span>( E const & x,
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span><
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1>,
|
||||
...,
|
||||
@ -274,7 +246,7 @@ boost
|
||||
<p>std::bad_alloc, or any exception emitted by T1..TN copy constructor.</p>
|
||||
</div></div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>get_error_info</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
@ -284,13 +256,16 @@ boost
|
||||
</div><h4>Requirements:</h4>
|
||||
<div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template.</li>
|
||||
<li> E must be polymorphic.</li>
|
||||
<li> The <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function must not be called outside of a catch block.</li>
|
||||
</ul></div>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If dynamic_cast<boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is an empty shared_ptr.</li>
|
||||
<li> Otherwise, the returned shared_ptr points to the stored value (use <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.</li>
|
||||
<li> Otherwise, the returned shared_ptr points to the stored value (use <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The interface of <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> may be affected by the build <span class="RenoLink"><a href="configuration_macros.html">configuration macros</a></span>.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>enable_error_info</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span>></p>
|
||||
@ -301,29 +276,13 @@ boost
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T const & x );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must be a user-defined type with accessible no-throw copy constructor as per (15.5.1).</p>
|
||||
<p>T must be a class with an accessible no-throw copy constructor as per (15.5.1).</p>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If T derives from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, the returned object is of type T and is a copy of x.</li>
|
||||
<li> Otherwise, the returned object is of an unspecified type that derives publicly from both T and boost::<span class="RenoLink"><a href="exception.html">exception</a></span>. The T sub-object is initialized from x by the T copy constructor.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>BOOST_ERROR_INFO</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;
|
||||
|
||||
#define <span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span>\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__)</span>
|
||||
}</pre>
|
||||
</div><p>This macro is designed to be used with <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> when throwing a boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, to store information about the location of the throw statement. It can be chained with other <span class="RenoLink"><a href="error_info.html">error_infos</a></span> in a single throw expression.</p>
|
||||
</div><h2>Transporting of Exceptions between Threads</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception_ptr</h3>
|
||||
</div>
|
||||
@ -336,9 +295,14 @@ boost
|
||||
</div><p>The <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>'s operations do not throw.</p>
|
||||
<p>Two instances of <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> are equivalent and compare equal if and only if they refer to the same exception.</p>
|
||||
<p>The default constructor of <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> produces the null value of the type. The null value is equivalent only to itself.</p>
|
||||
<h4>Thread safety</h4>
|
||||
<div><ul><li> It is legal for multiple threads to hold <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> references to the same exception object.</li>
|
||||
<li> It is illegal for multiple threads to modify the same <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> object concurrently.</li>
|
||||
<li> While calling <span class="RenoLink"><a href="current_exception.html">current_exception</a></span> makes a copy of the current exception object, it is still possible for the two copies to share internal state. Therefore, in general it is not safe to call <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span> concurrently to throw the same exception object into multiple threads.</li>
|
||||
</ul></div>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>enable_current_exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
@ -346,7 +310,7 @@ boost
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must be of user-defined type with an accessible no-throw copy constructor.</p>
|
||||
<p>T must be a class with an accessible no-throw copy constructor.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of <i>unspecified</i> type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &).</p>
|
||||
<h4>Description:</h4>
|
||||
@ -392,7 +356,15 @@ boost
|
||||
<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> <span class="RenoLink"><a href="copy_exception.html">copy_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<p>As if try { throw e; } catch( ... ) { return <span class="RenoLink"><a href="current_exception.html">current_exception</a></span>(); }</p>
|
||||
<p>As if</p>
|
||||
<pre>try
|
||||
{
|
||||
throw <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>(e);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return <span class="RenoLink"><a href="current_exception.html">current_exception</a></span>();
|
||||
}</pre>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>rethrow_exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></span>></p>
|
||||
@ -423,14 +395,23 @@ boost
|
||||
</div><h2>Printing Diagnostic Information</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>diagnostic_information</h3>
|
||||
</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>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( std::exception const & x );</span>
|
||||
<span class="RenoIncludeSPAN"> std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span>
|
||||
}</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>If dynamic_cast<boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const *>(&x) is not null, the returned string is initialized by a call to <span class="RenoLink"><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></span>; otherwise, the returned string combines the output of x.what() and typeid(x).name().</p>
|
||||
<p>This function iterates over all data 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>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p>
|
||||
<p>When the <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is expected to return std::string and is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error.</p>
|
||||
<h4>Notes:</h4>
|
||||
<div><ul><li>The format of the returned string is unspecified.</li>
|
||||
<li>The returned string is <i>not</i> user-friendly.</li>
|
||||
<li>If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what.</li>
|
||||
<li>The returned string may include additional platform-specific diagnostic information.</li>
|
||||
</ul></div>
|
||||
</div><h2>Throwing Exceptions</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>throw_exception</h3>
|
||||
</div>
|
||||
@ -438,16 +419,12 @@ boost
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> #ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
<span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
#else
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
|
||||
#endif</span>
|
||||
#endif</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>E must derive publicly from std::exception.</p>
|
||||
@ -455,7 +432,9 @@ boost
|
||||
<div><ul><li> If BOOST_NO_EXCEPTIONS is not defined, boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e) is equivalent to throw boost::<span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>(boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e) is equivalent to throw e;</li>
|
||||
<li> If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> are allowed to assume that the function never returns; therefore, if the user-defined <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> returns, the behavior is undefined.</li>
|
||||
</ul></div>
|
||||
</div><!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
</div><h2>Acknowledgements</h2>
|
||||
<p>Peter Dimov has been continuously influencing the design and evolution of Boost Exception. Also thanks to Tobias Schwinger, Tom Brinkman, Pavel Vozenilek and everyone who participated in the review process.</p>
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div id="footer">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>exception::diagnostic_information</title>
|
||||
<title>configuration macros</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,22 +19,19 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::diagnostic_information</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Configuration Macros</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
<div><ul><li>The return value remains valid until the exception object from which it was obtained is destroyed or modified.</li>
|
||||
<li>The header <span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span> provides a namespace-scope function <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> which takes a std::exception. It calls <span class="RenoLink"><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></span> if its argument can be converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>; otherwise it returns a string that combines the value of std::exception::what and the exception's dynamic type.</li>
|
||||
</ul></div>
|
||||
<p>Boost Exception responds to the following configuration macros:</p>
|
||||
<p><b>BOOST_NO_RTTI</b><span class="RenoBR"> </span><br/><b>BOOST_NO_TYPEID</b></p>
|
||||
<p>The first macro prevents Boost Exception from using dynamic_cast and dynamic typeid. If the second macro is also defined, Boost Exception does not use static typeid either. There are no observable degrading effects on the library functionality, except for the following:</p>
|
||||
<blockquote><p>By default, the <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template can be called with any exception type. If BOOST_NO_RTTI is defined, <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> can be used only with objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p></blockquote>
|
||||
<p><b>BOOST_EXCEPTION_DISABLE</b></p>
|
||||
<p>By default, <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span> and <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span> are integrated directly in the <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> function. Defining BOOST_EXCEPTION_DISABLE disables this integration.</p>
|
||||
<p>Note that on some non-conformant compilers, for example MSVC 7.0 and older, as well as BCC, BOOST_EXCEPTION_DISABLE is implicitly defined in <span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
@ -29,7 +29,15 @@ boost
|
||||
<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> <span class="RenoLink"><a href="copy_exception.html">copy_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<p>As if try { throw e; } catch( ... ) { return <span class="RenoLink"><a href="current_exception.html">current_exception</a></span>(); }</p>
|
||||
<p>As if</p>
|
||||
<pre>try
|
||||
{
|
||||
throw <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>(e);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return <span class="RenoLink"><a href="current_exception.html">current_exception</a></span>();
|
||||
}</pre>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
|
@ -45,6 +45,7 @@ boost
|
||||
</a><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp<br/>
|
||||
</a><a href="copy_exception.html">copy_exception<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a><a href="exception_ptr.html">exception_ptr<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -21,19 +21,29 @@
|
||||
<!-- 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>
|
||||
<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>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( std::exception const & x );</span>
|
||||
<span class="RenoIncludeSPAN"> std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span>
|
||||
}</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>If dynamic_cast<boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const *>(&x) is not null, the returned string is initialized by a call to <span class="RenoLink"><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></span>; otherwise, the returned string combines the output of x.what() and typeid(x).name().</p>
|
||||
<p>This function iterates over all data 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>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p>
|
||||
<p>When the <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is expected to return std::string and is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error.</p>
|
||||
<h4>Notes:</h4>
|
||||
<div><ul><li>The format of the returned string is unspecified.</li>
|
||||
<li>The returned string is <i>not</i> user-friendly.</li>
|
||||
<li>If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what.</li>
|
||||
<li>The returned string may include additional platform-specific diagnostic information.</li>
|
||||
</ul></div>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -21,7 +21,7 @@
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>enable_current_exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
@ -29,7 +29,7 @@ boost
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must be of user-defined type with an accessible no-throw copy constructor.</p>
|
||||
<p>T must be a class with an accessible no-throw copy constructor.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of <i>unspecified</i> type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &).</p>
|
||||
<h4>Description:</h4>
|
||||
@ -48,7 +48,9 @@ throw boost::<span class="RenoLink"><a href="enable_current_exception.html">enab
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp<br/>
|
||||
</a><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="copy_exception.html">copy_exception<br/>
|
||||
</a><a href="current_exception.html">current_exception<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
|
@ -29,7 +29,7 @@ boost
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T const & x );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must be a user-defined type with accessible no-throw copy constructor as per (15.5.1).</p>
|
||||
<p>T must be a class with an accessible no-throw copy constructor as per (15.5.1).</p>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If T derives from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, the returned object is of type T and is a copy of x.</li>
|
||||
<li> Otherwise, the returned object is of an unspecified type that derives publicly from both T and boost::<span class="RenoLink"><a href="exception.html">exception</a></span>. The T sub-object is initialized from x by the T copy constructor.</li>
|
||||
@ -38,8 +38,10 @@ boost
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
|
@ -39,25 +39,25 @@ boost
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.)</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This class template is used to associate a Tag type with a value type T. Objects of type <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> can be passed to <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to be stored in objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<p>This class template is used to associate a Tag type with a value type T. Objects of type <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> can be passed to <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to be stored in objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The header <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>> provides a declaration of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;</pre>
|
||||
<p>Of course, to actually add an <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to <span class="RenoLink"><a href="exception.html">exceptions</a></span> using <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>, or to retrieve it using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>, you must first #include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>.</p>
|
||||
<p>Of course, to actually add an <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to <span class="RenoLink"><a href="exception.html">exceptions</a></span> using <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, or to retrieve it using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>, you must first #include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp<br/>
|
||||
</a><a href="exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="exception_operator_shl.html">exception/operator<<<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a><a href="operator_shl_tuple.html">operator<</tuple<br/>
|
||||
</a><a href="tuple_operator_shl.html">tuple/operator<<<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -28,10 +28,6 @@ boost
|
||||
<span class="RenoIncludeSPAN"> class
|
||||
<span class="RenoLink"><a href="exception.html">exception</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
<span class="RenoIncludeSPAN"> virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</span>
|
||||
|
||||
protected:
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
@ -40,56 +36,28 @@ boost
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>Class boost::<span class="RenoLink"><a href="exception.html">exception</a></span> is designed to be used as a universal base for user-defined exception types.</p>
|
||||
<p>An object of any type deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> can store data of arbitrary types, using the <span class="RenoLink"><a href="error_info.html">error_info</a></span> wrapper and <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>.</p>
|
||||
<p>An object of any type deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> can store data of arbitrary types, using the <span class="RenoLink"><a href="error_info.html">error_info</a></span> wrapper and <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>.</p>
|
||||
<p>To retrieve data from a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object, use the <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
<span class="RenoLink"><a href="exception_constructors.html">exception</a></span>( <span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<div><ul><li> Default constructor: initializes an empty boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object.</li>
|
||||
<li> Copy constructor: initializes a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object which shares with x all data added through <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::~exception</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoLink"><a href="exception_destructor.html">~exception</a></span>();</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<p>Frees all resources associated with a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception::diagnostic_information</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
<div><ul><li>The return value remains valid until the exception object from which it was obtained is destroyed or modified.</li>
|
||||
<li>The header <span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span> provides a namespace-scope function <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> which takes a std::exception. It calls <span class="RenoLink"><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></span> if its argument can be converted to boost::<span class="RenoLink"><a href="exception.html">exception</a></span>; otherwise it returns a string that combines the value of std::exception::what and the exception's dynamic type.</li>
|
||||
</ul></div>
|
||||
</div></div><div class="RenoHR"><hr/></div>
|
||||
</div><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp<br/>
|
||||
</a><a href="exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="current_exception.html">current_exception<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a><a href="enable_error_info.html">enable_error_info<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a><a href="exception_operator_shl.html">exception/operator<<<br/>
|
||||
</a><a href="exception_constructors.html">exception::exception<br/>
|
||||
</a><a href="exception_destructor.html">exception::~exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a><a href="operator_shl_tuple.html">operator<</tuple<br/>
|
||||
</a><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="tuple_operator_shl.html">tuple/operator<<<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -25,7 +25,7 @@
|
||||
<span class="RenoLink"><a href="exception_constructors.html">exception</a></span>( <span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<div><ul><li> Default constructor: initializes an empty boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object.</li>
|
||||
<li> Copy constructor: initializes a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object which shares with x all data added through <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>, including data that is added at a future time.</li>
|
||||
<li> Copy constructor: initializes a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object which shares ownership with x of all data added through <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
|
@ -22,19 +22,19 @@
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/exception/diagnostic_information.hpp</h2>
|
||||
</div>
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre>#include <exception>
|
||||
<div class="RenoIncludeDIV"><pre>#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( std::exception const & x );</span></span>
|
||||
<span class="RenoIncludeSPAN"> class <span class="RenoLink"><a href="exception.html">exception</a></span>;</span>
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span></span>
|
||||
}</pre>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
@ -19,7 +19,7 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/exception/enable_current_exception.hpp</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>boost/exception/enable_current_exception.hpp</h3>
|
||||
</div>
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre>#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
@ -33,7 +33,6 @@ boost
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a></div>
|
||||
</div>
|
@ -19,7 +19,7 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/exception/enable_error_info.hpp</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>boost/exception/enable_error_info.hpp</h3>
|
||||
</div>
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre>#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
@ -33,7 +33,6 @@ boost
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a><a href="enable_error_info.html">enable_error_info<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -28,7 +28,7 @@ namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_tuple.html">operator<<</a></span>( E const & x,
|
||||
E const & <span class="RenoLink"><a href="tuple_operator_shl.html">operator<<</a></span>( E const & x,
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span><
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1>,
|
||||
...,
|
||||
@ -38,7 +38,7 @@ boost
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="operator_shl_tuple.html">operator<</tuple<br/>
|
||||
</a><a href="tuple_operator_shl.html">tuple/operator<<<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -40,29 +40,15 @@ boost
|
||||
error_info( value_type const & );
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span><typename ErrorInfo::value_type const> <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E const & x );</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;
|
||||
|
||||
#define <span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span>\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__)</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span></span>
|
||||
E const & <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span></span>
|
||||
}</pre>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a><a href="exception_operator_shl.html">exception/operator<<<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -31,6 +31,7 @@ boost
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -28,21 +28,26 @@ boost
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">class
|
||||
<span class="RenoLink"><a href="exception.html">exception</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
<span class="RenoIncludeSPAN"> virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</span>
|
||||
|
||||
protected:
|
||||
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_constructors.html">exception</a></span>();
|
||||
<span class="RenoLink"><a href="exception_constructors.html">exception</a></span>( <span class="RenoLink"><a href="exception.html">exception</a></span> const & x );</span>
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="exception_destructor.html">~exception</a></span>();</span>
|
||||
};</span></span>
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN">template <class Tag,class T>
|
||||
class <span class="RenoLink"><a href="error_info.html">error_info</a></span>;</span>
|
||||
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;</span>
|
||||
}</pre>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp<br/>
|
||||
</a><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp<br/>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>BOOST_ERROR_INFO</title>
|
||||
<title>boost/exception/get_error_info.hpp</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,26 +19,22 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>BOOST_ERROR_INFO</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/exception/get_error_info.hpp</h2>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre>#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_function,char const *> throw_function;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_file,char const *> throw_file;
|
||||
typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_throw_line,int> throw_line;
|
||||
|
||||
#define <span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span>\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__)</span>
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span><typename ErrorInfo::value_type const> <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E const & x );</span></span>
|
||||
}</pre>
|
||||
</div><p>This macro is designed to be used with <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> when throwing a boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, to store information about the location of the throw statement. It can be chained with other <span class="RenoLink"><a href="error_info.html">error_infos</a></span> in a single throw expression.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
@ -22,11 +22,13 @@
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/exception.hpp</h2>
|
||||
</div>
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoIncludeSPAN">#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
<div class="RenoIncludeDIV"><pre><span class="RenoIncludeSPAN">#include <<span class="RenoLink"><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>></span></pre>
|
||||
#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></span>></span></pre>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>operator<</exception</title>
|
||||
<title>exception/operator<<</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,14 +19,14 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>operator<</exception</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception/operator<<</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag, class T>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span>
|
||||
E const & <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> const & v );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>E must be boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, or a type that derives (indirectly) from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
@ -38,13 +38,12 @@ boost
|
||||
<p>std::bad_alloc, or any exception emitted by the T copy constructor.</p>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a><a href="exception_constructors.html">exception::exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
@ -30,6 +30,11 @@ boost
|
||||
</div><p>The <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>'s operations do not throw.</p>
|
||||
<p>Two instances of <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> are equivalent and compare equal if and only if they refer to the same exception.</p>
|
||||
<p>The default constructor of <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> produces the null value of the type. The null value is equivalent only to itself.</p>
|
||||
<h4>Thread safety</h4>
|
||||
<div><ul><li> It is legal for multiple threads to hold <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> references to the same exception object.</li>
|
||||
<li> It is illegal for multiple threads to modify the same <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> object concurrently.</li>
|
||||
<li> While calling <span class="RenoLink"><a href="current_exception.html">current_exception</a></span> makes a copy of the current exception object, it is still possible for the two copies to share internal state. Therefore, in general it is not safe to call <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span> concurrently to throw the same exception object into multiple threads.</li>
|
||||
</ul></div>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>get_error_info</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
@ -31,17 +31,22 @@ boost
|
||||
</div><h4>Requirements:</h4>
|
||||
<div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template.</li>
|
||||
<li> E must be polymorphic.</li>
|
||||
<li> The <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function must not be called outside of a catch block.</li>
|
||||
</ul></div>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If dynamic_cast<boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is an empty shared_ptr.</li>
|
||||
<li> Otherwise, the returned shared_ptr points to the stored value (use <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.</li>
|
||||
<li> Otherwise, the returned shared_ptr points to the stored value (use <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The interface of <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> may be affected by the build <span class="RenoLink"><a href="configuration_macros.html">configuration macros</a></span>.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a></div>
|
||||
|
@ -22,19 +22,22 @@
|
||||
<div class="RenoAutoDIV"><h1>Index</h1>
|
||||
</div>
|
||||
<div class="RenoIndex"><h3>B</h3>
|
||||
<p><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></p>
|
||||
<p><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></p>
|
||||
<p><a href="boost-exception.html">Boost Exception</a></p>
|
||||
<h3>b</h3>
|
||||
<p><a href="exception_hpp.html">boost/exception.hpp</a></p>
|
||||
<p><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></p>
|
||||
<p><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></p>
|
||||
<p><a href="exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></p>
|
||||
<p><a href="exception_enable_current_exception_hpp.html">boost/exception/enable_current_exception.hpp</a></p>
|
||||
<p><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></p>
|
||||
<p><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></p>
|
||||
<p><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></p>
|
||||
<p><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></p>
|
||||
<p><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></p>
|
||||
<p><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></p>
|
||||
<p><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></p>
|
||||
<p><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></p>
|
||||
<h3>C</h3>
|
||||
<p><a href="configuration_macros.html">Configuration Macros</a></p>
|
||||
<h3>c</h3>
|
||||
<p><a href="copy_exception.html">copy_exception</a></p>
|
||||
<p><a href="current_exception.html">current_exception</a></p>
|
||||
@ -47,17 +50,15 @@
|
||||
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
||||
<p><a href="error_info.html">error_info</a></p>
|
||||
<p><a href="exception.html">exception</a></p>
|
||||
<p><a href="exception_diagnostic_information.html">exception::diagnostic_information</a></p>
|
||||
<p><a href="exception_operator_shl.html">exception/operator<<</a></p>
|
||||
<p><a href="exception_constructors.html">exception::exception</a></p>
|
||||
<p><a href="exception_destructor.html">exception::~exception</a></p>
|
||||
<p><a href="exception_ptr.html">exception_ptr</a></p>
|
||||
<h3>g</h3>
|
||||
<p><a href="get_error_info.html">get_error_info</a></p>
|
||||
<h3>I</h3>
|
||||
<p><a href="name_idx.html">Index</a></p>
|
||||
<p><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies</a></p>
|
||||
<h3>o</h3>
|
||||
<p><a href="operator_shl_exception.html">operator<</exception</a></p>
|
||||
<p><a href="operator_shl_tuple.html">operator<</tuple</a></p>
|
||||
<h3>r</h3>
|
||||
<p><a href="rethrow_exception.html">rethrow_exception</a></p>
|
||||
<h3>T</h3>
|
||||
@ -65,6 +66,7 @@
|
||||
<p><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads</a></p>
|
||||
<h3>t</h3>
|
||||
<p><a href="throw_exception.html">throw_exception</a></p>
|
||||
<p><a href="tuple_operator_shl.html">tuple/operator<<</a></p>
|
||||
<h3>u</h3>
|
||||
<p><a href="unknown_exception.html">unknown_exception</a></p>
|
||||
</div>
|
||||
|
@ -35,6 +35,7 @@ boost
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp<br/>
|
||||
</a><a href="exception_ptr.html">exception_ptr<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,16 +25,12 @@
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> #ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
<span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
#else
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
|
||||
#endif</span>
|
||||
#endif</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>E must derive publicly from std::exception.</p>
|
||||
@ -44,8 +40,10 @@ boost
|
||||
</ul></div>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a></div>
|
||||
|
@ -22,28 +22,33 @@
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>boost/throw_exception.hpp</h2>
|
||||
</div>
|
||||
<h3>Synopsis</h3>
|
||||
<div class="RenoIncludeDIV"><pre>#include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span>>
|
||||
#include <exception>
|
||||
<div class="RenoIncludeDIV"><div class="RenoIncludeDIV"><pre><span class="RenoIncludeSPAN">#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
|
||||
#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>>
|
||||
#include <boost/current_function.hpp>
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x)\
|
||||
::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( ::boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(x) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_function</a></span>(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_file</a></span>(__FILE__) <<\
|
||||
::boost::<span class="RenoLink"><a href="exception_exception_hpp.html">throw_line</a></span>((int)__LINE__) )
|
||||
#else
|
||||
#define <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(x) ::boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(x)
|
||||
#endif</span>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
<span class="RenoIncludeSPAN">#ifdef BOOST_NO_EXCEPTIONS
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
#else
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
|
||||
#endif</span></span>
|
||||
#endif</span>
|
||||
}</pre>
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
</div></div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
<div class="RenoPageList"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>operator<</tuple</title>
|
||||
<title>tuple/operator<<</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,14 +19,14 @@
|
||||
<!-- Copyright (c) 2006-2008 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) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>operator<</tuple</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>tuple/operator<<</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & <span class="RenoLink"><a href="operator_shl_tuple.html">operator<<</a></span>( E const & x,
|
||||
E const & <span class="RenoLink"><a href="tuple_operator_shl.html">operator<<</a></span>( E const & x,
|
||||
<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span><
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1>,
|
||||
...,
|
@ -21,7 +21,12 @@
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Diagnostic Information</h2>
|
||||
</div>
|
||||
<p>Class boost::<span class="RenoLink"><a href="exception.html">exception</a></span> provides a virtual member function <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>, with a signature similar to the familiar std::exception::what function. The default implementation returns a string value that is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example:</p>
|
||||
<p>Boost Exception provides a namespace-scope function <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> which takes a boost::<span class="RenoLink"><a href="exception.html">exception</a></span>. The returned string contains:</p>
|
||||
<div><ul><li>the string representation of all data objects added to 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>;</li>
|
||||
<li>the output from std::exception::what;</li>
|
||||
<li>additional platform-specific diagnostic information.</li>
|
||||
</ul></div>
|
||||
<p>The returned string is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <iostream>
|
||||
|
||||
@ -37,17 +42,12 @@ g()
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
std::cerr << e.<span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>();
|
||||
std::cerr << <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>(e);
|
||||
}
|
||||
}</pre>
|
||||
<p>The <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span> member function iterates over all data objects stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> through <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p>
|
||||
<p>When the <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is expected to return std::string and is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string.</p>
|
||||
<p>Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -49,7 +49,7 @@ my_container
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
<p>The call to <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span><T> gets us an object of <i>unspecified type</i> which is guaranteed to derive from both boost::<span class="RenoLink"><a href="exception.html">exception</a></span> and T. This makes it possible to use <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::<span class="RenoLink"><a href="exception.html">exception</a></span> &, so that <span class="RenoLink"><a href="tutorial_transporting_data.html">more information can be added to the exception at a later time</a></span>.</p>
|
||||
<p>The call to <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span><T> gets us an object of <i>unspecified type</i> which is guaranteed to derive from both boost::<span class="RenoLink"><a href="exception.html">exception</a></span> and T. This makes it possible to use <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::<span class="RenoLink"><a href="exception.html">exception</a></span> &, so that <span class="RenoLink"><a href="tutorial_transporting_data.html">more information can be added to the exception at a later time</a></span>.</p>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
|
@ -27,8 +27,7 @@
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Using enable_current_exception at the Time of the Throw</h3>
|
||||
</div>
|
||||
<p>Here is how cloning can be enabled in a throw-expression (15.1):</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -41,7 +41,7 @@ f()
|
||||
</pre>
|
||||
<p>First, we instantiate the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template using a unique identifier -- tag_errno, and the type of the info it identifies -- int. This provides compile-time type safety for the various values stored in exception objects.</p>
|
||||
<p>Second, we define class my_error, which derives from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<p>Finally, (3) illustrates how the typedef from (1) can be used with <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> to store values in exception objects at the point of the throw.</p>
|
||||
<p>Finally, (3) illustrates how the typedef from (1) can be used with <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to store values in exception objects at the point of the throw.</p>
|
||||
<p>The stored errno value can be recovered at a later time like this:</p>
|
||||
<pre>// ...continued
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
//This example shows how to enable cloning when throwing a boost::exception.
|
||||
|
||||
#include <boost/exception/enable_current_exception.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
@ -41,7 +41,7 @@ error: //Base for all exception objects we throw.
|
||||
char const *
|
||||
what() const throw()
|
||||
{
|
||||
return boost::exception::diagnostic_information();
|
||||
return "example_io error";
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -66,11 +66,11 @@ my_fopen( char const * name, char const * mode )
|
||||
if( FILE * f = ::fopen(name,mode) )
|
||||
return boost::shared_ptr<FILE>(f,fclose);
|
||||
else
|
||||
throw fopen_error() << BOOST_ERROR_INFO <<
|
||||
BOOST_THROW_EXCEPTION(fopen_error() <<
|
||||
errno_info(errno) <<
|
||||
file_name_info(name) <<
|
||||
open_mode_info(mode) <<
|
||||
function_info("fopen");
|
||||
function_info("fopen"));
|
||||
}
|
||||
|
||||
void
|
||||
@ -78,10 +78,10 @@ my_fread( void * buffer, size_t size, size_t count, boost::shared_ptr<FILE> cons
|
||||
{
|
||||
assert(stream);
|
||||
if( count!=fread(buffer,size,count,stream.get()) || ferror(stream.get()) )
|
||||
throw fread_error() << BOOST_ERROR_INFO <<
|
||||
BOOST_THROW_EXCEPTION(fread_error() <<
|
||||
function_info("fread") <<
|
||||
errno_info(errno) <<
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream));
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream)));
|
||||
}
|
||||
|
||||
void
|
||||
@ -89,10 +89,10 @@ my_fwrite( void const * buffer, size_t size, size_t count, boost::shared_ptr<FIL
|
||||
{
|
||||
assert(stream);
|
||||
if( count!=fwrite(buffer,size,count,stream.get()) || ferror(stream.get()) )
|
||||
throw fwrite_error() << BOOST_ERROR_INFO <<
|
||||
BOOST_THROW_EXCEPTION(fwrite_error() <<
|
||||
function_info("fwrite") <<
|
||||
errno_info(errno) <<
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream));
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream)));
|
||||
}
|
||||
|
||||
void
|
||||
@ -150,7 +150,7 @@ void
|
||||
dump_file_info( boost::exception const & x )
|
||||
{
|
||||
if( boost::shared_ptr<std::string const> fn = boost::get_error_info<file_name_info>(x) )
|
||||
std::cout << "Source file name: " << *fn << "\n";
|
||||
std::cout << "File name: " << *fn << "\n";
|
||||
}
|
||||
|
||||
void
|
||||
@ -170,7 +170,7 @@ dump_all_info( boost::exception const & x )
|
||||
dump_file_info(x);
|
||||
dump_clib_info(x);
|
||||
std::cout << "\nOutput from diagnostic_information():\n";
|
||||
std::cout << x.diagnostic_information();
|
||||
std::cout << diagnostic_information(x);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -20,6 +20,6 @@ g()
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
std::cerr << e.diagnostic_information();
|
||||
std::cerr << diagnostic_information(e);
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
//Copyright (c) 2006-2008 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_F7D5662CCB0F11DCA353CAC656D89593
|
||||
#define UUID_F7D5662CCB0F11DCA353CAC656D89593
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class clone_base;
|
||||
|
||||
class
|
||||
cloning_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual clone_base const * clone() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||
virtual //Disable bogus GCC warning.
|
||||
#endif
|
||||
~cloning_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
//Copyright (c) 2006-2008 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_DBA0D90C930911DCBA7B675A56D89593
|
||||
#define UUID_DBA0D90C930911DCBA7B675A56D89593
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
counted_base
|
||||
{
|
||||
friend
|
||||
void
|
||||
intrusive_ptr_add_ref( counted_base const * c )
|
||||
{
|
||||
c->add_ref();
|
||||
}
|
||||
|
||||
friend
|
||||
void
|
||||
intrusive_ptr_release( counted_base const * c )
|
||||
{
|
||||
c->release();
|
||||
}
|
||||
|
||||
virtual void add_ref() const=0;
|
||||
virtual void release() const=0;
|
||||
|
||||
protected:
|
||||
|
||||
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||
virtual //Disable bogus GCC warning.
|
||||
#endif
|
||||
~counted_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
61
include/boost/exception/detail/error_info_impl.hpp
Normal file
61
include/boost/exception/detail/error_info_impl.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
//Copyright (c) 2006-2008 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_CE6983AC753411DDA764247956D89593
|
||||
#define UUID_CE6983AC753411DDA764247956D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual char const * tag_typeid_name() const = 0;
|
||||
virtual std::string value_as_string() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual
|
||||
~error_info_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
class
|
||||
error_info:
|
||||
public exception_detail::error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & value );
|
||||
~error_info() throw();
|
||||
|
||||
value_type const &
|
||||
value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
char const * tag_typeid_name() const;
|
||||
std::string value_as_string() const;
|
||||
|
||||
value_type const value_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -6,8 +6,8 @@
|
||||
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
#define UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <iomanip>
|
||||
#include <typeinfo>
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -24,7 +24,7 @@ boost
|
||||
object_hex_dump( T const & x, size_t max_size=16 )
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << "type: " << typeid(x).name() << ", size: " << sizeof(T) << ", dump: ";
|
||||
s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: ";
|
||||
size_t n=sizeof(T)>max_size?max_size:sizeof(T);
|
||||
s.fill('0');
|
||||
s.width(2);
|
||||
|
130
include/boost/exception/detail/type_info.hpp
Normal file
130
include/boost/exception/detail/type_info.hpp
Normal file
@ -0,0 +1,130 @@
|
||||
//Copyright (c) 2006-2008 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_C3E1741C754311DDB2834CCA55D89593
|
||||
#define UUID_C3E1741C754311DDB2834CCA55D89593
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class T>
|
||||
inline
|
||||
char const *
|
||||
tag_type_name()
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return typeid(T*).name();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
char const *
|
||||
type_name()
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return typeid(T).name();
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo type_;
|
||||
char const * name_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo 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 a.type_<b.type_;
|
||||
}
|
||||
|
||||
char const *
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
};
|
||||
#else
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo const * type_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo const & 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
|
||||
bool
|
||||
operator<( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
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>())
|
||||
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
||||
#endif
|
||||
|
||||
#endif
|
@ -6,21 +6,58 @@
|
||||
#ifndef UUID_0552D49838DD11DD90146B8956D89593
|
||||
#define UUID_0552D49838DD11DD90146B8956D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
inline
|
||||
char const *
|
||||
get_diagnostic_information( exception const & x )
|
||||
{
|
||||
if( error_info_container * c=x.data_.get() )
|
||||
try
|
||||
{
|
||||
return c->diagnostic_information();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
diagnostic_information( std::exception const & x )
|
||||
diagnostic_information( exception const & x )
|
||||
{
|
||||
if( exception const * be = dynamic_cast<exception const *>(&x) )
|
||||
return be->diagnostic_information();
|
||||
std::ostringstream tmp;
|
||||
if( boost::shared_ptr<char const * const> f=get_error_info<throw_file>(x) )
|
||||
{
|
||||
tmp << *f;
|
||||
if( boost::shared_ptr<int const> l=get_error_info<throw_line>(x) )
|
||||
tmp << '(' << *l << "): ";
|
||||
}
|
||||
tmp << "Throw in function ";
|
||||
if( boost::shared_ptr<char const * const> fn=get_error_info<throw_function>(x) )
|
||||
tmp << *fn;
|
||||
else
|
||||
return std::string("[ what: ") + x.what() + ", type: " + typeid(x).name() + " ]";
|
||||
tmp << "(unknown)";
|
||||
#ifndef BOOST_NO_RTTI
|
||||
tmp << "\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name();
|
||||
if( std::exception const * e=dynamic_cast<std::exception const *>(&x) )
|
||||
tmp << "\nstd::exception::what: " << e->what();
|
||||
#endif
|
||||
if( char const * s=exception_detail::get_diagnostic_information(x) )
|
||||
if( *s )
|
||||
tmp << '\n' << s;
|
||||
return tmp.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,154 +3,4 @@
|
||||
//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_78CC85B2914F11DC8F47B48E55D89593
|
||||
#define UUID_78CC85B2914F11DC8F47B48E55D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/cloning_base.hpp>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <new>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
clone_base:
|
||||
public counted_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void rethrow() const=0;
|
||||
};
|
||||
|
||||
struct
|
||||
bad_alloc_impl:
|
||||
public clone_base,
|
||||
public std::bad_alloc
|
||||
{
|
||||
void
|
||||
add_ref() const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
release() const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
rethrow() const
|
||||
{
|
||||
throw *this;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
clone_base * make_clone( T const & );
|
||||
|
||||
template <class T>
|
||||
class
|
||||
clone_impl:
|
||||
public T,
|
||||
public cloning_base
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
clone_impl( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
if( boost::exception * be1=dynamic_cast<boost::exception *>(this) )
|
||||
if( boost::exception const * be2=dynamic_cast<boost::exception const *>(&x) )
|
||||
*be1 = *be2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
clone_base const *
|
||||
clone() const
|
||||
{
|
||||
return make_clone<T>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class
|
||||
exception_clone:
|
||||
public T,
|
||||
public clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
exception_clone( T const & x ):
|
||||
T(x),
|
||||
count_(0)
|
||||
{
|
||||
if( boost::exception * be1=dynamic_cast<boost::exception *>(this) )
|
||||
if( boost::exception const * be2=dynamic_cast<boost::exception const *>(&x) )
|
||||
*be1 = *be2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
detail::atomic_count mutable count_;
|
||||
|
||||
void
|
||||
add_ref() const
|
||||
{
|
||||
++count_;
|
||||
}
|
||||
|
||||
void
|
||||
release() const
|
||||
{
|
||||
if( !--count_ )
|
||||
delete this;
|
||||
}
|
||||
|
||||
void
|
||||
rethrow() const
|
||||
{
|
||||
throw clone_impl<T>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
clone_base *
|
||||
make_clone( T const & x )
|
||||
{
|
||||
try
|
||||
{
|
||||
return new exception_clone<T>(x);
|
||||
}
|
||||
catch(
|
||||
std::bad_alloc & )
|
||||
{
|
||||
static bad_alloc_impl bad_alloc;
|
||||
return &bad_alloc;
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_detail::clone_impl<T>
|
||||
enable_current_exception( T const & x )
|
||||
{
|
||||
return exception_detail::clone_impl<T>(x);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3,104 +3,4 @@
|
||||
//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_0C5D492E909711DCB658AD4556D89593
|
||||
#define UUID_0C5D492E909711DCB658AD4556D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
struct
|
||||
error_info_injector:
|
||||
public T,
|
||||
public exception
|
||||
{
|
||||
explicit
|
||||
error_info_injector( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_injector() throw()
|
||||
{
|
||||
}
|
||||
|
||||
char const *
|
||||
diagnostic_information() const throw()
|
||||
{
|
||||
return boost::exception::_diagnostic_information(T::what());
|
||||
}
|
||||
};
|
||||
|
||||
struct large_size { char c[256]; };
|
||||
large_size dispatch( exception * );
|
||||
|
||||
struct small_size { };
|
||||
small_size dispatch( void * );
|
||||
|
||||
template <class,size_t>
|
||||
struct enable_error_info_helper;
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(large_size)>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(small_size)>
|
||||
{
|
||||
typedef error_info_injector<T> type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
|
||||
template <class T>
|
||||
struct
|
||||
sizeof_dispatch
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value = sizeof(dispatch((T*)0)) );
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_return_type
|
||||
{
|
||||
typedef typename enable_error_info_helper<T,sizeof_dispatch<T>::value>::type type;
|
||||
};
|
||||
#else
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_return_type
|
||||
{
|
||||
typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
|
||||
typename
|
||||
#endif
|
||||
exception_detail::enable_error_info_return_type<T>::type
|
||||
enable_error_info( T const & x )
|
||||
{
|
||||
return
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
|
||||
typename
|
||||
#endif
|
||||
exception_detail::enable_error_info_return_type<T>::type(x);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3,14 +3,4 @@
|
||||
//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_0E57632CCA3011DCB876FD9955D89593
|
||||
#define UUID_0E57632CCA3011DCB876FD9955D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T>
|
||||
class error_info;
|
||||
}
|
||||
|
||||
#endif
|
||||
namespace boost { template <class Tag,class T> class error_info; }
|
||||
|
@ -6,115 +6,391 @@
|
||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/exception/detail/counted_base.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class T>
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
class
|
||||
refcount_ptr
|
||||
{
|
||||
public:
|
||||
|
||||
refcount_ptr():
|
||||
px_(0)
|
||||
{
|
||||
}
|
||||
|
||||
~refcount_ptr()
|
||||
{
|
||||
release();
|
||||
}
|
||||
|
||||
refcount_ptr( refcount_ptr const & x ):
|
||||
px_(x.px_)
|
||||
{
|
||||
add_ref();
|
||||
}
|
||||
|
||||
refcount_ptr &
|
||||
operator=( refcount_ptr const & x )
|
||||
{
|
||||
adopt(x.px_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
adopt( T * px )
|
||||
{
|
||||
release();
|
||||
px_=px;
|
||||
add_ref();
|
||||
}
|
||||
|
||||
T *
|
||||
get() const
|
||||
{
|
||||
return px_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T * px_;
|
||||
|
||||
void
|
||||
add_ref()
|
||||
{
|
||||
if( px_ )
|
||||
px_->add_ref();
|
||||
}
|
||||
|
||||
void
|
||||
release()
|
||||
{
|
||||
if( px_ )
|
||||
px_->release();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class Tag,class T>
|
||||
class error_info;
|
||||
|
||||
typedef error_info<struct tag_throw_function,char const *> throw_function;
|
||||
typedef error_info<struct tag_throw_file,char const *> throw_file;
|
||||
typedef error_info<struct tag_throw_line,int> throw_line;
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<tag_throw_function,char const *>
|
||||
{
|
||||
public:
|
||||
typedef char const * value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<tag_throw_file,char const *>
|
||||
{
|
||||
public:
|
||||
typedef char const * value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<tag_throw_line,int>
|
||||
{
|
||||
public:
|
||||
typedef int value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||
|
||||
class exception;
|
||||
|
||||
template <class>
|
||||
class shared_ptr;
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class error_info_base;
|
||||
struct type_info_;
|
||||
|
||||
struct
|
||||
error_info_container:
|
||||
public exception_detail::counted_base
|
||||
error_info_container
|
||||
{
|
||||
virtual char const * diagnostic_information( char const *, std::type_info const & ) const = 0;
|
||||
virtual shared_ptr<error_info_base const> get( std::type_info const & ) const = 0;
|
||||
virtual void set( shared_ptr<error_info_base const> const & ) = 0;
|
||||
virtual char const * diagnostic_information() const = 0;
|
||||
virtual shared_ptr<error_info_base const> get( type_info_ const & ) const = 0;
|
||||
virtual void set( shared_ptr<error_info_base const> const &, type_info_ const & ) = 0;
|
||||
virtual void add_ref() const = 0;
|
||||
virtual void release() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual
|
||||
~error_info_container() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
struct get_info;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_function>;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_file>;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_line>;
|
||||
|
||||
char const * get_diagnostic_information( exception const & );
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
class error_info;
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||
|
||||
template <class ErrorInfo,class E>
|
||||
shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
|
||||
|
||||
class
|
||||
exception
|
||||
{
|
||||
public:
|
||||
|
||||
virtual
|
||||
char const *
|
||||
diagnostic_information() const throw()
|
||||
{
|
||||
return _diagnostic_information(0);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
exception()
|
||||
exception():
|
||||
throw_function_(0),
|
||||
throw_file_(0),
|
||||
throw_line_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
exception( exception const & e ):
|
||||
data_(e.data_)
|
||||
{
|
||||
}
|
||||
|
||||
char const *
|
||||
_diagnostic_information( char const * std_what ) const throw()
|
||||
{
|
||||
if( data_ )
|
||||
try
|
||||
{
|
||||
char const * w = data_->diagnostic_information(std_what,typeid(*this));
|
||||
BOOST_ASSERT(0!=w);
|
||||
return w;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
return std_what ? std_what : typeid(*this).name();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) )
|
||||
//Force class exception to be abstract.
|
||||
//Otherwise, MSVC bug allows throw exception(), even though the copy constructor is protected.
|
||||
virtual ~exception() throw()=0;
|
||||
#else
|
||||
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||
virtual //Disable bogus GCC warning.
|
||||
#endif
|
||||
~exception() throw()
|
||||
#ifdef __HP_aCC
|
||||
//On HP aCC, this protected copy constructor prevents throwing boost::exception.
|
||||
//On all other platforms, the same effect is achieved by the pure virtual destructor.
|
||||
exception( exception const & x ) throw():
|
||||
data_(x.data_),
|
||||
throw_function_(x.throw_function_),
|
||||
throw_file_(x.throw_file_),
|
||||
throw_line_(x.throw_line_)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~exception() throw()
|
||||
#ifndef __HP_aCC
|
||||
= 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
|
||||
#endif
|
||||
;
|
||||
|
||||
private:
|
||||
|
||||
shared_ptr<exception_detail::error_info_base const> get( std::type_info const & ) const;
|
||||
void set( shared_ptr<exception_detail::error_info_base const> const & ) const;
|
||||
template <class E>
|
||||
friend
|
||||
E const &
|
||||
operator<<( E const & x, throw_function const & y )
|
||||
{
|
||||
x.throw_function_=y.v_;
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class E>
|
||||
friend
|
||||
E const &
|
||||
operator<<( E const & x, throw_file const & y )
|
||||
{
|
||||
x.throw_file_=y.v_;
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class E>
|
||||
friend
|
||||
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 & );
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||
|
||||
template <class ErrorInfo,class E>
|
||||
friend shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
|
||||
template <class>
|
||||
friend struct exception_detail::get_info;
|
||||
friend struct exception_detail::get_info<throw_function>;
|
||||
friend struct exception_detail::get_info<throw_file>;
|
||||
friend struct exception_detail::get_info<throw_line>;
|
||||
|
||||
intrusive_ptr<exception_detail::error_info_container> mutable data_;
|
||||
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
||||
mutable char const * throw_function_;
|
||||
mutable char const * throw_file_;
|
||||
mutable int throw_line_;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) //See above.
|
||||
inline
|
||||
exception::
|
||||
~exception() throw()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
struct
|
||||
error_info_injector:
|
||||
public T,
|
||||
public exception
|
||||
{
|
||||
explicit
|
||||
error_info_injector( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_injector() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct large_size { char c[256]; };
|
||||
large_size dispatch( exception * );
|
||||
|
||||
struct small_size { };
|
||||
small_size dispatch( void * );
|
||||
|
||||
template <class,int>
|
||||
struct enable_error_info_helper;
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(large_size)>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(small_size)>
|
||||
{
|
||||
typedef error_info_injector<T> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_return_type
|
||||
{
|
||||
typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
typename
|
||||
exception_detail::enable_error_info_return_type<T>::type
|
||||
enable_error_info( T const & x )
|
||||
{
|
||||
typedef typename exception_detail::enable_error_info_return_type<T>::type rt;
|
||||
return rt(x);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual clone_base const * clone() const = 0;
|
||||
virtual void rethrow() const = 0;
|
||||
|
||||
virtual
|
||||
~clone_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
void
|
||||
copy_boost_exception( exception * a, exception const * b )
|
||||
{
|
||||
*a = *b;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
copy_boost_exception( void *, void const * )
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class
|
||||
clone_impl:
|
||||
public T,
|
||||
public clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
clone_impl( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
copy_boost_exception(this,&x);
|
||||
}
|
||||
|
||||
~clone_impl() throw()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
clone_base const *
|
||||
clone() const
|
||||
{
|
||||
return new clone_impl(*this);
|
||||
}
|
||||
|
||||
void
|
||||
rethrow() const
|
||||
{
|
||||
throw*this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_detail::clone_impl<T>
|
||||
enable_current_exception( T const & x )
|
||||
{
|
||||
return exception_detail::clone_impl<T>(x);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
134
include/boost/exception/get_error_info.hpp
Normal file
134
include/boost/exception/get_error_info.hpp
Normal file
@ -0,0 +1,134 @@
|
||||
//Copyright (c) 2006-2008 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_1A590226753311DD9E4CCF6156D89593
|
||||
#define UUID_1A590226753311DD9E4CCF6156D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
struct
|
||||
strwrap
|
||||
{
|
||||
std::string str;
|
||||
char const * ptr;
|
||||
|
||||
explicit
|
||||
strwrap( char const * s ):
|
||||
str(s),
|
||||
ptr(&str[0])
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
strwrap( strwrap const & );
|
||||
strwrap & operator=( strwrap const & );
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_function>
|
||||
{
|
||||
static
|
||||
shared_ptr<char const * const>
|
||||
get( exception const & x )
|
||||
{
|
||||
if( x.throw_function_ && *x.throw_function_ )
|
||||
{
|
||||
shared_ptr<strwrap> s(new strwrap(x.throw_function_));
|
||||
return shared_ptr<char const *>(s,&s->ptr);
|
||||
}
|
||||
else
|
||||
return shared_ptr<char const * const>();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_file>
|
||||
{
|
||||
static
|
||||
shared_ptr<char const * const>
|
||||
get( exception const & x )
|
||||
{
|
||||
if( x.throw_file_ && *x.throw_file_ )
|
||||
{
|
||||
shared_ptr<strwrap> s(new strwrap(x.throw_file_));
|
||||
return shared_ptr<char const *>(s,&s->ptr);
|
||||
}
|
||||
else
|
||||
return shared_ptr<char const * const>();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_line>
|
||||
{
|
||||
static
|
||||
shared_ptr<int const>
|
||||
get( exception const & x )
|
||||
{
|
||||
if( x.throw_line_!=-1 )
|
||||
return boost::shared_ptr<int>(new int(x.throw_line_));
|
||||
else
|
||||
return shared_ptr<int const>();
|
||||
}
|
||||
};
|
||||
|
||||
template <class ErrorInfo>
|
||||
struct
|
||||
get_info
|
||||
{
|
||||
static
|
||||
shared_ptr<typename ErrorInfo::value_type const>
|
||||
get( exception const & x )
|
||||
{
|
||||
if( exception_detail::error_info_container * c=x.data_.get() )
|
||||
if( shared_ptr<exception_detail::error_info_base const> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
|
||||
{
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo const *>(eib.get()) );
|
||||
#endif
|
||||
ErrorInfo const * w = static_cast<ErrorInfo const *>(eib.get());
|
||||
return shared_ptr<typename ErrorInfo::value_type const>(eib,&w->value());
|
||||
}
|
||||
return shared_ptr<typename ErrorInfo::value_type const>();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_RTTI
|
||||
template <class ErrorInfo>
|
||||
inline
|
||||
shared_ptr<typename ErrorInfo::value_type const>
|
||||
get_error_info( boost::exception const & x )
|
||||
{
|
||||
return exception_detail::get_info<ErrorInfo>::get(x);
|
||||
}
|
||||
#else
|
||||
template <class ErrorInfo,class E>
|
||||
inline
|
||||
shared_ptr<typename ErrorInfo::value_type const>
|
||||
get_error_info( E const & some_exception )
|
||||
{
|
||||
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
|
||||
return exception_detail::get_info<ErrorInfo>::get(*x);
|
||||
else
|
||||
return shared_ptr<typename ErrorInfo::value_type const>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
@ -6,108 +6,46 @@
|
||||
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
|
||||
#include <boost/type.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/error_info.hpp>
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <map>
|
||||
|
||||
#define BOOST_ERROR_INFO\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__)
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
typedef error_info<struct tag_throw_function,char const *> throw_function;
|
||||
typedef error_info<struct tag_throw_file,char const *> throw_file;
|
||||
typedef error_info<struct tag_throw_line,int> throw_line;
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
error_info( value_type const & value ):
|
||||
value_(value)
|
||||
{
|
||||
class
|
||||
error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual std::type_info const & tag_typeid() const = 0;
|
||||
virtual std::string value_as_string() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||
virtual //Disable bogus GCC warning.
|
||||
#endif
|
||||
~error_info_base()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
class
|
||||
error_info:
|
||||
public exception_detail::error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & value ):
|
||||
value_(value)
|
||||
{
|
||||
}
|
||||
|
||||
value_type const &
|
||||
value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::type_info const &
|
||||
tag_typeid() const
|
||||
{
|
||||
return typeid(type<Tag>);
|
||||
}
|
||||
|
||||
std::string
|
||||
value_as_string() const
|
||||
{
|
||||
return to_string_stub(value_);
|
||||
}
|
||||
|
||||
value_type const value_;
|
||||
};
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
E const &
|
||||
operator<<( E const & x, error_info<Tag,T> const & v )
|
||||
error_info<Tag,T>::
|
||||
~error_info() throw()
|
||||
{
|
||||
shared_ptr< error_info<Tag,T> > p( new error_info<Tag,T>(v) );
|
||||
x.set(p);
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class ErrorInfo,class E>
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
shared_ptr<typename ErrorInfo::value_type const>
|
||||
get_error_info( E const & some_exception )
|
||||
char const *
|
||||
error_info<Tag,T>::
|
||||
tag_typeid_name() const
|
||||
{
|
||||
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
|
||||
if( shared_ptr<exception_detail::error_info_base const> eib = x->get(typeid(ErrorInfo)) )
|
||||
{
|
||||
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo const *>(eib.get()) );
|
||||
ErrorInfo const * w = static_cast<ErrorInfo const *>(eib.get());
|
||||
return shared_ptr<typename ErrorInfo::value_type const>(eib,&w->value());
|
||||
}
|
||||
return shared_ptr<typename ErrorInfo::value_type const>();
|
||||
return tag_type_name<Tag>();
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
std::string
|
||||
error_info<Tag,T>::
|
||||
value_as_string() const
|
||||
{
|
||||
return to_string_stub(value_);
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -128,81 +66,57 @@ virtual //Disable bogus GCC warning.
|
||||
{
|
||||
}
|
||||
|
||||
shared_ptr<error_info_base const>
|
||||
get( std::type_info const & ti ) const
|
||||
void
|
||||
set( shared_ptr<error_info_base const> const & x, type_info_ const & typeid_ )
|
||||
{
|
||||
error_info_map::const_iterator i=info_.find(typeinfo(ti));
|
||||
BOOST_ASSERT(x);
|
||||
info_[typeid_] = x;
|
||||
diagnostic_info_str_.clear();
|
||||
}
|
||||
|
||||
shared_ptr<error_info_base const>
|
||||
get( type_info_ const & ti ) const
|
||||
{
|
||||
error_info_map::const_iterator i=info_.find(ti);
|
||||
if( info_.end()!=i )
|
||||
{
|
||||
shared_ptr<error_info_base const> const & p = i->second;
|
||||
BOOST_ASSERT( typeid(*p)==ti );
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
return shared_ptr<error_info_base const>();
|
||||
}
|
||||
|
||||
void
|
||||
set( shared_ptr<error_info_base const> const & x )
|
||||
{
|
||||
BOOST_ASSERT(x);
|
||||
info_[typeinfo(typeid(*x))] = x;
|
||||
what_.clear();
|
||||
}
|
||||
|
||||
char const *
|
||||
diagnostic_information( char const * std_what, std::type_info const & exception_type ) const
|
||||
diagnostic_information() const
|
||||
{
|
||||
if( what_.empty() )
|
||||
if( diagnostic_info_str_.empty() )
|
||||
{
|
||||
std::string tmp;
|
||||
if( std_what )
|
||||
{
|
||||
tmp += std_what;
|
||||
tmp += '\n';
|
||||
}
|
||||
tmp += "Dynamic exception type: ";
|
||||
tmp += exception_type.name();
|
||||
tmp += '\n';
|
||||
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
||||
{
|
||||
shared_ptr<error_info_base const> const & x = i->second;
|
||||
tmp += '[';
|
||||
tmp += x->tag_typeid().name();
|
||||
tmp += x->tag_typeid_name();
|
||||
tmp += "] = ";
|
||||
tmp += x->value_as_string();
|
||||
tmp += '\n';
|
||||
}
|
||||
what_.swap(tmp);
|
||||
diagnostic_info_str_.swap(tmp);
|
||||
}
|
||||
return what_.c_str();
|
||||
return diagnostic_info_str_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
friend class exception;
|
||||
friend class boost::exception;
|
||||
|
||||
struct
|
||||
typeinfo
|
||||
{
|
||||
std::type_info const * type;
|
||||
|
||||
explicit
|
||||
typeinfo( std::type_info const & t ):
|
||||
type(&t)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
operator<( typeinfo const & b ) const
|
||||
{
|
||||
return 0!=(type->before(*b.type));
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map< typeinfo, shared_ptr<error_info_base const> > error_info_map;
|
||||
typedef std::map< type_info_, shared_ptr<error_info_base const> > error_info_map;
|
||||
error_info_map info_;
|
||||
std::string mutable what_;
|
||||
int mutable count_;
|
||||
mutable std::string diagnostic_info_str_;
|
||||
mutable int count_;
|
||||
|
||||
void
|
||||
add_ref() const
|
||||
@ -219,25 +133,18 @@ virtual //Disable bogus GCC warning.
|
||||
};
|
||||
}
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
void
|
||||
exception::
|
||||
set( shared_ptr<exception_detail::error_info_base const> const & x ) const
|
||||
E const &
|
||||
operator<<( E const & x, error_info<Tag,T> const & v )
|
||||
{
|
||||
if( !data_ )
|
||||
data_ = intrusive_ptr<exception_detail::error_info_container>(new exception_detail::error_info_container_impl);
|
||||
data_->set(x);
|
||||
}
|
||||
|
||||
inline
|
||||
shared_ptr<exception_detail::error_info_base const>
|
||||
exception::
|
||||
get( std::type_info const & ti ) const
|
||||
{
|
||||
if( data_ )
|
||||
return data_->get(ti);
|
||||
else
|
||||
return shared_ptr<exception_detail::error_info_base const>();
|
||||
typedef error_info<Tag,T> error_info_tag_t;
|
||||
shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
|
||||
exception_detail::error_info_container * c;
|
||||
if( !(c=x.data_.get()) )
|
||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,19 +6,80 @@
|
||||
#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
|
||||
#define UUID_FA5836A2CADA11DC8CD47C8555D89593
|
||||
|
||||
#include <boost/exception/enable_current_exception.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/cloning_base.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdexcept>
|
||||
#include <new>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
exception_ptr():
|
||||
bad_alloc_(false)
|
||||
{
|
||||
}
|
||||
|
||||
operator unspecified_bool_type() const
|
||||
{
|
||||
return (bad_alloc_ || c_) ? &exception_ptr::bad_alloc_ : 0;
|
||||
}
|
||||
|
||||
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 std::exception,
|
||||
public exception_detail::clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
@ -35,9 +96,21 @@ boost
|
||||
~unknown_exception() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
|
||||
private:
|
||||
|
||||
exception_detail::clone_base const *
|
||||
clone() const
|
||||
{
|
||||
return new unknown_exception(*this);
|
||||
}
|
||||
|
||||
void
|
||||
rethrow() const
|
||||
{
|
||||
throw*this;
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
@ -46,7 +119,8 @@ boost
|
||||
class
|
||||
current_exception_std_exception_wrapper:
|
||||
public T,
|
||||
public boost::exception
|
||||
public boost::exception,
|
||||
public clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
@ -65,41 +139,150 @@ boost
|
||||
~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;
|
||||
}
|
||||
};
|
||||
|
||||
#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
|
||||
exception_ptr
|
||||
shared_ptr<clone_base const>
|
||||
current_exception_std_exception( T const & e1 )
|
||||
{
|
||||
if( boost::exception const * e2 = dynamic_cast<boost::exception const *>(&e1) )
|
||||
return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(e1,*e2)));
|
||||
if( boost::exception const * e2 = get_boost_exception(&e1) )
|
||||
return shared_ptr<clone_base const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
|
||||
else
|
||||
return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(e1)));
|
||||
return shared_ptr<clone_base const>(new current_exception_std_exception_wrapper<T>(e1));
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
shared_ptr<clone_base const>
|
||||
current_exception_unknown_exception()
|
||||
{
|
||||
return exception_ptr(exception_detail::make_clone(unknown_exception()));
|
||||
return shared_ptr<clone_base const>(new unknown_exception());
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
shared_ptr<clone_base const>
|
||||
current_exception_unknown_boost_exception( boost::exception const & e )
|
||||
{
|
||||
return shared_ptr<clone_base 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 = dynamic_cast<boost::exception const *>(&e) )
|
||||
return exception_ptr(exception_detail::make_clone(unknown_exception(*be)));
|
||||
if( boost::exception const * be = get_boost_exception(&e) )
|
||||
return current_exception_unknown_boost_exception(*be);
|
||||
else
|
||||
return current_exception_unknown_exception();
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_unknown_boost_exception( boost::exception const & e )
|
||||
shared_ptr<clone_base const>
|
||||
current_exception_impl()
|
||||
{
|
||||
return exception_ptr(exception_detail::make_clone(unknown_exception(e)));
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
exception_detail::clone_base & e )
|
||||
{
|
||||
return shared_ptr<exception_detail::clone_base const>(e.clone());
|
||||
}
|
||||
catch(
|
||||
std::invalid_argument & 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::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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,65 +292,30 @@ boost
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
return exception_ptr(exception_detail::current_exception_impl());
|
||||
}
|
||||
catch(
|
||||
exception_detail::cloning_base & e )
|
||||
std::bad_alloc & )
|
||||
{
|
||||
exception_detail::clone_base const * c = e.clone();
|
||||
BOOST_ASSERT(c!=0);
|
||||
return exception_ptr(c);
|
||||
}
|
||||
catch(
|
||||
std::invalid_argument & 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::bad_alloc & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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();
|
||||
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>
|
||||
@ -179,7 +327,8 @@ boost
|
||||
{
|
||||
throw enable_current_exception(e);
|
||||
}
|
||||
catch( ... )
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return current_exception();
|
||||
}
|
||||
@ -189,7 +338,11 @@ boost
|
||||
void
|
||||
rethrow_exception( exception_ptr const & p )
|
||||
{
|
||||
p->rethrow();
|
||||
BOOST_ASSERT(p);
|
||||
if( p.bad_alloc_ )
|
||||
throw enable_current_exception(std::bad_alloc());
|
||||
else
|
||||
p.c_->rethrow();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <exception>
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_NO_TYPEID )
|
||||
# define BOOST_EXCEPTION_DISABLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x590 )
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
|
||||
# define BOOST_EXCEPTION_DISABLE
|
||||
#endif
|
||||
|
||||
@ -37,8 +33,14 @@
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
|
||||
# include <boost/exception/enable_current_exception.hpp>
|
||||
# include <boost/exception/enable_error_info.hpp>
|
||||
# include <boost/exception/exception.hpp>
|
||||
# include <boost/current_function.hpp>
|
||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
|
||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
||||
::boost::throw_file(__FILE__) <<\
|
||||
::boost::throw_line((int)__LINE__))
|
||||
#else
|
||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
|
29
test/1-throw_exception_test.cpp
Normal file
29
test/1-throw_exception_test.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_ERROR("boost::throw_exception failed to throw.");
|
||||
}
|
||||
catch(
|
||||
my_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_ERROR("boost::throw_exception malfunction.");
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
30
test/2-throw_exception_no_exceptions_test.cpp
Normal file
30
test/2-throw_exception_no_exceptions_test.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#define BOOST_NO_EXCEPTIONS
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
|
||||
bool called=false;
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
void
|
||||
throw_exception( std::exception const & )
|
||||
{
|
||||
called=true;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_TEST(called);
|
||||
return boost::report_errors();
|
||||
}
|
30
test/3-throw_exception_no_integration_test.cpp
Normal file
30
test/3-throw_exception_no_integration_test.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#define BOOST_EXCEPTION_DISABLE
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_ERROR("boost::throw_exception failed to throw.");
|
||||
}
|
||||
catch(
|
||||
my_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_ERROR("boost::throw_exception malfunction.");
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
31
test/4-throw_exception_no_both_test.cpp
Normal file
31
test/4-throw_exception_no_both_test.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#define BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_EXCEPTION_DISABLE
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
|
||||
bool called=false;
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
void
|
||||
throw_exception( std::exception const & )
|
||||
{
|
||||
called=true;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_TEST(called);
|
||||
return boost::report_errors();
|
||||
}
|
@ -19,16 +19,20 @@ compile-fail to_string_fail.cpp ;
|
||||
|
||||
#exception
|
||||
|
||||
run 1-throw_exception_test.cpp ;
|
||||
run 2-throw_exception_no_exceptions_test.cpp ;
|
||||
run 3-throw_exception_no_integration_test.cpp ;
|
||||
run 4-throw_exception_no_both_test.cpp ;
|
||||
run cloning_test.cpp ;
|
||||
run copy_exception_test.cpp ;
|
||||
run unknown_exception_test.cpp ;
|
||||
run exception_test.cpp ;
|
||||
run boost_error_info_test.cpp ;
|
||||
run enable_error_info_test.cpp helper1.cpp ;
|
||||
run throw_exception_test.cpp helper2.cpp ;
|
||||
run errno_test.cpp ;
|
||||
run error_info_test.cpp ;
|
||||
run diagnostic_information_test.cpp ;
|
||||
run refcount_ptr_test.cpp ;
|
||||
compile-fail exception_fail.cpp ;
|
||||
compile-fail throw_exception_fail.cpp ;
|
||||
|
||||
@ -36,10 +40,9 @@ compile-fail throw_exception_fail.cpp ;
|
||||
|
||||
compile exception_ptr_hpp_test.cpp ;
|
||||
compile diagnostic_information_hpp_test.cpp ;
|
||||
compile enable_current_exception_hpp_test.cpp ;
|
||||
compile enable_error_info_hpp_test.cpp ;
|
||||
compile error_info_hpp_test.cpp ;
|
||||
compile exception_hpp_test.cpp ;
|
||||
compile get_error_info_hpp_test.cpp ;
|
||||
compile info_hpp_test.cpp ;
|
||||
compile info_tuple_hpp_test.cpp ;
|
||||
compile to_string_hpp_test.cpp ;
|
||||
|
@ -1,40 +0,0 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace
|
||||
test
|
||||
{
|
||||
class my_exception: public boost::exception { };
|
||||
|
||||
typedef boost::error_info<struct tag_my_info,int> my_info;
|
||||
|
||||
void
|
||||
test_boost_error_info()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw my_exception() << BOOST_ERROR_INFO << my_info(1);
|
||||
}
|
||||
catch(
|
||||
my_exception & x )
|
||||
{
|
||||
BOOST_TEST(1==*boost::get_error_info<my_info>(x));
|
||||
BOOST_TEST(boost::get_error_info<boost::throw_function>(x));
|
||||
BOOST_TEST(boost::get_error_info<boost::throw_file>(x));
|
||||
BOOST_TEST(boost::get_error_info<boost::throw_line>(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test::test_boost_error_info();
|
||||
return boost::report_errors();
|
||||
}
|
@ -4,32 +4,272 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <string>
|
||||
|
||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
||||
struct my_tag {};
|
||||
#endif
|
||||
|
||||
typedef boost::error_info<struct my_tag,int> my_info;
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
may_throw_on_copy
|
||||
{
|
||||
may_throw_on_copy():
|
||||
throw_(false)
|
||||
{
|
||||
}
|
||||
|
||||
may_throw_on_copy( may_throw_on_copy const & x ):
|
||||
throw_(x.throw_)
|
||||
{
|
||||
if( throw_ )
|
||||
throw T();
|
||||
}
|
||||
|
||||
bool throw_;
|
||||
};
|
||||
|
||||
struct
|
||||
test_exception:
|
||||
derives_nothing
|
||||
{
|
||||
int & count;
|
||||
|
||||
explicit
|
||||
derives_nothing( int & c ):
|
||||
count(c)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
||||
derives_nothing( derives_nothing const & x ):
|
||||
count(x.count)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
||||
~derives_nothing()
|
||||
{
|
||||
--count;
|
||||
}
|
||||
};
|
||||
|
||||
struct
|
||||
derives_std_exception:
|
||||
std::exception
|
||||
{
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
struct
|
||||
derives_std_boost_exception:
|
||||
std::exception,
|
||||
boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
struct
|
||||
derives_boost_exception:
|
||||
boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
test_std_exception()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw boost::enable_current_exception(test_exception());
|
||||
throw T();
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
test_exception & )
|
||||
T & )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
T & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
test_std_exception_what()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw T("what");
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
T & x )
|
||||
{
|
||||
BOOST_TEST(std::string("what")==x.what());
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
T & x )
|
||||
{
|
||||
BOOST_TEST(std::string("what")==x.what());
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Throw,class Catch>
|
||||
void
|
||||
test_throw_on_copy()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
throw boost::enable_current_exception(may_throw_on_copy<Throw>());
|
||||
}
|
||||
catch(
|
||||
may_throw_on_copy<Throw> & x )
|
||||
{
|
||||
x.throw_=true;
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
Catch & )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
boost::rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
Catch & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BOOST_TEST( boost::exception_ptr()==boost::exception_ptr() );
|
||||
BOOST_TEST( !(boost::exception_ptr()!=boost::exception_ptr()) );
|
||||
BOOST_TEST( !boost::exception_ptr() );
|
||||
|
||||
int count=0;
|
||||
try
|
||||
{
|
||||
throw boost::enable_current_exception(derives_nothing(count));
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
derives_nothing & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
@ -38,5 +278,194 @@ main()
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
BOOST_TEST(count==0);
|
||||
|
||||
try
|
||||
{
|
||||
throw boost::enable_current_exception(derives_std_exception());
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
derives_std_exception & )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
derives_std_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
throw derives_std_exception();
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
test_std_exception_what<std::invalid_argument>();
|
||||
test_std_exception_what<std::out_of_range>();
|
||||
test_std_exception_what<std::logic_error>();
|
||||
test_std_exception<std::bad_alloc>();
|
||||
#ifndef BOOST_NO_TYPEID
|
||||
test_std_exception<std::bad_cast>();
|
||||
test_std_exception<std::bad_typeid>();
|
||||
#endif
|
||||
test_std_exception<std::bad_exception>();
|
||||
|
||||
try
|
||||
{
|
||||
throw derives_std_boost_exception() << my_info(42);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & x )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<my_info>(x));
|
||||
if( boost::shared_ptr<int const> p=boost::get_error_info<my_info>(x) )
|
||||
BOOST_TEST(*p==42);
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & x )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<my_info>(x));
|
||||
if( boost::shared_ptr<int const> p=boost::get_error_info<my_info>(x) )
|
||||
BOOST_TEST(*p==42);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
throw derives_boost_exception() << my_info(42);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & x )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<my_info>(x));
|
||||
if( boost::shared_ptr<int const> p=boost::get_error_info<my_info>(x) )
|
||||
BOOST_TEST(*p==42);
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
BOOST_TEST(!(p==boost::exception_ptr()));
|
||||
BOOST_TEST(p!=boost::exception_ptr());
|
||||
BOOST_TEST(p);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & x )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<my_info>(x));
|
||||
if( boost::shared_ptr<int const> p=boost::get_error_info<my_info>(x) )
|
||||
BOOST_TEST(*p==42);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
test_throw_on_copy<std::bad_alloc,std::bad_alloc>();
|
||||
test_throw_on_copy<int,std::bad_exception>();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
|
@ -6,12 +6,18 @@
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
typedef boost::error_info<struct tag,int> tag_int;
|
||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
||||
struct test_tag {};
|
||||
#endif
|
||||
|
||||
typedef boost::error_info<struct test_tag,int> tag_int;
|
||||
|
||||
struct
|
||||
error1:
|
||||
public std::exception
|
||||
public std::exception,
|
||||
public boost::exception
|
||||
{
|
||||
char const *
|
||||
what() const throw()
|
||||
@ -22,53 +28,55 @@ error1:
|
||||
|
||||
struct
|
||||
error2:
|
||||
public std::exception,
|
||||
public boost::exception
|
||||
{
|
||||
char const *
|
||||
what() const throw()
|
||||
{
|
||||
return "error2";
|
||||
}
|
||||
};
|
||||
|
||||
struct
|
||||
error3:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
std::string
|
||||
get_diagnostic_information( std::exception const & x )
|
||||
{
|
||||
return boost::diagnostic_information(x);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost;
|
||||
try
|
||||
{
|
||||
error1 x;
|
||||
error1 x; x << tag_int(42);
|
||||
BOOST_TEST(x.what()==std::string("error1"));
|
||||
std::string di=get_diagnostic_information(x);
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
std::string di=boost::diagnostic_information(x);
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error1")!=std::string::npos);
|
||||
#endif
|
||||
BOOST_TEST(di.find("test_tag")!=std::string::npos);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
error2 x; x << tag_int(42);
|
||||
BOOST_TEST(x.what()==std::string("error2"));
|
||||
std::string di=get_diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error2")!=std::string::npos);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
try
|
||||
{
|
||||
error3 x;
|
||||
error2 x;
|
||||
x << tag_int(1);
|
||||
std::string w1 = x.diagnostic_information();
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
std::string w1 = diagnostic_information(x);
|
||||
x << tag_int(2);
|
||||
std::string w2 = x.diagnostic_information();
|
||||
std::string w2 = diagnostic_information(x);
|
||||
BOOST_TEST( w1!=w2 );
|
||||
BOOST_TEST(w1.find("test_tag")!=std::string::npos);
|
||||
BOOST_TEST(w2.find("test_tag")!=std::string::npos);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#include <boost/exception/enable_error_info.hpp>
|
@ -4,6 +4,7 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "helper1.hpp"
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -44,7 +45,26 @@ main()
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
BOOST_TEST( 42==*boost::get_error_info<test_int>(x) );
|
||||
#ifdef BOOST_NO_RTTI
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
#endif
|
||||
BOOST_TEST( boost::get_error_info<test_int>(x) );
|
||||
if( boost::shared_ptr<int const> p=boost::get_error_info<test_int>(x) )
|
||||
BOOST_TEST( 42==*p );
|
||||
#ifdef BOOST_NO_RTTI
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
#endif
|
||||
BOOST_TEST( std::string(x.what())==std::string("exception test length error") );
|
||||
}
|
||||
catch(
|
||||
|
@ -3,10 +3,16 @@
|
||||
//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)
|
||||
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#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;
|
||||
|
||||
class
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/error_info.hpp>
|
||||
#include <boost/exception/error_info.hpp>
|
||||
|
@ -3,18 +3,55 @@
|
||||
//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)
|
||||
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
struct throws_on_copy;
|
||||
struct non_printable { };
|
||||
|
||||
struct
|
||||
user_data
|
||||
{
|
||||
int & count;
|
||||
|
||||
explicit
|
||||
user_data( int & count ):
|
||||
count(count)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
||||
user_data( user_data const & x ):
|
||||
count(x.count)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
||||
~user_data()
|
||||
{
|
||||
--count;
|
||||
}
|
||||
};
|
||||
|
||||
#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_2,unsigned int> test_2;
|
||||
typedef boost::error_info<struct tag_test_3,float> test_3;
|
||||
typedef boost::error_info<struct tag_test_4,throws_on_copy> test_4;
|
||||
typedef boost::error_info<struct tag_test_5,std::string> test_5;
|
||||
typedef boost::error_info<struct tag_test_6,non_printable> test_6;
|
||||
typedef boost::error_info<struct tag_user_data,user_data> test_7;
|
||||
|
||||
struct
|
||||
test_exception:
|
||||
@ -38,12 +75,20 @@ throws_on_copy
|
||||
void
|
||||
basic_test()
|
||||
{
|
||||
test_exception x;
|
||||
x << test_1(1) << test_2(2u) << test_3(3.14159f);
|
||||
BOOST_TEST(*boost::get_error_info<test_1>(x)==1);
|
||||
BOOST_TEST(*boost::get_error_info<test_2>(x)==2u);
|
||||
BOOST_TEST(*boost::get_error_info<test_3>(x)==3.14159f);
|
||||
BOOST_TEST(!boost::get_error_info<test_4>(x));
|
||||
try
|
||||
{
|
||||
test_exception x;
|
||||
x << test_1(1) << test_2(2u) << test_3(3.14159f);
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST(*boost::get_error_info<test_1>(x)==1);
|
||||
BOOST_TEST(*boost::get_error_info<test_2>(x)==2u);
|
||||
BOOST_TEST(*boost::get_error_info<test_3>(x)==3.14159f);
|
||||
BOOST_TEST(!boost::get_error_info<test_4>(x));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -58,8 +103,8 @@ exception_safety_test()
|
||||
catch(
|
||||
test_exception & )
|
||||
{
|
||||
BOOST_TEST(!boost::get_error_info<test_4>(x));
|
||||
}
|
||||
BOOST_TEST(!boost::get_error_info<test_4>(x));
|
||||
}
|
||||
|
||||
void
|
||||
@ -107,7 +152,9 @@ test_empty()
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_TEST( dynamic_cast<test_exception *>(&x) );
|
||||
#endif
|
||||
BOOST_TEST( !boost::get_error_info<test_1>(x) );
|
||||
}
|
||||
catch(
|
||||
@ -124,7 +171,9 @@ test_empty()
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST( dynamic_cast<boost::exception *>(&x) );
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_TEST( dynamic_cast<boost::exception const *>(&x)!=0 );
|
||||
#endif
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
@ -245,6 +294,29 @@ test_add_tuple()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_lifetime()
|
||||
{
|
||||
int count=0;
|
||||
try
|
||||
{
|
||||
throw test_exception() << test_7(user_data(count));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
BOOST_TEST(count==1);
|
||||
BOOST_TEST( boost::get_error_info<test_7>(x) );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
BOOST_TEST(!count);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -254,5 +326,6 @@ main()
|
||||
test_basic_throw_catch();
|
||||
test_catch_add_info();
|
||||
test_add_tuple();
|
||||
test_lifetime();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <boost/exception.hpp>
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
|
@ -3,4 +3,5 @@
|
||||
//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)
|
||||
|
||||
#include <boost/exception/enable_current_exception.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
@ -3,7 +3,7 @@
|
||||
//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)
|
||||
|
||||
#include <boost/exception/enable_error_info.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
|
103
test/refcount_ptr_test.cpp
Normal file
103
test/refcount_ptr_test.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
//Copyright (c) 2006-2008 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)
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct
|
||||
test_type
|
||||
{
|
||||
test_type( int & count ):
|
||||
count_(count)
|
||||
{
|
||||
BOOST_TEST(count_==42);
|
||||
count_=0;
|
||||
}
|
||||
|
||||
~test_type()
|
||||
{
|
||||
BOOST_TEST(!count_);
|
||||
count_=42;
|
||||
}
|
||||
|
||||
void
|
||||
add_ref()
|
||||
{
|
||||
++count_;
|
||||
}
|
||||
|
||||
void
|
||||
release()
|
||||
{
|
||||
if( !--count_ )
|
||||
delete this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
test_type( test_type const & );
|
||||
test_type & operator=( test_type const & );
|
||||
|
||||
int & count_;
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using boost::exception_detail::refcount_ptr;
|
||||
|
||||
{
|
||||
refcount_ptr<test_type> x;
|
||||
BOOST_TEST(!x.get());
|
||||
}
|
||||
|
||||
{
|
||||
int count=42;
|
||||
test_type * a=new test_type(count);
|
||||
BOOST_TEST(!count);
|
||||
{
|
||||
refcount_ptr<test_type> p;
|
||||
BOOST_TEST(0==count);
|
||||
p.adopt(a);
|
||||
BOOST_TEST(p.get()==a);
|
||||
BOOST_TEST(1==count);
|
||||
{
|
||||
refcount_ptr<test_type> q;
|
||||
q.adopt(p.get());
|
||||
BOOST_TEST(q.get()==a);
|
||||
BOOST_TEST(2==count);
|
||||
{
|
||||
refcount_ptr<test_type> t(p);
|
||||
BOOST_TEST(t.get()==a);
|
||||
BOOST_TEST(3==count);
|
||||
{
|
||||
refcount_ptr<test_type> n;
|
||||
n=t;
|
||||
BOOST_TEST(n.get()==a);
|
||||
BOOST_TEST(4==count);
|
||||
int cb=42;
|
||||
test_type * b=new test_type(cb);
|
||||
BOOST_TEST(0==cb);
|
||||
n.adopt(b);
|
||||
BOOST_TEST(1==cb);
|
||||
BOOST_TEST(n.get()==b);
|
||||
BOOST_TEST(3==count);
|
||||
n.adopt(0);
|
||||
BOOST_TEST(42==cb);
|
||||
}
|
||||
BOOST_TEST(t.get()==a);
|
||||
BOOST_TEST(3==count);
|
||||
}
|
||||
BOOST_TEST(q.get()==a);
|
||||
BOOST_TEST(2==count);
|
||||
}
|
||||
BOOST_TEST(p.get()==a);
|
||||
BOOST_TEST(1==count);
|
||||
}
|
||||
BOOST_TEST(42==count);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
@ -4,12 +4,73 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "helper2.hpp"
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
typedef boost::error_info<struct tag_test_int,int> test_data;
|
||||
|
||||
struct
|
||||
exception1:
|
||||
std::exception
|
||||
{
|
||||
};
|
||||
|
||||
struct
|
||||
exception2:
|
||||
std::exception,
|
||||
boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
void
|
||||
boost_throw_exception_test()
|
||||
{
|
||||
try
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(exception1());
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
boost::shared_ptr<char const * const> file=boost::get_error_info<boost::throw_function>(x);
|
||||
boost::shared_ptr<char const * const> function=boost::get_error_info<boost::throw_file>(x);
|
||||
boost::shared_ptr<int const> line=boost::get_error_info<boost::throw_line>(x);
|
||||
BOOST_TEST( file && *file );
|
||||
BOOST_TEST( function && *function );
|
||||
BOOST_TEST( line && *line==32 );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
try
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(exception2() << test_data(42));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
boost::shared_ptr<char const * const> file=boost::get_error_info<boost::throw_function>(x);
|
||||
boost::shared_ptr<char const * const> function=boost::get_error_info<boost::throw_file>(x);
|
||||
boost::shared_ptr<int const> line=boost::get_error_info<boost::throw_line>(x);
|
||||
boost::shared_ptr<int const> data=boost::get_error_info<test_data>(x);
|
||||
BOOST_TEST( file && *file );
|
||||
BOOST_TEST( function && *function );
|
||||
BOOST_TEST( line && *line==52 );
|
||||
BOOST_TEST( data && *data==42 );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
throw_fwd( void (*thrower)(int) )
|
||||
{
|
||||
@ -46,9 +107,26 @@ tester()
|
||||
catch(
|
||||
T & y )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<test_data>(y));
|
||||
if( boost::shared_ptr<int const> d=boost::get_error_info<test_data>(y) )
|
||||
BOOST_TEST(*d==42);
|
||||
#ifdef BOOST_NO_RTTI
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
boost::exception & y )
|
||||
{
|
||||
#endif
|
||||
BOOST_TEST(boost::get_error_info<test_data>(y));
|
||||
if( boost::shared_ptr<int const> d=boost::get_error_info<test_data>(y) )
|
||||
BOOST_TEST(*d==42);
|
||||
#ifdef BOOST_NO_RTTI
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
#endif
|
||||
BOOST_TEST(y.x_==42);
|
||||
}
|
||||
catch(
|
||||
@ -62,6 +140,7 @@ tester()
|
||||
int
|
||||
main()
|
||||
{
|
||||
boost_throw_exception_test();
|
||||
tester<boost::exception_test::derives_boost_exception>();
|
||||
tester<boost::exception_test::derives_boost_exception_virtually>();
|
||||
tester<boost::exception_test::derives_std_exception>();
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/to_string.hpp>
|
||||
#include <boost/exception/to_string.hpp>
|
||||
|
@ -4,3 +4,4 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
|
@ -4,8 +4,14 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
||||
struct tag_test {};
|
||||
#endif
|
||||
|
||||
typedef boost::error_info<struct tag_test,int> test;
|
||||
|
||||
|
Reference in New Issue
Block a user