documentation update

[SVN r50508]
This commit is contained in:
Emil Dotchevski
2009-01-08 01:31:33 +00:00
parent f28285c073
commit cd1cb71367
11 changed files with 5019 additions and 4171 deletions

View File

@ -26,9 +26,9 @@
<p>Boost Exception also supports <span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span>-style <span class="RenoLink"><a href="tutorial_exception_ptr.html">copying</a></span> of exception objects, implemented non-intrusively and automatically by the boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> function.</p> <p>Boost Exception also supports <span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span>-style <span class="RenoLink"><a href="tutorial_exception_ptr.html">copying</a></span> of exception objects, implemented non-intrusively and automatically by the boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> function.</p>
<h2>Contents</h2> <h2>Contents</h2>
<div><ol><li>Tutorial<div><ol><li><span class="RenoLink"><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site</a></span></li> <div><ol><li>Tutorial<div><ol><li><span class="RenoLink"><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site</a></span></li>
<li><span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span></li>
<li><span class="RenoLink"><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies</a></span></li> <li><span class="RenoLink"><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies</a></span></li>
<li><span class="RenoLink"><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads</a></span></li> <li><span class="RenoLink"><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads</a></span></li>
<li><span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span></li>
</ol></div> </ol></div>
</li> </li>
<li>Documentation<div><ol><li>Class <span class="RenoLink"><a href="exception.html">exception</a></span></li> <li>Documentation<div><ol><li>Class <span class="RenoLink"><a href="exception.html">exception</a></span></li>
@ -95,9 +95,10 @@ boost
{ {
public: public:
typedef T value_type; <span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
error_info( value_type const &amp; ); <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 &amp; v );</span>
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const &amp; <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
};</span> };</span>
<span class="RenoIncludeSPAN">template &lt;class E, class Tag, class T&gt; <span class="RenoIncludeSPAN">template &lt;class E, class Tag, class T&gt;
@ -113,7 +114,7 @@ boost
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template &lt;class T&gt; <span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">template &lt;class T&gt;
---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T const &amp; x );</span></span> ---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T const &amp; 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 &amp; 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 &amp; );</span></span>
<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">class <span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">class
<span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>: <span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>:
@ -191,9 +192,10 @@ boost
{ {
public: public:
typedef T value_type; <span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
error_info( value_type const &amp; ); <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 &amp; v );</span>
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const &amp; <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
};</span> };</span>
}</pre> }</pre>
</div><h4>Requirements:</h4> </div><h4>Requirements:</h4>
@ -399,13 +401,16 @@ boost
<pre>namespace <pre>namespace
boost boost
{ {
<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 &amp; 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 &amp; );</span>
}</pre> }</pre>
</div><h4>Returns:</h4> </div><h4>Returns:</h4>
<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&lt;&lt;</a></span>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p> <p>This function returns a string value that is automatically composed from the string representations of all <span class="RenoLink"><a href="error_info.html">error_info</a></span> objects stored in a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> through <span class="RenoLink"><a href="exception_operator_shl.html">operator&lt;&lt;</a></span>, along with other diagnostic information relevant to the exception.</p>
<p>When the <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; 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>The string representation of each <span class="RenoLink"><a href="error_info.html">error_info</a></span> object is deduced by a function call that is bound at the time the <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; template is instantiated. The following overload resolutions are attempted in order:</p>
<p>Otherwise, the system attempts overload resolution for s &lt;&lt; x, where s is a std::ostringstream and x is of type T. If this is successful, the operator&lt;&lt; overload is used to convert objects of type T to string.</p> <div><ol><li>Unqualified call to to_string(x), where x is of type <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; (the return value is expected to be of type std::string.)</li>
<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> <li>Unqualified call to to_string(x.<span class="RenoLink"><a href="error_info_value.html">value</a></span>()) (the return value is expected to be of type std::string.)</li>
<li>Unqualified call to s &lt;&lt; x.<span class="RenoLink"><a href="error_info_value.html">value</a></span>(), where s is a std::ostringstream.</li>
</ol></div>
<p>The first successfully bound function is used at the time <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to string, and <i>an unspecified stub string value is used without issuing a compile error.</i></p>
<h4>Notes:</h4> <h4>Notes:</h4>
<div><ul><li>The format of the returned string is unspecified.</li> <div><ul><li>The format of the returned string is unspecified.</li>
<li>The returned string is <i>not</i> user-friendly.</li> <li>The returned string is <i>not</i> user-friendly.</li>

View File

