forked from boostorg/exception
Merging from trunk: new function diagnostic_information_what, and mutable error info access.
[SVN r56477]
This commit is contained in:
@ -34,6 +34,8 @@ boost
|
|||||||
|
|
||||||
std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & p );</span>
|
std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & p );</span>
|
||||||
|
|
||||||
|
<span class="RenoIncludeSPAN">char const * <span class="RenoLink"><a href="diagnostic_information_what.html">diagnostic_information_what</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & e ) throw();</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></span>();</span></span>
|
<span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></span>();</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
@ -41,6 +43,7 @@ boost
|
|||||||
<div class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp<br/>
|
<div class="RenoPageList"><a href="boost_exception_all_hpp.html">boost/exception/all.hpp<br/>
|
||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="synopsis.html">Synopsis<br/>
|
</a><a href="synopsis.html">Synopsis<br/>
|
||||||
</a></div>
|
</a></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,int> <span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>;</span></span>
|
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,char const *> <span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>;</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
<h3>See Also:</h3>
|
<h3>See Also:</h3>
|
||||||
|
@ -28,7 +28,10 @@ namespace
|
|||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
|
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template <class ErrorInfo,class E>
|
||||||
typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const * <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>( E const & x );</span></span>
|
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> const * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E const & x );
|
||||||
|
|
||||||
|
template <class ErrorInfo,class E>
|
||||||
|
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E & x );</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
<h3>See Also:</h3>
|
<h3>See Also:</h3>
|
||||||
|
@ -36,7 +36,8 @@ boost
|
|||||||
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;
|
||||||
|
<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> & <span class="RenoLink"><a href="error_info_value.html">value</a></span>();</span>
|
||||||
};</span>
|
};</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
||||||
|
@ -78,6 +78,7 @@ std::exception::what: example_io error
|
|||||||
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
</a><a href="configuration_macros.html">Configuration Macros<br/>
|
||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="frequently_asked_questions.html">Frequently Asked Questions<br/>
|
</a><a href="frequently_asked_questions.html">Frequently Asked Questions<br/>
|
||||||
</a><a href="motivation.html">Motivation<br/>
|
</a><a href="motivation.html">Motivation<br/>
|
||||||
</a><a href="throw_exception.html">throw_exception<br/>
|
</a><a href="throw_exception.html">throw_exception<br/>
|
||||||
|
59
doc/diagnostic_information_what.html
Normal file
59
doc/diagnostic_information_what.html
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<!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>diagnostic_information_what</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="../../../boost.png" alt="Boost" width="277" height="86"/></a>
|
||||||
|
</div>
|
||||||
|
<h1>Boost Exception</h1>
|
||||||
|
</div>
|
||||||
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
|
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
|
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>diagnostic_information_what</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>><span class="RenoBR"> </span><br/></p>
|
||||||
|
<pre>namespace
|
||||||
|
boost
|
||||||
|
{
|
||||||
|
<span class="RenoIncludeSPAN"> char const * <span class="RenoLink">diagnostic_information_what</span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & e ) throw();</span>
|
||||||
|
}</pre>
|
||||||
|
</div><p>The <span class="RenoLink">diagnostic_information_what</span> function is intended to be called from a user-defined std::exception::what() override. This allows diagnostic information to be returned as the what() string.</p>
|
||||||
|
<h4>Returns:</h4>
|
||||||
|
<p>A pointer to a zero-terminated buffer that contains a string similar to the std::string returned by the <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> function, or null to indicate a failure.</p>
|
||||||
|
<h4>Throws:</h4>
|
||||||
|
<p>Nothing.</p>
|
||||||
|
<h4>Note:</h4>
|
||||||
|
<p>The returned pointer becomes invalid if any <span class="RenoLink"><a href="error_info.html">error_info</a></span> is modified or added to the exception object, or if another diagnostic information function is called.</p>
|
||||||
|
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
|
<h3>See Also:</h3>
|
||||||
|
<div class="RenoPageList"><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp<br/>
|
||||||
|
</a></div>
|
||||||
|
</div>
|
||||||
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
|
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||||
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||||
|
<div id="footer">
|
||||||
|
<p> </p>
|
||||||
|
<hr/>
|
||||||
|
<p>
|
||||||
|
<a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><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-2009 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>
|
@ -27,7 +27,7 @@
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,int> <span class="RenoLink">errinfo_api_function</span>;</span></span>
|
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,char const *> <span class="RenoLink">errinfo_api_function</span>;</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div></div><p>This type is designed to be used as a standard <span class="RenoLink"><a href="error_info.html">error_info</a></span> instance for transporting the name of a relevant API function (which does not use exceptions to report errors) in exceptions deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
</div></div><p>This type is designed to be used as a standard <span class="RenoLink"><a href="error_info.html">error_info</a></span> instance for transporting the name of a relevant API function (which does not use exceptions to report errors) in exceptions deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||||
<h3>Example:</h3>
|
<h3>Example:</h3>
|
||||||
|
@ -34,7 +34,8 @@ boost
|
|||||||
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;
|
||||||
|
<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> & <span class="RenoLink"><a href="error_info_value.html">value</a></span>();</span>
|
||||||
};</span>
|
};</span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div><h4>Requirements:</h4>
|
</div><h4>Requirements:</h4>
|
||||||
@ -75,6 +76,7 @@ typedef boost::<span class="RenoLink">error_info</span><struct tag_errno,int&
|
|||||||
</a><a href="boost_exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
</a><a href="boost_exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
||||||
</a><a href="boost_exception_info_hpp.html">boost/exception/info.hpp<br/>
|
</a><a href="boost_exception_info_hpp.html">boost/exception/info.hpp<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
||||||
</a><a href="error_info_value.html">error_info::value<br/>
|
</a><a href="error_info_value.html">error_info::value<br/>
|
||||||
</a><a href="error_info_value_type.html">error_info::value_type<br/>
|
</a><a href="error_info_value_type.html">error_info::value_type<br/>
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>error_info::value</h3>
|
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>error_info::value</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_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="boost_exception_info_hpp.html">boost/exception/info.hpp</a></span>></p>
|
||||||
<pre><span class="RenoIncludeSPAN"><span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink">value</span>() const;</span></pre>
|
<pre><span class="RenoIncludeSPAN"><span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink">value</span>() const;
|
||||||
|
<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> & <span class="RenoLink">value</span>();</span></pre>
|
||||||
</div><h4>Description:</h4>
|
</div><h4>Description:</h4>
|
||||||
<p>Returns a const reference to the copy of the value passed to <span class="RenoLink"><a href="error_info.html">error_info</a></span>'s constructor stored in the <span class="RenoLink"><a href="error_info.html">error_info</a></span> object.</p>
|
<p>Returns a (const) reference to the copy of the value passed to <span class="RenoLink"><a href="error_info.html">error_info</a></span>'s constructor stored in the <span class="RenoLink"><a href="error_info.html">error_info</a></span> object.</p>
|
||||||
<h4>Throws:</h4>
|
<h4>Throws:</h4>
|
||||||
<p>Nothing.</p>
|
<p>Nothing.</p>
|
||||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
<div class="RenoPageList"><a href="error_info.html">error_info<br/>
|
<div class="RenoPageList"><a href="error_info.html">error_info<br/>
|
||||||
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
</a><a href="error_info_error_info.html">error_info::error_info<br/>
|
||||||
</a><a href="error_info_value.html">error_info::value<br/>
|
</a><a href="error_info_value.html">error_info::value<br/>
|
||||||
</a><a href="get_error_info.html">get_error_info<br/>
|
|
||||||
</a></div>
|
</a></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||||
|
@ -48,6 +48,7 @@ boost
|
|||||||
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
</a><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information<br/>
|
||||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||||
|
</a><a href="diagnostic_information_what.html">diagnostic_information_what<br/>
|
||||||
</a><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags<br/>
|
</a><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags<br/>
|
||||||
</a><a href="enable_current_exception.html">enable_current_exception<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="enable_error_info.html">enable_error_info<br/>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<p><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></p>
|
<p><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></p>
|
||||||
<h3>d</h3>
|
<h3>d</h3>
|
||||||
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
||||||
|
<p><a href="diagnostic_information_what.html">diagnostic_information_what</a></p>
|
||||||
<h3>e</h3>
|
<h3>e</h3>
|
||||||
<p><a href="enable_current_exception.html">enable_current_exception</a></p>
|
<p><a href="enable_current_exception.html">enable_current_exception</a></p>
|
||||||
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
||||||
|
@ -25,7 +25,10 @@
|
|||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
<span class="RenoIncludeSPAN"> template <class ErrorInfo,class E>
|
<span class="RenoIncludeSPAN"> template <class ErrorInfo,class E>
|
||||||
typename ErrorInfo::<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const * <span class="RenoLink">get_error_info</span>( E const & x );</span>
|
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> const * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E const & x );
|
||||||
|
|
||||||
|
template <class ErrorInfo,class E>
|
||||||
|
typename ErrorInfo::<span class="RenoLink"><a href="error_info::value_type">error_info::value_type</a></span> * <span class="RenoLink"><a href="get_error_info">get_error_info</a></span>( E & x );</span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div><h4>Requirements:</h4>
|
</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>
|
<div><ul><li> ErrorInfo must be an instance of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template.</li>
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<p><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></p>
|
<p><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></p>
|
||||||
<h3>d</h3>
|
<h3>d</h3>
|
||||||
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
||||||
|
<p><a href="diagnostic_information_what.html">diagnostic_information_what</a></p>
|
||||||
<h3>E</h3>
|
<h3>E</h3>
|
||||||
<p><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags</a></p>
|
<p><a href="exception_types_as_simple_semantic_tags.html">Exception Types as Simple Semantic Tags</a></p>
|
||||||
<h3>e</h3>
|
<h3>e</h3>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,8 @@ boost
|
|||||||
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
<span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_error_info.html">error_info</a></span>( <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & v );</span>
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
|
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const & <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;
|
||||||
|
<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> & <span class="RenoLink"><a href="error_info_value.html">value</a></span>();</span>
|
||||||
};</span>
|
};</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
<span class="RenoIncludeSPAN">template <class E, class Tag, class T>
|
||||||
@ -106,6 +107,8 @@ boost
|
|||||||
|
|
||||||
std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & p );</span>
|
std::string <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & p );</span>
|
||||||
|
|
||||||
|
<span class="RenoIncludeSPAN">char const * <span class="RenoLink"><a href="diagnostic_information_what.html">diagnostic_information_what</a></span>( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> const & e ) throw();</span>
|
||||||
|
|
||||||
<span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></span>();</span></span>
|
<span class="RenoIncludeSPAN">std::string <span class="RenoLink"><a href="current_exception_diagnostic_information.html">current_exception_diagnostic_information</a></span>();</span></span>
|
||||||
}</span></pre>
|
}</span></pre>
|
||||||
<p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_current_exception_cast_hpp.html">boost/exception/current_exception_cast.hpp</a></span>></p>
|
<p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_current_exception_cast_hpp.html">boost/exception/current_exception_cast.hpp</a></span>></p>
|
||||||
@ -178,7 +181,7 @@ boost
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,int> <span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>;</span></span>
|
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span><struct errinfo_api_function_,char const *> <span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>;</span></span>
|
||||||
}</pre>
|
}</pre>
|
||||||
</div><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_errinfo_at_line_hpp.html">boost/exception/errinfo_at_line.hpp</a></span>></p>
|
</div><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="boost_exception_errinfo_at_line_hpp.html">boost/exception/errinfo_at_line.hpp</a></span>></p>
|
||||||
<div class="RenoIncludeDIV"><pre>#include <<span class="RenoLink"><a href="boost_exception_error_info_hpp.html">boost/exception/error_info.hpp</a></span>>
|
<div class="RenoIncludeDIV"><pre>#include <<span class="RenoLink"><a href="boost_exception_error_info_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||||
|
@ -17,5 +17,5 @@ file_read( FILE * f, void * buffer, size_t size )
|
|||||||
{
|
{
|
||||||
if( size!=fread(buffer,1,size,f) )
|
if( size!=fread(buffer,1,size,f) )
|
||||||
throw boost::enable_current_exception(file_read_error()) <<
|
throw boost::enable_current_exception(file_read_error()) <<
|
||||||
boost::errinfo_errno(errno);
|
boost::errinfo_errno(errno);
|
||||||
}
|
}
|
||||||
|
@ -27,27 +27,27 @@ struct file_read_error: virtual file_error { };
|
|||||||
|
|
||||||
boost::shared_ptr<FILE>
|
boost::shared_ptr<FILE>
|
||||||
open_file( char const * file, char const * mode )
|
open_file( char const * file, char const * mode )
|
||||||
{
|
{
|
||||||
if( FILE * f=fopen(file,mode) )
|
if( FILE * f=fopen(file,mode) )
|
||||||
return boost::shared_ptr<FILE>(f,fclose);
|
return boost::shared_ptr<FILE>(f,fclose);
|
||||||
else
|
else
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
file_open_error() <<
|
file_open_error() <<
|
||||||
boost::errinfo_api_function("fopen") <<
|
boost::errinfo_api_function("fopen") <<
|
||||||
boost::errinfo_errno(errno) <<
|
boost::errinfo_errno(errno) <<
|
||||||
boost::errinfo_file_name(file) <<
|
boost::errinfo_file_name(file) <<
|
||||||
boost::errinfo_file_open_mode(mode) );
|
boost::errinfo_file_open_mode(mode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
read_file( boost::shared_ptr<FILE> const & f, void * buf, size_t size )
|
read_file( boost::shared_ptr<FILE> const & f, void * buf, size_t size )
|
||||||
{
|
{
|
||||||
size_t nr=fread(buf,1,size,f.get());
|
size_t nr=fread(buf,1,size,f.get());
|
||||||
if( ferror(f.get()) )
|
if( ferror(f.get()) )
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
file_read_error() <<
|
file_read_error() <<
|
||||||
boost::errinfo_api_function("fread") <<
|
boost::errinfo_api_function("fread") <<
|
||||||
boost::errinfo_errno(errno) <<
|
boost::errinfo_errno(errno) <<
|
||||||
boost::errinfo_file_handle(f) );
|
boost::errinfo_file_handle(f) );
|
||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ void
|
|||||||
file_read( FILE * f, void * buffer, size_t size )
|
file_read( FILE * f, void * buffer, size_t size )
|
||||||
{
|
{
|
||||||
if( size!=fread(buffer,1,size,f) )
|
if( size!=fread(buffer,1,size,f) )
|
||||||
throw file_read_error() << boost::errinfo_errno(errno);
|
throw file_read_error() << boost::errinfo_errno(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -39,7 +39,7 @@ parse_file( char const * file_name )
|
|||||||
catch(
|
catch(
|
||||||
boost::exception & e )
|
boost::exception & e )
|
||||||
{
|
{
|
||||||
e << boost::errinfo_file_name(file_name);
|
e << boost::errinfo_file_name(file_name);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,10 @@ my_fopen( char const * name, char const * mode )
|
|||||||
return boost::shared_ptr<FILE>(f,fclose);
|
return boost::shared_ptr<FILE>(f,fclose);
|
||||||
else
|
else
|
||||||
BOOST_THROW_EXCEPTION(fopen_error() <<
|
BOOST_THROW_EXCEPTION(fopen_error() <<
|
||||||
boost::errinfo_errno (errno) <<
|
boost::errinfo_errno (errno) <<
|
||||||
boost::errinfo_file_name(name) <<
|
boost::errinfo_file_name(name) <<
|
||||||
boost::errinfo_file_open_mode(mode) <<
|
boost::errinfo_file_open_mode(mode) <<
|
||||||
boost::errinfo_api_function("fopen"));
|
boost::errinfo_api_function("fopen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -75,7 +75,7 @@ my_fread( void * buffer, size_t size, size_t count, boost::shared_ptr<FILE> cons
|
|||||||
BOOST_THROW_EXCEPTION(fread_error() <<
|
BOOST_THROW_EXCEPTION(fread_error() <<
|
||||||
boost::errinfo_api_function("fread") <<
|
boost::errinfo_api_function("fread") <<
|
||||||
boost::errinfo_errno(errno) <<
|
boost::errinfo_errno(errno) <<
|
||||||
boost::errinfo_file_handle(boost::weak_ptr<FILE>(stream)));
|
boost::errinfo_file_handle(boost::weak_ptr<FILE>(stream)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -26,6 +26,6 @@ file_open( char const * name, char const * mode )
|
|||||||
return boost::shared_ptr<FILE>(f,fclose);
|
return boost::shared_ptr<FILE>(f,fclose);
|
||||||
else
|
else
|
||||||
throw file_open_error() <<
|
throw file_open_error() <<
|
||||||
boost::errinfo_file_name(name) <<
|
boost::errinfo_file_name(name) <<
|
||||||
clib_failure("fopen",errno);
|
clib_failure("fopen",errno);
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,18 @@ boost
|
|||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value_type &
|
||||||
|
value()
|
||||||
|
{
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
char const * tag_typeid_name() const;
|
char const * tag_typeid_name() const;
|
||||||
std::string value_as_string() const;
|
std::string value_as_string() const;
|
||||||
|
|
||||||
value_type const value_;
|
value_type value_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ boost
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
char const *
|
char const *
|
||||||
get_diagnostic_information( exception const & x )
|
get_diagnostic_information( exception const & x, char const * header )
|
||||||
{
|
{
|
||||||
if( error_info_container * c=x.data_.get() )
|
if( error_info_container * c=x.data_.get() )
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
return c->diagnostic_information();
|
return c->diagnostic_information(header);
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
@ -63,7 +63,7 @@ boost
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
diagnostic_information_impl( boost::exception const * be, std::exception const * se )
|
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(be||se);
|
BOOST_ASSERT(be||se);
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
@ -72,6 +72,13 @@ boost
|
|||||||
if( !be )
|
if( !be )
|
||||||
be = dynamic_cast<boost::exception const *>(se);
|
be = dynamic_cast<boost::exception const *>(se);
|
||||||
#endif
|
#endif
|
||||||
|
char const * wh=0;
|
||||||
|
if( with_what && se )
|
||||||
|
{
|
||||||
|
wh=se->what();
|
||||||
|
if( be && exception_detail::get_diagnostic_information(*be,0)==wh )
|
||||||
|
return wh;
|
||||||
|
}
|
||||||
std::ostringstream tmp;
|
std::ostringstream tmp;
|
||||||
if( be )
|
if( be )
|
||||||
{
|
{
|
||||||
@ -92,12 +99,12 @@ boost
|
|||||||
tmp << std::string("Dynamic exception type: ") <<
|
tmp << std::string("Dynamic exception type: ") <<
|
||||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
||||||
#endif
|
#endif
|
||||||
if( se )
|
if( with_what && se )
|
||||||
tmp << "std::exception::what: " << se->what() << '\n';
|
tmp << "std::exception::what: " << wh << '\n';
|
||||||
if( be )
|
if( be )
|
||||||
if( char const * s=exception_detail::get_diagnostic_information(*be) )
|
if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) )
|
||||||
if( *s )
|
if( *s )
|
||||||
tmp << s;
|
return s;
|
||||||
return tmp.str();
|
return tmp.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +114,7 @@ boost
|
|||||||
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
|
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
|
||||||
diagnostic_information( T const & e )
|
diagnostic_information( T const & e )
|
||||||
{
|
{
|
||||||
return exception_detail::diagnostic_information_impl(&e,0);
|
return exception_detail::diagnostic_information_impl(&e,0,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -115,7 +122,28 @@ boost
|
|||||||
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
|
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
|
||||||
diagnostic_information( T const & e )
|
diagnostic_information( T const & e )
|
||||||
{
|
{
|
||||||
return exception_detail::diagnostic_information_impl(0,&e);
|
return exception_detail::diagnostic_information_impl(0,&e,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
char const *
|
||||||
|
diagnostic_information_what( exception const & e ) throw()
|
||||||
|
{
|
||||||
|
char const * w=0;
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
||||||
|
return exception_detail::get_diagnostic_information(e,0);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +159,7 @@ boost
|
|||||||
boost::exception const * be=current_exception_cast<boost::exception const>();
|
boost::exception const * be=current_exception_cast<boost::exception const>();
|
||||||
std::exception const * se=current_exception_cast<std::exception const>();
|
std::exception const * se=current_exception_cast<std::exception const>();
|
||||||
if( be || se )
|
if( be || se )
|
||||||
return exception_detail::diagnostic_information_impl(be,se);
|
return exception_detail::diagnostic_information_impl(be,se,true);
|
||||||
else
|
else
|
||||||
return "No diagnostic information available.";
|
return "No diagnostic information available.";
|
||||||
}
|
}
|
||||||
|
@ -143,9 +143,9 @@ boost
|
|||||||
struct
|
struct
|
||||||
error_info_container
|
error_info_container
|
||||||
{
|
{
|
||||||
virtual char const * diagnostic_information() const = 0;
|
virtual char const * diagnostic_information( char const * ) const = 0;
|
||||||
virtual shared_ptr<error_info_base const> get( type_info_ const & ) const = 0;
|
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
|
||||||
virtual void set( shared_ptr<error_info_base const> const &, type_info_ const & ) = 0;
|
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
||||||
virtual void add_ref() const = 0;
|
virtual void add_ref() const = 0;
|
||||||
virtual void release() const = 0;
|
virtual void release() const = 0;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ boost
|
|||||||
template <>
|
template <>
|
||||||
struct get_info<throw_line>;
|
struct get_info<throw_line>;
|
||||||
|
|
||||||
char const * get_diagnostic_information( exception const & );
|
char const * get_diagnostic_information( exception const &, char const * );
|
||||||
}
|
}
|
||||||
|
|
||||||
class
|
class
|
||||||
@ -231,7 +231,7 @@ boost
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend char const * exception_detail::get_diagnostic_information( exception const & );
|
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
||||||
|
|
||||||
template <class E,class Tag,class T>
|
template <class E,class Tag,class T>
|
||||||
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
||||||
|
@ -22,16 +22,16 @@ boost
|
|||||||
get_info
|
get_info
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
typename ErrorInfo::value_type const *
|
typename ErrorInfo::value_type *
|
||||||
get( exception const & x )
|
get( exception const & x )
|
||||||
{
|
{
|
||||||
if( exception_detail::error_info_container * c=x.data_.get() )
|
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)) )
|
if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
|
||||||
{
|
{
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo const *>(eib.get()) );
|
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
|
||||||
#endif
|
#endif
|
||||||
ErrorInfo const * w = static_cast<ErrorInfo const *>(eib.get());
|
ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
|
||||||
return &w->value();
|
return &w->value();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -43,7 +43,7 @@ boost
|
|||||||
get_info<throw_function>
|
get_info<throw_function>
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
char const * const *
|
char const * *
|
||||||
get( exception const & x )
|
get( exception const & x )
|
||||||
{
|
{
|
||||||
return x.throw_function_ ? &x.throw_function_ : 0;
|
return x.throw_function_ ? &x.throw_function_ : 0;
|
||||||
@ -55,7 +55,7 @@ boost
|
|||||||
get_info<throw_file>
|
get_info<throw_file>
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
char const * const *
|
char const * *
|
||||||
get( exception const & x )
|
get( exception const & x )
|
||||||
{
|
{
|
||||||
return x.throw_file_ ? &x.throw_file_ : 0;
|
return x.throw_file_ ? &x.throw_file_ : 0;
|
||||||
@ -67,12 +67,26 @@ boost
|
|||||||
get_info<throw_line>
|
get_info<throw_line>
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
int const *
|
int *
|
||||||
get( exception const & x )
|
get( exception const & x )
|
||||||
{
|
{
|
||||||
return x.throw_line_!=-1 ? &x.throw_line_ : 0;
|
return x.throw_line_!=-1 ? &x.throw_line_ : 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T,class R>
|
||||||
|
struct
|
||||||
|
get_error_info_return_type
|
||||||
|
{
|
||||||
|
typedef R * type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T,class R>
|
||||||
|
struct
|
||||||
|
get_error_info_return_type<T const,R>
|
||||||
|
{
|
||||||
|
typedef R const * type;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_NO_RTTI
|
#ifdef BOOST_NO_RTTI
|
||||||
@ -83,11 +97,18 @@ boost
|
|||||||
{
|
{
|
||||||
return exception_detail::get_info<ErrorInfo>::get(x);
|
return exception_detail::get_info<ErrorInfo>::get(x);
|
||||||
}
|
}
|
||||||
|
template <class ErrorInfo>
|
||||||
|
inline
|
||||||
|
typename ErrorInfo::value_type *
|
||||||
|
get_error_info( boost::exception & x )
|
||||||
|
{
|
||||||
|
return exception_detail::get_info<ErrorInfo>::get(x);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
template <class ErrorInfo,class E>
|
template <class ErrorInfo,class E>
|
||||||
inline
|
inline
|
||||||
typename ErrorInfo::value_type const *
|
typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
|
||||||
get_error_info( E const & some_exception )
|
get_error_info( E & some_exception )
|
||||||
{
|
{
|
||||||
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
|
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
|
||||||
return exception_detail::get_info<ErrorInfo>::get(*x);
|
return exception_detail::get_info<ErrorInfo>::get(*x);
|
||||||
|
@ -75,34 +75,36 @@ boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set( shared_ptr<error_info_base const> const & x, type_info_ const & typeid_ )
|
set( shared_ptr<error_info_base> const & x, type_info_ const & typeid_ )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(x);
|
BOOST_ASSERT(x);
|
||||||
info_[typeid_] = x;
|
info_[typeid_] = x;
|
||||||
diagnostic_info_str_.clear();
|
diagnostic_info_str_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<error_info_base const>
|
shared_ptr<error_info_base>
|
||||||
get( type_info_ const & ti ) const
|
get( type_info_ const & ti ) const
|
||||||
{
|
{
|
||||||
error_info_map::const_iterator i=info_.find(ti);
|
error_info_map::const_iterator i=info_.find(ti);
|
||||||
if( info_.end()!=i )
|
if( info_.end()!=i )
|
||||||
{
|
{
|
||||||
shared_ptr<error_info_base const> const & p = i->second;
|
shared_ptr<error_info_base> const & p = i->second;
|
||||||
#ifndef BOOST_NO_RTTI
|
#ifndef BOOST_NO_RTTI
|
||||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
||||||
#endif
|
#endif
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return shared_ptr<error_info_base const>();
|
return shared_ptr<error_info_base>();
|
||||||
}
|
}
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
diagnostic_information() const
|
diagnostic_information( char const * header ) const
|
||||||
{
|
{
|
||||||
if( diagnostic_info_str_.empty() )
|
if( header )
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(*header!=0);
|
||||||
std::ostringstream tmp;
|
std::ostringstream tmp;
|
||||||
|
tmp << header;
|
||||||
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
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;
|
shared_ptr<error_info_base const> const & x = i->second;
|
||||||
@ -117,7 +119,7 @@ boost
|
|||||||
|
|
||||||
friend class boost::exception;
|
friend class boost::exception;
|
||||||
|
|
||||||
typedef std::map< type_info_, shared_ptr<error_info_base const> > error_info_map;
|
typedef std::map< type_info_, shared_ptr<error_info_base> > error_info_map;
|
||||||
error_info_map info_;
|
error_info_map info_;
|
||||||
mutable std::string diagnostic_info_str_;
|
mutable std::string diagnostic_info_str_;
|
||||||
mutable int count_;
|
mutable int count_;
|
||||||
|
@ -14,38 +14,30 @@ boost_test_compile_fail(to_string_fail)
|
|||||||
|
|
||||||
#exception
|
#exception
|
||||||
|
|
||||||
boost_test_run(1-throw_exception_test)
|
|
||||||
boost_test_run(2-throw_exception_no_exceptions_test)
|
|
||||||
boost_test_run(3-throw_exception_no_integration_test)
|
|
||||||
boost_test_run(4-throw_exception_no_both_test)
|
|
||||||
boost_test_run(cloning_test)
|
boost_test_run(cloning_test)
|
||||||
boost_test_run(copy_exception_test)
|
boost_test_run(copy_exception_test)
|
||||||
boost_test_run(unknown_exception_test)
|
boost_test_run(unknown_exception_test)
|
||||||
boost_test_run(exception_test)
|
boost_test_run(exception_test)
|
||||||
|
#boost_test_run(boost_error_info_test)
|
||||||
boost_test_run(enable_error_info_test enable_error_info_test.cpp helper1.cpp)
|
boost_test_run(enable_error_info_test enable_error_info_test.cpp helper1.cpp)
|
||||||
boost_test_run(throw_exception_test throw_exception_test.cpp helper2.cpp)
|
boost_test_run(throw_exception_test throw_exception_test.cpp helper2.cpp)
|
||||||
boost_test_run(errno_test)
|
boost_test_run(errno_test)
|
||||||
boost_test_run(error_info_test)
|
boost_test_run(error_info_test)
|
||||||
boost_test_run(diagnostic_information_test)
|
boost_test_run(diagnostic_information_test)
|
||||||
boost_test_run(refcount_ptr_test)
|
|
||||||
boost_test_run(current_exception_cast_test)
|
|
||||||
message(STATUS "!!!> run no_exceptions_test.cpp : : : <exception-handling>off ;")
|
|
||||||
|
|
||||||
boost_test_compile_fail(exception_fail)
|
boost_test_compile_fail(exception_fail)
|
||||||
boost_test_compile_fail(throw_exception_fail)
|
boost_test_compile_fail(throw_exception_fail)
|
||||||
|
|
||||||
# Compile headers tests
|
# Compile headers tests
|
||||||
set (compile_tests
|
set (compile_tests
|
||||||
exception_ptr_hpp_test
|
|
||||||
diagnostic_information_hpp_test
|
diagnostic_information_hpp_test
|
||||||
error_info_hpp_test
|
error_info_hpp_test
|
||||||
|
exception_ptr_hpp_test
|
||||||
exception_hpp_test
|
exception_hpp_test
|
||||||
get_error_info_hpp_test
|
get_error_info_hpp_test
|
||||||
info_hpp_test
|
info_hpp_test
|
||||||
info_tuple_hpp_test
|
info_tuple_hpp_test
|
||||||
to_string_hpp_test
|
to_string_hpp_test
|
||||||
to_string_stub_hpp_test
|
to_string_stub_hpp_test
|
||||||
current_exception_cast_hpp_test
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#-- Create a Compile test for each source
|
#-- Create a Compile test for each source
|
||||||
|
@ -38,6 +38,7 @@ run no_exceptions_test.cpp : : : <exception-handling>off ;
|
|||||||
run errinfos_test.cpp ;
|
run errinfos_test.cpp ;
|
||||||
compile-fail exception_fail.cpp ;
|
compile-fail exception_fail.cpp ;
|
||||||
compile-fail throw_exception_fail.cpp ;
|
compile-fail throw_exception_fail.cpp ;
|
||||||
|
compile-fail error_info_const_fail.cpp ;
|
||||||
|
|
||||||
#headers
|
#headers
|
||||||
|
|
||||||
|
@ -43,6 +43,29 @@ error2:
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
error3:
|
||||||
|
std::exception
|
||||||
|
{
|
||||||
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
return "error3";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
error4:
|
||||||
|
std::exception,
|
||||||
|
boost::exception
|
||||||
|
{
|
||||||
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
return diagnostic_information_what(*this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
test1( std::string const & di1, std::string const & di2 )
|
test1( std::string const & di1, std::string const & di2 )
|
||||||
{
|
{
|
||||||
@ -75,6 +98,33 @@ test2( std::string const & di1, std::string const & di2 )
|
|||||||
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test3( std::string const & di )
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di.find("error3")!=std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test4( std::string const & di1, std::string const & di2 )
|
||||||
|
{
|
||||||
|
BOOST_TEST( di1!=di2 );
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di1.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di1.find("test_tag1")!=std::string::npos);
|
||||||
|
BOOST_TEST(di1.find("test_tag2")!=std::string::npos);
|
||||||
|
BOOST_TEST(di1.find("fourty-two")!=std::string::npos);
|
||||||
|
#ifndef BOOST_NO_RTTI
|
||||||
|
BOOST_TEST(di2.find("type:")!=std::string::npos);
|
||||||
|
#endif
|
||||||
|
BOOST_TEST(di2.find("test_tag1")!=std::string::npos);
|
||||||
|
BOOST_TEST(di2.find("test_tag2")!=std::string::npos);
|
||||||
|
BOOST_TEST(di2.find("bad value")!=std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -131,9 +181,58 @@ main()
|
|||||||
error2 & x )
|
error2 & x )
|
||||||
{
|
{
|
||||||
std::string di1 = current_exception_diagnostic_information();
|
std::string di1 = current_exception_diagnostic_information();
|
||||||
|
BOOST_TEST(di1==boost::diagnostic_information_what(x));
|
||||||
x << tagged_int1(2) << tagged_int2(2);
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
std::string di2 = current_exception_diagnostic_information();
|
std::string di2 = current_exception_diagnostic_information();
|
||||||
|
BOOST_TEST(di2==boost::diagnostic_information_what(x));
|
||||||
test2(di1,di2);
|
test2(di1,di2);
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error3 x;
|
||||||
|
std::string di=diagnostic_information(x);
|
||||||
|
test3(di);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
std::string di=current_exception_diagnostic_information();
|
||||||
|
test3(di);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
error4 & x )
|
||||||
|
{
|
||||||
|
std::string di1=boost::diagnostic_information(x);
|
||||||
|
std::string wh1=x.what();
|
||||||
|
BOOST_TEST(wh1==di1);
|
||||||
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
|
std::string di2 = diagnostic_information(x);
|
||||||
|
std::string wh2=x.what();
|
||||||
|
BOOST_TEST(wh2==di2);
|
||||||
|
test4(di1,di2);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error4 x; x << tagged_int1(42) << tagged_int2(42);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
error4 & x )
|
||||||
|
{
|
||||||
|
std::string di1=boost::current_exception_diagnostic_information();
|
||||||
|
std::string wh1=x.what();
|
||||||
|
BOOST_TEST(wh1==di1);
|
||||||
|
x << tagged_int1(2) << tagged_int2(2);
|
||||||
|
std::string di2 = current_exception_diagnostic_information();
|
||||||
|
std::string wh2=x.what();
|
||||||
|
BOOST_TEST(wh2==di2);
|
||||||
|
test4(di1,di2);
|
||||||
|
}
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,19 @@ main()
|
|||||||
using namespace boost;
|
using namespace boost;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(
|
test_exception e;
|
||||||
test_exception() <<
|
e <<
|
||||||
errinfo_api_function("failed_api_function") <<
|
errinfo_api_function("failed_api_function") <<
|
||||||
errinfo_at_line(42) <<
|
errinfo_at_line(42) <<
|
||||||
errinfo_errno(errno) <<
|
errinfo_errno(errno) <<
|
||||||
errinfo_file_handle(weak_ptr<FILE>()) <<
|
errinfo_file_handle(weak_ptr<FILE>()) <<
|
||||||
errinfo_file_name("filename.txt") <<
|
errinfo_file_name("filename.txt") <<
|
||||||
errinfo_file_open_mode("rb") <<
|
errinfo_file_open_mode("rb");
|
||||||
errinfo_type_info_name(typeid(int).name()) );
|
#ifdef BOOST_NO_TYPEID
|
||||||
|
BOOST_THROW_EXCEPTION(e);
|
||||||
|
#else
|
||||||
|
BOOST_THROW_EXCEPTION(e<<errinfo_type_info_name(typeid(int).name()));
|
||||||
|
#endif
|
||||||
BOOST_TEST(false);
|
BOOST_TEST(false);
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
@ -50,7 +54,9 @@ main()
|
|||||||
BOOST_TEST(get_error_info<errinfo_file_handle>(e) && get_error_info<errinfo_file_handle>(e)->expired());
|
BOOST_TEST(get_error_info<errinfo_file_handle>(e) && get_error_info<errinfo_file_handle>(e)->expired());
|
||||||
BOOST_TEST(get_error_info<errinfo_file_name>(e) && *get_error_info<errinfo_file_name>(e)=="filename.txt");
|
BOOST_TEST(get_error_info<errinfo_file_name>(e) && *get_error_info<errinfo_file_name>(e)=="filename.txt");
|
||||||
BOOST_TEST(get_error_info<errinfo_file_open_mode>(e) && *get_error_info<errinfo_file_open_mode>(e)=="rb");
|
BOOST_TEST(get_error_info<errinfo_file_open_mode>(e) && *get_error_info<errinfo_file_open_mode>(e)=="rb");
|
||||||
|
#ifndef BOOST_NO_TYPEID
|
||||||
BOOST_TEST(get_error_info<errinfo_type_info_name>(e) && *get_error_info<errinfo_type_info_name>(e)==typeid(int).name());
|
BOOST_TEST(get_error_info<errinfo_type_info_name>(e) && *get_error_info<errinfo_type_info_name>(e)==typeid(int).name());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
... )
|
... )
|
||||||
|
14
test/error_info_const_fail.cpp
Normal file
14
test/error_info_const_fail.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||||
|
|
||||||
|
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#include <boost/exception/get_error_info.hpp>
|
||||||
|
|
||||||
|
typedef boost::error_info<struct foo_,int> foo;
|
||||||
|
|
||||||
|
void
|
||||||
|
test( boost::exception const * e )
|
||||||
|
{
|
||||||
|
++*boost::get_error_info<foo>(*e);
|
||||||
|
}
|
@ -83,6 +83,23 @@ basic_test()
|
|||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
test_exception & x )
|
test_exception & x )
|
||||||
|
{
|
||||||
|
++*boost::get_error_info<test_1>(x);
|
||||||
|
++*boost::get_error_info<test_2>(x);
|
||||||
|
++*boost::get_error_info<test_3>(x);
|
||||||
|
BOOST_TEST(*boost::get_error_info<test_1>(x)==2);
|
||||||
|
BOOST_TEST(*boost::get_error_info<test_2>(x)==3u);
|
||||||
|
BOOST_TEST(*boost::get_error_info<test_3>(x)==4.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 const & x )
|
||||||
{
|
{
|
||||||
BOOST_TEST(*boost::get_error_info<test_1>(x)==1);
|
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_2>(x)==2u);
|
||||||
@ -317,6 +334,28 @@ test_lifetime()
|
|||||||
BOOST_TEST(!count);
|
BOOST_TEST(!count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_const( int const * )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_const( int * )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_const()
|
||||||
|
{
|
||||||
|
test_exception e;
|
||||||
|
boost::exception const & c(e);
|
||||||
|
boost::exception & m(e);
|
||||||
|
BOOST_TEST(is_const(boost::get_error_info<test_1>(c)));
|
||||||
|
BOOST_TEST(!is_const(boost::get_error_info<test_1>(m)));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -327,5 +366,6 @@ main()
|
|||||||
test_catch_add_info();
|
test_catch_add_info();
|
||||||
test_add_tuple();
|
test_add_tuple();
|
||||||
test_lifetime();
|
test_lifetime();
|
||||||
|
test_const();
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user