forked from boostorg/exception
boost exception
[SVN r43485]
This commit is contained in:
51
doc/BOOST_ERROR_INFO.html
Normal file
51
doc/BOOST_ERROR_INFO.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!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_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>
|
||||
<div class="RenoIncludeDIV"><h3>BOOST_ERROR_INFO</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></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 <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> when throwing a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, to store information about the location of the throw statement. It can be chained with other <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt>s in a single throw expression.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a></div>
|
||||
<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>
|
73
doc/adding_data_at_throw.html
Normal file
73
doc/adding_data_at_throw.html
Normal file
@ -0,0 +1,73 @@
|
||||
<!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>Tutorial: Adding of Arbitrary Data at the Point of the Throw</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>
|
||||
<div class="RenoIncludeDIV"><h3>Adding of Arbitrary Data at the Point of the Throw</h3>
|
||||
<p>The following example demonstrates how <tt>errno</tt> can be stored in exception objects using Boost Exception:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info; //(1)
|
||||
|
||||
class my_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, public std::exception { }; //(2)
|
||||
|
||||
void
|
||||
f()
|
||||
{
|
||||
throw my_error() << errno_info(errno); //(3)
|
||||
}
|
||||
</pre>
|
||||
<p>First, we instantiate the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template using a unique identifier -- <tt>tag_errno</tt>, and the type of the info it identifies -- <tt>int</tt>. This provides compile-time type safety for the various values stored in exception objects.</p>
|
||||
<p>Second, we define class <tt>my_error</tt>, which derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<p>Finally, (3) illustrates how the <tt>typedef</tt> from (1) can be used with <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to store values in exception objects at the point of the throw.</p>
|
||||
<p>The stored <tt>errno</tt> value can be recovered at a later time like this:</p>
|
||||
<pre>// ...continued
|
||||
|
||||
void
|
||||
g()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch(
|
||||
my_error & x )
|
||||
{
|
||||
if( boost::shared_ptr<int const> err=boost::<span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span><errno_info>(x) )
|
||||
std::cerr << "Error code: " << *err;
|
||||
}
|
||||
}</pre>
|
||||
<p>The <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt> function template is instantiated with the <tt>typedef</tt> from (1), and is passed an exception object of any type that derives publicly from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. If the exception object contains the requested value, the returned <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt> will point to it; otherwise an empty <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt> is returned.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a></div>
|
||||
<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>
|
116
doc/adding_data_later.html
Normal file
116
doc/adding_data_later.html
Normal file
@ -0,0 +1,116 @@
|
||||
<!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>Tutorial: Adding of Arbitrary Data to Active Exception Objects</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>
|
||||
<div class="RenoIncludeDIV"><h3>Adding of Arbitrary Data to Active Exception Objects</h3>
|
||||
<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>
|
||||
<pre>#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
class
|
||||
file_read_error
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
file_read_error( std::string const & fn ):
|
||||
fn_(fn)
|
||||
{
|
||||
};
|
||||
|
||||
std::string const &
|
||||
file_name() const
|
||||
{
|
||||
return fn_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string fn_;
|
||||
};
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw file_read_error("????");
|
||||
}</pre>
|
||||
<p>We have defined an exception class <tt>file_read_error</tt> which can store a file name, so that when we catch a <tt>file_read_error</tt> object, we know which file the failure is related to. However, the <tt>file_read</tt> function does not have the file name at the time of the throw; all it has is a <tt>FILE</tt> handle.</p>
|
||||
<p>One possible solution is to not use <tt>FILE</tt> handles directly. We could have our own <tt>class file</tt> which stores both a <tt>FILE</tt> handle and a file name, and pass that to <tt>file_read()</tt>. However, this could be problematic if we communicate with 3rd party code that does not use our <tt>class file</tt> (probably because they have their own similar class.)</p>
|
||||
<p>A better solution is to make class <tt>file_read_error</tt> derive (possibly indirectly) from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, and free the <tt>file_read()</tt> function from the burden of storing the file name in exceptions it throws:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw file_read_error() << errno_info(errno);
|
||||
}</pre>
|
||||
<p>If <tt>file_read()</tt> detects a failure, it throws an exception which contains the information that is available at the time, namely the <tt>errno</tt>. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_file_name,std::string> file_name_info;
|
||||
|
||||
boost::shared_ptr<FILE> file_open( char const * file_name, char const * mode );
|
||||
void file_read( FILE * f, void * buffer, size_t size );
|
||||
|
||||
void
|
||||
parse_file( char const * file_name )
|
||||
{
|
||||
boost::shared_ptr<FILE> f = file_open(file_name,"rb");
|
||||
assert(f);
|
||||
try
|
||||
{
|
||||
char buf[1024];
|
||||
file_read( f.get(), buf, sizeof(buf) );
|
||||
}
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
e << file_name_info(file_name);
|
||||
throw;
|
||||
}
|
||||
}</pre>
|
||||
<p>The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the <tt>try</tt> block, <tt>parse_file()</tt> does not need to do any real work, but it intercepts any <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object is that the file name is relevant to any failure that occurs in <tt>parse_file()</tt>, <i>even if the failure is unrelated to file I/O</i>.</p>
|
||||
<p>As usual, the stored data can be retrieved using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a></div>
|
||||
<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>
|
410
doc/boost-exception.html
Normal file
410
doc/boost-exception.html
Normal file
@ -0,0 +1,410 @@
|
||||
<!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 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>
|
||||
<h2>Abstract</h2>
|
||||
<p>The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code.</p>
|
||||
<p>It supports transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception classes. Data can be added to any exception object, either directly in the throw-expression (15.1), or at a later time as the exception object propagates up the call stack.</p>
|
||||
<p>The ability to add data to exception objects after they have been passed to <tt>throw</tt> is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected. </p>
|
||||
<p>Boost Exception also supports <span class="RenoLink"><a href="cloning.html">cloning</a></span> of exception objects, implemented non-intrusively and automatically by the <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>()</tt> function.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>Boost Exception was accepted as a Boost library on November 7, 2007; however it has not yet been part of an official Boost release.</p>
|
||||
<h2>Contents</h2>
|
||||
<div><ol><li>Tutorial<div><ol><li><span class="RenoLink"><a href="transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site</a></span></li>
|
||||
<li><span class="RenoLink"><a href="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</a></span></li>
|
||||
<li><span class="RenoLink"><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads</a></span></li>
|
||||
<li><span class="RenoLink"><a href="logging.html">Tutorial: Logging of boost::exception Objects</a></span></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li>Documentation<div><ol><li>Class <tt><span class="RenoLink"><a href="exception.html">exception</a></span></tt></li>
|
||||
<li>Transporting of Arbitrary Data to the Catch Site<div><ol><li><tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></span></tt></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li>Transporting of Exceptions between Threads<div><ol><li><tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>()</tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li><tt><span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>()</tt></li>
|
||||
<li>Headers<div><ol><li><tt><span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_exception_cloning.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span></tt></li>
|
||||
<li><tt><span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span></tt></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li><span class="RenoLink"><a href="name_idx.html">Index</a></span></li>
|
||||
<li><span class="RenoLink"><a href="boost-exception.zip">Download</a></span></li>
|
||||
<li><span class="RenoLink"><a href="source">Browse source code</a></span></li>
|
||||
</ol></div>
|
||||
<h2>Synopsis</h2>
|
||||
<p><tt>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
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_what.html">what</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>
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> template <class Tag,class T>
|
||||
class
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & );
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag1, class T1>
|
||||
E const & operator<<( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1> const & v );
|
||||
|
||||
template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & operator<<( 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>,
|
||||
...,
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><TagN,TN> > const & v );</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"> template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>( T 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"> typedef ---unspecified--- <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>;</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>( T const & e );</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> <span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>( T const & e );</span>
|
||||
<span class="RenoIncludeSPAN"> void <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & ep );</span>
|
||||
|
||||
<span class="RenoIncludeSPAN"> class
|
||||
<span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>:
|
||||
public std::exception
|
||||
public boost::exception
|
||||
{
|
||||
---unspecified---
|
||||
};</span>
|
||||
|
||||
<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
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
#endif</span>
|
||||
}</pre>
|
||||
<div class="RenoIncludeDIV"><h2>exception</h2>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
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_what.html">what</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>
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>Class <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> is designed to be used as a universal base for user-defined exception types.</p>
|
||||
<p>An object of any type deriving from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> can store data of arbitrary types, using the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> wrapper and <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>.</p>
|
||||
<p>To retrieve data from a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object, use the <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt> function template.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoIncludeDIV"><h3>exception constructors</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</li>
|
||||
<li> Copy constructor: initializes a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object which shares with <tt>x</tt> all data added through <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>exception destructor</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>exception::what()</h3>
|
||||
<div class="RenoIncludeDIV"><pre> virtual char const * <span class="RenoLink"><a href="exception_what.html">what</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>An string representation of all data stored in the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object by the <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> function. See "<span class="RenoLink"><a href="logging.html">Tutorial: Logging of boost::exception Objects</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The return value remains valid until the exception object from which it is obtained is destroyed or modified.</p>
|
||||
</div></div></div><h2>Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
<div class="RenoIncludeDIV"><h3>error_info</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class Tag,class T>
|
||||
class
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & );
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must have accessible copy constructor and must not be a reference.</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This class template is used to associate a <tt>Tag</tt> type with a value type <tt>T</tt>. Objects of type <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T></tt> can be passed to <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to be stored in objects of type <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The header <tt><<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>></tt> provides a declaration of the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template, which is sufficient for the purpose of <tt>typedef</tt>ing an instance for specific <tt>Tag</tt> and <tt>T</tt>, 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 <tt>errno_info</tt> object to exceptions using <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>, or to retrieve it using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>, you must first <tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt>.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>operator<<()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt><span class="RenoBR"> </span><br/><tt>#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag1, class T1>
|
||||
E const & operator<<( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1> const & v );
|
||||
|
||||
template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & operator<<( 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>,
|
||||
...,
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><TagN,TN> > const & v );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>E</tt> must be <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, or a type that derives (indirectly) from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Effects:</h4>
|
||||
<div><ul><li> The first overload stores a copy of <tt>v</tt> into <tt>x</tt>. If <tt>x</tt> already contains data of type <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1></tt>, that data is overwritten.</li>
|
||||
<li> The <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> overload is equivalent to <tt>x << v.<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements">get</a></span><0>() << ... << v.<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements">get</a></span><N>()</tt>.</li>
|
||||
</ul></div>
|
||||
<h4>Returns:</h4>
|
||||
<p><tt>x</tt>.</p>
|
||||
<div class="RenoIncludeDIV"><h4>Throws:</h4>
|
||||
<p><tt>std::bad_alloc</tt>, or any exception emitted by <tt>T1..TN</tt> copy constructor.</p>
|
||||
</div></div><div class="RenoIncludeDIV"><h3>get_error_info()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<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>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>The type of the <tt>x</tt> object must derive from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>; <tt>ErrorInfo</tt> must be an instance of the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>If <tt>x</tt> does not store an object of type <tt>ErrorInfo</tt>, returns an empty <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt>; otherwise returns pointer to the stored value. Use <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to store values in exception objects.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>enable_error_info()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<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>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must be a user-defined type with accessible no-throw copy constructor.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of unspecified type with no-throw copy semantics, which derives publicly from both <tt>T</tt>, and class <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. The <tt>T</tt> sub-object is initialized from <tt>x</tt> by the <tt>T</tt> copy constructor. If <tt>T</tt> already derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, then the type of the returned object does not derive <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>BOOST_ERROR_INFO</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></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 <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> when throwing a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, to store information about the location of the throw statement. It can be chained with other <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt>s in a single throw expression.</p>
|
||||
</div><h2>Transporting of Exceptions between Threads</h2>
|
||||
<div class="RenoIncludeDIV"><h3>exception_ptr</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> typedef ---unspecified--- <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>;</span>
|
||||
}</pre>
|
||||
</div><p>The <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> type can be used to refer to a copy of a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt>'s operations do not throw.</p>
|
||||
<p>Two instances of <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> are equivalent and compare equal if and only if they refer to the same exception.</p>
|
||||
<p>The default constructor of <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> produces the null value of the type. The null value is equivalent only to itself.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>enable_exception_cloning()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_exception_cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must have an accessible no-throw copy constructor</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of <i>unspecified</i> type which derives publicly from <tt>T</tt>. That is, the returned object can be intercepted by a <tt>catch(T &)</tt>.</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This function is designed to be used directly in a throw-expression to enable the cloning support in Boost Exception. For example:</p>
|
||||
<pre>class
|
||||
my_exception:
|
||||
public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
....
|
||||
throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(my_exception());</pre>
|
||||
<p>Unless <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> is called at the time an exception object is used in a throw-expression, any attempt to copy it using <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> returns an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> which refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>Instead of using the <tt>throw</tt> keyword directly, it is preferable to call <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>()</tt>. This is guaranteed to throw an exception that derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> and supports cloning.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>clone_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> <span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must be polymorphic.</p>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> was not used at the time the exception object was passed to <tt>throw</tt>, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>. In this case, if the original exception object derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, then the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> sub-object of the <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt> object is initialized by the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> copy constructor;</li>
|
||||
<li> Otherwise, if the attempt to clone the exception results in a <tt>std::bad_alloc</tt> exception, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to an instance of <tt>std::bad_alloc</tt>;</li>
|
||||
<li> Otherwise, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to a copy of <tt>e</tt>.</li>
|
||||
</ul></div>
|
||||
<h4>Note:</h4>
|
||||
<p>It is unspecified whether the return values of two successive calls to <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> refer to the same exception object.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>rethrow_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> void <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & ep );</span>
|
||||
}</pre>
|
||||
</div><h4>Precondition:</h4>
|
||||
<p><tt>ep</tt> shall not be null.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>The exception to which <tt>ep</tt> refers.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>unknown_exception</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> class
|
||||
<span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>:
|
||||
public std::exception
|
||||
public boost::exception
|
||||
{
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>This type is used by the <span class="RenoLink"><a href="cloning.html">cloning</a></span> support in Boost Exception.</p>
|
||||
<p>To allow an exception to be cloned, <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> must be used at the time the exception object is passed to <tt>throw</tt>. Otherwise, calling <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> returns an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> which refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</p>
|
||||
</div><h2>Throwing Exceptions</h2>
|
||||
<div class="RenoIncludeDIV"><h3>throw_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>></tt></p>
|
||||
<pre>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
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
#endif</span>
|
||||
}</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<div><ul><li> If <tt>BOOST_NO_EXCEPTIONS</tt> is not defined, <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e)</tt> is equivalent to <tt>throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(e))</tt>, unless <tt>BOOST_EXCEPTION_DISABLE</tt> is defined, in which case <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e)</tt> is equivalent to <tt>throw e;</tt></li>
|
||||
<li> If <tt>BOOST_NO_EXCEPTIONS</tt> is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of <tt>throw_exception</tt> are allowed to assume that the function never returns; therefore, if the user-defined <tt>throw_exception</tt> returns, the behavior is undefined.</li>
|
||||
</ul></div>
|
||||
</div><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>
|
55
doc/clone_exception.html
Normal file
55
doc/clone_exception.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!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>clone_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>
|
||||
<div class="RenoIncludeDIV"><h3>clone_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> <span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must be polymorphic.</p>
|
||||
<h4>Returns:</h4>
|
||||
<div><ul><li> If <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> was not used at the time the exception object was passed to <tt>throw</tt>, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>. In this case, if the original exception object derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, then the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> sub-object of the <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt> object is initialized by the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> copy constructor;</li>
|
||||
<li> Otherwise, if the attempt to clone the exception results in a <tt>std::bad_alloc</tt> exception, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to an instance of <tt>std::bad_alloc</tt>;</li>
|
||||
<li> Otherwise, the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> refers to a copy of <tt>e</tt>.</li>
|
||||
</ul></div>
|
||||
<h4>Note:</h4>
|
||||
<p>It is unspecified whether the return values of two successive calls to <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> refer to the same exception object.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
98
doc/cloning.html
Normal file
98
doc/cloning.html
Normal file
@ -0,0 +1,98 @@
|
||||
<!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>Tutorial: Transporting of Exceptions between Threads</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>
|
||||
<div class="RenoIncludeDIV"><h2>Transporting of Exceptions between Threads</h2>
|
||||
<p>Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to <span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span>, but because Boost Exception can not rely on language support, the use of <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> at the time of the throw is required in order to use cloning.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>All exceptions emitted by the familiar function <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>()</tt> are guaranteed to derive from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> and to support cloning.</p>
|
||||
<div class="RenoIncludeDIV"><h3>Using enable_exception_cloning() at the Time of the Throw</h3>
|
||||
<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_exception_cloning.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(file_read_error()) <<
|
||||
errno_info(errno);
|
||||
}</pre>
|
||||
</div><div class="RenoIncludeDIV"><h3>Cloning and Re-throwing an Exception</h3>
|
||||
<p>When you catch a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, you can call <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> to get an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> object:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
void do_work(); //throws cloning-enabled boost::<span class="RenoLink"><a href="exception.html">exception</a></span>s
|
||||
|
||||
void
|
||||
worker_thread( boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> & error )
|
||||
{
|
||||
try
|
||||
{
|
||||
do_work();
|
||||
error = boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>();
|
||||
}
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
error = boost::<span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>(e);
|
||||
}
|
||||
}</pre>
|
||||
<p>In the above example, note that <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> captures the original type of the exception object, even though <tt>e</tt> refers to the base type <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. This original type can be thrown again using the <tt><span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>()</tt> function:</p>
|
||||
<pre>// ...continued
|
||||
|
||||
void
|
||||
work()
|
||||
{
|
||||
boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> error;
|
||||
boost::<span class="RenoLink"><a href="http://www.boost.org/doc/html/boost/thread.html">thread</a></span> t( boost::<span class="RenoLink"><a href="http://www.boost.org/libs/bind/bind.html">bind</a></span>(worker_thread,boost::<span class="RenoLink"><a href="http://www.boost.org/doc/html/ref.html">ref</a></span>(error)) );
|
||||
t.<span class="RenoLink"><a href="http://www.boost.org/doc/html/boost/thread.html">join</a></span>();
|
||||
if( error )
|
||||
boost::<span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>(error);
|
||||
}</pre>
|
||||
<p><tt><span class="RenoLink"><a href="clone_exception.html">Clone_exception</a></span>()</tt> could fail to copy the original exception object in the following cases:</p>
|
||||
<div><ul><li> if there is not enough memory, in which case the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> points to an instance of <tt>std::bad_alloc</tt>, or</li>
|
||||
<li> if <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> was not used in the throw-expression passed to the original <tt>throw</tt> statement, in which case the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> points to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</li>
|
||||
</ul></div>
|
||||
<p>Regardless, the use of <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> and <tt><span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>()</tt> in the above examples is well-formed.</p>
|
||||
</div></div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
75
doc/cloning_and_rethrowing.html
Normal file
75
doc/cloning_and_rethrowing.html
Normal file
@ -0,0 +1,75 @@
|
||||
<!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>Tutorial: Cloning and Re-throwing an 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>
|
||||
<div class="RenoIncludeDIV"><h3>Cloning and Re-throwing an Exception</h3>
|
||||
<p>When you catch a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, you can call <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> to get an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> object:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
void do_work(); //throws cloning-enabled boost::<span class="RenoLink"><a href="exception.html">exception</a></span>s
|
||||
|
||||
void
|
||||
worker_thread( boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> & error )
|
||||
{
|
||||
try
|
||||
{
|
||||
do_work();
|
||||
error = boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>();
|
||||
}
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
error = boost::<span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>(e);
|
||||
}
|
||||
}</pre>
|
||||
<p>In the above example, note that <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> captures the original type of the exception object, even though <tt>e</tt> refers to the base type <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. This original type can be thrown again using the <tt><span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>()</tt> function:</p>
|
||||
<pre>// ...continued
|
||||
|
||||
void
|
||||
work()
|
||||
{
|
||||
boost::<span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> error;
|
||||
boost::<span class="RenoLink"><a href="http://www.boost.org/doc/html/boost/thread.html">thread</a></span> t( boost::<span class="RenoLink"><a href="http://www.boost.org/libs/bind/bind.html">bind</a></span>(worker_thread,boost::<span class="RenoLink"><a href="http://www.boost.org/doc/html/ref.html">ref</a></span>(error)) );
|
||||
t.<span class="RenoLink"><a href="http://www.boost.org/doc/html/boost/thread.html">join</a></span>();
|
||||
if( error )
|
||||
boost::<span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>(error);
|
||||
}</pre>
|
||||
<p><tt><span class="RenoLink"><a href="clone_exception.html">Clone_exception</a></span>()</tt> could fail to copy the original exception object in the following cases:</p>
|
||||
<div><ul><li> if there is not enough memory, in which case the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> points to an instance of <tt>std::bad_alloc</tt>, or</li>
|
||||
<li> if <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> was not used in the throw-expression passed to the original <tt>throw</tt> statement, in which case the returned <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> points to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</li>
|
||||
</ul></div>
|
||||
<p>Regardless, the use of <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> and <tt><span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>()</tt> in the above examples is well-formed.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads<br/>
|
||||
</a></div>
|
||||
<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>
|
52
doc/enable_error_info.html
Normal file
52
doc/enable_error_info.html
Normal 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>enable_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>
|
||||
<div class="RenoIncludeDIV"><h3>enable_error_info()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<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>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must be a user-defined type with accessible no-throw copy constructor.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of unspecified type with no-throw copy semantics, which derives publicly from both <tt>T</tt>, and class <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. The <tt>T</tt> sub-object is initialized from <tt>x</tt> by the <tt>T</tt> copy constructor. If <tt>T</tt> already derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, then the type of the returned object does not derive <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
65
doc/enable_exception_cloning.html
Normal file
65
doc/enable_exception_cloning.html
Normal file
@ -0,0 +1,65 @@
|
||||
<!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>enable_exception_cloning</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>
|
||||
<div class="RenoIncludeDIV"><h3>enable_exception_cloning()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_exception_cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class T>
|
||||
---unspecified--- <span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>( T const & e );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must have an accessible no-throw copy constructor</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>An object of <i>unspecified</i> type which derives publicly from <tt>T</tt>. That is, the returned object can be intercepted by a <tt>catch(T &)</tt>.</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This function is designed to be used directly in a throw-expression to enable the cloning support in Boost Exception. For example:</p>
|
||||
<pre>class
|
||||
my_exception:
|
||||
public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
....
|
||||
throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(my_exception());</pre>
|
||||
<p>Unless <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> is called at the time an exception object is used in a throw-expression, any attempt to copy it using <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> returns an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> which refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>Instead of using the <tt>throw</tt> keyword directly, it is preferable to call <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>()</tt>. This is guaranteed to throw an exception that derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> and supports cloning.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="clone_exception.html">clone_exception<br/>
|
||||
</a><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
73
doc/error_info.html
Normal file
73
doc/error_info.html
Normal file
@ -0,0 +1,73 @@
|
||||
<!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</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>
|
||||
<div class="RenoIncludeDIV"><h3>error_info</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class Tag,class T>
|
||||
class
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & );
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>T</tt> must have accessible copy constructor and must not be a reference.</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This class template is used to associate a <tt>Tag</tt> type with a value type <tt>T</tt>. Objects of type <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T></tt> can be passed to <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to be stored in objects of type <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The header <tt><<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>></tt> provides a declaration of the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template, which is sufficient for the purpose of <tt>typedef</tt>ing an instance for specific <tt>Tag</tt> and <tt>T</tt>, 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 <tt>errno_info</tt> object to exceptions using <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>, or to retrieve it using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>, you must first <tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt>.</p>
|
||||
</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/>
|
||||
</a><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp<br/>
|
||||
</a><a href="exception.html">exception<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="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="logging.html">Tutorial: Logging of boost::exception Objects<br/>
|
||||
</a></div>
|
||||
<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>
|
97
doc/exception.html
Normal file
97
doc/exception.html
Normal file
@ -0,0 +1,97 @@
|
||||
<!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>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>
|
||||
<div class="RenoIncludeDIV"><h2>exception</h2>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_exception_hpp.html">boost/exception/exception.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
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_what.html">what</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>
|
||||
|
||||
private:
|
||||
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>Class <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> is designed to be used as a universal base for user-defined exception types.</p>
|
||||
<p>An object of any type deriving from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> can store data of arbitrary types, using the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> wrapper and <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>.</p>
|
||||
<p>To retrieve data from a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object, use the <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt> function template.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoIncludeDIV"><h3>exception constructors</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</li>
|
||||
<li> Copy constructor: initializes a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object which shares with <tt>x</tt> all data added through <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>exception destructor</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>exception::what()</h3>
|
||||
<div class="RenoIncludeDIV"><pre> virtual char const * <span class="RenoLink"><a href="exception_what.html">what</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>An string representation of all data stored in the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object by the <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> function. See "<span class="RenoLink"><a href="logging.html">Tutorial: Logging of boost::exception Objects</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The return value remains valid until the exception object from which it is obtained is destroyed or modified.</p>
|
||||
</div></div></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/>
|
||||
</a><a href="clone_exception.html">clone_exception<br/>
|
||||
</a><a href="enable_error_info.html">enable_error_info<br/>
|
||||
</a><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception_ptr.html">exception_ptr<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="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="logging.html">Tutorial: Logging of boost::exception Objects<br/>
|
||||
</a><a href="transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads<br/>
|
||||
</a></div>
|
||||
<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>
|
40
doc/exception_cloning_hpp.html
Normal file
40
doc/exception_cloning_hpp.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!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/exception/cloning.hpp</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>
|
||||
<h3>boost/exception/cloning.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="clone_exception.html">clone_exception<br/>
|
||||
</a><a href="exception_ptr.html">exception_ptr<br/>
|
||||
</a><a href="rethrow_exception.html">rethrow_exception<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
45
doc/exception_constructors.html
Normal file
45
doc/exception_constructors.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!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>exception::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>
|
||||
<div class="RenoIncludeDIV"><h3>exception constructors</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</li>
|
||||
<li> Copy constructor: initializes a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object which shares with <tt>x</tt> all data added through <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>, including data that is added at a future time.</li>
|
||||
</ul></div>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="exception.html">exception<br/>
|
||||
</a></div>
|
||||
<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>
|
42
doc/exception_destructor.html
Normal file
42
doc/exception_destructor.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!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>exception::~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>
|
||||
<div class="RenoIncludeDIV"><h3>exception destructor</h3>
|
||||
<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 <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="exception.html">exception<br/>
|
||||
</a></div>
|
||||
<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>
|
37
doc/exception_enable_error_info_hpp.html
Normal file
37
doc/exception_enable_error_info_hpp.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!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/exception/enable_error_info.hpp</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>
|
||||
<h3>boost/exception/enable_error_info.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="enable_error_info.html">enable_error_info<br/>
|
||||
</a></div>
|
||||
<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>
|
37
doc/exception_enable_exception_cloning_hpp.html
Normal file
37
doc/exception_enable_exception_cloning_hpp.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!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/exception/enable_exception_cloning.hpp</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>
|
||||
<h3>boost/exception/enable_exception_cloning.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a></div>
|
||||
<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>
|
37
doc/exception_error_info_group_hpp.html
Normal file
37
doc/exception_error_info_group_hpp.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!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/exception/info_tuple.hpp</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>
|
||||
<h3>boost/exception/info_tuple.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a></div>
|
||||
<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>
|
40
doc/exception_error_info_hpp.html
Normal file
40
doc/exception_error_info_hpp.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!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/exception/info.hpp</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>
|
||||
<h3>boost/exception/info.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<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></div>
|
||||
<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>
|
41
doc/exception_error_info_value_hpp.html
Normal file
41
doc/exception_error_info_value_hpp.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!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/exception/error_info.hpp</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>
|
||||
<h3>boost/exception/error_info.hpp</h3>
|
||||
<p>This header file contains the following declaration:</p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag, class T>
|
||||
class <span class="RenoLink"><a href="error_info.html">error_info</a></span>;
|
||||
}</pre>
|
||||
<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>
|
37
doc/exception_exception_hpp.html
Normal file
37
doc/exception_exception_hpp.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!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/exception/exception.hpp</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>
|
||||
<h3>boost/exception/exception.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="exception.html">exception<br/>
|
||||
</a></div>
|
||||
<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>
|
45
doc/exception_hpp.html
Normal file
45
doc/exception_hpp.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!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/exception.hpp</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>
|
||||
<h3>boost/exception.hpp</h3>
|
||||
<p>This header file includes all other header files of Boost Exception:</p>
|
||||
<div class="RenoPageList"><a href="exception_hpp.html">boost/exception.hpp<br/>
|
||||
</a><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp<br/>
|
||||
</a><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp<br/>
|
||||
</a><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_exception_cloning.hpp<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="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a></div>
|
||||
<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>
|
50
doc/exception_ptr.html
Normal file
50
doc/exception_ptr.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!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>exception_ptr</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>
|
||||
<div class="RenoIncludeDIV"><h3>exception_ptr</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> typedef ---unspecified--- <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span>;</span>
|
||||
}</pre>
|
||||
</div><p>The <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> type can be used to refer to a copy of a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt>'s operations do not throw.</p>
|
||||
<p>Two instances of <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> are equivalent and compare equal if and only if they refer to the same exception.</p>
|
||||
<p>The default constructor of <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> produces the null value of the type. The null value is equivalent only to itself.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="clone_exception.html">clone_exception<br/>
|
||||
</a><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a><a href="rethrow_exception.html">rethrow_exception<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
45
doc/exception_what.html
Normal file
45
doc/exception_what.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!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>exception::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="http://www.boost.org/boost.png" alt="Boost" width="277" height="86"/></a>
|
||||
</div>
|
||||
<h1>Boost Exception</h1>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><h3>exception::what()</h3>
|
||||
<div class="RenoIncludeDIV"><pre> virtual char const * <span class="RenoLink"><a href="exception_what.html">what</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>An string representation of all data stored in the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object by the <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> function. See "<span class="RenoLink"><a href="logging.html">Tutorial: Logging of boost::exception Objects</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The return value remains valid until the exception object from which it is obtained is destroyed or modified.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="exception.html">exception<br/>
|
||||
</a><a href="logging.html">Tutorial: Logging of boost::exception Objects<br/>
|
||||
</a></div>
|
||||
<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>
|
52
doc/get_error_info.html
Normal file
52
doc/get_error_info.html
Normal 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>get_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>
|
||||
<div class="RenoIncludeDIV"><h3>get_error_info()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<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>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p>The type of the <tt>x</tt> object must derive from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>; <tt>ErrorInfo</tt> must be an instance of the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template.</p>
|
||||
<h4>Returns:</h4>
|
||||
<p>If <tt>x</tt> does not store an object of type <tt>ErrorInfo</tt>, returns an empty <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt>; otherwise returns pointer to the stored value. Use <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to store values in exception objects.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a></div>
|
||||
<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>
|
62
doc/grouping_data.html
Normal file
62
doc/grouping_data.html
Normal file
@ -0,0 +1,62 @@
|
||||
<!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>Tutorial: Adding Grouped Data to Exceptions</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>
|
||||
<div class="RenoIncludeDIV"><h3>Adding Grouped Data to Exceptions</h3>
|
||||
<p>The code snippet below demonstrates how <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> can be used to bundle the name of the function that failed, together with the reported <tt>errno</tt> so that they can be added to exception objects more conveniently together:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <errno>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_file_name,std::string> file_name_info;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_function,char const *> function_info;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;
|
||||
typedef boost::tuple<function_info,errno_info> clib_failure;
|
||||
|
||||
class file_open_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
boost::shared_ptr<FILE>
|
||||
file_open( char const * name, char const * mode )
|
||||
{
|
||||
if( FILE * f=fopen(name,mode) )
|
||||
return boost::shared_ptr<FILE>(f,fclose);
|
||||
else
|
||||
throw file_open_error() <<
|
||||
file_name_info(name) <<
|
||||
clib_failure("fopen",errno);
|
||||
}</pre>
|
||||
<p>Note that the members of a <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> are stored separately in exception objects; they can only be retrieved individually, using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a></div>
|
||||
<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>
|
60
doc/logging.html
Normal file
60
doc/logging.html
Normal file
@ -0,0 +1,60 @@
|
||||
<!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>Tutorial: Logging of boost::exception Objects</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>
|
||||
<div class="RenoIncludeDIV"><h2>Logging of boost::exception Objects</h2>
|
||||
<p>Class <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> provides a virtual member function <tt><span class="RenoLink"><a href="exception_what.html">what</a></span>()</tt>, with a signature identical to the familiar <tt>std::exception::what()</tt> 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>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <iostream>
|
||||
|
||||
void f(); //throws unknown types that derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.
|
||||
|
||||
void
|
||||
g()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
std::cerr << e.<span class="RenoLink"><a href="exception_what.html">what</a></span>();
|
||||
}
|
||||
}</pre>
|
||||
<p>The <tt><span class="RenoLink"><a href="exception_what.html">what</a></span>()</tt> member function iterates over all data objects stored in the <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> through <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt>. The returned string is constructed by converting each data object to string and then concatenating these strings together.</p>
|
||||
<p>When the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T></tt> template is instantiated, the system attempts overload resolution for an unqualified call to <tt>to_string(x)</tt>, where <tt>x</tt> is of type <tt>T</tt>. If this is successful, the <tt>to_string()</tt> overload is used to convert objects of type <tt>T</tt> to string.</p>
|
||||
<p>Otherwise, the system attempts overload resolution for <tt>s << x</tt>, where <tt>s</tt> is a <tt>std::ostringstream</tt> and <tt>x</tt> is of type <tt>T</tt>. If this is successful, the <tt>operator<<</tt> overload is used to convert objects of type <tt>T</tt> to string.</p>
|
||||
<p>Otherwise the system is unable to convert objects of type <tt>T</tt> to string, and an unspecified stub string value is used without issuing a compile error.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a></div>
|
||||
<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>
|
68
doc/name_idx.html
Normal file
68
doc/name_idx.html
Normal file
@ -0,0 +1,68 @@
|
||||
<!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>Index</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>
|
||||
<h1>Index</h1>
|
||||
<div class="RenoIndex"><h3>B</h3>
|
||||
<p><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></p>
|
||||
<h3>b</h3>
|
||||
<p><a href="exception_hpp.html">boost/exception.hpp</a></p>
|
||||
<p><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></p>
|
||||
<p><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp</a></p>
|
||||
<p><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_exception_cloning.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_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="throw_exception_hpp.html">boost/throw_exception.hpp</a></p>
|
||||
<h3>c</h3>
|
||||
<p><a href="clone_exception.html">clone_exception</a></p>
|
||||
<h3>e</h3>
|
||||
<p><a href="enable_error_info.html">enable_error_info</a></p>
|
||||
<p><a href="enable_exception_cloning.html">enable_exception_cloning</a></p>
|
||||
<p><a href="error_info.html">error_info</a></p>
|
||||
<p><a href="exception.html">exception</a></p>
|
||||
<p><a href="exception_constructors.html">exception::exception</a></p>
|
||||
<p><a href="exception_what.html">exception::what</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>o</h3>
|
||||
<p><a href="operator_shl_exception.html">operator<</exception</a></p>
|
||||
<h3>r</h3>
|
||||
<p><a href="rethrow_exception.html">rethrow_exception</a></p>
|
||||
<h3>t</h3>
|
||||
<p><a href="throw_exception.html">throw_exception</a></p>
|
||||
<h3>u</h3>
|
||||
<p><a href="unknown_exception.html">unknown_exception</a></p>
|
||||
</div>
|
||||
<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>
|
67
doc/operator_shl_exception.html
Normal file
67
doc/operator_shl_exception.html
Normal file
@ -0,0 +1,67 @@
|
||||
<!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>operator<</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>
|
||||
<div class="RenoIncludeDIV"><h3>operator<<()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>></tt><span class="RenoBR"> </span><br/><tt>#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> template <class E, class Tag1, class T1>
|
||||
E const & operator<<( E const & x, <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1> const & v );
|
||||
|
||||
template <class E, class Tag1, class T1, ..., class TagN, class TN>
|
||||
E const & operator<<( 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>,
|
||||
...,
|
||||
<span class="RenoLink"><a href="error_info.html">error_info</a></span><TagN,TN> > const & v );</span>
|
||||
}</pre>
|
||||
</div><h4>Requirements:</h4>
|
||||
<p><tt>E</tt> must be <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, or a type that derives (indirectly) from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<h4>Effects:</h4>
|
||||
<div><ul><li> The first overload stores a copy of <tt>v</tt> into <tt>x</tt>. If <tt>x</tt> already contains data of type <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag1,T1></tt>, that data is overwritten.</li>
|
||||
<li> The <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> overload is equivalent to <tt>x << v.<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements">get</a></span><0>() << ... << v.<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements">get</a></span><N>()</tt>.</li>
|
||||
</ul></div>
|
||||
<h4>Returns:</h4>
|
||||
<p><tt>x</tt>.</p>
|
||||
<div class="RenoIncludeDIV"><h4>Throws:</h4>
|
||||
<p><tt>std::bad_alloc</tt>, or any exception emitted by <tt>T1..TN</tt> copy constructor.</p>
|
||||
</div></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/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="logging.html">Tutorial: Logging of boost::exception Objects<br/>
|
||||
</a></div>
|
||||
<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>
|
218
doc/reno.css
Normal file
218
doc/reno.css
Normal file
@ -0,0 +1,218 @@
|
||||
body
|
||||
{
|
||||
font-family: Trebuchet, Verdana, Arial, Helvetica, Sans;
|
||||
font-size: 10pt;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-position: left;
|
||||
background-image: url( 'left.png' );
|
||||
background-repeat: repeat-y;
|
||||
}
|
||||
|
||||
.RenoPageList,
|
||||
ol,
|
||||
ul
|
||||
{
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.RenoPageList
|
||||
{
|
||||
margin:0;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font-size: 24pt;
|
||||
clear: left;
|
||||
padding-top: 5pt;
|
||||
padding-bottom: 5pt;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-size: 18pt;
|
||||
clear: left;
|
||||
padding-top: 20pt;
|
||||
padding-bottom: 5pt;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
font-size: 14pt;
|
||||
clear: left;
|
||||
padding-top: 15pt;
|
||||
padding-bottom: 5pt;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h4
|
||||
{
|
||||
font-size: 10pt;
|
||||
float: left;
|
||||
clear: left;
|
||||
padding-top: 5pt;
|
||||
padding-bottom: 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 4pt;
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
font-size: 10pt;
|
||||
padding-top: 5pt;
|
||||
padding-bottom: 5pt;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
clear:right;
|
||||
}
|
||||
|
||||
pre
|
||||
{
|
||||
border-top: 1px solid #000000;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
font-size: 10pt;
|
||||
background-color: #F0F0F0;
|
||||
padding-top: 5pt;
|
||||
padding-bottom: 5pt;
|
||||
padding-left: 5pt;
|
||||
padding-right: 5pt;
|
||||
margin-top: 10pt;
|
||||
margin-bottom: 10pt;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
ol,ul
|
||||
{
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
ul li
|
||||
{
|
||||
padding-top: 5pt;
|
||||
padding-bottom: 5pt;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.RenoIndex h3
|
||||
{
|
||||
margin: 20pt 0 5pt 0;
|
||||
padding: 2pt;
|
||||
display: inline;
|
||||
border: 1.5pt solid #A0A0A0;
|
||||
float: left;
|
||||
clear: both;
|
||||
width: 15pt;
|
||||
text-align: center;
|
||||
background-color: #EAEAEA;
|
||||
}
|
||||
|
||||
.RenoIndex p
|
||||
{
|
||||
clear: both;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.RenoHookUnbound,
|
||||
.RenoHookBound
|
||||
{
|
||||
background-position: left center;
|
||||
background-image: url('link.gif');
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 10pt;
|
||||
}
|
||||
|
||||
.RenoIncludeDIV
|
||||
{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.RenoError
|
||||
{
|
||||
background-color: red;
|
||||
color: white;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
a
|
||||
{
|
||||
text-decoration: underline;
|
||||
color: #0000AA;
|
||||
}
|
||||
|
||||
tt
|
||||
{
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
hr
|
||||
{
|
||||
border: 0;
|
||||
color: black;
|
||||
background-color: black;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
blockquote
|
||||
{
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
padding-right: 0;
|
||||
padding-left: 20pt;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#boost_logo
|
||||
{
|
||||
float:right;
|
||||
}
|
||||
|
||||
#footer
|
||||
{
|
||||
}
|
||||
|
||||
.logo_pic
|
||||
{
|
||||
border:0;
|
||||
}
|
||||
|
||||
.logo
|
||||
{
|
||||
float:right;
|
||||
margin-left: 6pt;
|
||||
margin-right: -4pt;
|
||||
}
|
||||
|
||||
.body-0
|
||||
{
|
||||
min-width: 40em;
|
||||
padding-left: 30px;
|
||||
background: url(shade-l.png) repeat-y left;
|
||||
}
|
||||
.body-1
|
||||
{
|
||||
padding-right: 30px;
|
||||
background: url(shade-r.png) repeat-y right;
|
||||
}
|
||||
.body-2
|
||||
{
|
||||
background-color: white;
|
||||
padding: 0 8pt 0 8pt;
|
||||
margin-left: 0;
|
||||
border-top: solid 2.5pt #717171;
|
||||
border-bottom: solid 3pt #717171;
|
||||
}
|
47
doc/rethrow_exception.html
Normal file
47
doc/rethrow_exception.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!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>rethrow_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>
|
||||
<div class="RenoIncludeDIV"><h3>rethrow_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> void <span class="RenoLink"><a href="rethrow_exception.html">rethrow_exception</a></span>( <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> const & ep );</span>
|
||||
}</pre>
|
||||
</div><h4>Precondition:</h4>
|
||||
<p><tt>ep</tt> shall not be null.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>The exception to which <tt>ep</tt> refers.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a></div>
|
||||
<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>
|
BIN
doc/shade-l.png
Normal file
BIN
doc/shade-l.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 948 B |
BIN
doc/shade-r.png
Normal file
BIN
doc/shade-r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 946 B |
54
doc/throw_exception.html
Normal file
54
doc/throw_exception.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!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>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>
|
||||
<div class="RenoIncludeDIV"><h3>throw_exception()</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="throw_exception_hpp.html">boost/throw_exception.hpp</a></span>></tt></p>
|
||||
<pre>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
|
||||
template <class E>
|
||||
void <span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>( E const & e );
|
||||
#endif</span>
|
||||
}</pre>
|
||||
</div><h4>Effects:</h4>
|
||||
<div><ul><li> If <tt>BOOST_NO_EXCEPTIONS</tt> is not defined, <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e)</tt> is equivalent to <tt>throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(e))</tt>, unless <tt>BOOST_EXCEPTION_DISABLE</tt> is defined, in which case <tt>boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span>(e)</tt> is equivalent to <tt>throw e;</tt></li>
|
||||
<li> If <tt>BOOST_NO_EXCEPTIONS</tt> is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of <tt>throw_exception</tt> are allowed to assume that the function never returns; therefore, if the user-defined <tt>throw_exception</tt> returns, the behavior is undefined.</li>
|
||||
</ul></div>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads<br/>
|
||||
</a></div>
|
||||
<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>
|
37
doc/throw_exception_hpp.html
Normal file
37
doc/throw_exception_hpp.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!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.hpp</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>
|
||||
<h3>boost/exception/throw_exception.hpp</h3>
|
||||
<p>This header file contains the following definitions/declarations:</p>
|
||||
<div class="RenoPageList"><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
<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>
|
182
doc/transporting_data.html
Normal file
182
doc/transporting_data.html
Normal file
@ -0,0 +1,182 @@
|
||||
<!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>Tutorial: Transporting of Arbitrary Data to the Catch Site</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>
|
||||
<div class="RenoIncludeDIV"><h2>Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
<p>All exception types that derive from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> can be used as type-safe containers of arbitrary data objects, while complying with the no-throw requirements (15.5.1) of the ANSI C++ standard for exception classes. Data can be added to a <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> at the time of the throw, or at a later time.</p>
|
||||
<div class="RenoIncludeDIV"><h3>Adding of Arbitrary Data at the Point of the Throw</h3>
|
||||
<p>The following example demonstrates how <tt>errno</tt> can be stored in exception objects using Boost Exception:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info; //(1)
|
||||
|
||||
class my_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, public std::exception { }; //(2)
|
||||
|
||||
void
|
||||
f()
|
||||
{
|
||||
throw my_error() << errno_info(errno); //(3)
|
||||
}
|
||||
</pre>
|
||||
<p>First, we instantiate the <tt><span class="RenoLink"><a href="error_info.html">error_info</a></span></tt> template using a unique identifier -- <tt>tag_errno</tt>, and the type of the info it identifies -- <tt>int</tt>. This provides compile-time type safety for the various values stored in exception objects.</p>
|
||||
<p>Second, we define class <tt>my_error</tt>, which derives from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>.</p>
|
||||
<p>Finally, (3) illustrates how the <tt>typedef</tt> from (1) can be used with <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to store values in exception objects at the point of the throw.</p>
|
||||
<p>The stored <tt>errno</tt> value can be recovered at a later time like this:</p>
|
||||
<pre>// ...continued
|
||||
|
||||
void
|
||||
g()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch(
|
||||
my_error & x )
|
||||
{
|
||||
if( boost::shared_ptr<int const> err=boost::<span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span><errno_info>(x) )
|
||||
std::cerr << "Error code: " << *err;
|
||||
}
|
||||
}</pre>
|
||||
<p>The <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt> function template is instantiated with the <tt>typedef</tt> from (1), and is passed an exception object of any type that derives publicly from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>. If the exception object contains the requested value, the returned <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt> will point to it; otherwise an empty <tt><span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span></tt> is returned.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>Adding of Arbitrary Data to Active Exception Objects</h3>
|
||||
<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>
|
||||
<pre>#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
class
|
||||
file_read_error
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
file_read_error( std::string const & fn ):
|
||||
fn_(fn)
|
||||
{
|
||||
};
|
||||
|
||||
std::string const &
|
||||
file_name() const
|
||||
{
|
||||
return fn_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string fn_;
|
||||
};
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw file_read_error("????");
|
||||
}</pre>
|
||||
<p>We have defined an exception class <tt>file_read_error</tt> which can store a file name, so that when we catch a <tt>file_read_error</tt> object, we know which file the failure is related to. However, the <tt>file_read</tt> function does not have the file name at the time of the throw; all it has is a <tt>FILE</tt> handle.</p>
|
||||
<p>One possible solution is to not use <tt>FILE</tt> handles directly. We could have our own <tt>class file</tt> which stores both a <tt>FILE</tt> handle and a file name, and pass that to <tt>file_read()</tt>. However, this could be problematic if we communicate with 3rd party code that does not use our <tt>class file</tt> (probably because they have their own similar class.)</p>
|
||||
<p>A better solution is to make class <tt>file_read_error</tt> derive (possibly indirectly) from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt>, and free the <tt>file_read()</tt> function from the burden of storing the file name in exceptions it throws:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw file_read_error() << errno_info(errno);
|
||||
}</pre>
|
||||
<p>If <tt>file_read()</tt> detects a failure, it throws an exception which contains the information that is available at the time, namely the <tt>errno</tt>. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_file_name,std::string> file_name_info;
|
||||
|
||||
boost::shared_ptr<FILE> file_open( char const * file_name, char const * mode );
|
||||
void file_read( FILE * f, void * buffer, size_t size );
|
||||
|
||||
void
|
||||
parse_file( char const * file_name )
|
||||
{
|
||||
boost::shared_ptr<FILE> f = file_open(file_name,"rb");
|
||||
assert(f);
|
||||
try
|
||||
{
|
||||
char buf[1024];
|
||||
file_read( f.get(), buf, sizeof(buf) );
|
||||
}
|
||||
catch(
|
||||
boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & e )
|
||||
{
|
||||
e << file_name_info(file_name);
|
||||
throw;
|
||||
}
|
||||
}</pre>
|
||||
<p>The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the <tt>try</tt> block, <tt>parse_file()</tt> does not need to do any real work, but it intercepts any <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> object is that the file name is relevant to any failure that occurs in <tt>parse_file()</tt>, <i>even if the failure is unrelated to file I/O</i>.</p>
|
||||
<p>As usual, the stored data can be retrieved using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>.</p>
|
||||
</div><div class="RenoIncludeDIV"><h3>Adding Grouped Data to Exceptions</h3>
|
||||
<p>The code snippet below demonstrates how <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> can be used to bundle the name of the function that failed, together with the reported <tt>errno</tt> so that they can be added to exception objects more conveniently together:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <errno>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_file_name,std::string> file_name_info;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_function,char const *> function_info;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;
|
||||
typedef boost::tuple<function_info,errno_info> clib_failure;
|
||||
|
||||
class file_open_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
boost::shared_ptr<FILE>
|
||||
file_open( char const * name, char const * mode )
|
||||
{
|
||||
if( FILE * f=fopen(name,mode) )
|
||||
return boost::shared_ptr<FILE>(f,fclose);
|
||||
else
|
||||
throw file_open_error() <<
|
||||
file_name_info(name) <<
|
||||
clib_failure("fopen",errno);
|
||||
}</pre>
|
||||
<p>Note that the members of a <tt>boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span></tt> are stored separately in exception objects; they can only be retrieved individually, using <tt><span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>()</tt>.</p>
|
||||
</div></div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="using_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a></div>
|
||||
<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>
|
53
doc/unknown_exception.html
Normal file
53
doc/unknown_exception.html
Normal 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>unknown_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>
|
||||
<div class="RenoIncludeDIV"><h3>unknown_exception</h3>
|
||||
<div class="RenoIncludeDIV"><p><tt>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception/cloning.hpp</a></span>></tt></p>
|
||||
<pre>namespace
|
||||
boost
|
||||
{
|
||||
<span class="RenoIncludeSPAN"> class
|
||||
<span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span>:
|
||||
public std::exception
|
||||
public boost::exception
|
||||
{
|
||||
---unspecified---
|
||||
};</span>
|
||||
}</pre>
|
||||
</div><p>This type is used by the <span class="RenoLink"><a href="cloning.html">cloning</a></span> support in Boost Exception.</p>
|
||||
<p>To allow an exception to be cloned, <tt><span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>()</tt> must be used at the time the exception object is passed to <tt>throw</tt>. Otherwise, calling <tt><span class="RenoLink"><a href="clone_exception.html">clone_exception</a></span>()</tt> returns an <tt><span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span></tt> which refers to an instance of <tt><span class="RenoLink"><a href="unknown_exception.html">unknown_exception</a></span></tt>.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="clone_exception.html">clone_exception<br/>
|
||||
</a><a href="enable_exception_cloning.html">enable_exception_cloning<br/>
|
||||
</a></div>
|
||||
<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>
|
54
doc/using_enable_cloning.html
Normal file
54
doc/using_enable_cloning.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!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>Tutorial: Using enable_exception_cloning() at the Time of the Throw</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>
|
||||
<div class="RenoIncludeDIV"><h3>Using enable_exception_cloning() at the Time of the Throw</h3>
|
||||
<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_exception_cloning.hpp</a></span>>
|
||||
#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw boost::<span class="RenoLink"><a href="enable_exception_cloning.html">enable_exception_cloning</a></span>(file_read_error()) <<
|
||||
errno_info(errno);
|
||||
}</pre>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="cloning.html">Tutorial: Transporting of Exceptions between Threads<br/>
|
||||
</a></div>
|
||||
<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>
|
66
doc/using_enable_error_info.html
Normal file
66
doc/using_enable_error_info.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!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>Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</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>
|
||||
<div class="RenoIncludeDIV"><h2>Integrating Boost Exception in Existing Exception Class Hierarchies</h2>
|
||||
<p>Some exception hierarchies can not be modified to make <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> a base type. For this case, the <tt><span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>()</tt> function template can be used to make exception objects derive from <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> anyway. Here is an example:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
#include <stdexcept>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_std_range_min,size_t> std_range_min;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_std_range_max,size_t> std_range_max;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_std_range_index,size_t> std_range_index;
|
||||
|
||||
template <class T>
|
||||
class
|
||||
my_container
|
||||
{
|
||||
public:
|
||||
|
||||
size_t size() const;
|
||||
|
||||
T const &
|
||||
operator[]( size_t i ) const
|
||||
{
|
||||
if( i > size() )
|
||||
throw boost::<span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span>(std::range_error("Index out of range")) <<
|
||||
std_range_min(0) <<
|
||||
std_range_max(size()) <<
|
||||
std_range_index(i);
|
||||
//....
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
<p><tt><span class="RenoLink"><a href="enable_error_info.html">Enable_error_info</a></span><T></tt> returns an object of <i>unspecified type</i> which is guaranteed to derive from both <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span></tt> and <tt>T</tt>. This makes it possible to use <tt><span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span>()</tt> to store additional information in the exception object. The exception can be intercepted as <tt>T &</tt>, therefore existing exception handling will not break. It can also be intercepted as <tt>boost::<span class="RenoLink"><a href="exception.html">exception</a></span> &</tt>, so that <span class="RenoLink"><a href="transporting_data.html">more information can be added to the exception at a later time</a></span>.</p>
|
||||
</div><h3>See also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a></div>
|
||||
<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>
|
BIN
doc/valid-css.png
Normal file
BIN
doc/valid-css.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
BIN
doc/valid-xhtml.png
Normal file
BIN
doc/valid-xhtml.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
15
example/Jamfile
Normal file
15
example/Jamfile
Normal file
@ -0,0 +1,15 @@
|
||||
# Boost Exception Library example Jamfile
|
||||
#
|
||||
# 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)
|
||||
|
||||
exe example_io : example_io.cpp ;
|
||||
obj error_info_1 : error_info_1.cpp ;
|
||||
obj error_info_2 : error_info_2.cpp ;
|
||||
obj cloning_1 : cloning_1.cpp ;
|
||||
obj cloning_2 : cloning_2.cpp ;
|
||||
obj info_tuple : info_tuple.cpp ;
|
||||
obj enable_error_info : enable_error_info.cpp ;
|
||||
obj logging : logging.cpp ;
|
22
example/cloning_1.cpp
Normal file
22
example/cloning_1.cpp
Normal file
@ -0,0 +1,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)
|
||||
|
||||
//This example shows how to enable cloning when throwing a boost::exception.
|
||||
|
||||
#include <boost/exception/enable_exception_cloning.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::exception { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw boost::enable_exception_cloning(file_read_error()) << errno_info(errno);
|
||||
}
|
39
example/cloning_2.cpp
Normal file
39
example/cloning_2.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
//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)
|
||||
|
||||
//This example shows how to transport cloning-enabled boost::exceptions between threads.
|
||||
|
||||
#include <boost/exception/cloning.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
void do_work(); //throws cloning-enabled boost::exceptions
|
||||
|
||||
void
|
||||
worker_thread( boost::exception_ptr & error )
|
||||
{
|
||||
try
|
||||
{
|
||||
do_work();
|
||||
error = boost::exception_ptr();
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
error = boost::clone_exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void
|
||||
work()
|
||||
{
|
||||
boost::exception_ptr error;
|
||||
boost::thread t( boost::bind(worker_thread,boost::ref(error)) );
|
||||
t.join();
|
||||
if( error )
|
||||
boost::rethrow_exception(error);
|
||||
}
|
35
example/enable_error_info.cpp
Normal file
35
example/enable_error_info.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
//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)
|
||||
|
||||
//This example shows how to throw exception objects that support
|
||||
//transporting of arbitrary data to the catch site, even for types
|
||||
//that do not derive from boost::exception.
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
typedef boost::error_info<struct tag_std_range_min,size_t> std_range_min;
|
||||
typedef boost::error_info<struct tag_std_range_max,size_t> std_range_max;
|
||||
typedef boost::error_info<struct tag_std_range_index,size_t> std_range_index;
|
||||
|
||||
template <class T>
|
||||
class
|
||||
my_container
|
||||
{
|
||||
public:
|
||||
|
||||
size_t size() const;
|
||||
|
||||
T const &
|
||||
operator[]( size_t i ) const
|
||||
{
|
||||
if( i > size() )
|
||||
throw boost::enable_error_info(std::range_error("Index out of range")) <<
|
||||
std_range_min(0) <<
|
||||
std_range_max(size()) <<
|
||||
std_range_index(i);
|
||||
//....
|
||||
}
|
||||
};
|
36
example/error_info_1.cpp
Normal file
36
example/error_info_1.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//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)
|
||||
|
||||
//This example shows how to add data to boost::exception objects at the
|
||||
//point of the throw, and how to retrieve that data at the point of the catch.
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info; //(1)
|
||||
|
||||
class my_error: public boost::exception, public std::exception { }; //(2)
|
||||
|
||||
void
|
||||
f()
|
||||
{
|
||||
throw my_error() << errno_info(errno); //(3)
|
||||
}
|
||||
|
||||
void
|
||||
g()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch(
|
||||
my_error & x )
|
||||
{
|
||||
if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
|
||||
std::cerr << "Error code: " << *err;
|
||||
}
|
||||
}
|
49
example/error_info_2.cpp
Normal file
49
example/error_info_2.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
//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)
|
||||
|
||||
//This example shows how to add arbitrary data to active exception objects.
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
//
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
|
||||
class file_read_error: public boost::exception { };
|
||||
|
||||
void
|
||||
file_read( FILE * f, void * buffer, size_t size )
|
||||
{
|
||||
if( size!=fread(buffer,1,size,f) )
|
||||
throw file_read_error() << errno_info(errno);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
typedef boost::error_info<struct tag_file_name,std::string> file_name_info;
|
||||
|
||||
boost::shared_ptr<FILE> file_open( char const * file_name, char const * mode );
|
||||
void file_read( FILE * f, void * buffer, size_t size );
|
||||
|
||||
void
|
||||
parse_file( char const * file_name )
|
||||
{
|
||||
boost::shared_ptr<FILE> f = file_open(file_name,"rb");
|
||||
assert(f);
|
||||
try
|
||||
{
|
||||
char buf[1024];
|
||||
file_read( f.get(), buf, sizeof(buf) );
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
e << file_name_info(file_name);
|
||||
throw;
|
||||
}
|
||||
}
|
215
example/example_io.cpp
Normal file
215
example/example_io.cpp
Normal file
@ -0,0 +1,215 @@
|
||||
//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)
|
||||
|
||||
//This program simulates errors on copying simple data files.
|
||||
//It demonstrates how the proposed Boost exception library can be used.
|
||||
//
|
||||
//The documentation for boost::exception can be found at:
|
||||
//
|
||||
// http://www.revergestudios.com/boost-exception/boost-exception.htm.
|
||||
//
|
||||
//The output from this program can vary depending on the compiler/OS combination.
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
typedef boost::error_info<struct tag_file_stream,boost::weak_ptr<FILE> > file_stream_info;
|
||||
typedef boost::error_info<struct tag_open_mode,std::string> open_mode_info; //The open mode of a failed fopen request.
|
||||
typedef boost::error_info<struct tag_file_name,std::string> file_name_info; //The file name of a failed file operation.
|
||||
typedef boost::error_info<struct tag_file_name_src,std::string> file_name_src_info; //The source file name of a failed copy operation.
|
||||
typedef boost::error_info<struct tag_file_name_dst,std::string> file_name_dst_info; //The destination file name of a failed copy operation.
|
||||
typedef boost::error_info<struct tag_function,std::string> function_info; //The name of the C function which reported the failure.
|
||||
|
||||
char const data[] = "example";
|
||||
size_t const data_size = sizeof(data);
|
||||
|
||||
class
|
||||
error: //Base for all exception objects we throw.
|
||||
public std::exception,
|
||||
public boost::exception
|
||||
{
|
||||
public:
|
||||
|
||||
char const *
|
||||
what() const throw()
|
||||
{
|
||||
return boost::exception::what();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
~error() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class open_error: public error { };
|
||||
class read_error: public error { };
|
||||
class write_error: public error { };
|
||||
|
||||
class fopen_error: public open_error { };
|
||||
class fread_error: public read_error { };
|
||||
class fwrite_error: public write_error { };
|
||||
|
||||
|
||||
boost::shared_ptr<FILE>
|
||||
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 <<
|
||||
errno_info(errno) <<
|
||||
file_name_info(name) <<
|
||||
open_mode_info(mode) <<
|
||||
function_info("fopen");
|
||||
}
|
||||
|
||||
void
|
||||
my_fread( void * buffer, size_t size, size_t count, boost::shared_ptr<FILE> const & stream )
|
||||
{
|
||||
assert(stream);
|
||||
if( count!=fread(buffer,size,count,stream.get()) || ferror(stream.get()) )
|
||||
throw fread_error() << BOOST_ERROR_INFO <<
|
||||
function_info("fread") <<
|
||||
errno_info(errno) <<
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream));
|
||||
}
|
||||
|
||||
void
|
||||
my_fwrite( void const * buffer, size_t size, size_t count, boost::shared_ptr<FILE> const & stream )
|
||||
{
|
||||
assert(stream);
|
||||
if( count!=fwrite(buffer,size,count,stream.get()) || ferror(stream.get()) )
|
||||
throw fwrite_error() << BOOST_ERROR_INFO <<
|
||||
function_info("fwrite") <<
|
||||
errno_info(errno) <<
|
||||
file_stream_info(boost::weak_ptr<FILE>(stream));
|
||||
}
|
||||
|
||||
void
|
||||
reset_file( char const * file_name )
|
||||
{
|
||||
(void) my_fopen(file_name,"wb");
|
||||
}
|
||||
|
||||
void
|
||||
create_data( char const * file_name )
|
||||
{
|
||||
boost::shared_ptr<FILE> f = my_fopen(file_name,"wb");
|
||||
my_fwrite( data, 1, data_size, f );
|
||||
}
|
||||
|
||||
void
|
||||
copy_data( char const * src_file_name, char const * dst_file_name )
|
||||
{
|
||||
boost::shared_ptr<FILE> src = my_fopen(src_file_name,"rb");
|
||||
boost::shared_ptr<FILE> dst = my_fopen(dst_file_name,"wb");
|
||||
try
|
||||
{
|
||||
char buffer[data_size];
|
||||
my_fread( buffer, 1, data_size, src );
|
||||
my_fwrite( buffer, 1, data_size, dst );
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
if( boost::shared_ptr<boost::weak_ptr<FILE> const> f=boost::get_error_info<file_stream_info>(x) )
|
||||
if( boost::shared_ptr<FILE> fs = f->lock() )
|
||||
{
|
||||
if( fs==src )
|
||||
x << file_name_info(src_file_name);
|
||||
else if( fs==dst )
|
||||
x << file_name_info(dst_file_name);
|
||||
}
|
||||
x <<
|
||||
file_name_src_info(src_file_name) <<
|
||||
file_name_dst_info(dst_file_name);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_copy_info( boost::exception const & x )
|
||||
{
|
||||
if( boost::shared_ptr<std::string const> src = boost::get_error_info<file_name_src_info>(x) )
|
||||
std::cout << "Source file name: " << *src << "\n";
|
||||
if( boost::shared_ptr<std::string const> dst = boost::get_error_info<file_name_dst_info>(x) )
|
||||
std::cout << "Destination file name: " << *dst << "\n";
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
void
|
||||
dump_clib_info( boost::exception const & x )
|
||||
{
|
||||
if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
|
||||
std::cout << "OS error: " << *err << "\n";
|
||||
if( boost::shared_ptr<std::string const> fn=boost::get_error_info<function_info>(x) )
|
||||
std::cout << "Failed function: " << *fn << "\n";
|
||||
}
|
||||
|
||||
void
|
||||
dump_all_info( boost::exception const & x )
|
||||
{
|
||||
std::cout << "-------------------------------------------------\n";
|
||||
dump_copy_info(x);
|
||||
dump_file_info(x);
|
||||
dump_clib_info(x);
|
||||
std::cout << "\nOutput from what():\n";
|
||||
std::cout << x.what();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
create_data( "tmp1.txt" );
|
||||
copy_data( "tmp1.txt", "tmp2.txt" ); //This should succeed.
|
||||
|
||||
reset_file( "tmp1.txt" ); //Creates empty file.
|
||||
try
|
||||
{
|
||||
copy_data( "tmp1.txt", "tmp2.txt" ); //This should fail, tmp1.txt is empty.
|
||||
}
|
||||
catch(
|
||||
read_error & x )
|
||||
{
|
||||
std::cout << "\nCaught 'read_error' exception.\n";
|
||||
dump_all_info(x);
|
||||
}
|
||||
|
||||
remove( "tmp1.txt" );
|
||||
remove( "tmp2.txt" );
|
||||
try
|
||||
{
|
||||
copy_data( "tmp1.txt", "tmp2.txt" ); //This should fail, tmp1.txt does not exist.
|
||||
}
|
||||
catch(
|
||||
open_error & x )
|
||||
{
|
||||
std::cout << "\nCaught 'open_error' exception.\n";
|
||||
dump_all_info(x);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
std::cout << "\nCaught unexpected boost::exception!\n";
|
||||
dump_all_info(x);
|
||||
}
|
||||
}
|
31
example/info_tuple.cpp
Normal file
31
example/info_tuple.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)
|
||||
|
||||
//This example shows how boost::error_info_group can be used to bundle
|
||||
//the name of the function that fails together with the reported errno.
|
||||
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <errno.h>
|
||||
|
||||
typedef boost::error_info<struct tag_file_name,std::string> file_name_info;
|
||||
typedef boost::error_info<struct tag_function,char const *> function_info;
|
||||
typedef boost::error_info<struct tag_errno,int> errno_info;
|
||||
typedef boost::tuple<function_info,errno_info> clib_failure;
|
||||
|
||||
class file_open_error: public boost::exception { };
|
||||
|
||||
boost::shared_ptr<FILE>
|
||||
file_open( char const * name, char const * mode )
|
||||
{
|
||||
if( FILE * f=fopen(name,mode) )
|
||||
return boost::shared_ptr<FILE>(f,fclose);
|
||||
else
|
||||
throw file_open_error() <<
|
||||
file_name_info(name) <<
|
||||
clib_failure("fopen",errno);
|
||||
}
|
25
example/logging.cpp
Normal file
25
example/logging.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
//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)
|
||||
|
||||
//This example shows to print all data contained in a boost::exception.
|
||||
|
||||
#include <boost/exception.hpp>
|
||||
#include <iostream>
|
||||
|
||||
void f(); //throws unknown types that derive from boost::exception.
|
||||
|
||||
void
|
||||
g()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
std::cerr << e.what();
|
||||
}
|
||||
}
|
58
include/boost/exception/cloning.hpp
Normal file
58
include/boost/exception/cloning.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
//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_FA5836A2CADA11DC8CD47C8555D89593
|
||||
#define UUID_FA5836A2CADA11DC8CD47C8555D89593
|
||||
|
||||
#include <boost/exception/enable_exception_cloning.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/cloning_base.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
class
|
||||
unknown_exception:
|
||||
public exception,
|
||||
public std::exception
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
unknown_exception()
|
||||
{
|
||||
}
|
||||
|
||||
explicit
|
||||
unknown_exception( boost::exception const & x ):
|
||||
boost::exception(x)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
|
||||
|
||||
template <class T>
|
||||
exception_ptr
|
||||
clone_exception( T const & e )
|
||||
{
|
||||
if( boost::exception_detail::cloning_base const * cb = dynamic_cast<boost::exception_detail::cloning_base const *>(&e) )
|
||||
if( exception_detail::clone_base const * c = cb->clone() )
|
||||
return exception_ptr(c);
|
||||
if( boost::exception const * be = dynamic_cast<boost::exception const *>(&e) )
|
||||
return exception_ptr(exception_detail::make_clone(unknown_exception(*be)));
|
||||
else
|
||||
return exception_ptr(exception_detail::make_clone(unknown_exception()));
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
rethrow_exception( exception_ptr const & p )
|
||||
{
|
||||
p->rethrow();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
27
include/boost/exception/detail/cloning_base.hpp
Normal file
27
include/boost/exception/detail/cloning_base.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
//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
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class clone_base;
|
||||
|
||||
class
|
||||
cloning_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual clone_base const * clone() const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
38
include/boost/exception/detail/counted_base.hpp
Normal file
38
include/boost/exception/detail/counted_base.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
//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
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
69
include/boost/exception/enable_error_info.hpp
Normal file
69
include/boost/exception/enable_error_info.hpp
Normal file
@ -0,0 +1,69 @@
|
||||
//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_0C5D492E909711DCB658AD4556D89593
|
||||
#define UUID_0C5D492E909711DCB658AD4556D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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>
|
||||
typename exception_detail::enable_error_info_return_type<T>::type
|
||||
enable_error_info( T const & x )
|
||||
{
|
||||
return typename exception_detail::enable_error_info_return_type<T>::type(x);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
148
include/boost/exception/enable_exception_cloning.hpp
Normal file
148
include/boost/exception/enable_exception_cloning.hpp
Normal file
@ -0,0 +1,148 @@
|
||||
//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_78CC85B2914F11DC8F47B48E55D89593
|
||||
#define UUID_78CC85B2914F11DC8F47B48E55D89593
|
||||
|
||||
#include <boost/exception/detail/counted_base.hpp>
|
||||
#include <boost/exception/detail/cloning_base.hpp>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
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>
|
||||
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>
|
||||
exception_detail::clone_impl<T>
|
||||
enable_exception_cloning( T const & x )
|
||||
{
|
||||
return exception_detail::clone_impl<T>(x);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
16
include/boost/exception/error_info.hpp
Normal file
16
include/boost/exception/error_info.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
//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_0E57632CCA3011DCB876FD9955D89593
|
||||
#define UUID_0E57632CCA3011DCB876FD9955D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T>
|
||||
class error_info;
|
||||
}
|
||||
|
||||
#endif
|
90
include/boost/exception/exception.hpp
Normal file
90
include/boost/exception/exception.hpp
Normal file
@ -0,0 +1,90 @@
|
||||
//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_274DA366004E11DCB1DDFE2E56D89593
|
||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
|
||||
#include <boost/exception/detail/counted_base.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class T>
|
||||
class shared_ptr;
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class error_info_base;
|
||||
|
||||
struct
|
||||
error_info_container:
|
||||
public exception_detail::counted_base
|
||||
{
|
||||
virtual char const * what( 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;
|
||||
};
|
||||
}
|
||||
|
||||
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 ~exception() throw()=0;
|
||||
virtual char const * what() const throw();
|
||||
|
||||
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,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 & );
|
||||
|
||||
intrusive_ptr<exception_detail::error_info_container> mutable data_;
|
||||
};
|
||||
|
||||
inline
|
||||
exception::
|
||||
~exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
char const *
|
||||
exception::
|
||||
what() const throw()
|
||||
{
|
||||
if( data_ )
|
||||
try
|
||||
{
|
||||
char const * w = data_->what(typeid(*this));
|
||||
BOOST_ASSERT(0!=w);
|
||||
return w;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
return typeid(*this).name();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
233
include/boost/exception/info.hpp
Normal file
233
include/boost/exception/info.hpp
Normal file
@ -0,0 +1,233 @@
|
||||
//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_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/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
|
||||
{
|
||||
class
|
||||
error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual std::type_info const & tag_typeid() const = 0;
|
||||
virtual std::string value_as_string() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
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 ErrorInfo>
|
||||
struct
|
||||
error_info_type
|
||||
{
|
||||
typedef typename ErrorInfo::value_type value_type;
|
||||
};
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
E const &
|
||||
operator<<( E const & x, error_info<Tag,T> const & v )
|
||||
{
|
||||
shared_ptr< error_info<Tag,T> > p( new error_info<Tag,T>(v) );
|
||||
x.set(p);
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class ErrorInfo,class E>
|
||||
shared_ptr<typename ErrorInfo::value_type const>
|
||||
get_error_info( E const & some_exception )
|
||||
{
|
||||
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>();
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
error_info_container_impl:
|
||||
public error_info_container
|
||||
{
|
||||
public:
|
||||
|
||||
error_info_container_impl():
|
||||
count_(0)
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_container_impl() throw()
|
||||
{
|
||||
}
|
||||
|
||||
shared_ptr<error_info_base const>
|
||||
get( std::type_info const & ti ) const
|
||||
{
|
||||
error_info_map::const_iterator i=info_.find(typeinfo(ti));
|
||||
if( info_.end()!=i )
|
||||
{
|
||||
shared_ptr<error_info_base const> const & p = i->second;
|
||||
BOOST_ASSERT( typeid(*p)==ti );
|
||||
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 *
|
||||
what( std::type_info const & exception_type ) const
|
||||
{
|
||||
if( what_.empty() )
|
||||
{
|
||||
std::string 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 += "] = ";
|
||||
tmp += x->value_as_string();
|
||||
tmp += '\n';
|
||||
}
|
||||
what_.swap(tmp);
|
||||
}
|
||||
return what_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
friend class 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;
|
||||
error_info_map info_;
|
||||
std::string mutable what_;
|
||||
int mutable count_;
|
||||
|
||||
void
|
||||
add_ref() const
|
||||
{
|
||||
++count_;
|
||||
}
|
||||
|
||||
void
|
||||
release() const
|
||||
{
|
||||
if( !--count_ )
|
||||
delete this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
exception::
|
||||
set( shared_ptr<exception_detail::error_info_base const> const & x ) const
|
||||
{
|
||||
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>();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
64
include/boost/exception/info_tuple.hpp
Normal file
64
include/boost/exception/info_tuple.hpp
Normal file
@ -0,0 +1,64 @@
|
||||
//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_63EE924290FB11DC87BB856555D89593
|
||||
#define UUID_63EE924290FB11DC87BB856555D89593
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2 >
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2> > const & v )
|
||||
{
|
||||
return x << v.get<0>() << v.get<1>();
|
||||
}
|
||||
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2,
|
||||
class Tag3,class T3 >
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2>,
|
||||
error_info<Tag3,T3> > const & v )
|
||||
{
|
||||
return x << v.get<0>() << v.get<1>() << v.get<2>();
|
||||
}
|
||||
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2,
|
||||
class Tag3,class T3,
|
||||
class Tag4,class T4 >
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2>,
|
||||
error_info<Tag3,T3>,
|
||||
error_info<Tag4,T4> > const & v )
|
||||
{
|
||||
return x << v.get<0>() << v.get<1>() << v.get<2>() << v.get<3>();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
27
include/boost/exception/to_string.hpp
Normal file
27
include/boost/exception/to_string.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
//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_7E48761AD92811DC9011477D56D89593
|
||||
#define UUID_7E48761AD92811DC9011477D56D89593
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
{
|
||||
template <class T>
|
||||
std::string
|
||||
to_string( T const & x )
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << x;
|
||||
return out.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
148
include/boost/exception/to_string_stub.hpp
Normal file
148
include/boost/exception/to_string_stub.hpp
Normal file
@ -0,0 +1,148 @@
|
||||
//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_E788439ED9F011DCB181F25B55D89593
|
||||
#define UUID_E788439ED9F011DCB181F25B55D89593
|
||||
|
||||
#include <boost/exception/to_string.hpp>
|
||||
#include <iomanip>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <bool ShiftLeftAvailable>
|
||||
struct shift_left_dispatcher;
|
||||
|
||||
template <>
|
||||
struct
|
||||
shift_left_dispatcher<true>
|
||||
{
|
||||
template <class T,class CharT,class Traits,class Stub>
|
||||
static
|
||||
void
|
||||
convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub )
|
||||
{
|
||||
out << x;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
shift_left_dispatcher<false>
|
||||
{
|
||||
template <class T,class CharT,class Traits,class Stub>
|
||||
static
|
||||
void
|
||||
convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
|
||||
{
|
||||
out << s(x);
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
shift_left_dispatch
|
||||
{
|
||||
template <class T,class CharT,class Traits>
|
||||
char operator<<( std::basic_ostream<CharT,Traits> &, T );
|
||||
|
||||
template <class T,class CharT,class Traits,class Stub>
|
||||
void
|
||||
dispatch( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
|
||||
{
|
||||
shift_left_dispatcher<1!=sizeof(out<<x)>::convert(out,x,s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <bool ToStringAvailable>
|
||||
struct to_string_dispatcher;
|
||||
|
||||
template <>
|
||||
struct
|
||||
to_string_dispatcher<true>
|
||||
{
|
||||
template <class T,class Stub>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, Stub )
|
||||
{
|
||||
return to_string(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
to_string_dispatcher<false>
|
||||
{
|
||||
template <class T,class Stub>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, Stub s )
|
||||
{
|
||||
std::ostringstream out;
|
||||
shift_left_dispatch::dispatch(out,x,s);
|
||||
return out.str();
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
to_string_dispatch
|
||||
{
|
||||
template <class T>
|
||||
char to_string( T );
|
||||
|
||||
template <class T,class Stub>
|
||||
std::string
|
||||
dispatch( T const & x, Stub s )
|
||||
{
|
||||
return to_string_dispatcher<1!=sizeof(to_string(x))>::convert(x,s);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::string
|
||||
string_stub_dump( T const & x )
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << "[ type: " << typeid(x).name() << ", size: " << sizeof(T) << ", dump: ";
|
||||
size_t n=sizeof(T)>16?16:sizeof(T);
|
||||
s.fill('0');
|
||||
s.width(2);
|
||||
for( unsigned char const * b=reinterpret_cast<unsigned char const *>(&x),* e=b+n; b!=e; ++b )
|
||||
s << std::setw(2) << std::hex << (unsigned int)*b << " ";
|
||||
s << "]";
|
||||
return s.str();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::string
|
||||
to_string_stub( T const & x )
|
||||
{
|
||||
return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>);
|
||||
}
|
||||
|
||||
template <class T,class Stub>
|
||||
std::string
|
||||
to_string_stub( T const & x, Stub s )
|
||||
{
|
||||
return exception_detail::to_string_dispatch::dispatch(x,s);
|
||||
}
|
||||
|
||||
template <class T,class U>
|
||||
std::string
|
||||
to_string( std::pair<T,U> const & x )
|
||||
{
|
||||
return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
20
test/Jamfile
Normal file
20
test/Jamfile
Normal file
@ -0,0 +1,20 @@
|
||||
# Boost Exception Library test Jamfile
|
||||
#
|
||||
# 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)
|
||||
|
||||
import testing ;
|
||||
|
||||
run cloning_test.cpp ;
|
||||
run unknown_exception_test.cpp ;
|
||||
run to_string_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 what_test.cpp ;
|
||||
compile-fail exception_fail.cpp ;
|
40
test/boost_error_info_test.cpp
Normal file
40
test/boost_error_info_test.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
//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();
|
||||
}
|
42
test/cloning_test.cpp
Normal file
42
test/cloning_test.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
//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/cloning.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct
|
||||
test_exception:
|
||||
std::exception
|
||||
{
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw boost::enable_exception_cloning(test_exception());
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
boost::exception_ptr p = boost::clone_exception(x);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
test_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
49
test/enable_error_info_test.cpp
Normal file
49
test/enable_error_info_test.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
//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 "helper1.hpp"
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef boost::error_info<struct tag_test_int,int> test_int;
|
||||
|
||||
void
|
||||
throw_wrapper()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::exception_test::throw_length_error();
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
x << test_int(42);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_wrapper();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
BOOST_TEST( 42==*boost::get_error_info<test_int>(x) );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
33
test/errno_test.cpp
Normal file
33
test/errno_test.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
//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 <errno.h>
|
||||
|
||||
typedef boost::error_info<struct tag_errno,int> info_errno;
|
||||
|
||||
class
|
||||
my_exception:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
errno=1;
|
||||
throw my_exception() << info_errno(errno);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
my_exception & x )
|
||||
{
|
||||
BOOST_TEST(1==*boost::get_error_info<info_errno>(x));
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
217
test/error_info_test.cpp
Normal file
217
test/error_info_test.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
//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_tuple.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct throws_on_copy;
|
||||
struct non_printable { };
|
||||
|
||||
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;
|
||||
|
||||
struct
|
||||
test_exception:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
struct
|
||||
throws_on_copy
|
||||
{
|
||||
throws_on_copy()
|
||||
{
|
||||
}
|
||||
|
||||
throws_on_copy( throws_on_copy const & )
|
||||
{
|
||||
throw test_exception();
|
||||
}
|
||||
};
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
void
|
||||
exception_safety_test()
|
||||
{
|
||||
test_exception x;
|
||||
try
|
||||
{
|
||||
x << test_4(throws_on_copy());
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
test_exception & )
|
||||
{
|
||||
}
|
||||
BOOST_TEST(!boost::get_error_info<test_4>(x));
|
||||
}
|
||||
|
||||
void
|
||||
throw_empty()
|
||||
{
|
||||
throw test_exception();
|
||||
}
|
||||
|
||||
void
|
||||
throw_test_1( char const * value )
|
||||
{
|
||||
throw test_exception() << test_5(std::string(value));
|
||||
}
|
||||
|
||||
void
|
||||
throw_test_2()
|
||||
{
|
||||
throw test_exception() << test_6(non_printable());
|
||||
}
|
||||
|
||||
void
|
||||
throw_catch_add_file_name( char const * name )
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_empty();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
x << test_5(std::string(name));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_empty()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_empty();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
BOOST_TEST( dynamic_cast<test_exception *>(&x) );
|
||||
BOOST_TEST( !boost::get_error_info<test_1>(x) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
throw_empty();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST( dynamic_cast<boost::exception *>(&x) );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_basic_throw_catch()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_test_1("test");
|
||||
BOOST_ASSERT(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
|
||||
}
|
||||
try
|
||||
{
|
||||
throw_test_2();
|
||||
BOOST_ASSERT(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
BOOST_TEST(boost::get_error_info<test_6>(x));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_catch_add_info()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_catch_add_file_name("test");
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_add_tuple()
|
||||
{
|
||||
typedef boost::tuple<test_1,test_2> test_12;
|
||||
typedef boost::tuple<test_1,test_2,test_3> test_123;
|
||||
typedef boost::tuple<test_1,test_2,test_3,test_5> test_1235;
|
||||
try
|
||||
{
|
||||
throw test_exception() << test_12(42,42u);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
|
||||
BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
|
||||
}
|
||||
try
|
||||
{
|
||||
throw test_exception() << test_123(42,42u,42.0f);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
|
||||
BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
|
||||
BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
|
||||
}
|
||||
try
|
||||
{
|
||||
throw test_exception() << test_1235(42,42u,42.0f,std::string("42"));
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
{
|
||||
BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
|
||||
BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
|
||||
BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
|
||||
BOOST_TEST( *boost::get_error_info<test_5>(x)=="42" );
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
basic_test();
|
||||
exception_safety_test();
|
||||
test_empty();
|
||||
test_basic_throw_catch();
|
||||
test_catch_add_info();
|
||||
test_add_tuple();
|
||||
return boost::report_errors();
|
||||
}
|
12
test/exception_fail.cpp
Normal file
12
test/exception_fail.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
//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>
|
||||
|
||||
void
|
||||
tester( boost::exception & x )
|
||||
{
|
||||
throw x; //must not compile.
|
||||
}
|
35
test/exception_test.cpp
Normal file
35
test/exception_test.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
//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>
|
||||
|
||||
class
|
||||
test_exception:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
void
|
||||
test_throw()
|
||||
{
|
||||
throw test_exception();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
test_throw();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
test_exception & )
|
||||
{
|
||||
BOOST_TEST(true);
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
21
test/helper1.cpp
Normal file
21
test/helper1.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
//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>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_test
|
||||
{
|
||||
void
|
||||
throw_length_error()
|
||||
{
|
||||
throw enable_error_info( std::length_error("my length error") );
|
||||
}
|
||||
}
|
||||
}
|
19
test/helper1.hpp
Normal file
19
test/helper1.hpp
Normal file
@ -0,0 +1,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)
|
||||
|
||||
#ifndef UUID_4AEB7924CA2E11DC888A8C9355D89593
|
||||
#define UUID_4AEB7924CA2E11DC888A8C9355D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_test
|
||||
{
|
||||
void throw_length_error();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
53
test/helper2.cpp
Normal file
53
test/helper2.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
//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 "helper2.hpp"
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_test
|
||||
{
|
||||
inline
|
||||
some_boost_exception::
|
||||
some_boost_exception( int x ):
|
||||
x_(x)
|
||||
{
|
||||
}
|
||||
|
||||
some_boost_exception::
|
||||
~some_boost_exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
some_std_exception::
|
||||
some_std_exception( int x ):
|
||||
x_(x)
|
||||
{
|
||||
}
|
||||
|
||||
some_std_exception::
|
||||
~some_std_exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
template <>
|
||||
void
|
||||
throw_test_exception<some_boost_exception>( int x )
|
||||
{
|
||||
boost::throw_exception( some_boost_exception(x) );
|
||||
}
|
||||
|
||||
template <>
|
||||
void
|
||||
throw_test_exception<some_std_exception>( int x )
|
||||
{
|
||||
boost::throw_exception( some_std_exception(x) );
|
||||
}
|
||||
}
|
||||
}
|
47
test/helper2.hpp
Normal file
47
test/helper2.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
//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_BC765EB4CA2A11DCBDC5828355D89593
|
||||
#define UUID_BC765EB4CA2A11DCBDC5828355D89593
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_test
|
||||
{
|
||||
struct
|
||||
some_boost_exception:
|
||||
public boost::exception,
|
||||
public std::exception
|
||||
{
|
||||
explicit some_boost_exception( int x );
|
||||
virtual ~some_boost_exception() throw();
|
||||
int x_;
|
||||
};
|
||||
|
||||
struct
|
||||
some_std_exception:
|
||||
public std::exception
|
||||
{
|
||||
explicit some_std_exception( int x );
|
||||
virtual ~some_std_exception() throw();
|
||||
int x_;
|
||||
};
|
||||
|
||||
template <class>
|
||||
void throw_test_exception( int );
|
||||
|
||||
template <>
|
||||
void throw_test_exception<some_boost_exception>( int );
|
||||
|
||||
template <>
|
||||
void throw_test_exception<some_std_exception>( int );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
71
test/throw_exception_test.cpp
Normal file
71
test/throw_exception_test.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
//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 "helper2.hpp"
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/cloning.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
typedef boost::error_info<struct tag_test_int,int> test_int;
|
||||
|
||||
void
|
||||
throw_fwd( void (*thrower)(int) )
|
||||
{
|
||||
try
|
||||
{
|
||||
thrower(42);
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
x << test_int(42);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
tester()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_fwd( &boost::exception_test::throw_test_exception<T> );
|
||||
BOOST_ASSERT(false);
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
boost::exception_ptr p = boost::clone_exception(x);
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
T & y )
|
||||
{
|
||||
BOOST_TEST(*boost::get_error_info<test_int>(y)==42);
|
||||
BOOST_TEST(y.x_==42);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
tester<boost::exception_test::some_boost_exception>();
|
||||
tester<boost::exception_test::some_std_exception>();
|
||||
return boost::report_errors();
|
||||
}
|
97
test/to_string_test.cpp
Normal file
97
test/to_string_test.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
//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/to_string_stub.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
n1
|
||||
{
|
||||
class
|
||||
c1
|
||||
{
|
||||
};
|
||||
|
||||
std::string
|
||||
to_string( c1 const & )
|
||||
{
|
||||
return "c1";
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
n2
|
||||
{
|
||||
class
|
||||
c2
|
||||
{
|
||||
};
|
||||
|
||||
std::ostream &
|
||||
operator<<( std::ostream & s, c2 const & )
|
||||
{
|
||||
s << "c2";
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
n3
|
||||
{
|
||||
class
|
||||
c3
|
||||
{
|
||||
};
|
||||
|
||||
std::ostream &
|
||||
operator<<( std::ostream & s, c3 const & )
|
||||
{
|
||||
s << "bad";
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string
|
||||
to_string( c3 const & )
|
||||
{
|
||||
return "c3";
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
class
|
||||
to_string_tester
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
my_stub
|
||||
{
|
||||
std::string
|
||||
operator()( T const & )
|
||||
{
|
||||
return "stub";
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost;
|
||||
BOOST_TEST( to_string(5)=="5" );
|
||||
BOOST_TEST( to_string(n1::c1())=="c1" );
|
||||
BOOST_TEST( to_string(n2::c2())=="c2" );
|
||||
BOOST_TEST( to_string(n3::c3())=="c3" );
|
||||
BOOST_TEST( to_string_stub(5)=="5" );
|
||||
BOOST_TEST( to_string_stub(n1::c1())=="c1" );
|
||||
BOOST_TEST( to_string_stub(n2::c2())=="c2" );
|
||||
BOOST_TEST( to_string_stub(n3::c3())=="c3" );
|
||||
BOOST_TEST( to_string_stub(to_string_tester(),my_stub<to_string_tester>())=="stub" );
|
||||
return boost::report_errors();
|
||||
}
|
84
test/unknown_exception_test.cpp
Normal file
84
test/unknown_exception_test.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
//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/cloning.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
typedef boost::error_info<struct tag_test,int> test;
|
||||
|
||||
struct
|
||||
test_boost_exception:
|
||||
boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
void
|
||||
throw_boost_exception()
|
||||
{
|
||||
throw test_boost_exception() << test(42);
|
||||
}
|
||||
|
||||
void
|
||||
throw_unknown_exception()
|
||||
{
|
||||
struct
|
||||
test_exception:
|
||||
std::exception
|
||||
{
|
||||
};
|
||||
throw test_exception();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw_boost_exception();
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
boost::exception_ptr ep=boost::clone_exception(x);
|
||||
try
|
||||
{
|
||||
rethrow_exception(ep);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & x )
|
||||
{
|
||||
BOOST_TEST( 42==*boost::get_error_info<test>(x) );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
throw_unknown_exception();
|
||||
}
|
||||
catch(
|
||||
std::exception & x )
|
||||
{
|
||||
boost::exception_ptr ep=boost::clone_exception(x);
|
||||
try
|
||||
{
|
||||
rethrow_exception(ep);
|
||||
}
|
||||
catch(
|
||||
boost::unknown_exception & )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
27
test/what_test.cpp
Normal file
27
test/what_test.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
//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>
|
||||
|
||||
typedef boost::error_info<struct tag_test,int> test;
|
||||
|
||||
class
|
||||
my_exception:
|
||||
public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
my_exception x;
|
||||
x << test(1);
|
||||
std::string w1 = x.what();
|
||||
x << test(2);
|
||||
std::string w2 = x.what();
|
||||
BOOST_TEST( w1!=w2 );
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user