@ -25,13 +25,16 @@
<pre>namespace <pre>namespace
boost boost
{ {
<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 &amp; 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 &amp; );</span>
}</pre> }</pre>
</div><h4>Returns:</h4> </div><h4>Returns:</h4>
<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&lt;&lt;</a></span>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p> <p>This function returns a string value that is automatically composed from the string representations of all <span class="RenoLink"><a href="error_info.html">error_info</a></span> objects stored in a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> through <span class="RenoLink"><a href="exception_operator_shl.html">operator&lt;&lt;</a></span>, along with other diagnostic information relevant to the exception.</p>
<p>When the <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; 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>The string representation of each <span class="RenoLink"><a href="error_info.html">error_info</a></span> object is deduced by a function call that is bound at the time the <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; template is instantiated. The following overload resolutions are attempted in order:</p>
<p>Otherwise, the system attempts overload resolution for s &lt;&lt; x, where s is a std::ostringstream and x is of type T. If this is successful, the operator&lt;&lt; overload is used to convert objects of type T to string.</p> <div><ol><li>Unqualified call to to_string(x), where x is of type <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt; (the return value is expected to be of type std::string.)</li>
<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> <li>Unqualified call to to_string(x.<span class="RenoLink"><a href="error_info_value.html">value</a></span>()) (the return value is expected to be of type std::string.)</li>
<li>Unqualified call to s &lt;&lt; x.<span class="RenoLink"><a href="error_info_value.html">value</a></span>(), where s is a std::ostringstream.</li>
</ol></div>
<p>The first successfully bound function is used at the time <span class="RenoLink"><a href="diagnostic_information.html">diagnostic_information</a></span> is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to string, and <i>an unspecified stub string value is used without issuing a compile error.</i></p>
<h4>Notes:</h4> <h4>Notes:</h4>
<div><ul><li>The format of the returned string is unspecified.</li> <div><ul><li>The format of the returned string is unspecified.</li>
<li>The returned string is <i>not</i> user-friendly.</li> <li>The returned string is <i>not</i> user-friendly.</li>

View File

@ -31,9 +31,10 @@ boost
{ {
public: public:
typedef T value_type; <span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
error_info( value_type const &amp; ); <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 &amp; v );</span>
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const &amp; <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
};</span> };</span>
}</pre> }</pre>
</div><h4>Requirements:</h4> </div><h4>Requirements:</h4>
@ -53,6 +54,9 @@ typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></
</a><a href="exception_exception_hpp.html">boost/exception/exception.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="exception_error_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="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_type.html">error_info::value_type<br/>
</a><a href="exception.html">exception<br/> </a><a href="exception.html">exception<br/>
</a><a href="exception_operator_shl.html">exception/operator&lt;&lt;<br/> </a><a href="exception_operator_shl.html">exception/operator&lt;&lt;<br/>
</a><a href="get_error_info.html">get_error_info<br/> </a><a href="get_error_info.html">get_error_info<br/>

View File

@ -0,0 +1,52 @@
<!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>error_info::error_info</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>error_info::error_info</h3>
</div>
<div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>&gt;</p>
<pre><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 &amp; v );</span></pre>
</div><h4>Effects:</h4>
<p>Stores a copy of v in the <span class="RenoLink"><a href="error_info.html">error_info</a></span> object.</p>
<div class="RenoIncludeDIV"><h4>Throws:</h4>
<p>Any exception emitted by v's copy constructor.</p>
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
<h3>See Also:</h3>
<div class="RenoPageList"><a href="error_info.html">error_info<br/>
</a></div>
</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>&nbsp;</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>

53
doc/error_info_value.html Normal file
View File

@ -0,0 +1,53 @@
<!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>error_info::value</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>error_info::value</h3>
</div>
<div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>&gt;</p>
<pre><span class="RenoIncludeSPAN"><span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const &amp; <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span></pre>
</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>
<h4>Throws:</h4>
<p>Nothing.</p>
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
<h3>See Also:</h3>
<div class="RenoPageList"><a href="diagnostic_information.html">diagnostic_information<br/>
</a><a href="error_info.html">error_info<br/>
</a></div>
</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>&nbsp;</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>

View File

@ -0,0 +1,52 @@
<!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>error_info::value_type</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>error_info::value_type</h3>
</div>
<div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>&gt;</p>
<pre><span class="RenoIncludeSPAN">typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span></pre>
</div><h4>Definition:</h4>
<p>The expression <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;Tag,T&gt;::<span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> evaluates to T.</p>
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
<h3>See Also:</h3>
<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_value.html">error_info::value<br/>
</a></div>
</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>&nbsp;</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>

View File

@ -28,7 +28,7 @@ namespace
boost boost
{ {
<span class="RenoIncludeSPAN"> class <span class="RenoLink"><a href="exception.html">exception</a></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 &amp; 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 &amp; );</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>

View File

@ -35,9 +35,10 @@ boost
{ {
public: public:
typedef T value_type; <span class="RenoIncludeSPAN"> typedef T <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span>;</span>
error_info( value_type const &amp; ); <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 &amp; v );</span>
<span class="RenoIncludeSPAN"> <span class="RenoLink"><a href="error_info_value_type.html">value_type</a></span> const &amp; <span class="RenoLink"><a href="error_info_value.html">value</a></span>() const;</span>
};</span> };</span>
<span class="RenoIncludeSPAN">template &lt;class E, class Tag, class T&gt; <span class="RenoIncludeSPAN">template &lt;class E, class Tag, class T&gt;
@ -48,6 +49,9 @@ boost
<div class="RenoPageList"><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="exception_hpp.html">boost/exception.hpp<br/>
</a><a href="error_info.html">error_info<br/> </a><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_value.html">error_info::value<br/>
</a><a href="error_info_value_type.html">error_info::value_type<br/>
</a><a href="exception_operator_shl.html">exception/operator&lt;&lt;<br/> </a><a href="exception_operator_shl.html">exception/operator&lt;&lt;<br/>
</a></div> </a></div>
</div> </div>

View File

@ -49,6 +49,9 @@
<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>
<p><a href="error_info.html">error_info</a></p> <p><a href="error_info.html">error_info</a></p>
<p><a href="error_info_error_info.html">error_info::error_info</a></p>
<p><a href="error_info_value.html">error_info::value</a></p>
<p><a href="error_info_value_type.html">error_info::value_type</a></p>
<p><a href="exception.html">exception</a></p> <p><a href="exception.html">exception</a></p>
<p><a href="exception_operator_shl.html">exception/operator&lt;&lt;</a></p> <p><a href="exception_operator_shl.html">exception/operator&lt;&lt;</a></p>
<p><a href="exception_constructors.html">exception::exception</a></p> <p><a href="exception_constructors.html">exception::exception</a></p>

File diff suppressed because it is too large Load Diff

View File

@ -62,41 +62,15 @@ g()
<p>The <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, the returned <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> will point to it; otherwise an empty <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> is returned.</p> <p>The <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, the returned <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> will point to it; otherwise an empty <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> is returned.</p>
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding of Arbitrary Data to Active Exception Objects</h3> </div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding of Arbitrary Data to Active Exception Objects</h3>
</div> </div>
<p>Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Here is an example:</p> <p>Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Let's say we have an exception type file_read_error, which takes a file name in its constructor. Consider the following function:</p>
<pre>#include &lt;stdio.h&gt; <pre>void
#include &lt;string&gt;
class
file_read_error
{
public:
explicit
file_read_error( std::string const &amp; fn ):
fn_(fn)
{
};
std::string const &amp;
file_name() const
{
return fn_;
}
private:
std::string fn_;
};
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("????"); throw file_read_error(????);
}</pre> }</pre>
<p>We have defined an exception class file_read_error which can store a file name, so that when we catch a file_read_error object, we know which file the failure is related to. However, the file_read function does not have the file name at the time of the throw; all it has is a FILE handle.</p> <p>How can the file_read function pass a file name to the exception type constructor? All it has is a FILE handle.</p>
<p>One possible solution is to not use FILE handles directly. We could have our own class file which stores both a FILE handle and a file name, and pass that to file_read. However, this could be problematic if we communicate with 3rd party code that does not use our class file (probably because they have their own similar class.)</p> <p>Using boost::<span class="RenoLink"><a href="exception.html">exception</a></span> allows us to free the file_read function from the burden of storing the file name in exceptions it throws:</p>
<p>A better solution is to make class file_read_error derive (possibly indirectly) from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, and free the file_read function from the burden of storing the file name in exceptions it throws:</p>
<pre>#include &lt;<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>&gt; <pre>#include &lt;<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>&gt;
#include &lt;stdio.h&gt; #include &lt;stdio.h&gt;
#include &lt;errno.h&gt; #include &lt;errno.h&gt;
@ -140,7 +114,6 @@ parse_file( char const * file_name )
} }
}</pre> }</pre>
<p>The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object is that the file name is relevant to any failure that occurs in parse_file, <i>even if the failure is unrelated to file I/O</i>.</p> <p>The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object is that the file name is relevant to any failure that occurs in parse_file, <i>even if the failure is unrelated to file I/O</i>.</p>
<p>As usual, the stored data can be retrieved using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>.</p>
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding Grouped Data to Exceptions</h3> </div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding Grouped Data to Exceptions</h3>
</div> </div>
<p>The code snippet below demonstrates how boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span> can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together:</p> <p>The code snippet below demonstrates how boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span> can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together:</p>