From a1c08eb8e03aab8ff560314a8d8f1825d0d54ad4 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sat, 28 Jun 2008 18:29:40 +0000 Subject: [PATCH] Boost Exception In other libraries, watch for compile error referring to throw_exception_assert_compatibility in boost::throw_exception. Resolve by throwing an exception that derives from std::exception. This is not a new requirement but it is being enforced now. [SVN r46818] --- doc/BOOST_ERROR_INFO.html | 58 + doc/boost-exception.html | 443 + ..._exception_diagnostic_information_hpp.html | 53 + doc/copy_exception.html | 54 + doc/current_exception.html | 66 + doc/diagnostic_information.html | 52 + doc/enable_current_exception.html | 71 + doc/enable_error_info.html | 59 + doc/error_info.html | 77 + doc/exception.html | 110 + doc/exception_cloning_hpp.html | 72 + doc/exception_constructors.html | 51 + doc/exception_destructor.html | 48 + doc/exception_diagnostic_information.html | 53 + doc/exception_enable_error_info_hpp.html | 54 + ...xception_enable_exception_cloning_hpp.html | 54 + doc/exception_error_info_group_hpp.html | 58 + doc/exception_error_info_hpp.html | 81 + doc/exception_error_info_value_hpp.html | 51 + doc/exception_exception_hpp.html | 67 + doc/exception_hpp.html | 51 + doc/exception_ptr.html | 60 + doc/exception_what.html | 50 + doc/get_error_info.html | 59 + doc/name_idx.html | 85 + doc/operator_shl_exception.html | 67 + doc/operator_shl_tuple.html | 63 + doc/reno.css | 225 + doc/rethrow_exception.html | 54 + doc/shade-l.png | Bin 0 -> 948 bytes doc/shade-r.png | Bin 0 -> 946 bytes doc/source/boost-exception.reno | 9982 +++++++++++++++++ doc/source/html_prefix.txt | 21 + doc/source/html_suffix.txt | 18 + doc/throw_exception.html | 67 + doc/throw_exception_hpp.html | 64 + doc/tutorial_diagnostic_information.html | 67 + doc/tutorial_enable_error_info.html | 72 + doc/tutorial_exception_ptr.html | 103 + doc/tutorial_transporting_data.html | 188 + doc/unknown_exception.html | 59 + doc/valid-css.png | Bin 0 -> 5130 bytes doc/valid-xhtml.png | Bin 0 -> 5805 bytes example/Jamfile | 15 + example/cloning_1.cpp | 23 + example/cloning_2.cpp | 39 + example/enable_error_info.cpp | 35 + example/error_info_1.cpp | 36 + example/error_info_2.cpp | 49 + example/example_io.cpp | 215 + example/info_tuple.cpp | 31 + example/logging.cpp | 25 + .../boost/exception/detail/cloning_base.hpp | 38 + .../boost/exception/detail/counted_base.hpp | 49 + .../exception/detail/is_output_streamable.hpp | 38 + .../exception/detail/object_hex_dump.hpp | 39 + .../exception/diagnostic_information.hpp | 27 + .../exception/enable_current_exception.hpp | 154 + include/boost/exception/enable_error_info.hpp | 111 + include/boost/exception/error_info.hpp | 16 + include/boost/exception/exception.hpp | 127 + include/boost/exception/info.hpp | 242 + include/boost/exception/info_tuple.hpp | 64 + include/boost/exception/to_string.hpp | 72 + include/boost/exception/to_string_stub.hpp | 96 + include/boost/exception_ptr.hpp | 194 + include/boost/throw_exception.hpp | 36 +- test/Jamfile.v2 | 47 + test/boost_error_info_test.cpp | 40 + test/cloning_test.cpp | 42 + test/copy_exception_test.cpp | 34 + test/diagnostic_information_hpp_test.cpp | 6 + test/diagnostic_information_test.cpp | 80 + test/enable_current_exception_hpp_test.cpp | 6 + test/enable_error_info_hpp_test.cpp | 6 + test/enable_error_info_test.cpp | 57 + test/errno_test.cpp | 33 + test/error_info_hpp_test.cpp | 6 + test/error_info_test.cpp | 258 + test/exception_fail.cpp | 12 + test/exception_hpp_test.cpp | 6 + test/exception_ptr_hpp_test.cpp | 6 + test/exception_test.cpp | 35 + test/has_to_string_test.cpp | 57 + test/helper1.cpp | 22 + test/helper1.hpp | 19 + test/helper2.cpp | 72 + test/helper2.hpp | 61 + test/info_hpp_test.cpp | 6 + test/info_tuple_hpp_test.cpp | 6 + test/is_output_streamable_test.cpp | 41 + test/throw_exception_fail.cpp | 18 + test/throw_exception_test.cpp | 69 + test/to_string_fail.cpp | 23 + test/to_string_hpp_test.cpp | 6 + test/to_string_stub_hpp_test.cpp | 6 + test/to_string_stub_test.cpp | 98 + test/to_string_test.cpp | 56 + test/unknown_exception_test.cpp | 117 + test/what_test.cpp | 32 + 100 files changed, 16134 insertions(+), 7 deletions(-) create mode 100644 doc/BOOST_ERROR_INFO.html create mode 100644 doc/boost-exception.html create mode 100644 doc/boost_exception_diagnostic_information_hpp.html create mode 100644 doc/copy_exception.html create mode 100644 doc/current_exception.html create mode 100644 doc/diagnostic_information.html create mode 100644 doc/enable_current_exception.html create mode 100644 doc/enable_error_info.html create mode 100644 doc/error_info.html create mode 100644 doc/exception.html create mode 100644 doc/exception_cloning_hpp.html create mode 100644 doc/exception_constructors.html create mode 100644 doc/exception_destructor.html create mode 100644 doc/exception_diagnostic_information.html create mode 100644 doc/exception_enable_error_info_hpp.html create mode 100644 doc/exception_enable_exception_cloning_hpp.html create mode 100644 doc/exception_error_info_group_hpp.html create mode 100644 doc/exception_error_info_hpp.html create mode 100644 doc/exception_error_info_value_hpp.html create mode 100644 doc/exception_exception_hpp.html create mode 100644 doc/exception_hpp.html create mode 100644 doc/exception_ptr.html create mode 100644 doc/exception_what.html create mode 100644 doc/get_error_info.html create mode 100644 doc/name_idx.html create mode 100644 doc/operator_shl_exception.html create mode 100644 doc/operator_shl_tuple.html create mode 100644 doc/reno.css create mode 100644 doc/rethrow_exception.html create mode 100644 doc/shade-l.png create mode 100644 doc/shade-r.png create mode 100644 doc/source/boost-exception.reno create mode 100644 doc/source/html_prefix.txt create mode 100644 doc/source/html_suffix.txt create mode 100644 doc/throw_exception.html create mode 100644 doc/throw_exception_hpp.html create mode 100644 doc/tutorial_diagnostic_information.html create mode 100644 doc/tutorial_enable_error_info.html create mode 100644 doc/tutorial_exception_ptr.html create mode 100644 doc/tutorial_transporting_data.html create mode 100644 doc/unknown_exception.html create mode 100644 doc/valid-css.png create mode 100644 doc/valid-xhtml.png create mode 100644 example/Jamfile create mode 100644 example/cloning_1.cpp create mode 100644 example/cloning_2.cpp create mode 100644 example/enable_error_info.cpp create mode 100644 example/error_info_1.cpp create mode 100644 example/error_info_2.cpp create mode 100644 example/example_io.cpp create mode 100644 example/info_tuple.cpp create mode 100644 example/logging.cpp create mode 100644 include/boost/exception/detail/cloning_base.hpp create mode 100644 include/boost/exception/detail/counted_base.hpp create mode 100644 include/boost/exception/detail/is_output_streamable.hpp create mode 100644 include/boost/exception/detail/object_hex_dump.hpp create mode 100644 include/boost/exception/diagnostic_information.hpp create mode 100644 include/boost/exception/enable_current_exception.hpp create mode 100644 include/boost/exception/enable_error_info.hpp create mode 100644 include/boost/exception/error_info.hpp create mode 100644 include/boost/exception/exception.hpp create mode 100644 include/boost/exception/info.hpp create mode 100644 include/boost/exception/info_tuple.hpp create mode 100644 include/boost/exception/to_string.hpp create mode 100644 include/boost/exception/to_string_stub.hpp create mode 100644 include/boost/exception_ptr.hpp create mode 100644 test/Jamfile.v2 create mode 100644 test/boost_error_info_test.cpp create mode 100644 test/cloning_test.cpp create mode 100644 test/copy_exception_test.cpp create mode 100644 test/diagnostic_information_hpp_test.cpp create mode 100644 test/diagnostic_information_test.cpp create mode 100644 test/enable_current_exception_hpp_test.cpp create mode 100644 test/enable_error_info_hpp_test.cpp create mode 100644 test/enable_error_info_test.cpp create mode 100644 test/errno_test.cpp create mode 100644 test/error_info_hpp_test.cpp create mode 100644 test/error_info_test.cpp create mode 100644 test/exception_fail.cpp create mode 100644 test/exception_hpp_test.cpp create mode 100644 test/exception_ptr_hpp_test.cpp create mode 100644 test/exception_test.cpp create mode 100644 test/has_to_string_test.cpp create mode 100644 test/helper1.cpp create mode 100644 test/helper1.hpp create mode 100644 test/helper2.cpp create mode 100644 test/helper2.hpp create mode 100644 test/info_hpp_test.cpp create mode 100644 test/info_tuple_hpp_test.cpp create mode 100644 test/is_output_streamable_test.cpp create mode 100644 test/throw_exception_fail.cpp create mode 100644 test/throw_exception_test.cpp create mode 100644 test/to_string_fail.cpp create mode 100644 test/to_string_hpp_test.cpp create mode 100644 test/to_string_stub_hpp_test.cpp create mode 100644 test/to_string_stub_test.cpp create mode 100644 test/to_string_test.cpp create mode 100644 test/unknown_exception_test.cpp create mode 100644 test/what_test.cpp diff --git a/doc/BOOST_ERROR_INFO.html b/doc/BOOST_ERROR_INFO.html new file mode 100644 index 0000000..a83038c --- /dev/null +++ b/doc/BOOST_ERROR_INFO.html @@ -0,0 +1,58 @@ + + + + + BOOST_ERROR_INFO + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

BOOST_ERROR_INFO

+

#include <boost/exception/info.hpp>

+
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;
+    
+    #define BOOST_ERROR_INFO\
+        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
+        ::boost::throw_file(__FILE__) <<\
+        ::boost::throw_line((int)__LINE__)
+    }
+

This macro is designed to be used with operator<< when throwing a boost::exception, to store information about the location of the throw statement. It can be chained with other error_infos in a single throw expression.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/boost-exception.html b/doc/boost-exception.html new file mode 100644 index 0000000..4ba3d6e --- /dev/null +++ b/doc/boost-exception.html @@ -0,0 +1,443 @@ + + + + + Boost Exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Introduction

+

The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code.

+

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.

+

The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected.

+

Boost Exception also supports N2179-style copying of exception objects, implemented non-intrusively and automatically by the boost::throw_exception function.

+

Note:

+

Boost Exception was accepted as a Boost library on November 7 2007, however it has not yet been part of an official Boost release. Current version can be downloaded from Boost SVN.

+

Contents

+
  1. Tutorial +
  2. +
  3. Documentation +
  4. +
  5. Index
  6. +
+

Synopsis

+

#include <boost/exception.hpp>

+
namespace
+boost
+    {
+    class
+    exception
+        {
+        public:
+    
+        virtual char const * diagnostic_information() const throw();    
+        virtual char const * what() const throw();    
+    
+        protected:
+    
+        exception();
+        exception( exception const & x );    
+        ~exception();    
+        };
+
+    template <class Tag,class T>
+    class
+    error_info
+        {
+        public:
+    
+        typedef T value_type;
+    
+        error_info( value_type const & );
+        };    
+    
+    template <class ErrorInfo,class E>
+    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );    
+    
+    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;
+    
+    #define BOOST_ERROR_INFO\
+        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
+        ::boost::throw_file(__FILE__) <<\
+        ::boost::throw_line((int)__LINE__)    
+    
+    template <class E, class Tag, class T>
+    E const & operator<<( E const & x, error_info<Tag,T> const & v );
+
+    template <class E, class Tag1, class T1, ..., class TagN, class TN>
+    E const & operator<<( E const & x,
+        tuple<
+            error_info<Tag1,T1>,
+            ...,
+            error_info<TagN,TN> > const & v );
+
+    template <class T>
+    ---unspecified--- enable_error_info( T const & x );
+
+    std::string diagnostic_information( std::exception const & x );
+
+    class
+    unknown_exception:
+        public std::exception
+        public boost::exception
+        {
+        ---unspecified---
+        };    
+    
+    typedef ---unspecified--- exception_ptr;    
+    
+    template <class T>
+    exception_ptr copy_exception( T const & e );    
+    
+    exception_ptr current_exception();    
+    
+    void rethrow_exception( exception_ptr const & ep );
+
+    template <class T>
+    ---unspecified--- enable_current_exception( T const & e );
+
+    #ifdef BOOST_NO_EXCEPTIONS
+    
+    void throw_exception( std::exception const & e ); // user defined
+    
+    #else
+    
+    template <class E>
+    void throw_exception( E const & e );
+    
+    #endif
+    }
+

Class exception

+

exception

+

#include <boost/exception/exception.hpp>

+
namespace
+boost
+    {
+    class
+    exception
+        {
+        public:
+    
+        virtual char const * diagnostic_information() const throw();    
+        virtual char const * what() const throw();    
+    
+        protected:
+    
+        exception();
+        exception( exception const & x );    
+        ~exception();    
+        };
+    }
+

Class boost::exception is designed to be used as a universal base for user-defined exception types.

+

An object of any type deriving from boost::exception can store data of arbitrary types, using the error_info wrapper and operator<<.

+

To retrieve data from a boost::exception object, use the get_error_info function template.

+

exception::exception

+
exception();
+exception( exception const & x );
+

Effects:

+
  • Default constructor: initializes an empty boost::exception object.
  • +
  • Copy constructor: initializes a boost::exception object which shares with x all data added through operator<<, including data that is added at a future time.
  • +
+

Throws:

+

Nothing.

+

exception::~exception

+

Effects:

+

Frees all resources associated with a boost::exception object.

+

Throws:

+

Nothing.

+

exception::diagnostic_information

+
virtual char const * diagnostic_information() const throw();
+

Returns:

+

An string representation of all data stored in the boost::exception object by the operator<< function. See "Tutorial: Diagnostic Information" for details.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

exception::what

+
virtual char const * what() const throw();
+

Returns:

+

The default implementation is equivalent to return exception::diagnostic_information(). The signature of boost::exception::what is identical to the familiar std::exception::what function, so that when an exception type that derives both std::exception and boost::exception overrides the what function, it overrides both std::exception::what and boost::exception::what.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

Transporting of Arbitrary Data to the Catch Site

+

error_info

+

#include <boost/exception/info.hpp>

+
namespace
+boost
+    {
+    template <class Tag,class T>
+    class
+    error_info
+        {
+        public:
+    
+        typedef T value_type;
+    
+        error_info( value_type const & );
+        };
+    }
+

Requirements:

+

T must have accessible copy constructor and must not be a reference.

+

Description:

+

This class template is used to associate a Tag type with a value type T. Objects of type error_info<Tag,T> can be passed to operator<< to be stored in objects of type boost::exception.

+

Note:

+

The header <boost/exception/error_info.hpp> provides a declaration of the error_info template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this:

+
#include <boost/exception/error_info.hpp>
+
+typedef boost::error_info<struct tag_errno,int> errno_info;
+

Of course, to actually add an errno_info object to exceptions using operator<<, or to retrieve it using get_error_info, you must first #include <boost/exception/info.hpp>.

+

operator<<, error_info overload

+

#include <boost/exception/info.hpp> 

+
namespace
+boost
+    {
+    template <class E, class Tag, class T>
+    E const & operator<<( E const & x, error_info<Tag,T> const & v );
+    }
+

Requirements:

+

E must be boost::exception, or a type that derives (indirectly) from boost::exception.

+

Effects:

+

Stores a copy of v into x. If x already contains data of type error_info<Tag1,T1>, that data is overwritten.

+

Returns:

+

x.

+

Throws:

+

std::bad_alloc, or any exception emitted by the T copy constructor.

+

get_error_info

+

#include <boost/exception/info.hpp>

+
namespace
+boost
+    {
+    template <class ErrorInfo,class E>
+    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );
+    }
+

Requirements:

+

The type of the x object must derive from boost::exception; ErrorInfo must be an instance of the error_info template.

+

Returns:

+

If x does not store an object of type ErrorInfo, returns an empty shared_ptr; otherwise returns pointer to the stored value. Use operator<< to store values in exception objects.

+

Throws:

+

Nothing.

+

enable_error_info

+

#include <boost/exception/enable_error_info.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_error_info( T const & x );
+    }
+

Requirements:

+

T must be a user-defined type with accessible no-throw copy constructor.

+

Returns:

+

An object of unspecified type with no-throw copy semantics, which derives publicly from both T, and class boost::exception. The T sub-object is initialized from x by the T copy constructor. If T already derives from boost::exception, then the type of the returned object does not derive boost::exception.

+

Throws:

+

Nothing.

+

BOOST_ERROR_INFO

+

#include <boost/exception/info.hpp>

+
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;
+    
+    #define BOOST_ERROR_INFO\
+        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
+        ::boost::throw_file(__FILE__) <<\
+        ::boost::throw_line((int)__LINE__)
+    }
+

This macro is designed to be used with operator<< when throwing a boost::exception, to store information about the location of the throw statement. It can be chained with other error_infos in a single throw expression.

+

Transporting of Exceptions between Threads

+

exception_ptr

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    typedef ---unspecified--- exception_ptr;
+    }
+

The exception_ptr type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; exception_ptr's operations do not throw.

+

Two instances of exception_ptr are equivalent and compare equal if and only if they refer to the same exception.

+

The default constructor of exception_ptr produces the null value of the type. The null value is equivalent only to itself.

+

Note:

+

exception_ptr objects are returned by current_exception and copy_exception.

+

enable_current_exception

+

#include <boost/exception/enable_current_exception.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_current_exception( T const & e );
+    }
+

Requirements:

+

T must have an accessible no-throw copy constructor

+

Returns:

+

An object of unspecified type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &).

+

Description:

+

This function is designed to be used directly in a throw-expression to enable the exception_ptr support in Boost Exception. For example:

+
class
+my_exception:
+    public std::exception
+    {
+    };
+
+....
+throw boost::enable_current_exception(my_exception());
+

Unless enable_current_exception is called at the time an exception object is used in a throw-expression, an attempt to copy it using current_exception may return an exception_ptr which refers to an instance of unknown_exception. See current_exception for details.

+

Note:

+

Instead of using the throw keyword directly, it is preferable to call boost::throw_exception. This is guaranteed to throw an exception that derives from boost::exception and supports exception_ptr functionality.

+

current_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    exception_ptr current_exception();
+    }
+

Requirements:

+

The current_exception function must not be called outside of a catch block.

+

Returns:

+
  • An exception_ptr that refers to the currently handled exception or a copy of the currently handled exception.
  • +
  • If the function needs to allocate memory and the attempt fails, it returns an exception_ptr that refers to an instance of std::bad_alloc.
  • +
+

Throws:

+

Nothing.

+

Notes:

+
+

copy_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    exception_ptr copy_exception( T const & e );
+    }
+

Effects:

+

As if try { throw e; } catch( ... ) { return current_exception(); }

+

rethrow_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    void rethrow_exception( exception_ptr const & ep );
+    }
+

Precondition:

+

ep shall not be null.

+

Throws:

+

The exception to which ep refers.

+

unknown_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    class
+    unknown_exception:
+        public std::exception
+        public boost::exception
+        {
+        ---unspecified---
+        };
+    }
+

This type is used by the exception_ptr support in Boost Exception. Please see current_exception.

+

Printing Diagnostic Information

+

diagnostic_information

+

#include <boost/exception/diagnostic_information.hpp>

+
namespace
+boost
+    {
+    std::string diagnostic_information( std::exception const & x );
+    }
+

Returns:

+

If dynamic_cast<boost::exception *>(&x) is not null, the returned string is initialized by a call to exception::diagnostic_information; otherwise, the returned string combines the output of x.what() and typeid(x).name().

+

Throwing Exceptions

+

throw_exception

+

#include <boost/throw_exception.hpp>

+
namespace
+boost
+    {
+    #ifdef BOOST_NO_EXCEPTIONS
+    
+    void throw_exception( std::exception const & e ); // user defined
+    
+    #else
+    
+    template <class E>
+    void throw_exception( E const & e );
+    
+    #endif
+    }
+

Requirements:

+

E must derive publicly from std::exception.

+

Effects:

+
  • If BOOST_NO_EXCEPTIONS is not defined, boost::throw_exception(e) is equivalent to throw boost::enable_current_exception(boost::enable_error_info(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::throw_exception(e) is equivalent to throw e;
  • +
  • If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of throw_exception are allowed to assume that the function never returns; therefore, if the user-defined throw_exception returns, the behavior is undefined.
  • +
+
+ + + +
+
+
+ + diff --git a/doc/boost_exception_diagnostic_information_hpp.html b/doc/boost_exception_diagnostic_information_hpp.html new file mode 100644 index 0000000..2fe07fd --- /dev/null +++ b/doc/boost_exception_diagnostic_information_hpp.html @@ -0,0 +1,53 @@ + + + + + boost/exception/diagnostic_information.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/diagnostic_information.hpp

+

Synopsis

+
#include <exception>
+
+namespace
+boost
+    {
+    std::string diagnostic_information( std::exception const & x );
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/copy_exception.html b/doc/copy_exception.html new file mode 100644 index 0000000..afc4bd8 --- /dev/null +++ b/doc/copy_exception.html @@ -0,0 +1,54 @@ + + + + + copy_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

copy_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    exception_ptr copy_exception( T const & e );
+    }
+

Effects:

+

As if try { throw e; } catch( ... ) { return current_exception(); }

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/current_exception.html b/doc/current_exception.html new file mode 100644 index 0000000..759f47f --- /dev/null +++ b/doc/current_exception.html @@ -0,0 +1,66 @@ + + + + + current_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

current_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    exception_ptr current_exception();
+    }
+

Requirements:

+

The current_exception function must not be called outside of a catch block.

+

Returns:

+
  • An exception_ptr that refers to the currently handled exception or a copy of the currently handled exception.
  • +
  • If the function needs to allocate memory and the attempt fails, it returns an exception_ptr that refers to an instance of std::bad_alloc.
  • +
+

Throws:

+

Nothing.

+

Notes:

+
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/diagnostic_information.html b/doc/diagnostic_information.html new file mode 100644 index 0000000..c60ef6f --- /dev/null +++ b/doc/diagnostic_information.html @@ -0,0 +1,52 @@ + + + + + diagnostic_information + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

diagnostic_information

+

#include <boost/exception/diagnostic_information.hpp>

+
namespace
+boost
+    {
+    std::string diagnostic_information( std::exception const & x );
+    }
+

Returns:

+

If dynamic_cast<boost::exception *>(&x) is not null, the returned string is initialized by a call to exception::diagnostic_information; otherwise, the returned string combines the output of x.what() and typeid(x).name().

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/enable_current_exception.html b/doc/enable_current_exception.html new file mode 100644 index 0000000..fbcc5fb --- /dev/null +++ b/doc/enable_current_exception.html @@ -0,0 +1,71 @@ + + + + + enable_current_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

enable_current_exception

+

#include <boost/exception/enable_current_exception.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_current_exception( T const & e );
+    }
+

Requirements:

+

T must have an accessible no-throw copy constructor

+

Returns:

+

An object of unspecified type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &).

+

Description:

+

This function is designed to be used directly in a throw-expression to enable the exception_ptr support in Boost Exception. For example:

+
class
+my_exception:
+    public std::exception
+    {
+    };
+
+....
+throw boost::enable_current_exception(my_exception());
+

Unless enable_current_exception is called at the time an exception object is used in a throw-expression, an attempt to copy it using current_exception may return an exception_ptr which refers to an instance of unknown_exception. See current_exception for details.

+

Note:

+

Instead of using the throw keyword directly, it is preferable to call boost::throw_exception. This is guaranteed to throw an exception that derives from boost::exception and supports exception_ptr functionality.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/enable_error_info.html b/doc/enable_error_info.html new file mode 100644 index 0000000..4ea13ef --- /dev/null +++ b/doc/enable_error_info.html @@ -0,0 +1,59 @@ + + + + + enable_error_info + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

enable_error_info

+

#include <boost/exception/enable_error_info.hpp>

+
namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_error_info( T const & x );
+    }
+

Requirements:

+

T must be a user-defined type with accessible no-throw copy constructor.

+

Returns:

+

An object of unspecified type with no-throw copy semantics, which derives publicly from both T, and class boost::exception. The T sub-object is initialized from x by the T copy constructor. If T already derives from boost::exception, then the type of the returned object does not derive boost::exception.

+

Throws:

+

Nothing.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/error_info.html b/doc/error_info.html new file mode 100644 index 0000000..61f6f00 --- /dev/null +++ b/doc/error_info.html @@ -0,0 +1,77 @@ + + + + + error_info + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

error_info

+

#include <boost/exception/info.hpp>

+
namespace
+boost
+    {
+    template <class Tag,class T>
+    class
+    error_info
+        {
+        public:
+    
+        typedef T value_type;
+    
+        error_info( value_type const & );
+        };
+    }
+

Requirements:

+

T must have accessible copy constructor and must not be a reference.

+

Description:

+

This class template is used to associate a Tag type with a value type T. Objects of type error_info<Tag,T> can be passed to operator<< to be stored in objects of type boost::exception.

+

Note:

+

The header <boost/exception/error_info.hpp> provides a declaration of the error_info template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this:

+
#include <boost/exception/error_info.hpp>
+
+typedef boost::error_info<struct tag_errno,int> errno_info;
+

Of course, to actually add an errno_info object to exceptions using operator<<, or to retrieve it using get_error_info, you must first #include <boost/exception/info.hpp>.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception.html b/doc/exception.html new file mode 100644 index 0000000..2b7f81b --- /dev/null +++ b/doc/exception.html @@ -0,0 +1,110 @@ + + + + + exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception

+

#include <boost/exception/exception.hpp>

+
namespace
+boost
+    {
+    class
+    exception
+        {
+        public:
+    
+        virtual char const * diagnostic_information() const throw();    
+        virtual char const * what() const throw();    
+    
+        protected:
+    
+        exception();
+        exception( exception const & x );    
+        ~exception();    
+        };
+    }
+

Class boost::exception is designed to be used as a universal base for user-defined exception types.

+

An object of any type deriving from boost::exception can store data of arbitrary types, using the error_info wrapper and operator<<.

+

To retrieve data from a boost::exception object, use the get_error_info function template.

+

exception::exception

+
exception();
+exception( exception const & x );
+

Effects:

+
  • Default constructor: initializes an empty boost::exception object.
  • +
  • Copy constructor: initializes a boost::exception object which shares with x all data added through operator<<, including data that is added at a future time.
  • +
+

Throws:

+

Nothing.

+

exception::~exception

+

Effects:

+

Frees all resources associated with a boost::exception object.

+

Throws:

+

Nothing.

+

exception::diagnostic_information

+
virtual char const * diagnostic_information() const throw();
+

Returns:

+

An string representation of all data stored in the boost::exception object by the operator<< function. See "Tutorial: Diagnostic Information" for details.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

exception::what

+
virtual char const * what() const throw();
+

Returns:

+

The default implementation is equivalent to return exception::diagnostic_information(). The signature of boost::exception::what is identical to the familiar std::exception::what function, so that when an exception type that derives both std::exception and boost::exception overrides the what function, it overrides both std::exception::what and boost::exception::what.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_cloning_hpp.html b/doc/exception_cloning_hpp.html new file mode 100644 index 0000000..a712e73 --- /dev/null +++ b/doc/exception_cloning_hpp.html @@ -0,0 +1,72 @@ + + + + + boost/exception_ptr.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception_ptr.hpp

+

Synopsis

+
#include <boost/exception/exception.hpp>
+
+namespace
+boost
+    {
+    class
+    unknown_exception:
+        public std::exception
+        public boost::exception
+        {
+        ---unspecified---
+        };    
+    
+    typedef ---unspecified--- exception_ptr;    
+    
+    template <class T>
+    exception_ptr copy_exception( T const & e );    
+    
+    exception_ptr current_exception();    
+    
+    void rethrow_exception( exception_ptr const & ep );
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_constructors.html b/doc/exception_constructors.html new file mode 100644 index 0000000..447674d --- /dev/null +++ b/doc/exception_constructors.html @@ -0,0 +1,51 @@ + + + + + exception::exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception::exception

+
exception();
+exception( exception const & x );
+

Effects:

+
  • Default constructor: initializes an empty boost::exception object.
  • +
  • Copy constructor: initializes a boost::exception object which shares with x all data added through operator<<, including data that is added at a future time.
  • +
+

Throws:

+

Nothing.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_destructor.html b/doc/exception_destructor.html new file mode 100644 index 0000000..785e6f2 --- /dev/null +++ b/doc/exception_destructor.html @@ -0,0 +1,48 @@ + + + + + exception::~exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception::~exception

+

Effects:

+

Frees all resources associated with a boost::exception object.

+

Throws:

+

Nothing.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_diagnostic_information.html b/doc/exception_diagnostic_information.html new file mode 100644 index 0000000..f68a336 --- /dev/null +++ b/doc/exception_diagnostic_information.html @@ -0,0 +1,53 @@ + + + + + exception::diagnostic_information + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception::diagnostic_information

+
virtual char const * diagnostic_information() const throw();
+

Returns:

+

An string representation of all data stored in the boost::exception object by the operator<< function. See "Tutorial: Diagnostic Information" for details.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_enable_error_info_hpp.html b/doc/exception_enable_error_info_hpp.html new file mode 100644 index 0000000..d135d70 --- /dev/null +++ b/doc/exception_enable_error_info_hpp.html @@ -0,0 +1,54 @@ + + + + + boost/exception/enable_error_info.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/enable_error_info.hpp

+

Synopsis

+
#include <boost/exception/exception.hpp>
+
+namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_error_info( T const & x );
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_enable_exception_cloning_hpp.html b/doc/exception_enable_exception_cloning_hpp.html new file mode 100644 index 0000000..761c5f1 --- /dev/null +++ b/doc/exception_enable_exception_cloning_hpp.html @@ -0,0 +1,54 @@ + + + + + boost/exception/enable_current_exception.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/enable_current_exception.hpp

+

Synopsis

+
#include <boost/exception/exception.hpp>
+
+namespace
+boost
+    {
+    template <class T>
+    ---unspecified--- enable_current_exception( T const & e );
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_error_info_group_hpp.html b/doc/exception_error_info_group_hpp.html new file mode 100644 index 0000000..3db6a18 --- /dev/null +++ b/doc/exception_error_info_group_hpp.html @@ -0,0 +1,58 @@ + + + + + boost/exception/info_tuple.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/info_tuple.hpp

+

Synopsis

+
#include <boost/tuple/tuple.hpp>
+
+namespace
+boost
+    {
+    template <class E, class Tag1, class T1, ..., class TagN, class TN>
+    E const & operator<<( E const & x,
+        tuple<
+            error_info<Tag1,T1>,
+            ...,
+            error_info<TagN,TN> > const & v );
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_error_info_hpp.html b/doc/exception_error_info_hpp.html new file mode 100644 index 0000000..4a72bc4 --- /dev/null +++ b/doc/exception_error_info_hpp.html @@ -0,0 +1,81 @@ + + + + + boost/exception/info.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/info.hpp

+

Synopsis

+
#include <boost/exception/exception.hpp>
+#include <boost/current_function.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace
+boost
+    {
+    template <class Tag,class T>
+    class
+    error_info
+        {
+        public:
+    
+        typedef T value_type;
+    
+        error_info( value_type const & );
+        };    
+    
+    template <class ErrorInfo,class E>
+    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );    
+    
+    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;
+    
+    #define BOOST_ERROR_INFO\
+        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
+        ::boost::throw_file(__FILE__) <<\
+        ::boost::throw_line((int)__LINE__)    
+    
+    template <class E, class Tag, class T>
+    E const & operator<<( E const & x, error_info<Tag,T> const & v );
+    }
+
+ + + + +
+
+
+ + diff --git a/doc/exception_error_info_value_hpp.html b/doc/exception_error_info_value_hpp.html new file mode 100644 index 0000000..7cf82a7 --- /dev/null +++ b/doc/exception_error_info_value_hpp.html @@ -0,0 +1,51 @@ + + + + + boost/exception/error_info.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/error_info.hpp

+

Synopsis

+
namespace
+boost
+    {
+    template <class Tag, class T>
+    class error_info;
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_exception_hpp.html b/doc/exception_exception_hpp.html new file mode 100644 index 0000000..c16e1a4 --- /dev/null +++ b/doc/exception_exception_hpp.html @@ -0,0 +1,67 @@ + + + + + boost/exception/exception.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception/exception.hpp

+

Synopsis

+
namespace
+boost
+    {
+    class
+    exception
+        {
+        public:
+    
+        virtual char const * diagnostic_information() const throw();    
+        virtual char const * what() const throw();    
+    
+        protected:
+    
+        exception();
+        exception( exception const & x );    
+        ~exception();    
+        };
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_hpp.html b/doc/exception_hpp.html new file mode 100644 index 0000000..5b32d79 --- /dev/null +++ b/doc/exception_hpp.html @@ -0,0 +1,51 @@ + + + + + boost/exception.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/exception.hpp

+

Synopsis

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_ptr.html b/doc/exception_ptr.html new file mode 100644 index 0000000..50655eb --- /dev/null +++ b/doc/exception_ptr.html @@ -0,0 +1,60 @@ + + + + + exception_ptr + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception_ptr

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    typedef ---unspecified--- exception_ptr;
+    }
+

The exception_ptr type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; exception_ptr's operations do not throw.

+

Two instances of exception_ptr are equivalent and compare equal if and only if they refer to the same exception.

+

The default constructor of exception_ptr produces the null value of the type. The null value is equivalent only to itself.

+

Note:

+

exception_ptr objects are returned by current_exception and copy_exception.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/exception_what.html b/doc/exception_what.html new file mode 100644 index 0000000..2cef231 --- /dev/null +++ b/doc/exception_what.html @@ -0,0 +1,50 @@ + + + + + exception::what + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

exception::what

+
virtual char const * what() const throw();
+

Returns:

+

The default implementation is equivalent to return exception::diagnostic_information(). The signature of boost::exception::what is identical to the familiar std::exception::what function, so that when an exception type that derives both std::exception and boost::exception overrides the what function, it overrides both std::exception::what and boost::exception::what.

+

Throws:

+

Nothing.

+

Note:

+

The return value remains valid until the exception object from which it is obtained is destroyed or modified.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/get_error_info.html b/doc/get_error_info.html new file mode 100644 index 0000000..47d598e --- /dev/null +++ b/doc/get_error_info.html @@ -0,0 +1,59 @@ + + + + + get_error_info + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

get_error_info

+

#include <boost/exception/info.hpp>

+
namespace
+boost
+    {
+    template <class ErrorInfo,class E>
+    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );
+    }
+

Requirements:

+

The type of the x object must derive from boost::exception; ErrorInfo must be an instance of the error_info template.

+

Returns:

+

If x does not store an object of type ErrorInfo, returns an empty shared_ptr; otherwise returns pointer to the stored value. Use operator<< to store values in exception objects.

+

Throws:

+

Nothing.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/name_idx.html b/doc/name_idx.html new file mode 100644 index 0000000..00633eb --- /dev/null +++ b/doc/name_idx.html @@ -0,0 +1,85 @@ + + + + + Index + + + +
+ +
+ + diff --git a/doc/operator_shl_exception.html b/doc/operator_shl_exception.html new file mode 100644 index 0000000..b458fb3 --- /dev/null +++ b/doc/operator_shl_exception.html @@ -0,0 +1,67 @@ + + + + + operator<</exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

operator<<, error_info overload

+

#include <boost/exception/info.hpp> 

+
namespace
+boost
+    {
+    template <class E, class Tag, class T>
+    E const & operator<<( E const & x, error_info<Tag,T> const & v );
+    }
+

Requirements:

+

E must be boost::exception, or a type that derives (indirectly) from boost::exception.

+

Effects:

+

Stores a copy of v into x. If x already contains data of type error_info<Tag1,T1>, that data is overwritten.

+

Returns:

+

x.

+

Throws:

+

std::bad_alloc, or any exception emitted by the T copy constructor.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/operator_shl_tuple.html b/doc/operator_shl_tuple.html new file mode 100644 index 0000000..3cbb657 --- /dev/null +++ b/doc/operator_shl_tuple.html @@ -0,0 +1,63 @@ + + + + + operator<</tuple + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

operator<<, tuple overload

+

#include <boost/exception/info_tuple.hpp>

+
namespace
+boost
+    {
+    template <class E, class Tag1, class T1, ..., class TagN, class TN>
+    E const & operator<<( E const & x,
+        tuple<
+            error_info<Tag1,T1>,
+            ...,
+            error_info<TagN,TN> > const & v );
+    }
+

Requirements:

+

E must be boost::exception, or a type that derives (indirectly) from boost::exception.

+

Effects:

+

Equivalent to x << v.get<0>() << ... << v.get<N>().

+

Returns:

+

x.

+

Throws:

+

std::bad_alloc, or any exception emitted by T1..TN copy constructor.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/reno.css b/doc/reno.css new file mode 100644 index 0000000..f5650c8 --- /dev/null +++ b/doc/reno.css @@ -0,0 +1,225 @@ +/* + * 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) + */ + +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; +} diff --git a/doc/rethrow_exception.html b/doc/rethrow_exception.html new file mode 100644 index 0000000..ea33e37 --- /dev/null +++ b/doc/rethrow_exception.html @@ -0,0 +1,54 @@ + + + + + rethrow_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

rethrow_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    void rethrow_exception( exception_ptr const & ep );
+    }
+

Precondition:

+

ep shall not be null.

+

Throws:

+

The exception to which ep refers.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/shade-l.png b/doc/shade-l.png new file mode 100644 index 0000000000000000000000000000000000000000..a11fa0b44f175bc868faf39ae36de89c466cb72a GIT binary patch literal 948 zcmeAS@N?(olHy`uVBq!ia0y~yV31>AU|`{3W?*1gx41r+fq|JJz$e6&0Sp)!8JU=v zn3tIk~vFxVgD`czAeudHMMG`1$z-1Ox;H1%-r!goTAg zL_|bIMa9I##KpxWBqSsyC8eaKq@|^0WMpJzW##1LAqtgWqWY;0_8ZSCyr?CtFx92^`S9i5zoD;^X5J5)u*<6O)pXl9Q8DQc_Y=Q`6GY($mv3GBPqVGqbX? zva_>ua&mHWbMx}@^7Hcx3JMAf3yX@1ii?X&N=iygOUug2%FD|uDk>@~E32xis;jGO zYHDh0YwPOj>g($p8X6iK8=IP%nwy(jT3T9LTie>&+S}VZIyyQ#JG;8Ny1To3dU|?$ zd;9wO`uqDQOqein;>1alCQY6^dCHV2Q>RXyHf`GU>C zHEY+dUAJ!C`t|EKY}l}IK79Ddkt0Ws9zAyK*zx1XPnAmsE?vHS`O1|mSFc{ZcJ12r>(_7GxN-C5&0Du_ z-M)SM&Ye4V@7}$4@813U_a8iX@bKZoM~@yoe*E~!lP6D~K7ID=+4JYmU%Ytn^5x4{ zuU@@={rb(DH*ep*efRF&`}glZeE9J3&?&!0bk|Ni~=?_bk_r)3Nb42&f~e!&b5&u*lFI7!~_E({&4vK|Z!44efX zk;M!Q+`=Ht$S`Y;1Oo$ugQtsQNX49Fi_%|LPEJ^5G!!@3Qwdc4gjOwUj&E zfBucTVeyfN8l0AU|`{3W?*1gx41r+fq|JJz$e6&0Sp)!8JU=v zn3tIk~vFxVgD`czAeudHMMG`1$z-1Ox;H1%-r!goTAg zL_|bIMa9I##KpxWBqSsyC8eaKq@|^0WMpJzW##1LAqtgWqWY;0_8ZSCyr?CtFx92^`S9i5zoD;^X5J5)u*<6O)pXl9Q8DQc_Y=Q`6GY($mv3GBPqVGqbX? zva_>ua&mHWbMx}@^7Hcx3JMAf3yX@1ii?X&N=iygOUug2%FD|uDk>@~E32xis;jGO zYHDh0YwPOj>g($p8X6iK8=IP%nwy(jT3T9LTie>&+S}VZIyyQ#JG;8Ny1To3dU|?$ zd;9wO`uqDQOqein;>1alCQY6^dCHV2Q>RXyHf`GU>C zHEY+dUAJ!C`t|EKY}l}IK79Ddkt0Ws9zAyK*zx1XPnAmsE?vHS`O1|mSFc{ZcJ12r>(_7GxN-C5&0Du_ z-M)SM&Ye4V@7}$4@813U_a8iX@bKZoM~@yoe*E~!lP6D~K7ID=+4JYmU%Ytn^5x4{ zuU@@={rb(DH*ep*efRF&`}glZeE9J3&?&!0bk|Ni~=?_bk_r)3Nb42&f~e!&b5&u*lFI7!~_E({&4vK|Z!44efX zk;M!Q+`=Ht$S`Y;1Oo$uou`XqNX49Fjdd%s-_A0~z1F0veLe5arrPWG{<8DQ+Eu-| z@ljaaZ=Ti3fRMoJmn;*t^j;q7+V!lDGx)@1UWNqwz@>W*%2tB%o~Nsy%Q~loCIEUX BvZVk3 literal 0 HcmV?d00001 diff --git a/doc/source/boost-exception.reno b/doc/source/boost-exception.reno new file mode 100644 index 0000000..c107de6 --- /dev/null +++ b/doc/source/boost-exception.reno @@ -0,0 +1,9982 @@ + + 1 + + reno_project + + + + + + 2 + + reno_config + + + + + 0 + ../../../.. + 1 + 0 + + + + .*\.(cpp|hpp|h)$ + + + + + + + 3 + + reno_layer_map + + + + 9 + + default + + 4 + + reno_layer + + + + 40 + + + 0 + + 5 + + reno_context + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 9567A192BF523DDF741004FFF5BDB044D715FEB7CE9AEC89ACC25C1C33E48C4E + 2232115228 + 381 + 26 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>unknown_exception</string> + + + + + + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + 6 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Boost Exception</string> + + + boost-exception + + + + + + 111 + 2 + !!Introduction The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code. 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. The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected. Boost Exception also supports (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:)-style (:link + 1 + + 0 + + 7 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Tutorial: Transporting of Exceptions between Threads</string> + + + tutorial_exception_ptr + + + + + 2 + |copying:) of exception objects, implemented non-intrusively and automatically by the boost::(:link + 1 + + 0 + + 8 + + reno_context + + + + + + + 2 + 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A + 1770110914 + 587 + 1207 + 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D + 3929437933 + 361 + 213 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>throw_exception</string> + + + + + + + + 2 + :) function. !!!!Note: Boost Exception was accepted as a Boost library on November 7 2007, however it has not yet been part of an official Boost release. Current version can be downloaded from (:link http://svn.boost.org/svn/boost/trunk | Boost SVN:). !!Contents #Tutorial ##(:link + 1 + + 0 + + 9 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Tutorial: Transporting of Arbitrary Data to the Catch Site</string> + + + tutorial_transporting_data + + + + + 2 + :) ##(:link + 1 + + 0 + + 10 + + reno_context + + + + + + + 1 + D9B8E6AA12A4F33953B1A961FA590C5A3840234B6531CA8C04AC985AD5800835 + 2432554768 + 702 + 408 + + + + + + 0 + ../../example/enable_error_info.cpp + 0 + 0 + + + + + <string>Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</string> + + + tutorial_enable_error_info + + + + + 2 + :) ##(:link + 1 + + 0 + + -7 + + + 2 + :) ##(:link + 1 + + 0 + + 11 + + reno_context + + + + + + + 1 + CE411E21EE9878B55B5906D033A0FC52574FB59D8A8CECB75405E9B1C9D782DB + 1173443713 + 308 + 302 + + + + + + 0 + ../../example/logging.cpp + 0 + 0 + + + + + <string>Tutorial: Diagnostic Information</string> + + + tutorial_diagnostic_information + + + + + 2 + :) #Documentation ##Class (:link + 1 + + 0 + + 12 + + reno_context + + + + + + + 2 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception</string> + + + + + + + + 2 + :) ##Transporting of Arbitrary Data to the Catch Site ###(:link + 1 + + 0 + + 13 + + reno_context + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + F839AFD37DC086BB1231B8E87D8EEBD28129649A06FC685AC7DF65595871AE30 + 2291609923 + 1204 + 243 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>error_info</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 14 + + reno_context + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + 27AC1164E0A824D548386BEDCDC81DCAC283F3D286B0ECEE05B039BB8C392BFC + 1247954090 + 249 + 1449 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>operator<</exception</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 15 + + reno_context + + + + + + + 2 + 07430F64896197A110C276D8A14CA8A75FBA482DDF50CD40D689A1898C84D054 + 1712604289 + 1296 + 396 + BCCB91D0DCA6EC45F29CB70CB64AEA6AB54F32F8F1D1937C4CB80B059346DC81 + 695614553 + 1264 + 26 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + + <string>operator<</tuple</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 16 + + reno_context + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + 65D13C1BB0A16823F69A32BAB56A51CA317075C7FC8B7441EE0D9B57AF5AB2AC + 2592266329 + 712 + 1700 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>get_error_info</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 17 + + reno_context + + + + + + + 2 + 837760557B72743BFC955BC4B1213EC27F47583A9D7D08EA0BC5616F977A21A7 + 493325143 + 2449 + 457 + ACC64445E8B6AAEF58395C0083BC0247CDE33AC00ED8DB9B7B4F216325DEE410 + 2943579912 + 400 + 2043 + + + + + + 0 + ../../../../boost/exception/enable_error_info.hpp + 0 + 0 + + + + + <string>enable_error_info</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 18 + + reno_context + + + + + + + 1 + 49D31376D97691F7C84A134B5D8C7C66EF1ED6901D376CA250D634AE2B38AB5E + 549270010 + 163 + 572 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>BOOST_ERROR_INFO</string> + + + + + + + + 2 + :) ##(:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:) Transporting of Exceptions between Threads ###(:link + 1 + + 0 + + 19 + + reno_context + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + ED09F845070FF7D381BE5EFB6B55313FD09FBA16B64B69992410380EFA45519C + 2051939590 + 78 + 409 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>exception_ptr</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 20 + + reno_context + + + + + + + 2 + 392208A2FD122D1ED27D128A7BF65F9340218FAAD756EA58D26D2205D32681A6 + 729208193 + 3206 + 506 + 8F3B5E1A267CA225679713F4DDF528041F573BC02D1DBCD8FFEF57EF0AA599B9 + 4197332561 + 180 + 3020 + + + + + + 0 + ../../../../boost/exception/enable_current_exception.hpp + 0 + 0 + + + + + <string>enable_current_exception</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 21 + + reno_context + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 9DEEF8ED70BF74F501A96BA5DE5BFD42FAD16DE333ABE189E512C332586FC465 + 2250569940 + 1893 + 2528 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>current_exception</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 22 + + reno_context + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 921FBF6991E17349BFF2AD6F165372F85AA9457DDB28E502ABB6B392BBA6B529 + 3119269037 + 284 + 4423 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>copy_exception</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 23 + + reno_context + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 156B870761DB092CE4269C1173B479A344A1041BA2B883765AF19A72B371D776 + 3239976720 + 117 + 4709 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>rethrow_exception</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + -5 + + + 2 + :) ##(:link + 1 + + 0 + + 24 + + reno_context + + + + + + + 2 + 05061ED1DD1B33224DE28BF86AB10D99286A48DC055D54A19FF93B36F22E8A90 + 3225446538 + 372 + 408 + ED09AD72D3766F261A0044B58B9B73AA355EB50B1A8F602E5EE7F68D0D928596 + 328425570 + 340 + 26 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>diagnostic_information</string> + + + + + + + + 2 + :) ##(:link + 1 + + 0 + + -8 + + + 2 + :) ##Headers ###(:link + 1 + + 0 + + 25 + + reno_context + + + + + + + 1 + 429F0DE3599A4CC08B9458E2AECA2EAC202AB3471554FE82C307493805E6676E + 4224422781 + 401 + 323 + + + + + + 0 + ../../../../boost/exception.hpp + 0 + 0 + + + + + <string>boost/exception.hpp</string> + + + exception_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 26 + + reno_context + + + + + + + 1 + ECAD4A1E70A31D7F87F79F557D107AB0A3C5161CB370139974E08ECAFBE2D32F + 1816954312 + 457 + 323 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>boost/exception/diagnostic_information.hpp</string> + + + + + + + + 2 + :) ###(:link + 1 + + 0 + + 27 + + reno_context + + + + + + + 1 + A9C65F105342D728DE9C996079E82DF25408B94A272090039FAAC12D29659F69 + 2378831669 + 94 + 227 + + + + + + 0 + ../../../../boost/exception/enable_current_exception.hpp + 0 + 0 + + + + + <string>boost/exception/enable_current_exception.hpp</string> + + + exception_enable_exception_cloning_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 28 + + reno_context + + + + + + + 1 + B23D4FF62C70B07638898ECB0B683410BC3E4C4F7DB2922C7B0E9844B1855FF5 + 3540957683 + 2583 + 323 + + + + + + 0 + ../../../../boost/exception/enable_error_info.hpp + 0 + 0 + + + + + <string>boost/exception/enable_error_info.hpp</string> + + + exception_enable_error_info_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 29 + + reno_context + + + + + + + 1 + CAB4D823BD4720B71E1CA5BE482AC95B42A9E07CD5E08671EA23184635F281A2 + 3077708282 + 89 + 323 + + + + + + 0 + ../../../../boost/exception/error_info.hpp + 0 + 0 + + + + + <string>boost/exception/error_info.hpp</string> + + + exception_error_info_value_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 30 + + reno_context + + + + + + + 1 + 251773B273187F592361DB0624E7F5D52C95845C3A6562F4A0F830C46D775BC8 + 3425410730 + 3294 + 323 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>boost/exception/exception.hpp</string> + + + exception_exception_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 31 + + reno_context + + + + + + + 1 + F19D72C24D904689FEEE070D77ABD19090396E7C7663A5BA80E474F1EDA62861 + 4081508978 + 6759 + 323 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>boost/exception/info.hpp</string> + + + exception_error_info_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 32 + + reno_context + + + + + + + 1 + CAD6C404CB725D336A44920D2341ECA131149AB02C368B59028F8147F16737BF + 2258638601 + 94 + 227 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + + <string>boost/exception/info_tuple.hpp</string> + + + exception_error_info_group_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 33 + + reno_context + + + + + + + 1 + CB567E3390BC92DA06F9899E700792C3790D3707C024CA21D15C930D908AD10A + 3422645546 + 5023 + 323 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>boost/exception_ptr.hpp</string> + + + exception_cloning_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 34 + + reno_context + + + + + + + 1 + 48A0C42CCA66A6C935724A9B7BD30B6B3DF16A0A808C804A585A5CC90D85DC5E + 1606229033 + 1723 + 91 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>boost/throw_exception.hpp</string> + + + throw_exception_hpp + + + + + 2 + :) #(:link + 1 + + 0 + + 35 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Index</string> + + + name_idx + + + + + 2 + :) !!Synopsis `#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> [@namespace boost { (:include + 1 + + 0 + + -30 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -31 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -32 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -28 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -26 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -33 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -27 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -34 + + + 2 + decl pre_indent="4":) }@] !!Class exception (:include + 1 + + 0 + + -12 + + + 2 + :) !!Transporting of Arbitrary Data to the Catch Site (:include + 1 + + 0 + + -13 + + + 2 + :) (:include + 1 + + 0 + + -14 + + + 2 + :) (:include + 1 + + 0 + + -16 + + + 2 + :) (:include + 1 + + 0 + + -17 + + + 2 + :) (:include + 1 + + 0 + + -18 + + + 2 + :) !!Transporting of Exceptions between Threads (:include + 1 + + 0 + + -19 + + + 2 + :) (:include + 1 + + 0 + + -20 + + + 2 + :) (:include + 1 + + 0 + + -21 + + + 2 + :) (:include + 1 + + 0 + + -22 + + + 2 + :) (:include + 1 + + 0 + + -23 + + + 2 + :) (:include + 1 + + 0 + + -5 + + + 2 + :) !!Printing Diagnostic Information (:include + 1 + + 0 + + -24 + + + 2 + :) !!Throwing Exceptions (:include + 1 + + 0 + + -8 + + + 2 + :) + + + + + 0 + + -7 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -8 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -9 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -10 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -11 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -12 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso,exception":) + + + + + 0 + + -13 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -14 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -15 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -16 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -17 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -18 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -19 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -20 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -21 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -22 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -23 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -24 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -25 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -26 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -27 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -28 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -29 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -30 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -31 + + + + 1 + 2 + (:include include:) (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -32 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -33 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -34 + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + -35 + + + + 1 + 2 + !Index (:pagelist fmt="index" except_tags="index,noindex":) + + + + + 0 + + 36 + + reno_context + + + + + + + 1 + FC684D0DD5A9732B4130F2AB3DB6E0491D0F523E14B7FB738B2019EA2C7F8717 + 2229778754 + 631 + 319 + + + + + + 0 + ../../example/cloning_2.cpp + 0 + 0 + + + + + <string>Tutorial: Cloning and Re-throwing an Exception</string> + + + cloning_and_rethrowing + + + + + + 0 + + + + + 0 + + 37 + + reno_context + + + + + + + 4 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + 85EE1980CFB24E054EDB1B3BDFA61FD4D65AD0EF248A1A42D4C2552700459327 + 2238151539 + 428 + 1070 + AD3F339F7126003907BCBDB3EF846FCACA895132E1100D202DA67D2B7846EE65 + 3032091776 + 60 + 369 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::~exception</string> + + + exception_destructor + + + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + 38 + + reno_context + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + BAC52AC87CFA3174B3352140A8DC10BB7F48C945FC87787C3AC96F0FC2CFDB40 + 1066412964 + 165 + 204 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::diagnostic_information</string> + + + + + + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + 39 + + reno_context + + + + + + + 1 + 5373E336DC4892A41D31694BCA1146382FC3137819A04689CA1F9FFAF1CFAB3B + 4050491732 + 466 + 307 + + + + + + 0 + ../../example/cloning_1.cpp + 0 + 0 + + + + + <string>Tutorial: Using enable_current_exception at the Time of the Throw</string> + + + using_enable_cloning + + + + + + 0 + + + + + 0 + + 40 + + reno_context + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + BACD79DFB4C710C1A67687FC6344DF2251E2379613C2DF5B2729B2CD37E24EA3 + 458367129 + 154 + 393 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::exception</string> + + + exception_constructors + + + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + 0 + + 41 + + reno_context + + + + + + + 1 + E444EE9697EEADFDE0767E1D0242FC0E70D98E61FB1F0FFA099648DE509B82F3 + 94503238 + 773 + 374 + + + + + + 0 + ../../example/info_tuple.cpp + 0 + 0 + + + + + <string>Tutorial: Adding Grouped Data to Exceptions</string> + + + grouping_data + + + + + + 0 + + + + + 0 + + 42 + + reno_context + + + + + + + 1 + 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 + 4276724153 + 574 + 382 + + + + + + 0 + ../../example/error_info_1.cpp + 0 + 0 + + + + + <string>Tutorial: Adding of Arbitrary Data at the Point of the Throw</string> + + + adding_data_at_throw + + + + + + 0 + + + + + 0 + + 43 + + reno_context + + + + + + + 1 + F4C951B28F7DE500973AA3DFAA99F2BADA6EDAFA2B406C30BEF3B7FBE6FD57D7 + 2263754923 + 982 + 306 + + + + + + 0 + ../../example/error_info_2.cpp + 0 + 0 + + + + + <string>Tutorial: Adding of Arbitrary Data to Active Exception Objects</string> + + + adding_data_later + + + + + + 0 + + + + + 0 + + 44 + + reno_context + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + E1E6A9EFC3D0DCF4197171BA3C804656908C414424194530416F69E471FC99AD + 120398751 + 145 + 57 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::what</string> + + + + + + + + + 1 + 2 + (:include include:) !!!See also: (:pagelist link="backlink" except_tags="noalso":) + + + + + + + + headers + + 45 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 0 + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 0 + + + + + 0 + + -15 + + + + 0 + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 3 + 2 + [@#include < + 1 + + 1 + + 2 + >@] + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 3 + 2 + [@#include < + 1 + + 1 + + 2 + >@] + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 0 + + + + + 0 + + -27 + + + + 0 + + + + + 0 + + -28 + + + + 0 + + + + + 0 + + -29 + + + + 0 + + + + + 0 + + -30 + + + + 0 + + + + + 0 + + -31 + + + + 0 + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 + + + + 0 + + + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + ctors + + 46 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 0 + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 0 + + + + + 0 + + -15 + + + + 0 + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 0 + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 0 + + + + + 0 + + -27 + + + + 0 + + + + + 0 + + -28 + + + + 0 + + + + + 0 + + -29 + + + + 0 + + + + + 0 + + -30 + + + + 0 + + + + + 0 + + -31 + + + + 0 + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 + + + + 0 + + + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + free + + 47 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 0 + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 0 + + + + + 0 + + -15 + + + + 0 + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 0 + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 0 + + + + + 0 + + -27 + + + + 0 + + + + + 0 + + -28 + + + + 0 + + + + + 0 + + -29 + + + + 0 + + + + + 0 + + -30 + + + + 0 + + + + + 0 + + -31 + + + + 0 + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 + + + + 0 + + + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + decl + + 48 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 5 + 2 + [@class (:link + 1 + + 0 + + -5 + + + 2 + :): public std::exception public boost:: + 1 + + 0 + + -12 + + + 2 + { ---unspecified--- };@] + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 5 + 2 + [@#ifdef BOOST_NO_EXCEPTIONS void (:link + 1 + + 0 + + -8 + + + 2 + :)( std::exception const & e ); // user defined #else template <class E> void (:link + 1 + + 0 + + -8 + + + 2 + :)( E const & e ); #endif@] + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 11 + 2 + [@class (:link + 1 + + 0 + + -12 + + + 2 + :) { public: (:include + 1 + + 0 + + -38 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -44 + + + 2 + decl pre_indent="4":) protected: (:include + 1 + + 0 + + -40 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -37 + + + 2 + decl pre_indent="4":) };@] + + + + + 0 + + -13 + + + + 3 + 2 + [@template <class Tag,class T> class (:link + 1 + + 0 + + -13 + + + 2 + :) { public: typedef T value_type; error_info( value_type const & ); };@] + + + + + 0 + + -14 + + + + 5 + 2 + [@template <class E, class Tag, class T> E const & (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:)( E const & x, (:link + 1 + + 0 + + -13 + + + 2 + :)<Tag,T> const & v );@] + + + + + 0 + + -15 + + + + 7 + 2 + [@template <class E, class Tag1, class T1, ..., class TagN, class TN> E const & (:link + 1 + + 0 + + -15 + + + 2 + |operator<<:)( E const & x, (:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:)< (:link + 1 + + 0 + + -13 + + + 2 + :)<Tag1,T1>, ..., (:link + 1 + + 0 + + -13 + + + 2 + :)<TagN,TN> > const & v );@] + + + + + 0 + + -16 + + + + 3 + 2 + [@template <class ErrorInfo,class E> (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:)<typename ErrorInfo::value_type const> (:link + 1 + + 0 + + -16 + + + 2 + :)( E const & x );@] + + + + + 0 + + -17 + + + + 3 + 2 + [@template <class T> ---unspecified--- (:link + 1 + + 0 + + -17 + + + 2 + :)( T const & x );@] + + + + + 0 + + -18 + + + + 9 + 2 + [@typedef (:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_throw_function,char const *> throw_function; typedef (:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_throw_file,char const *> throw_file; typedef (:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_throw_line,int> throw_line; #define (:link + 1 + + 0 + + -18 + + + 2 + :)\ ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\ ::boost::throw_file(__FILE__) <<\ ::boost::throw_line((int)__LINE__)@] + + + + + 0 + + -19 + + + + 3 + 2 + [@typedef ---unspecified--- (:link + 1 + + 0 + + -19 + + + 2 + :);@] + + + + + 0 + + -20 + + + + 3 + 2 + [@template <class T> ---unspecified--- (:link + 1 + + 0 + + -20 + + + 2 + :)( T const & e );@] + + + + + 0 + + -21 + + + + 5 + 2 + [@(:link + 1 + + 0 + + -19 + + + 2 + :) (:link + 1 + + 0 + + -21 + + + 2 + :)();@] + + + + + 0 + + -22 + + + + 5 + 2 + [@template <class T> (:link + 1 + + 0 + + -19 + + + 2 + :) (:link + 1 + + 0 + + -22 + + + 2 + :)( T const & e );@] + + + + + 0 + + -23 + + + + 5 + 2 + [@void (:link + 1 + + 0 + + -23 + + + 2 + :)( (:link + 1 + + 0 + + -19 + + + 2 + :) const & ep ); + + + + + 0 + + -24 + + + + 3 + 2 + [@std::string + 1 + + 0 + + -24 + + + 2 + ( std::exception const & x );@] + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -24 + + + 2 + decl:)@] + + + + + 0 + + -27 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -20 + + + 2 + decl:)@] + + + + + 0 + + -28 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -17 + + + 2 + decl:)@] + + + + + 0 + + -29 + + + + 3 + 2 + [@template <class Tag, class T> class (:link + 1 + + 0 + + -13 + + + 2 + :);@] + + + + + 0 + + -30 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -12 + + + 2 + decl:)@] + + + + + 0 + + -31 + + + + 9 + 2 + [@(:include + 1 + + 0 + + -13 + + + 2 + decl:) (:include + 1 + + 0 + + -16 + + + 2 + decl:) (:include + 1 + + 0 + + -18 + + + 2 + decl:) (:include + 1 + + 0 + + -14 + + + 2 + decl:)@] + + + + + 0 + + -32 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -15 + + + 2 + decl:)@] + + + + + 0 + + -33 + + + + 11 + 2 + [@(:include + 1 + + 0 + + -5 + + + 2 + decl:) (:include + 1 + + 0 + + -19 + + + 2 + decl:) (:include + 1 + + 0 + + -22 + + + 2 + decl:) (:include + 1 + + 0 + + -21 + + + 2 + decl:) (:include + 1 + + 0 + + -23 + + + 2 + decl:)@] + + + + + 0 + + -34 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -8 + + + 2 + decl:)@] + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 3 + 2 + [@(:link + 1 + + 0 + + -37 + + + 2 + :::)();@] + + + + + 0 + + -38 + + + + 3 + 2 + [@virtual char const * (:link + 1 + + 0 + + -38 + + + 2 + :::)() const throw();@] + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 7 + 2 + [@(:link + 1 + + 0 + + -40 + + + 2 + :::)(); (:link + 1 + + 0 + + -40 + + + 2 + :::)( (:link + 1 + + 0 + + -12 + + + 2 + :) const & x );@] + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 3 + 2 + [@virtual char const * (:link + 1 + + 0 + + -44 + + + 2 + :::)() const throw();@] + + + + + + + + include + + 49 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 5 + 2 + !!!unknown_exception (:include synopsis:) This type is used by the + 1 + + 0 + + -19 + + + 2 + support in Boost Exception. Please see (:link + 1 + + 0 + + -21 + + + 2 + :). + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 11 + 2 + !!Transporting of Exceptions between Threads Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:), but because Boost Exception can not rely on language support, the use of (:link + 1 + + 0 + + -20 + + + 2 + :) at the time of the throw is required in order to use cloning. !!!!Note: All exceptions emitted by the familiar function boost::(:link + 1 + + 0 + + -8 + + + 2 + :) are guaranteed to derive from boost::(:link + 1 + + 0 + + -12 + + + 2 + :) and to support cloning. (:include + 1 + + 0 + + -39 + + + 2 + :) (:include + 1 + + 0 + + -36 + + + 2 + :) + + + + + 0 + + -8 + + + + 9 + 2 + !!!throw_exception (:include synopsis:) !!!!Requirements: E must derive publicly from std::exception. !!!!Effects: * If BOOST_NO_EXCEPTIONS is not defined, boost::(:link + 1 + + 0 + + -8 + + + 2 + :)(e) is equivalent to throw boost::(:link + 1 + + 0 + + -20 + + + 2 + :)(boost::(:link + 1 + + 0 + + -17 + + + 2 + :)(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::(:link + 1 + + 0 + + -8 + + + 2 + :)(e) is equivalent to throw e; * If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of throw_exception are allowed to assume that the function never returns; therefore, if the user-defined throw_exception returns, the behavior is undefined. + + + + + 0 + + -9 + + + + 11 + 2 + !!Transporting of Arbitrary Data to the Catch Site All exception types that derive from boost::(:link + 1 + + 0 + + -12 + + + 2 + :) 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 types. Data can be added to a boost::(:link + 1 + + 0 + + -12 + + + 2 + :) at the time of the throw, or at a later time. (:include + 1 + + 0 + + -42 + + + 2 + :) (:include + 1 + + 0 + + -43 + + + 2 + :) (:include + 1 + + 0 + + -41 + + + 2 + :) + + + + + 0 + + -10 + + + + 27 + 2 + !!Integrating Boost Exception in Existing Exception Class Hierarchies Some exception hierarchies can not be modified to make boost::(:link + 1 + + 0 + + -12 + + + 2 + :) a base type. For this case, the (:link + 1 + + 0 + + -17 + + + 2 + :) function template can be used to make exception objects derive from boost::(:link + 1 + + 0 + + -12 + + + 2 + :) anyway. Here is an example: [@#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <stdexcept> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_std_range_min,size_t> std_range_min; typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_std_range_max,size_t> std_range_max; typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<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::(:link + 1 + + 0 + + -17 + + + 2 + :)(std::range_error("Index out of range")) << std_range_min(0) << std_range_max(size()) << std_range_index(i); //.... } }; @] The call to (:link + 1 + + 0 + + -17 + + + 2 + :)<T> gets us an object of ''unspecified type'' which is guaranteed to derive from both boost::(:link + 1 + + 0 + + -12 + + + 2 + :) and T. This makes it possible to use (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::(:link + 1 + + 0 + + -12 + + + 2 + :) &, so that (:link + 1 + + 0 + + -9 + + + 2 + |more information can be added to the exception at a later time:). + + + + + 0 + + -11 + + + + 21 + 2 + !!Diagnostic Information Class boost::(:link + 1 + + 0 + + -12 + + + 2 + :) provides a virtual member function (:link + 1 + + 0 + + -38 + + + 2 + :::), with a signature similar to the familiar std::exception::what function. The default implementation returns a string value that is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example: [@#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <iostream> void f(); //throws unknown types that derive from boost::(:link + 1 + + 0 + + -12 + + + 2 + :). void g() { try { f(); } catch( boost::(:link + 1 + + 0 + + -12 + + + 2 + :) & e ) { std::cerr << e.(:link + 1 + + 0 + + -38 + + + 2 + :::)(); } }@] The (:link + 1 + + 0 + + -38 + + + 2 + :::) member function iterates over all data objects stored in the boost::(:link + 1 + + 0 + + -12 + + + 2 + :) through (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:). The returned string is constructed by converting each data object to string and then concatenating these strings together. When the (:link + 1 + + 0 + + -13 + + + 2 + :)<Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is used to convert objects of type T to string. Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string. Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error. + + + + + 0 + + -12 + + + + 21 + 2 + !!!exception (:include synopsis:) Class boost::(:link + 1 + + 0 + + -12 + + + 2 + :) is designed to be used as a universal base for user-defined exception types. An object of any type deriving from boost::(:link + 1 + + 0 + + -12 + + + 2 + :) can store data of arbitrary types, using the (:link + 1 + + 0 + + -13 + + + 2 + :) wrapper and (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:). To retrieve data from a boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object, use the (:link + 1 + + 0 + + -16 + + + 2 + :) function template. (:include + 1 + + 0 + + -40 + + + 2 + :) (:include + 1 + + 0 + + -37 + + + 2 + :) (:include + 1 + + 0 + + -38 + + + 2 + :) (:include + 1 + + 0 + + -44 + + + 2 + :) + + + + + 0 + + -13 + + + + 21 + 2 + !!!error_info (:include synopsis:) !!!!Requirements: T must have accessible copy constructor and must not be a reference. !!!!Description: This class template is used to associate a Tag type with a value type T. Objects of type (:link + 1 + + 0 + + -13 + + + 2 + :)<Tag,T> can be passed to (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) to be stored in objects of type boost::(:link + 1 + + 0 + + -12 + + + 2 + :). !!!!Note: The header <(:link + 1 + + 0 + + -29 + + + 2 + :)> provides a declaration of the (:link + 1 + + 0 + + -13 + + + 2 + :) template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this: [@#include <(:link + 1 + + 0 + + -29 + + + 2 + :)> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_errno,int> errno_info;@] Of course, to actually add an errno_info object to exceptions using (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:), or to retrieve it using (:link + 1 + + 0 + + -16 + + + 2 + :), you must first #include <(:link + 1 + + 0 + + -31 + + + 2 + :)>. + + + + + 0 + + -14 + + + + 7 + 2 + !!!operator<<, error_info overload (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -12 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -12 + + + 2 + :). !!!!Effects: Stores a copy of v into x. If x already contains data of type (:link + 1 + + 0 + + -13 + + + 2 + :)<Tag1,T1>, that data is overwritten. !!!!Returns: x. (:include throws:) + + + + + 0 + + -15 + + + + 5 + 2 + !!!operator<<, tuple overload (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -12 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -12 + + + 2 + :). !!!!Effects: Equivalent to x << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<0>() << ... << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<N>(). !!!!Returns: x. (:include throws:) + + + + + 0 + + -16 + + + + 7 + 2 + !!!get_error_info (:include synopsis:) !!!!Requirements: The type of the x object must derive from boost::(:link + 1 + + 0 + + -12 + + + 2 + :); ErrorInfo must be an instance of the (:link + 1 + + 0 + + -13 + + + 2 + :) template. !!!!Returns: If x does not store an object of type ErrorInfo, returns an empty (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:); otherwise returns pointer to the stored value. Use (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) to store values in exception objects. !!!!Throws: Nothing. + + + + + 0 + + -17 + + + + 7 + 2 + !!!enable_error_info (:include synopsis:) !!!!Requirements: T must be a user-defined type with accessible no-throw copy constructor. !!!!Returns: An object of unspecified type with no-throw copy semantics, which derives publicly from both T, and class boost::(:link + 1 + + 0 + + -12 + + + 2 + :). The T sub-object is initialized from x by the T copy constructor. If T already derives from boost::(:link + 1 + + 0 + + -12 + + + 2 + :), then the type of the returned object does not derive boost::(:link + 1 + + 0 + + -12 + + + 2 + :). !!!!Throws: Nothing. + + + + + 0 + + -18 + + + + 7 + 2 + !!!BOOST_ERROR_INFO (:include synopsis:) This macro is designed to be used with (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) when throwing a boost::(:link + 1 + + 0 + + -12 + + + 2 + :), to store information about the location of the throw statement. It can be chained with other (:link + 1 + + 0 + + -13 + + + 2 + :)s in a single throw expression. + + + + + 0 + + -19 + + + + 15 + 2 + !!!exception_ptr (:include synopsis:) The (:link + 1 + + 0 + + -19 + + + 2 + :) type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; (:link + 1 + + 0 + + -19 + + + 2 + :)'s operations do not throw. Two instances of (:link + 1 + + 0 + + -19 + + + 2 + :) are equivalent and compare equal if and only if they refer to the same exception. The default constructor of (:link + 1 + + 0 + + -19 + + + 2 + :) produces the null value of the type. The null value is equivalent only to itself. !!!!Note: (:link + 1 + + 0 + + -19 + + + 2 + :) objects are returned by (:link + 1 + + 0 + + -21 + + + 2 + :) and (:link + 1 + + 0 + + -22 + + + 2 + :). + + + + + 0 + + -20 + + + + 17 + 2 + !!!enable_current_exception (:include synopsis:) !!!!Requirements: T must have an accessible no-throw copy constructor !!!!Returns: An object of ''unspecified'' type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &). !!!!Description: This function is designed to be used directly in a throw-expression to enable the exception_ptr support in Boost Exception. For example: [@class my_exception: public std::exception { }; .... throw boost::(:link + 1 + + 0 + + -20 + + + 2 + :)(my_exception());@] Unless (:link + 1 + + 0 + + -20 + + + 2 + :) is called at the time an exception object is used in a throw-expression, an attempt to copy it using (:link + 1 + + 0 + + -21 + + + 2 + :) may return an (:link + 1 + + 0 + + -19 + + + 2 + :) which refers to an instance of (:link + 1 + + 0 + + -5 + + + 2 + :). See (:link + 1 + + 0 + + -21 + + + 2 + :) for details. !!!!Note: Instead of using the throw keyword directly, it is preferable to call boost::(:link + 1 + + 0 + + -8 + + + 2 + :). This is guaranteed to throw an exception that derives from boost::(:link + 1 + + 0 + + -12 + + + 2 + :) and supports exception_ptr functionality. + + + + + 0 + + -21 + + + + 29 + 2 + !!!current_exception (:include synopsis:) !!!!Requirements: The (:link + 1 + + 0 + + -21 + + + 2 + :) function must not be called outside of a catch block. !!!!Returns: * An (:link + 1 + + 0 + + -19 + + + 2 + :) that refers to the currently handled exception or a copy of the currently handled exception. * If the function needs to allocate memory and the attempt fails, it returns an (:link + 1 + + 0 + + -19 + + + 2 + :) that refers to an instance of std::bad_alloc. !!!!Throws: Nothing. !!!!Notes: * It is unspecified whether the return values of two successive calls to (:link + 1 + + 0 + + -21 + + + 2 + :) refer to the same exception object. * Correct implementation of (:link + 1 + + 0 + + -21 + + + 2 + :) may require compiler support, unless (:link + 1 + + 0 + + -20 + + + 2 + :) is used at the time the currently handled exception object was passed to throw. If (:link + 1 + + 0 + + -20 + + + 2 + :) is not used, and if the compiler does not provide the necessary support, then (:link + 1 + + 0 + + -21 + + + 2 + :) may return an (:link + 1 + + 0 + + -19 + + + 2 + :) that refers to an instance of (:link + 1 + + 0 + + -5 + + + 2 + :). In this case, if the original exception object derives from boost::(:link + 1 + + 0 + + -12 + + + 2 + :), then the boost::(:link + 1 + + 0 + + -12 + + + 2 + :) sub-object of the (:link + 1 + + 0 + + -5 + + + 2 + :) object is initialized by the boost::(:link + 1 + + 0 + + -12 + + + 2 + :) copy constructor. + + + + + 0 + + -22 + + + + 3 + 2 + !!!copy_exception (:include synopsis:) !!!!Effects: As if try { throw e; } catch( ... ) { return (:link + 1 + + 0 + + -21 + + + 2 + :)(); } + + + + + 0 + + -23 + + + + 1 + 2 + !!!rethrow_exception (:include synopsis:) !!!!Precondition: ep shall not be null. !!!!Throws: The exception to which ep refers. + + + + + 0 + + -24 + + + + 5 + 2 + !!!diagnostic_information (:include synopsis:) !!!!Returns: If dynamic_cast<boost::(:link + 1 + + 0 + + -12 + + + 2 + :) *>(&x) is not null, the returned string is initialized by a call to (:link + 1 + + 0 + + -38 + + + 2 + :); otherwise, the returned string combines the output of x.what() and typeid(x).name(). + + + + + 0 + + -25 + + + + 1 + 2 + !!boost/exception.hpp !!Synopsis (:include synopsis:) + + + + + 0 + + -26 + + + + 1 + 2 + !!boost/exception/diagnostic_information.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -27 + + + + 1 + 2 + !!boost/exception/enable_current_exception.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -28 + + + + 1 + 2 + !!boost/exception/enable_error_info.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -29 + + + + 1 + 2 + !!boost/exception/error_info.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -30 + + + + 1 + 2 + !!boost/exception/exception.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -31 + + + + 1 + 2 + !!boost/exception/info.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -32 + + + + 1 + 2 + !!boost/exception/info_tuple.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -33 + + + + 1 + 2 + !!boost/exception_ptr.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -34 + + + + 1 + 2 + !!boost/throw_exception.hpp !!!Synopsis (:include synopsis:) + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 37 + 2 + !!!Cloning and Re-throwing an Exception When you catch an exception, you can call (:link + 1 + + 0 + + -21 + + + 2 + :) to get an (:link + 1 + + 0 + + -19 + + + 2 + :) object: [@#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> #include <boost/thread.hpp> #include <boost/bind.hpp> void do_work(); //throws cloning-enabled boost::(:link + 1 + + 0 + + -12 + + + 2 + :)s void worker_thread( boost::(:link + 1 + + 0 + + -19 + + + 2 + :) & error ) { try { do_work(); error = boost::(:link + 1 + + 0 + + -19 + + + 2 + :)(); } catch( ... ) { error = boost::(:link + 1 + + 0 + + -21 + + + 2 + :)(); } }@] In the above example, note that (:link + 1 + + 0 + + -21 + + + 2 + :) captures the original type of the exception object. The exception can be thrown again using the (:link + 1 + + 0 + + -23 + + + 2 + :) function: [@// ...continued void work() { boost::(:link + 1 + + 0 + + -19 + + + 2 + :) error; boost::(:link http://www.boost.org/doc/html/boost/thread.html|thread:) t( boost::(:link http://www.boost.org/libs/bind/bind.html|bind:)(worker_thread,boost::(:link http://www.boost.org/doc/html/ref.html|ref:)(error)) ); t.(:link http://www.boost.org/doc/html/boost/thread.html|join:)(); if( error ) boost::(:link + 1 + + 0 + + -23 + + + 2 + :)(error); }@] Note that (:link + 1 + + 0 + + -21 + + + 2 + :) could fail to copy the original exception object in the following cases:* if there is not enough memory, in which case the returned (:link + 1 + + 0 + + -19 + + + 2 + :) points to an instance of std::bad_alloc, or * if (:link + 1 + + 0 + + -20 + + + 2 + :) was not used in the throw-expression passed to the original throw statement and the current implementation does not have the necessary compiler-specific support to copy the exception automatically, in which case the returned (:link + 1 + + 0 + + -19 + + + 2 + :) points to an instance of (:link + 1 + + 0 + + -5 + + + 2 + :). Regardless, the use of (:link + 1 + + 0 + + -21 + + + 2 + :) and (:link + 1 + + 0 + + -23 + + + 2 + :) in the above examples is well-formed. + + + + + 0 + + -37 + + + + 3 + 2 + !!!exception::~exception (:include decl:) !!!!Effects: Frees all resources associated with a boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object. !!!!Throws: Nothing. + + + + + 0 + + -38 + + + + 7 + 2 + !!!exception::diagnostic_information (:include decl:) !!!!Returns: An string representation of all data stored in the boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object by the (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) function. See "(:link + 1 + + 0 + + -11 + + + 2 + :)" for details. !!!!Throws: Nothing. !!!!Note: The return value remains valid until the exception object from which it is obtained is destroyed or modified. + + + + + 0 + + -39 + + + + 13 + 2 + !!!Using enable_current_exception at the Time of the Throw Here is how cloning can be enabled in a throw-expression (15.1): [@#include <(:link + 1 + + 0 + + -27 + + + 2 + :)> #include <(:link + 1 + + 0 + + -31 + + + 2 + :)> #include <stdio.h> #include <errno.h> typedef boost::error_info<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link + 1 + + 0 + + -12 + + + 2 + :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw boost::(:link + 1 + + 0 + + -20 + + + 2 + :)(file_read_error()) << errno_info(errno); }@] Of course, + 1 + + 0 + + -20 + + + 2 + may be used with any exception type; there is no requirement that it should derive from boost:: + 1 + + 0 + + -12 + + + 2 + . + + + + + 0 + + -40 + + + + 7 + 2 + !!!exception::exception (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object. * Copy constructor: initializes a boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object which shares with x all data added through (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:), including data that is added at a future time. !!!!Throws: Nothing. + + + + + 0 + + -41 + + + + 13 + 2 + !!!Adding Grouped Data to Exceptions The code snippet below demonstrates how boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together: [@#include <(:link + 1 + + 0 + + -32 + + + 2 + :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> #include <errno.h> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_file_name,std::string> file_name_info; typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_function,char const *> function_info; typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_errno,int> errno_info; typedef boost::tuple<function_info,errno_info> clib_failure; class file_open_error: public boost::(:link + 1 + + 0 + + -12 + + + 2 + :) { }; 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); }@] Note that the members of a boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) are stored separately in exception objects; they can only be retrieved individually, using (:link + 1 + + 0 + + -16 + + + 2 + :). + + + + + 0 + + -42 + + + + 19 + 2 + !!!Adding of Arbitrary Data at the Point of the Throw The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <errno.h> #include <iostream> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_errno,int> errno_info; //(1) class my_error: public boost::(:link + 1 + + 0 + + -12 + + + 2 + :), public std::exception { }; //(2) void f() { throw my_error() << errno_info(errno); //(3) } @] First, we instantiate the (:link + 1 + + 0 + + -13 + + + 2 + :) template using a unique identifier -- tag_errno, and the type of the info it identifies -- int. This provides compile-time type safety for the various values stored in exception objects. Second, we define class my_error, which derives from boost::(:link + 1 + + 0 + + -12 + + + 2 + :). Finally, (3) illustrates how the typedef from (1) can be used with (:link + 1 + + 0 + + -14 + + + 2 + |operator<<:) to store values in exception objects at the point of the throw. The stored errno value can be recovered at a later time like this: [@// ...continued void g() { try { f(); } catch( my_error & x ) { if( boost::shared_ptr<int const> err=boost::(:link + 1 + + 0 + + -16 + + + 2 + :)<errno_info>(x) ) std::cerr << "Error code: " << *err; } }@] The (:link + 1 + + 0 + + -16 + + + 2 + :) function template is instantiated with the typedef from (1), and is passed an exception object of any type that derives publicly from boost::(:link + 1 + + 0 + + -12 + + + 2 + :). If the exception object contains the requested value, the returned (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:) will point to it; otherwise an empty (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:) is returned. + + + + + 0 + + -43 + + + + 21 + 2 + !!!Adding of Arbitrary Data to Active Exception Objects 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: [@#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("????"); }@] We have defined an exception class file_read_error which can store a file name, so that when we catch a file_read_error object, we know which file the failure is related to. However, the file_read function does not have the file name at the time of the throw; all it has is a FILE handle. One possible solution is to not use FILE handles directly. We could have our own class file which stores both a FILE handle and a file name, and pass that to file_read. However, this could be problematic if we communicate with 3rd party code that does not use our class file (probably because they have their own similar class.) A better solution is to make class file_read_error derive (possibly indirectly) from boost::(:link + 1 + + 0 + + -12 + + + 2 + :), and free the file_read function from the burden of storing the file name in exceptions it throws: [@#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <stdio.h> #include <errno.h> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link + 1 + + 0 + + -12 + + + 2 + :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw file_read_error() << errno_info(errno); }@] If file_read detects a failure, it throws an exception which contains the information that is available at the time, namely the errno. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally: [@#include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> typedef boost::(:link + 1 + + 0 + + -13 + + + 2 + :)<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::(:link + 1 + + 0 + + -12 + + + 2 + :) & e ) { e << file_name_info(file_name); throw; } }@] The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::(:link + 1 + + 0 + + -12 + + + 2 + :) object is that the file name is relevant to any failure that occurs in parse_file, ''even if the failure is unrelated to file I/O''. As usual, the stored data can be retrieved using (:link + 1 + + 0 + + -16 + + + 2 + :). + + + + + 0 + + -44 + + + + 9 + 2 + !!!exception::what (:include decl:) !!!!Returns: The default implementation is equivalent to return (:link + 1 + + 0 + + -38 + + + 2 + :)(). The signature of boost::(:link + 1 + + 0 + + -44 + + + 2 + :) is identical to the familiar std::exception::what function, so that when an exception type that derives both std::exception and boost::(:link + 1 + + 0 + + -12 + + + 2 + :) overrides the what function, it overrides both std::exception::what and boost::(:link + 1 + + 0 + + -44 + + + 2 + :). !!!!Throws: Nothing. !!!!Note: The return value remains valid until the exception object from which it is obtained is destroyed or modified. + + + + + + + + throws + + 50 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 0 + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by the T copy constructor. + + + + + 0 + + -15 + + + + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by T1..TN copy constructor. + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 0 + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 0 + + + + + 0 + + -27 + + + + 0 + + + + + 0 + + -28 + + + + 0 + + + + + 0 + + -29 + + + + 0 + + + + + 0 + + -30 + + + + 0 + + + + + 0 + + -31 + + + + 0 + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 + + + + 0 + + + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + members + + 51 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 0 + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 0 + + + + + 0 + + -15 + + + + 0 + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 0 + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 0 + + + + + 0 + + -27 + + + + 0 + + + + + 0 + + -28 + + + + 0 + + + + + 0 + + -29 + + + + 0 + + + + + 0 + + -30 + + + + 0 + + + + + 0 + + -31 + + + + 0 + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 + + + + 0 + + + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + synopsis + + 52 + + reno_layer + + + + 40 + + + 0 + + -5 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -6 + + + + 0 + + + + + 0 + + -7 + + + + 0 + + + + + 0 + + -8 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -34 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -30 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -13 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -14 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -31 + + + 2 + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -15 + + + + 5 + 2 + `#include <(:link + 1 + + 0 + + -32 + + + 2 + :)> [@namespace boost { (:include + 1 + + 0 + + -15 + + + 2 + decl pre_indent="4":) }@] + + + + + 0 + + -16 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -17 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -28 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -18 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -19 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -20 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -27 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -21 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -22 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -23 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -33 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -24 + + + + 3 + 2 + `#include < + 1 + + 0 + + -26 + + + 2 + > [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -25 + + + + 11 + 2 + [@#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> #include <(:link + 1 + + 0 + + -32 + + + 2 + :)> #include < + 1 + + 0 + + -26 + + + 2 + > #include <(:link + 1 + + 0 + + -33 + + + 2 + :)> #include <(:link + 1 + + 0 + + -34 + + + 2 + :)>@] + + + + + 0 + + -26 + + + + 1 + 2 + [@#include <exception> namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -27 + + + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -30 + + + 2 + :)> namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -28 + + + + 3 + 2 + [@#include < + 1 + + 0 + + -30 + + + 2 + > namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -29 + + + + 1 + 2 + [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -30 + + + + 1 + 2 + [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -31 + + + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -30 + + + 2 + :)> #include <boost/current_function.hpp> #include <boost/shared_ptr.hpp> namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -32 + + + + 1 + 2 + [@#include <boost/tuple/tuple.hpp> namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -33 + + + + 3 + 2 + [@#include < + 1 + + 0 + + -30 + + + 2 + > namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -34 + + + + 5 + 2 + [@#include <(:link + 1 + + 0 + + -27 + + + 2 + :)> #include <(:link + 1 + + 0 + + -28 + + + 2 + :)> #include <exception> namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -35 + + + + 0 + + + + + 0 + + -36 + + + + 0 + + + + + 0 + + -37 + + + + 0 + + + + + 0 + + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + + + + + + + + + 53 + + reno_context_map + + + + + 40 + + -5 + + + -6 + + + -7 + + + -8 + + + -9 + + + -10 + + + -11 + + + -12 + + + -13 + + + -14 + + + -15 + + + -16 + + + -17 + + + -18 + + + -19 + + + -20 + + + -21 + + + -22 + + + -23 + + + -24 + + + -25 + + + -26 + + + -27 + + + -28 + + + -29 + + + -30 + + + -31 + + + -32 + + + -33 + + + -34 + + + -35 + + + -36 + + + -37 + + + -38 + + + -39 + + + -40 + + + -41 + + + -42 + + + -43 + + + -44 + + + + + + 40 + + + + + 0 + + + + + + 1 + + + + -6 + + + + + + + 0 + + + + + + 1 + + + + -7 + + + + + + + 0 + + + + + + 1 + + + + -9 + + + + + + + 0 + + + + + + 1 + + + + -35 + + + + + + + 1 + CB567E3390BC92DA06F9899E700792C3790D3707C024CA21D15C930D908AD10A + 3422645546 + 5023 + 323 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -33 + + + + + + + 1 + FC684D0DD5A9732B4130F2AB3DB6E0491D0F523E14B7FB738B2019EA2C7F8717 + 2229778754 + 631 + 319 + + + + + + 0 + ../../example/cloning_2.cpp + 0 + 0 + + + + -36 + + + + + + + 1 + ECAD4A1E70A31D7F87F79F557D107AB0A3C5161CB370139974E08ECAFBE2D32F + 1816954312 + 457 + 323 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + -26 + + + + + + + 1 + D9B8E6AA12A4F33953B1A961FA590C5A3840234B6531CA8C04AC985AD5800835 + 2432554768 + 702 + 408 + + + + + + 0 + ../../example/enable_error_info.cpp + 0 + 0 + + + + -10 + + + + + + + 1 + 5373E336DC4892A41D31694BCA1146382FC3137819A04689CA1F9FFAF1CFAB3B + 4050491732 + 466 + 307 + + + + + + 0 + ../../example/cloning_1.cpp + 0 + 0 + + + + -39 + + + + + + + 2 + 07430F64896197A110C276D8A14CA8A75FBA482DDF50CD40D689A1898C84D054 + 1712604289 + 1296 + 396 + BCCB91D0DCA6EC45F29CB70CB64AEA6AB54F32F8F1D1937C4CB80B059346DC81 + 695614553 + 1264 + 26 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + -15 + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 921FBF6991E17349BFF2AD6F165372F85AA9457DDB28E502ABB6B392BBA6B529 + 3119269037 + 284 + 4423 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -22 + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 9567A192BF523DDF741004FFF5BDB044D715FEB7CE9AEC89ACC25C1C33E48C4E + 2232115228 + 381 + 26 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -5 + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 9DEEF8ED70BF74F501A96BA5DE5BFD42FAD16DE333ABE189E512C332586FC465 + 2250569940 + 1893 + 2528 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -21 + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + 156B870761DB092CE4269C1173B479A344A1041BA2B883765AF19A72B371D776 + 3239976720 + 117 + 4709 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -23 + + + + + + + 2 + 973F8368D72D56424349CBB81C8F3015CB9F4F0CD7B23A8C62C3DBADDA37CD57 + 3833800883 + 4832 + 514 + ED09F845070FF7D381BE5EFB6B55313FD09FBA16B64B69992410380EFA45519C + 2051939590 + 78 + 409 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -19 + + + + + + + 1 + 49D31376D97691F7C84A134B5D8C7C66EF1ED6901D376CA250D634AE2B38AB5E + 549270010 + 163 + 572 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -18 + + + + + + + 1 + 48A0C42CCA66A6C935724A9B7BD30B6B3DF16A0A808C804A585A5CC90D85DC5E + 1606229033 + 1723 + 91 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + -34 + + + + + + + 1 + F19D72C24D904689FEEE070D77ABD19090396E7C7663A5BA80E474F1EDA62861 + 4081508978 + 6759 + 323 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -31 + + + + + + + 1 + A9C65F105342D728DE9C996079E82DF25408B94A272090039FAAC12D29659F69 + 2378831669 + 94 + 227 + + + + + + 0 + ../../../../boost/exception/enable_current_exception.hpp + 0 + 0 + + + + -27 + + + + + + + 1 + 429F0DE3599A4CC08B9458E2AECA2EAC202AB3471554FE82C307493805E6676E + 4224422781 + 401 + 323 + + + + + + 0 + ../../../../boost/exception.hpp + 0 + 0 + + + + -25 + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + F839AFD37DC086BB1231B8E87D8EEBD28129649A06FC685AC7DF65595871AE30 + 2291609923 + 1204 + 243 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -13 + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + 65D13C1BB0A16823F69A32BAB56A51CA317075C7FC8B7441EE0D9B57AF5AB2AC + 2592266329 + 712 + 1700 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -16 + + + + + + + 2 + C1FAB39F3B09548EC7B197853DC956883AE1C3A29A8A9D2FBDB97D8BEC76CD75 + 173037458 + 6345 + 737 + 27AC1164E0A824D548386BEDCDC81DCAC283F3D286B0ECEE05B039BB8C392BFC + 1247954090 + 249 + 1449 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -14 + + + + + + + 2 + 05061ED1DD1B33224DE28BF86AB10D99286A48DC055D54A19FF93B36F22E8A90 + 3225446538 + 372 + 408 + ED09AD72D3766F261A0044B58B9B73AA355EB50B1A8F602E5EE7F68D0D928596 + 328425570 + 340 + 26 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + -24 + + + + + + + 2 + 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A + 1770110914 + 587 + 1207 + 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D + 3929437933 + 361 + 213 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + -8 + + + + + + + 1 + CAB4D823BD4720B71E1CA5BE482AC95B42A9E07CD5E08671EA23184635F281A2 + 3077708282 + 89 + 323 + + + + + + 0 + ../../../../boost/exception/error_info.hpp + 0 + 0 + + + + -29 + + + + + + + 2 + 392208A2FD122D1ED27D128A7BF65F9340218FAAD756EA58D26D2205D32681A6 + 729208193 + 3206 + 506 + 8F3B5E1A267CA225679713F4DDF528041F573BC02D1DBCD8FFEF57EF0AA599B9 + 4197332561 + 180 + 3020 + + + + + + 0 + ../../../../boost/exception/enable_current_exception.hpp + 0 + 0 + + + + -20 + + + + + + + 2 + 837760557B72743BFC955BC4B1213EC27F47583A9D7D08EA0BC5616F977A21A7 + 493325143 + 2449 + 457 + ACC64445E8B6AAEF58395C0083BC0247CDE33AC00ED8DB9B7B4F216325DEE410 + 2943579912 + 400 + 2043 + + + + + + 0 + ../../../../boost/exception/enable_error_info.hpp + 0 + 0 + + + + -17 + + + + + + + 1 + CAD6C404CB725D336A44920D2341ECA131149AB02C368B59028F8147F16737BF + 2258638601 + 94 + 227 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + -32 + + + + + + + 1 + 251773B273187F592361DB0624E7F5D52C95845C3A6562F4A0F830C46D775BC8 + 3425410730 + 3294 + 323 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -30 + + + + + + + 1 + F4C951B28F7DE500973AA3DFAA99F2BADA6EDAFA2B406C30BEF3B7FBE6FD57D7 + 2263754923 + 982 + 306 + + + + + + 0 + ../../example/error_info_2.cpp + 0 + 0 + + + + -43 + + + + + + + 1 + CE411E21EE9878B55B5906D033A0FC52574FB59D8A8CECB75405E9B1C9D782DB + 1173443713 + 308 + 302 + + + + + + 0 + ../../example/logging.cpp + 0 + 0 + + + + -11 + + + + + + + 2 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -12 + + + + + + + 4 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + 85EE1980CFB24E054EDB1B3BDFA61FD4D65AD0EF248A1A42D4C2552700459327 + 2238151539 + 428 + 1070 + AD3F339F7126003907BCBDB3EF846FCACA895132E1100D202DA67D2B7846EE65 + 3032091776 + 60 + 369 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -37 + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + BAC52AC87CFA3174B3352140A8DC10BB7F48C945FC87787C3AC96F0FC2CFDB40 + 1066412964 + 165 + 204 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -38 + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + BACD79DFB4C710C1A67687FC6344DF2251E2379613C2DF5B2729B2CD37E24EA3 + 458367129 + 154 + 393 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -40 + + + + + + + 3 + A8142902F961A340F0621653A76FC7941054FFA10ADADB1018A2E797D7EB1FE9 + 665149135 + 3114 + 503 + FA32C25852E9BB3A713A7790E50C8060367F9810A8B03F3E63338FBF590F1EB9 + 201993397 + 2071 + 878 + E1E6A9EFC3D0DCF4197171BA3C804656908C414424194530416F69E471FC99AD + 120398751 + 145 + 57 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -44 + + + + + + + 1 + 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 + 4276724153 + 574 + 382 + + + + + + 0 + ../../example/error_info_1.cpp + 0 + 0 + + + + -42 + + + + + + + 1 + E444EE9697EEADFDE0767E1D0242FC0E70D98E61FB1F0FFA099648DE509B82F3 + 94503238 + 773 + 374 + + + + + + 0 + ../../example/info_tuple.cpp + 0 + 0 + + + + -41 + + + + + + + 1 + B23D4FF62C70B07638898ECB0B683410BC3E4C4F7DB2922C7B0E9844B1855FF5 + 3540957683 + 2583 + 323 + + + + + + 0 + ../../../../boost/exception/enable_error_info.hpp + 0 + 0 + + + + -28 + + + + + + + + + + 54 + + tag_index + + + + + 41 + + + 1 + + + + + + 0 + + -5 + + + exception_ptr,type,unknown_exception + + + + 0 + + -6 + + + noindex + + + + 0 + + -7 + + + tutorial + + + + 0 + + -8 + + + free,function,throw_exception + + + + 0 + + -9 + + + tutorial + + + + 0 + + -10 + + + tutorial + + + + 0 + + -11 + + + tutorial + + + + 0 + + -12 + + + exception,type + + + + 0 + + -13 + + + error_info,free,type + + + + 0 + + -14 + + + error_info,free,function,operator<<,operator<</exception + + + + 0 + + -15 + + + error_info,free,function,operator<<,operator<</tuple + + + + 0 + + -16 + + + error_info,free,function,get_error_info + + + + 0 + + -17 + + + enable_error_info,error_info,free,function + + + + 0 + + -18 + + + BOOST_ERROR_INFO,error_info,macro + + + + 0 + + -19 + + + exception_ptr,type + + + + 0 + + -20 + + + enable_current_exception,exception_ptr,free,function + + + + 0 + + -21 + + + current_exception,exception_ptr,free,function + + + + 0 + + -22 + + + copy_exception,exception_ptr,free,function + + + + 0 + + -23 + + + exception_ptr,free,function,rethrow_exception + + + + 0 + + -24 + + + diagnostic_information,free,function + + + + 0 + + -25 + + + boost/exception.hpp,header + + + + 0 + + -26 + + + boost/exception/diagnostic_information.hpp,diagnostic_information,header + + + + 0 + + -27 + + + boost/exception/enable_current_exception.hpp,enable_current_exception,exception_ptr,header + + + + 0 + + -28 + + + boost/exception/enable_error_info.hpp,enable_error_info,error_info,header + + + + 0 + + -29 + + + boost/exception/error_info.hpp,error_info,header + + + + 0 + + -30 + + + boost/exception/exception.hpp,exception,header + + + + 0 + + -31 + + + boost/exception/info.hpp,error_info,header,info + + + + 0 + + -32 + + + boost/exception/info_tuple.hpp,error_info,header,info_tuple + + + + 0 + + -33 + + + boost/exception_ptr.hpp,exception_ptr,header + + + + 0 + + -34 + + + boost/throw_exception.hpp,header,throw_exception + + + + 0 + + -35 + + + index,noindex + + + + 0 + + -36 + + + noalso,noindex,tutorial + + + + 0 + + -37 + + + exception,exception::~exception,function,member + + + + 0 + + -38 + + + diagnostic_information,exception,exception::diagnostic_information,function,member + + + + 0 + + -39 + + + noalso,noindex,tutorial + + + + 0 + + -40 + + + exception,exception::exception,function,member + + + + 0 + + -41 + + + noalso,noindex,tutorial + + + + 0 + + -42 + + + noalso,noindex,tutorial + + + + 0 + + -43 + + + noalso,noindex,tutorial + + + + 0 + + -44 + + + exception,exception::what,function,member + + + + + + + + + diff --git a/doc/source/html_prefix.txt b/doc/source/html_prefix.txt new file mode 100644 index 0000000..42180a4 --- /dev/null +++ b/doc/source/html_prefix.txt @@ -0,0 +1,21 @@ + + + + + %s + + + +
+
+
+
+ +

Boost Exception

+
+ + + diff --git a/doc/source/html_suffix.txt b/doc/source/html_suffix.txt new file mode 100644 index 0000000..a03659a --- /dev/null +++ b/doc/source/html_suffix.txt @@ -0,0 +1,18 @@ + + + + +
+
+
+ + diff --git a/doc/throw_exception.html b/doc/throw_exception.html new file mode 100644 index 0000000..853c8aa --- /dev/null +++ b/doc/throw_exception.html @@ -0,0 +1,67 @@ + + + + + throw_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

throw_exception

+

#include <boost/throw_exception.hpp>

+
namespace
+boost
+    {
+    #ifdef BOOST_NO_EXCEPTIONS
+    
+    void throw_exception( std::exception const & e ); // user defined
+    
+    #else
+    
+    template <class E>
+    void throw_exception( E const & e );
+    
+    #endif
+    }
+

Requirements:

+

E must derive publicly from std::exception.

+

Effects:

+
  • If BOOST_NO_EXCEPTIONS is not defined, boost::throw_exception(e) is equivalent to throw boost::enable_current_exception(boost::enable_error_info(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::throw_exception(e) is equivalent to throw e;
  • +
  • If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of throw_exception are allowed to assume that the function never returns; therefore, if the user-defined throw_exception returns, the behavior is undefined.
  • +
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/throw_exception_hpp.html b/doc/throw_exception_hpp.html new file mode 100644 index 0000000..0e0417a --- /dev/null +++ b/doc/throw_exception_hpp.html @@ -0,0 +1,64 @@ + + + + + boost/throw_exception.hpp + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

boost/throw_exception.hpp

+

Synopsis

+
#include <boost/exception/enable_current_exception.hpp>
+#include <boost/exception/enable_error_info.hpp>
+#include <exception>
+
+namespace
+boost
+    {
+    #ifdef BOOST_NO_EXCEPTIONS
+    
+    void throw_exception( std::exception const & e ); // user defined
+    
+    #else
+    
+    template <class E>
+    void throw_exception( E const & e );
+    
+    #endif
+    }
+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/tutorial_diagnostic_information.html b/doc/tutorial_diagnostic_information.html new file mode 100644 index 0000000..6d3d45c --- /dev/null +++ b/doc/tutorial_diagnostic_information.html @@ -0,0 +1,67 @@ + + + + + Tutorial: Diagnostic Information + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Diagnostic Information

+

Class boost::exception provides a virtual member function diagnostic_information, with a signature similar to the familiar std::exception::what function. The default implementation returns a string value that is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example:

+
#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.diagnostic_information();
+        }
+    }
+

The diagnostic_information member function iterates over all data objects stored in the boost::exception through operator<<. The returned string is constructed by converting each data object to string and then concatenating these strings together.

+

When the error_info<Tag,T> template is instantiated, the system attempts overload resolution for an unqualified call to to_string(x), where x is of type T. If this is successful, the to_string overload is used to convert objects of type T to string.

+

Otherwise, the system attempts overload resolution for s << x, where s is a std::ostringstream and x is of type T. If this is successful, the operator<< overload is used to convert objects of type T to string.

+

Otherwise the system is unable to convert objects of type T to string, and an unspecified stub string value is used without issuing a compile error.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/tutorial_enable_error_info.html b/doc/tutorial_enable_error_info.html new file mode 100644 index 0000000..c966995 --- /dev/null +++ b/doc/tutorial_enable_error_info.html @@ -0,0 +1,72 @@ + + + + + Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Integrating Boost Exception in Existing Exception Class Hierarchies

+

Some exception hierarchies can not be modified to make boost::exception a base type. For this case, the enable_error_info function template can be used to make exception objects derive from boost::exception anyway. Here is an example:

+
#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);
+        //....
+        }
+    };
+
+

The call to enable_error_info<T> gets us an object of unspecified type which is guaranteed to derive from both boost::exception and T. This makes it possible to use operator<< to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::exception &, so that more information can be added to the exception at a later time.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/tutorial_exception_ptr.html b/doc/tutorial_exception_ptr.html new file mode 100644 index 0000000..26a7bec --- /dev/null +++ b/doc/tutorial_exception_ptr.html @@ -0,0 +1,103 @@ + + + + + Tutorial: Transporting of Exceptions between Threads + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Transporting of Exceptions between Threads

+

Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to N2179, but because Boost Exception can not rely on language support, the use of enable_current_exception at the time of the throw is required in order to use cloning.

+

Note:

+

All exceptions emitted by the familiar function boost::throw_exception are guaranteed to derive from boost::exception and to support cloning.

+

Using enable_current_exception at the Time of the Throw

+

Here is how cloning can be enabled in a throw-expression (15.1):

+
#include <boost/exception/enable_current_exception.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_current_exception(file_read_error()) <<
+            errno_info(errno);
+    }
+

Of course, enable_current_exception may be used with any exception type; there is no requirement that it should derive from boost::exception.

+

Cloning and Re-throwing an Exception

+

When you catch an exception, you can call current_exception to get an exception_ptr object:

+
#include <boost/exception_ptr.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(
+    ... )
+        {
+        error = boost::current_exception();
+        }
+    }
+

In the above example, note that current_exception captures the original type of the exception object. The exception can be thrown again using the rethrow_exception function:

+
// ...continued
+
+void
+work()
+    {
+    boost::exception_ptr error;
+    boost::thread t( boost::bind(worker_thread,boost::ref(error)) );
+    t.join();
+    if( error )
+        boost::rethrow_exception(error);
+    }
+

Note that current_exception could fail to copy the original exception object in the following cases:* if there is not enough memory, in which case the returned exception_ptr points to an instance of std::bad_alloc, or

+
  • if enable_current_exception was not used in the throw-expression passed to the original throw statement and the current implementation does not have the necessary compiler-specific support to copy the exception automatically, in which case the returned exception_ptr points to an instance of unknown_exception.
  • +
+

Regardless, the use of current_exception and rethrow_exception in the above examples is well-formed.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/tutorial_transporting_data.html b/doc/tutorial_transporting_data.html new file mode 100644 index 0000000..e1bb3c3 --- /dev/null +++ b/doc/tutorial_transporting_data.html @@ -0,0 +1,188 @@ + + + + + Tutorial: Transporting of Arbitrary Data to the Catch Site + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Transporting of Arbitrary Data to the Catch Site

+

All exception types that derive from boost::exception 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 types. Data can be added to a boost::exception at the time of the throw, or at a later time.

+

Adding of Arbitrary Data at the Point of the Throw

+

The following example demonstrates how errno can be stored in exception objects using Boost Exception:

+
#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)
+    }
+
+

First, we instantiate the error_info template using a unique identifier -- tag_errno, and the type of the info it identifies -- int. This provides compile-time type safety for the various values stored in exception objects.

+

Second, we define class my_error, which derives from boost::exception.

+

Finally, (3) illustrates how the typedef from (1) can be used with operator<< to store values in exception objects at the point of the throw.

+

The stored errno value can be recovered at a later time like this:

+
// ...continued
+
+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;
+        }
+    }
+

The get_error_info function template is instantiated with the typedef from (1), and is passed an exception object of any type that derives publicly from boost::exception. If the exception object contains the requested value, the returned shared_ptr will point to it; otherwise an empty shared_ptr is returned.

+

Adding of Arbitrary Data to Active Exception Objects

+

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:

+
#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("????");
+    }
+

We have defined an exception class file_read_error which can store a file name, so that when we catch a file_read_error object, we know which file the failure is related to. However, the file_read function does not have the file name at the time of the throw; all it has is a FILE handle.

+

One possible solution is to not use FILE handles directly. We could have our own class file which stores both a FILE handle and a file name, and pass that to file_read. However, this could be problematic if we communicate with 3rd party code that does not use our class file (probably because they have their own similar class.)

+

A better solution is to make class file_read_error derive (possibly indirectly) from boost::exception, and free the file_read function from the burden of storing the file name in exceptions it throws:

+
#include <boost/exception.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);
+    }
+

If file_read detects a failure, it throws an exception which contains the information that is available at the time, namely the errno. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally:

+
#include <boost/exception.hpp>
+#include <boost/shared_ptr.hpp>
+#include <stdio.h>
+#include <string>
+
+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;
+        }
+    }
+

The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::exception object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::exception object is that the file name is relevant to any failure that occurs in parse_file, even if the failure is unrelated to file I/O.

+

As usual, the stored data can be retrieved using get_error_info.

+

Adding Grouped Data to Exceptions

+

The code snippet below demonstrates how boost::tuple can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together:

+
#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);
+    }
+

Note that the members of a boost::tuple are stored separately in exception objects; they can only be retrieved individually, using get_error_info.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/unknown_exception.html b/doc/unknown_exception.html new file mode 100644 index 0000000..74f3ffb --- /dev/null +++ b/doc/unknown_exception.html @@ -0,0 +1,59 @@ + + + + + unknown_exception + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

unknown_exception

+

#include <boost/exception_ptr.hpp>

+
namespace
+boost
+    {
+    class
+    unknown_exception:
+        public std::exception
+        public boost::exception
+        {
+        ---unspecified---
+        };
+    }
+

This type is used by the exception_ptr support in Boost Exception. Please see current_exception.

+

See also:

+ + + + + +
+
+
+ + diff --git a/doc/valid-css.png b/doc/valid-css.png new file mode 100644 index 0000000000000000000000000000000000000000..931bacfe9fcd25a55261b9e3b4883f215cc74c7a GIT binary patch literal 5130 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 literal 0 HcmV?d00001 diff --git a/doc/valid-xhtml.png b/doc/valid-xhtml.png new file mode 100644 index 0000000000000000000000000000000000000000..7b127151886262d93fb0685978a9b973027f244e GIT binary patch literal 5805 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 literal 0 HcmV?d00001 diff --git a/example/Jamfile b/example/Jamfile new file mode 100644 index 0000000..a5f4e8c --- /dev/null +++ b/example/Jamfile @@ -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 ; diff --git a/example/cloning_1.cpp b/example/cloning_1.cpp new file mode 100644 index 0000000..5aa700a --- /dev/null +++ b/example/cloning_1.cpp @@ -0,0 +1,23 @@ +//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 +#include +#include +#include + +typedef boost::error_info 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_current_exception(file_read_error()) << + errno_info(errno); + } diff --git a/example/cloning_2.cpp b/example/cloning_2.cpp new file mode 100644 index 0000000..3c10786 --- /dev/null +++ b/example/cloning_2.cpp @@ -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 +#include +#include + +void do_work(); //throws cloning-enabled boost::exceptions + +void +worker_thread( boost::exception_ptr & error ) + { + try + { + do_work(); + error = boost::exception_ptr(); + } + catch( + ... ) + { + error = boost::current_exception(); + } + } + +// ...continued + +void +work() + { + boost::exception_ptr error; + boost::thread t( boost::bind(worker_thread,boost::ref(error)) ); + t.join(); + if( error ) + boost::rethrow_exception(error); + } diff --git a/example/enable_error_info.cpp b/example/enable_error_info.cpp new file mode 100644 index 0000000..0470bf1 --- /dev/null +++ b/example/enable_error_info.cpp @@ -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 +#include + +typedef boost::error_info std_range_min; +typedef boost::error_info std_range_max; +typedef boost::error_info std_range_index; + +template +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); + //.... + } + }; diff --git a/example/error_info_1.cpp b/example/error_info_1.cpp new file mode 100644 index 0000000..b67f728 --- /dev/null +++ b/example/error_info_1.cpp @@ -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 +#include +#include + +typedef boost::error_info 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 err=boost::get_error_info(x) ) + std::cerr << "Error code: " << *err; + } + } diff --git a/example/error_info_2.cpp b/example/error_info_2.cpp new file mode 100644 index 0000000..7464aaf --- /dev/null +++ b/example/error_info_2.cpp @@ -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 +#include +#include +#include + +// + +typedef boost::error_info 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 file_name_info; + +boost::shared_ptr 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 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; + } + } diff --git a/example/example_io.cpp b/example/example_io.cpp new file mode 100644 index 0000000..3777e9a --- /dev/null +++ b/example/example_io.cpp @@ -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 +#include +#include +#include +#include +#include +#include + +typedef boost::error_info errno_info; +typedef boost::error_info > file_stream_info; +typedef boost::error_info open_mode_info; //The open mode of a failed fopen request. +typedef boost::error_info file_name_info; //The file name of a failed file operation. +typedef boost::error_info file_name_src_info; //The source file name of a failed copy operation. +typedef boost::error_info file_name_dst_info; //The destination file name of a failed copy operation. +typedef boost::error_info 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::diagnostic_information(); + } + + 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 +my_fopen( char const * name, char const * mode ) + { + if( FILE * f = ::fopen(name,mode) ) + return boost::shared_ptr(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 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(stream)); + } + +void +my_fwrite( void const * buffer, size_t size, size_t count, boost::shared_ptr 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(stream)); + } + +void +reset_file( char const * file_name ) + { + (void) my_fopen(file_name,"wb"); + } + +void +create_data( char const * file_name ) + { + boost::shared_ptr 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 src = my_fopen(src_file_name,"rb"); + boost::shared_ptr 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 const> f=boost::get_error_info(x) ) + if( boost::shared_ptr 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 src = boost::get_error_info(x) ) + std::cout << "Source file name: " << *src << "\n"; + if( boost::shared_ptr dst = boost::get_error_info(x) ) + std::cout << "Destination file name: " << *dst << "\n"; + } + +void +dump_file_info( boost::exception const & x ) + { + if( boost::shared_ptr fn = boost::get_error_info(x) ) + std::cout << "Source file name: " << *fn << "\n"; + } + +void +dump_clib_info( boost::exception const & x ) + { + if( boost::shared_ptr err=boost::get_error_info(x) ) + std::cout << "OS error: " << *err << "\n"; + if( boost::shared_ptr fn=boost::get_error_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 diagnostic_information():\n"; + std::cout << x.diagnostic_information(); + } + +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); + } + } diff --git a/example/info_tuple.cpp b/example/info_tuple.cpp new file mode 100644 index 0000000..53c1aa0 --- /dev/null +++ b/example/info_tuple.cpp @@ -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 +#include +#include +#include +#include + +typedef boost::error_info file_name_info; +typedef boost::error_info function_info; +typedef boost::error_info errno_info; +typedef boost::tuple clib_failure; + +class file_open_error: public boost::exception { }; + +boost::shared_ptr +file_open( char const * name, char const * mode ) + { + if( FILE * f=fopen(name,mode) ) + return boost::shared_ptr(f,fclose); + else + throw file_open_error() << + file_name_info(name) << + clib_failure("fopen",errno); + } diff --git a/example/logging.cpp b/example/logging.cpp new file mode 100644 index 0000000..41295b5 --- /dev/null +++ b/example/logging.cpp @@ -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 +#include + +void f(); //throws unknown types that derive from boost::exception. + +void +g() + { + try + { + f(); + } + catch( + boost::exception & e ) + { + std::cerr << e.diagnostic_information(); + } + } diff --git a/include/boost/exception/detail/cloning_base.hpp b/include/boost/exception/detail/cloning_base.hpp new file mode 100644 index 0000000..86dc400 --- /dev/null +++ b/include/boost/exception/detail/cloning_base.hpp @@ -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_F7D5662CCB0F11DCA353CAC656D89593 +#define UUID_F7D5662CCB0F11DCA353CAC656D89593 + +#include + +namespace +boost + { + namespace + exception_detail + { + class clone_base; + + class + cloning_base + { + public: + + virtual clone_base const * clone() const = 0; + + protected: + +#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) ) +virtual //Disable bogus GCC warning. +#endif + ~cloning_base() throw() + { + } + }; + } + } + +#endif diff --git a/include/boost/exception/detail/counted_base.hpp b/include/boost/exception/detail/counted_base.hpp new file mode 100644 index 0000000..75f6375 --- /dev/null +++ b/include/boost/exception/detail/counted_base.hpp @@ -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) + +#ifndef UUID_DBA0D90C930911DCBA7B675A56D89593 +#define UUID_DBA0D90C930911DCBA7B675A56D89593 + +#include + +namespace +boost + { + namespace + exception_detail + { + class + counted_base + { + friend + void + intrusive_ptr_add_ref( counted_base const * c ) + { + c->add_ref(); + } + + friend + void + intrusive_ptr_release( counted_base const * c ) + { + c->release(); + } + + virtual void add_ref() const=0; + virtual void release() const=0; + + protected: + +#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) ) +virtual //Disable bogus GCC warning. +#endif + ~counted_base() throw() + { + } + }; + } + } + +#endif diff --git a/include/boost/exception/detail/is_output_streamable.hpp b/include/boost/exception/detail/is_output_streamable.hpp new file mode 100644 index 0000000..57376bf --- /dev/null +++ b/include/boost/exception/detail/is_output_streamable.hpp @@ -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_898984B4076411DD973EDFA055D89593 +#define UUID_898984B4076411DD973EDFA055D89593 + +#include + +namespace +boost + { + namespace + to_string_detail + { + template + char operator<<( std::basic_ostream &, T const & ); + + template + struct + is_output_streamable_impl + { + static std::basic_ostream & f(); + static T const & g(); + enum e { value=1!=(sizeof(f()< > + struct + is_output_streamable + { + enum e { value=to_string_detail::is_output_streamable_impl::value }; + }; + } + +#endif diff --git a/include/boost/exception/detail/object_hex_dump.hpp b/include/boost/exception/detail/object_hex_dump.hpp new file mode 100644 index 0000000..b1cba64 --- /dev/null +++ b/include/boost/exception/detail/object_hex_dump.hpp @@ -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) + +#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593 +#define UUID_6F463AC838DF11DDA3E6909F56D89593 + +#include +#include +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + std::string + object_hex_dump( T const & x, size_t max_size=16 ) + { + std::ostringstream s; + s << "type: " << typeid(x).name() << ", size: " << sizeof(T) << ", dump: "; + size_t n=sizeof(T)>max_size?max_size:sizeof(T); + s.fill('0'); + s.width(2); + unsigned char const * b=reinterpret_cast(&x); + s << std::setw(2) << std::hex << (unsigned int)*b; + for( unsigned char const * e=b+n; ++b!=e; ) + s << " " << std::setw(2) << std::hex << (unsigned int)*b; + return s.str(); + } + } + } + +#endif diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp new file mode 100644 index 0000000..a456577 --- /dev/null +++ b/include/boost/exception/diagnostic_information.hpp @@ -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_0552D49838DD11DD90146B8956D89593 +#define UUID_0552D49838DD11DD90146B8956D89593 + +#include +#include +#include + +namespace +boost + { + inline + std::string + diagnostic_information( std::exception const & x ) + { + if( exception const * be = dynamic_cast(&x) ) + return be->diagnostic_information(); + else + return std::string("[ what: ") + x.what() + ", type: " + typeid(x).name() + " ]"; + } + } + +#endif diff --git a/include/boost/exception/enable_current_exception.hpp b/include/boost/exception/enable_current_exception.hpp new file mode 100644 index 0000000..12a200c --- /dev/null +++ b/include/boost/exception/enable_current_exception.hpp @@ -0,0 +1,154 @@ +//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 +#include +#include +#include +#include + +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 + clone_base * make_clone( T const & ); + + template + class + clone_impl: + public T, + public cloning_base + { + public: + + explicit + clone_impl( T const & x ): + T(x) + { + if( boost::exception * be1=dynamic_cast(this) ) + if( boost::exception const * be2=dynamic_cast(&x) ) + *be1 = *be2; + } + + private: + + clone_base const * + clone() const + { + return make_clone(*this); + } + }; + + template + class + exception_clone: + public T, + public clone_base + { + public: + + explicit + exception_clone( T const & x ): + T(x), + count_(0) + { + if( boost::exception * be1=dynamic_cast(this) ) + if( boost::exception const * be2=dynamic_cast(&x) ) + *be1 = *be2; + } + + private: + + detail::atomic_count mutable count_; + + void + add_ref() const + { + ++count_; + } + + void + release() const + { + if( !--count_ ) + delete this; + } + + void + rethrow() const + { + throw clone_impl(*this); + } + }; + + template + clone_base * + make_clone( T const & x ) + { + try + { + return new exception_clone(x); + } + catch( + std::bad_alloc & ) + { + static bad_alloc_impl bad_alloc; + return &bad_alloc; + } + catch( + ... ) + { + BOOST_ASSERT(0); + return 0; + } + } + } + + template + exception_detail::clone_impl + enable_current_exception( T const & x ) + { + return exception_detail::clone_impl(x); + } + } + +#endif diff --git a/include/boost/exception/enable_error_info.hpp b/include/boost/exception/enable_error_info.hpp new file mode 100644 index 0000000..fa98983 --- /dev/null +++ b/include/boost/exception/enable_error_info.hpp @@ -0,0 +1,111 @@ +//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 +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + struct + error_info_injector: + public T, + public exception + { + explicit + error_info_injector( T const & x ): + T(x) + { + } + + ~error_info_injector() throw() + { + } + + char const * + what() const throw() + { + return T::what(); + } + + char const * + diagnostic_information() const throw() + { + return boost::exception::_diagnostic_information(T::what()); + } + }; + + struct large_size { char c[256]; }; + large_size dispatch( exception * ); + + struct small_size { }; + small_size dispatch( void * ); + + template + struct enable_error_info_helper; + + template + struct + enable_error_info_helper + { + typedef T type; + }; + + template + struct + enable_error_info_helper + { + typedef error_info_injector type; + }; + +#if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582)) + template + struct + sizeof_dispatch + { + BOOST_STATIC_CONSTANT(int, value = sizeof(dispatch((T*)0)) ); + }; + + template + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper::value>::type type; + }; +#else + template + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper::type type; + }; +#endif + } + + template +#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582)) + typename +#endif + exception_detail::enable_error_info_return_type::type + enable_error_info( T const & x ) + { + return +#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582)) + typename +#endif + exception_detail::enable_error_info_return_type::type(x); + } + } + +#endif diff --git a/include/boost/exception/error_info.hpp b/include/boost/exception/error_info.hpp new file mode 100644 index 0000000..23f6f30 --- /dev/null +++ b/include/boost/exception/error_info.hpp @@ -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 error_info; + } + +#endif diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp new file mode 100644 index 0000000..c8a7e72 --- /dev/null +++ b/include/boost/exception/exception.hpp @@ -0,0 +1,127 @@ +//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 +#include +#include +#include +#include + +namespace +boost + { + template + class shared_ptr; + + namespace + exception_detail + { + class error_info_base; + + struct + error_info_container: + public exception_detail::counted_base + { + virtual char const * diagnostic_information( char const *, std::type_info const & ) const = 0; + virtual shared_ptr get( std::type_info const & ) const = 0; + virtual void set( shared_ptr const & ) = 0; + }; + } + + template + class error_info; + + template + E const & operator<<( E const &, error_info const & ); + + template + shared_ptr get_error_info( E const & ); + + class + exception + { + public: + + virtual + char const * + what() const throw() + { + return diagnostic_information(); + } + + virtual + char const * + diagnostic_information() const throw() + { + return _diagnostic_information(0); + } + + protected: + + exception() + { + } + + exception( exception const & e ): + data_(e.data_) + { + } + + char const * + _diagnostic_information( char const * std_what ) const throw() + { + if( data_ ) + try + { + char const * w = data_->diagnostic_information(std_what,typeid(*this)); + BOOST_ASSERT(0!=w); + return w; + } + catch(...) + { + } + return std_what ? std_what : typeid(*this).name(); + } + +#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) + //Force class exception to be abstract. + //Otherwise, MSVC bug allows throw exception(), even though the copy constructor is protected. + virtual ~exception() throw()=0; +#else +#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) ) + virtual //Disable bogus GCC warning. +#endif + ~exception() throw() + { + } +#endif + + private: + + shared_ptr get( std::type_info const & ) const; + void set( shared_ptr const & ) const; + + template + friend E const & operator<<( E const &, error_info const & ); + + template + friend shared_ptr get_error_info( E const & ); + + intrusive_ptr mutable data_; + }; + +#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) //See above. + inline + exception:: + ~exception() throw() + { + } +#endif + } + +#endif diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp new file mode 100644 index 0000000..fa35e37 --- /dev/null +++ b/include/boost/exception/info.hpp @@ -0,0 +1,242 @@ +//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 +#include +#include +#include +#include +#include +#include + +#define BOOST_ERROR_INFO\ + ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\ + ::boost::throw_file(__FILE__) <<\ + ::boost::throw_line((int)__LINE__) + +namespace +boost + { + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info 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; + + protected: + +#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) ) +virtual //Disable bogus GCC warning. +#endif + ~error_info_base() + { + } + }; + } + + template + 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); + } + + std::string + value_as_string() const + { + return to_string_stub(value_); + } + + value_type const value_; + }; + + template + E const & + operator<<( E const & x, error_info const & v ) + { + shared_ptr< error_info > p( new error_info(v) ); + x.set(p); + return x; + } + + template + shared_ptr + get_error_info( E const & some_exception ) + { + if( exception const * x = dynamic_cast(&some_exception) ) + if( shared_ptr eib = x->get(typeid(ErrorInfo)) ) + { + BOOST_ASSERT( 0!=dynamic_cast(eib.get()) ); + ErrorInfo const * w = static_cast(eib.get()); + return shared_ptr(eib,&w->value()); + } + return shared_ptr(); + } + + 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 + get( std::type_info const & ti ) const + { + error_info_map::const_iterator i=info_.find(typeinfo(ti)); + if( info_.end()!=i ) + { + shared_ptr const & p = i->second; + BOOST_ASSERT( typeid(*p)==ti ); + return p; + } + return shared_ptr(); + } + + void + set( shared_ptr const & x ) + { + BOOST_ASSERT(x); + info_[typeinfo(typeid(*x))] = x; + what_.clear(); + } + + char const * + diagnostic_information( char const * std_what, std::type_info const & exception_type ) const + { + if( what_.empty() ) + { + std::string tmp; + if( std_what ) + { + tmp += std_what; + tmp += '\n'; + } + tmp += "Dynamic exception type: "; + tmp += exception_type.name(); + tmp += '\n'; + for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) + { + shared_ptr 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_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 const & x ) const + { + if( !data_ ) + data_ = intrusive_ptr(new exception_detail::error_info_container_impl); + data_->set(x); + } + + inline + shared_ptr + exception:: + get( std::type_info const & ti ) const + { + if( data_ ) + return data_->get(ti); + else + return shared_ptr(); + } + } + +#endif diff --git a/include/boost/exception/info_tuple.hpp b/include/boost/exception/info_tuple.hpp new file mode 100644 index 0000000..43a9a76 --- /dev/null +++ b/include/boost/exception/info_tuple.hpp @@ -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 +#include + +namespace +boost + { + template < + class E, + class Tag1,class T1, + class Tag2,class T2 > + E const & + operator<<( + E const & x, + tuple< + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template 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, + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template 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, + error_info, + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>(); + } + } + +#endif diff --git a/include/boost/exception/to_string.hpp b/include/boost/exception/to_string.hpp new file mode 100644 index 0000000..844dc97 --- /dev/null +++ b/include/boost/exception/to_string.hpp @@ -0,0 +1,72 @@ +//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 +#include +#include + +namespace +boost + { + namespace + to_string_detail + { + template + typename disable_if,char>::type to_string( T const & ); + + template + struct has_to_string_impl; + + template + struct + has_to_string_impl + { + enum e { value=1 }; + }; + + template + struct + has_to_string_impl + { + static T const & f(); + enum e { value=1!=sizeof(to_string(f())) }; + }; + } + + template + typename enable_if,std::string>::type + to_string( T const & x ) + { + std::ostringstream out; + out << x; + return out.str(); + } + + template + struct + has_to_string + { + enum e { value=to_string_detail::has_to_string_impl::value>::value }; + }; + + template + std::string + to_string( std::pair const & x ) + { + return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')'; + } + + inline + std::string + to_string( std::exception const & x ) + { + return x.what(); + } + } + +#endif diff --git a/include/boost/exception/to_string_stub.hpp b/include/boost/exception/to_string_stub.hpp new file mode 100644 index 0000000..adc553c --- /dev/null +++ b/include/boost/exception/to_string_stub.hpp @@ -0,0 +1,96 @@ +//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 +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + struct + to_string_dispatcher + { + template + static + std::string + convert( T const & x, Stub ) + { + return to_string(x); + } + }; + + template <> + struct + to_string_dispatcher + { + template + static + std::string + convert( T const & x, Stub s ) + { + return s(x); + } + + template + static + std::string + convert( T const & x, std::string s ) + { + return s; + } + + template + static + std::string + convert( T const & x, char const * s ) + { + BOOST_ASSERT(s!=0); + return s; + } + }; + + namespace + to_string_dispatch + { + template + std::string + dispatch( T const & x, Stub s ) + { + return to_string_dispatcher::value>::convert(x,s); + } + } + + template + std::string + string_stub_dump( T const & x ) + { + return "[ " + exception_detail::object_hex_dump(x) + " ]"; + } + } + + template + std::string + to_string_stub( T const & x ) + { + return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump); + } + + template + std::string + to_string_stub( T const & x, Stub s ) + { + return exception_detail::to_string_dispatch::dispatch(x,s); + } + } + +#endif diff --git a/include/boost/exception_ptr.hpp b/include/boost/exception_ptr.hpp new file mode 100644 index 0000000..0f02aa9 --- /dev/null +++ b/include/boost/exception_ptr.hpp @@ -0,0 +1,194 @@ +//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 +#include +#include +#include +#include + +namespace +boost + { + class + unknown_exception: + public exception, + public std::exception + { + public: + + unknown_exception() + { + } + + explicit + unknown_exception( boost::exception const & e ): + boost::exception(e) + { + } + + ~unknown_exception() throw() + { + } + }; + + typedef intrusive_ptr exception_ptr; + + namespace + exception_detail + { + template + class + current_exception_std_exception_wrapper: + public T, + public boost::exception + { + public: + + explicit + current_exception_std_exception_wrapper( T const & e1 ): + T(e1) + { + } + + current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ): + T(e1), + boost::exception(e2) + { + } + + ~current_exception_std_exception_wrapper() throw() + { + } + }; + + template + exception_ptr + current_exception_std_exception( T const & e1 ) + { + if( boost::exception const * e2 = dynamic_cast(&e1) ) + return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper(e1,*e2))); + else + return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper(e1))); + } + + inline + exception_ptr + current_exception_unknown_exception() + { + return exception_ptr(exception_detail::make_clone(unknown_exception())); + } + + inline + exception_ptr + current_exception_unknown_std_exception( std::exception const & e ) + { + if( boost::exception const * be = dynamic_cast(&e) ) + return exception_ptr(exception_detail::make_clone(unknown_exception(*be))); + else + return current_exception_unknown_exception(); + } + + inline + exception_ptr + current_exception_unknown_boost_exception( boost::exception const & e ) + { + return exception_ptr(exception_detail::make_clone(unknown_exception(e))); + } + } + + inline + exception_ptr + current_exception() + { + try + { + throw; + } + catch( + exception_detail::cloning_base & e ) + { + exception_detail::clone_base const * c = e.clone(); + BOOST_ASSERT(c!=0); + return exception_ptr(c); + } + catch( + std::invalid_argument & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::out_of_range & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::logic_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_alloc & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_cast & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_typeid & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_exception & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::exception & e ) + { + return exception_detail::current_exception_unknown_std_exception(e); + } + catch( + boost::exception & e ) + { + return exception_detail::current_exception_unknown_boost_exception(e); + } + catch( + ... ) + { + return exception_detail::current_exception_unknown_exception(); + } + } + + template + exception_ptr + copy_exception( T const & e ) + { + try + { + throw enable_current_exception(e); + } + catch( ... ) + { + return current_exception(); + } + } + + inline + void + rethrow_exception( exception_ptr const & p ) + { + p->rethrow(); + } + } + +#endif diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index bb79a37..6555763 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -11,18 +11,30 @@ // boost/throw_exception.hpp // // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 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) +// 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) // // http://www.boost.org/libs/utility/throw_exception.html // #include +#include +#include -#ifdef BOOST_NO_EXCEPTIONS -# include +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x590 ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) +# include +# include #endif namespace boost @@ -30,13 +42,23 @@ namespace boost #ifdef BOOST_NO_EXCEPTIONS -void throw_exception(std::exception const & e); // user defined +void throw_exception( std::exception const & e ); // user defined #else -template inline void throw_exception(E const & e) +inline void throw_exception_assert_compatibility( std::exception const & ) { } + +template inline void throw_exception( E const & e ) { + //All boost exceptions are required to derive std::exception, + //to ensure compatibility with BOOST_NO_EXCEPTIONS. + throw_exception_assert_compatibility(e); + +#ifndef BOOST_EXCEPTION_DISABLE + throw enable_current_exception(enable_error_info(e)); +#else throw e; +#endif } #endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 new file mode 100644 index 0000000..f532e3e --- /dev/null +++ b/test/Jamfile.v2 @@ -0,0 +1,47 @@ +# 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 ; + +project : requirements on ; + +#to_string + +run is_output_streamable_test.cpp ; +run has_to_string_test.cpp ; +run to_string_test.cpp ; +run to_string_stub_test.cpp ; +compile-fail to_string_fail.cpp ; + +#exception + +run cloning_test.cpp ; +run copy_exception_test.cpp ; +run unknown_exception_test.cpp ; +run exception_test.cpp ; +run boost_error_info_test.cpp ; +run enable_error_info_test.cpp helper1.cpp ; +run throw_exception_test.cpp helper2.cpp ; +run errno_test.cpp ; +run error_info_test.cpp ; +run diagnostic_information_test.cpp ; +run what_test.cpp ; +compile-fail exception_fail.cpp ; +compile-fail throw_exception_fail.cpp ; + +#headers + +compile exception_ptr_hpp_test.cpp ; +compile diagnostic_information_hpp_test.cpp ; +compile enable_current_exception_hpp_test.cpp ; +compile enable_error_info_hpp_test.cpp ; +compile error_info_hpp_test.cpp ; +compile exception_hpp_test.cpp ; +compile info_hpp_test.cpp ; +compile info_tuple_hpp_test.cpp ; +compile to_string_hpp_test.cpp ; +compile to_string_stub_hpp_test.cpp ; diff --git a/test/boost_error_info_test.cpp b/test/boost_error_info_test.cpp new file mode 100644 index 0000000..d919eb7 --- /dev/null +++ b/test/boost_error_info_test.cpp @@ -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 +#include +#include + +namespace +test + { + class my_exception: public boost::exception { }; + + typedef boost::error_info 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(x)); + BOOST_TEST(boost::get_error_info(x)); + BOOST_TEST(boost::get_error_info(x)); + BOOST_TEST(boost::get_error_info(x)); + } + } + } + +int +main() + { + test::test_boost_error_info(); + return boost::report_errors(); + } diff --git a/test/cloning_test.cpp b/test/cloning_test.cpp new file mode 100644 index 0000000..5f2319a --- /dev/null +++ b/test/cloning_test.cpp @@ -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 +#include + +struct +test_exception: + std::exception + { + }; + +int +main() + { + try + { + throw boost::enable_current_exception(test_exception()); + } + catch( + ... ) + { + boost::exception_ptr p = boost::current_exception(); + try + { + rethrow_exception(p); + BOOST_TEST(false); + } + catch( + test_exception & ) + { + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + return boost::report_errors(); + } diff --git a/test/copy_exception_test.cpp b/test/copy_exception_test.cpp new file mode 100644 index 0000000..721c7e4 --- /dev/null +++ b/test/copy_exception_test.cpp @@ -0,0 +1,34 @@ +//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 +#include + +struct +test_exception: + std::exception + { + }; + +int +main() + { + boost::exception_ptr p = boost::copy_exception(test_exception()); + try + { + rethrow_exception(p); + BOOST_TEST(false); + } + catch( + test_exception & ) + { + } + catch( + ... ) + { + BOOST_TEST(false); + } + return boost::report_errors(); + } diff --git a/test/diagnostic_information_hpp_test.cpp b/test/diagnostic_information_hpp_test.cpp new file mode 100644 index 0000000..e7381db --- /dev/null +++ b/test/diagnostic_information_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/diagnostic_information_test.cpp b/test/diagnostic_information_test.cpp new file mode 100644 index 0000000..873f835 --- /dev/null +++ b/test/diagnostic_information_test.cpp @@ -0,0 +1,80 @@ +//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 +#include +#include + +typedef boost::error_info tag_int; + +struct +error1: + public std::exception + { + char const * + what() const throw() + { + return "error1"; + } + }; + +struct +error2: + public std::exception, + public boost::exception + { + char const * + what() const throw() + { + return "error2"; + } + }; + +struct +error3: + public boost::exception + { + }; + +std::string +get_diagnostic_information( std::exception const & x ) + { + return boost::diagnostic_information(x); + } + +std::string +get_what( std::exception const & x ) + { + return x.what(); + } + +int +main() + { + using namespace boost; + { + error1 x; + BOOST_TEST(get_what(x)=="error1"); + std::string di=get_diagnostic_information(x); + BOOST_TEST(di.find("type:")!=std::string::npos); + BOOST_TEST(di.find("error1")!=std::string::npos); + } + { + error2 x; x << tag_int(42); + BOOST_TEST(get_what(x)=="error2"); + std::string di=get_diagnostic_information(x); + BOOST_TEST(di.find("type:")!=std::string::npos); + BOOST_TEST(di.find("error2")!=std::string::npos); + } + { + error3 x; + x << tag_int(1); + std::string w1 = x.diagnostic_information(); + x << tag_int(2); + std::string w2 = x.diagnostic_information(); + BOOST_TEST( w1!=w2 ); + } + return boost::report_errors(); + } diff --git a/test/enable_current_exception_hpp_test.cpp b/test/enable_current_exception_hpp_test.cpp new file mode 100644 index 0000000..4745df5 --- /dev/null +++ b/test/enable_current_exception_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/enable_error_info_hpp_test.cpp b/test/enable_error_info_hpp_test.cpp new file mode 100644 index 0000000..49badaf --- /dev/null +++ b/test/enable_error_info_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/enable_error_info_test.cpp b/test/enable_error_info_test.cpp new file mode 100644 index 0000000..eaa34ff --- /dev/null +++ b/test/enable_error_info_test.cpp @@ -0,0 +1,57 @@ +//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 +#include +#include + +namespace + { + typedef boost::error_info test_int; + + void + throw_wrapper() + { + try + { + boost::exception_test::throw_length_error(); + } + catch( + boost::exception & x ) + { + x << test_int(42); + throw; + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + } + +int +main() + { + try + { + throw_wrapper(); + BOOST_TEST(false); + } + catch( + std::exception & x ) + { + BOOST_TEST( 42==*boost::get_error_info(x) ); + BOOST_TEST( std::string(x.what())==std::string("exception test length error") ); + BOOST_TEST( std::string(x.what())!=std::string(boost::diagnostic_information(x)) ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + return boost::report_errors(); + } diff --git a/test/errno_test.cpp b/test/errno_test.cpp new file mode 100644 index 0000000..7280068 --- /dev/null +++ b/test/errno_test.cpp @@ -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 +#include +#include + +typedef boost::error_info 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(x)); + } + return boost::report_errors(); + } diff --git a/test/error_info_hpp_test.cpp b/test/error_info_hpp_test.cpp new file mode 100644 index 0000000..a47d620 --- /dev/null +++ b/test/error_info_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/error_info_test.cpp b/test/error_info_test.cpp new file mode 100644 index 0000000..c61609a --- /dev/null +++ b/test/error_info_test.cpp @@ -0,0 +1,258 @@ +//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 +#include + +struct throws_on_copy; +struct non_printable { }; + +typedef boost::error_info test_1; +typedef boost::error_info test_2; +typedef boost::error_info test_3; +typedef boost::error_info test_4; +typedef boost::error_info test_5; +typedef boost::error_info test_6; + +struct +test_exception: + 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(x)==1); + BOOST_TEST(*boost::get_error_info(x)==2u); + BOOST_TEST(*boost::get_error_info(x)==3.14159f); + BOOST_TEST(!boost::get_error_info(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(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(&x) ); + BOOST_TEST( !boost::get_error_info(x) ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + + try + { + throw_empty(); + BOOST_TEST(false); + } + catch( + test_exception & x ) + { + BOOST_TEST( dynamic_cast(&x) ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + +void +test_basic_throw_catch() + { + try + { + throw_test_1("test"); + BOOST_ASSERT(false); + } + catch( + boost::exception & x ) + { + BOOST_TEST(*boost::get_error_info(x)==std::string("test")); + } + catch( + ... ) + { + BOOST_TEST(false); + } + + try + { + throw_test_2(); + BOOST_ASSERT(false); + } + catch( + boost::exception & x ) + { + BOOST_TEST(boost::get_error_info(x)); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + +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(x)==std::string("test")); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + +void +test_add_tuple() + { + typedef boost::tuple test_12; + typedef boost::tuple test_123; + typedef boost::tuple test_1235; + try + { + throw test_exception() << test_12(42,42u); + } + catch( + test_exception & x ) + { + BOOST_TEST( *boost::get_error_info(x)==42 ); + BOOST_TEST( *boost::get_error_info(x)==42u ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + throw test_exception() << test_123(42,42u,42.0f); + } + catch( + test_exception & x ) + { + BOOST_TEST( *boost::get_error_info(x)==42 ); + BOOST_TEST( *boost::get_error_info(x)==42u ); + BOOST_TEST( *boost::get_error_info(x)==42.0f ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + throw test_exception() << test_1235(42,42u,42.0f,std::string("42")); + } + catch( + test_exception & x ) + { + BOOST_TEST( *boost::get_error_info(x)==42 ); + BOOST_TEST( *boost::get_error_info(x)==42u ); + BOOST_TEST( *boost::get_error_info(x)==42.0f ); + BOOST_TEST( *boost::get_error_info(x)=="42" ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + +int +main() + { + basic_test(); + exception_safety_test(); + test_empty(); + test_basic_throw_catch(); + test_catch_add_info(); + test_add_tuple(); + return boost::report_errors(); + } diff --git a/test/exception_fail.cpp b/test/exception_fail.cpp new file mode 100644 index 0000000..0edbf7e --- /dev/null +++ b/test/exception_fail.cpp @@ -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 + +void +tester( boost::exception & x ) + { + throw x; //must not compile. + } diff --git a/test/exception_hpp_test.cpp b/test/exception_hpp_test.cpp new file mode 100644 index 0000000..3f2ed76 --- /dev/null +++ b/test/exception_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/exception_ptr_hpp_test.cpp b/test/exception_ptr_hpp_test.cpp new file mode 100644 index 0000000..a671147 --- /dev/null +++ b/test/exception_ptr_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/exception_test.cpp b/test/exception_test.cpp new file mode 100644 index 0000000..7cadc5d --- /dev/null +++ b/test/exception_test.cpp @@ -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 +#include + +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(); + } diff --git a/test/has_to_string_test.cpp b/test/has_to_string_test.cpp new file mode 100644 index 0000000..7d55acc --- /dev/null +++ b/test/has_to_string_test.cpp @@ -0,0 +1,57 @@ +//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 +#include + +namespace +n1 + { + struct + c1 + { + }; + } + +namespace +n2 + { + struct + c2 + { + }; + + std::string + to_string( c2 const & ) + { + return "c2"; + } + } + +namespace +n3 + { + struct + c3 + { + }; + + std::ostream & + operator<<( std::ostream & s, c3 const & ) + { + return s << "c3"; + } + } + +int +main() + { + using namespace boost; + BOOST_TEST( !has_to_string::value ); + BOOST_TEST( has_to_string::value ); + BOOST_TEST( has_to_string::value ); + BOOST_TEST( has_to_string::value ); + return boost::report_errors(); + } diff --git a/test/helper1.cpp b/test/helper1.cpp new file mode 100644 index 0000000..cfd734b --- /dev/null +++ b/test/helper1.cpp @@ -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) + +#include +#include +#include + +namespace +boost + { + namespace + exception_test + { + void + throw_length_error() + { + throw enable_error_info( std::length_error("exception test length error") ); + } + } + } diff --git a/test/helper1.hpp b/test/helper1.hpp new file mode 100644 index 0000000..65570dc --- /dev/null +++ b/test/helper1.hpp @@ -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 diff --git a/test/helper2.cpp b/test/helper2.cpp new file mode 100644 index 0000000..258b6aa --- /dev/null +++ b/test/helper2.cpp @@ -0,0 +1,72 @@ +//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 + +namespace +boost + { + namespace + exception_test + { + inline + derives_boost_exception:: + derives_boost_exception( int x ): + x_(x) + { + } + + derives_boost_exception:: + ~derives_boost_exception() throw() + { + } + + inline + derives_boost_exception_virtually:: + derives_boost_exception_virtually( int x ): + x_(x) + { + } + + derives_boost_exception_virtually:: + ~derives_boost_exception_virtually() throw() + { + } + + inline + derives_std_exception:: + derives_std_exception( int x ): + x_(x) + { + } + + derives_std_exception:: + ~derives_std_exception() throw() + { + } + + template <> + void + throw_test_exception( int x ) + { + boost::throw_exception( derives_boost_exception(x) ); + } + + template <> + void + throw_test_exception( int x ) + { + boost::throw_exception( derives_boost_exception_virtually(x) ); + } + + template <> + void + throw_test_exception( int x ) + { + boost::throw_exception( derives_std_exception(x) ); + } + } + } diff --git a/test/helper2.hpp b/test/helper2.hpp new file mode 100644 index 0000000..df36fd9 --- /dev/null +++ b/test/helper2.hpp @@ -0,0 +1,61 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_BC765EB4CA2A11DCBDC5828355D89593 +#define UUID_BC765EB4CA2A11DCBDC5828355D89593 + +#include +#include + +namespace +boost + { + namespace + exception_test + { + struct + derives_boost_exception: + public boost::exception, + public std::exception + { + explicit derives_boost_exception( int x ); + virtual ~derives_boost_exception() throw(); + int x_; + }; + + struct + derives_boost_exception_virtually: + public virtual boost::exception, + public std::exception + { + explicit derives_boost_exception_virtually( int x ); + virtual ~derives_boost_exception_virtually() throw(); + int x_; + }; + + struct + derives_std_exception: + public std::exception + { + explicit derives_std_exception( int x ); + virtual ~derives_std_exception() throw(); + int x_; + }; + + template + void throw_test_exception( int ); + + template <> + void throw_test_exception( int ); + + template <> + void throw_test_exception( int ); + + template <> + void throw_test_exception( int ); + } + } + +#endif diff --git a/test/info_hpp_test.cpp b/test/info_hpp_test.cpp new file mode 100644 index 0000000..34407bc --- /dev/null +++ b/test/info_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/info_tuple_hpp_test.cpp b/test/info_tuple_hpp_test.cpp new file mode 100644 index 0000000..a4040ab --- /dev/null +++ b/test/info_tuple_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/is_output_streamable_test.cpp b/test/is_output_streamable_test.cpp new file mode 100644 index 0000000..521d176 --- /dev/null +++ b/test/is_output_streamable_test.cpp @@ -0,0 +1,41 @@ +//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 +#include + +namespace +n1 + { + class + c1 + { + }; + } + +namespace +n2 + { + class + c2 + { + }; + + std::ostream & + operator<<( std::ostream & s, c2 const & ) + { + s << "c2"; + return s; + } + } + +int +main() + { + BOOST_TEST( !boost::is_output_streamable::value ); + BOOST_TEST( boost::is_output_streamable::value ); + BOOST_TEST( boost::is_output_streamable::value ); + return boost::report_errors(); + } diff --git a/test/throw_exception_fail.cpp b/test/throw_exception_fail.cpp new file mode 100644 index 0000000..19fda91 --- /dev/null +++ b/test/throw_exception_fail.cpp @@ -0,0 +1,18 @@ +//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 + +struct +my_exception + { + }; + +void +tester() + { + //Must not compile, throw_exception requires exception types to derive std::exception. + boost::throw_exception(my_exception()); + } diff --git a/test/throw_exception_test.cpp b/test/throw_exception_test.cpp new file mode 100644 index 0000000..247575d --- /dev/null +++ b/test/throw_exception_test.cpp @@ -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) + +#include "helper2.hpp" +#include +#include +#include + +typedef boost::error_info test_data; + +void +throw_fwd( void (*thrower)(int) ) + { + try + { + thrower(42); + } + catch( + boost::exception & x ) + { + x << test_data(42); + throw; + } + } + +template +void +tester() + { + try + { + throw_fwd( &boost::exception_test::throw_test_exception ); + BOOST_ASSERT(false); + } + catch( + ... ) + { + boost::exception_ptr p = boost::current_exception(); + try + { + rethrow_exception(p); + BOOST_TEST(false); + } + catch( + T & y ) + { + BOOST_TEST(boost::get_error_info(y)); + if( boost::shared_ptr d=boost::get_error_info(y) ) + BOOST_TEST(*d==42); + BOOST_TEST(y.x_==42); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + } + +int +main() + { + tester(); + tester(); + tester(); + return boost::report_errors(); + } diff --git a/test/to_string_fail.cpp b/test/to_string_fail.cpp new file mode 100644 index 0000000..d1b903c --- /dev/null +++ b/test/to_string_fail.cpp @@ -0,0 +1,23 @@ +//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 + +namespace +n1 + { + struct + c1 + { + }; + } + +int +tester() + { + using namespace boost; + (void) to_string(n1::c1()); + return 1; + } diff --git a/test/to_string_hpp_test.cpp b/test/to_string_hpp_test.cpp new file mode 100644 index 0000000..27b98a3 --- /dev/null +++ b/test/to_string_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/to_string_stub_hpp_test.cpp b/test/to_string_stub_hpp_test.cpp new file mode 100644 index 0000000..475b72f --- /dev/null +++ b/test/to_string_stub_hpp_test.cpp @@ -0,0 +1,6 @@ +//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 diff --git a/test/to_string_stub_test.cpp b/test/to_string_stub_test.cpp new file mode 100644 index 0000000..d5d6518 --- /dev/null +++ b/test/to_string_stub_test.cpp @@ -0,0 +1,98 @@ +//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 +#include +#include + +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 +struct +my_stub + { + std::string + operator()( T const & ) + { + return "stub"; + } + }; + +int +main() + { + using namespace boost; + BOOST_TEST( to_string(42)=="42" ); + 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(42)=="42" ); + 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())=="stub" ); + BOOST_TEST( !to_string_stub(to_string_tester()).empty() ); + return boost::report_errors(); + } diff --git a/test/to_string_test.cpp b/test/to_string_test.cpp new file mode 100644 index 0000000..31aeb3b --- /dev/null +++ b/test/to_string_test.cpp @@ -0,0 +1,56 @@ +//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 +#include + +namespace +n1 + { + struct + c1 + { + }; + } + +namespace +n2 + { + struct + c2 + { + }; + + std::string + to_string( c2 const & ) + { + return "c2"; + } + } + +namespace +n3 + { + struct + c3 + { + }; + + std::ostream & + operator<<( std::ostream & s, c3 const & ) + { + return s << "c3"; + } + } + +int +main() + { + using namespace boost; + BOOST_TEST( "c2"==to_string(n2::c2()) ); + BOOST_TEST( "c3"==to_string(n3::c3()) ); + BOOST_TEST( "42"==to_string(42) ); + return boost::report_errors(); + } diff --git a/test/unknown_exception_test.cpp b/test/unknown_exception_test.cpp new file mode 100644 index 0000000..e493e90 --- /dev/null +++ b/test/unknown_exception_test.cpp @@ -0,0 +1,117 @@ +//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 +#include +#include + +typedef boost::error_info 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_ptr ep=boost::current_exception(); + try + { + rethrow_exception(ep); + } + catch( + boost::unknown_exception & x ) + { + if( boost::shared_ptr d=boost::get_error_info(x) ) + BOOST_TEST( 42==*d ); + else + BOOST_TEST(false); + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + rethrow_exception(ep); + } + catch( + boost::exception & x ) + { + if( boost::shared_ptr d=boost::get_error_info(x) ) + BOOST_TEST( 42==*d ); + else + BOOST_TEST(false); + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + try + { + throw_unknown_exception(); + } + catch( + ... ) + { + boost::exception_ptr ep=boost::current_exception(); + try + { + rethrow_exception(ep); + } + catch( + boost::unknown_exception & ) + { + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + rethrow_exception(ep); + } + catch( + boost::exception & ) + { + } + catch( + ... ) + { + BOOST_TEST(false); + } + } + return boost::report_errors(); + } diff --git a/test/what_test.cpp b/test/what_test.cpp new file mode 100644 index 0000000..cc7021a --- /dev/null +++ b/test/what_test.cpp @@ -0,0 +1,32 @@ +//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 +#include +#include +#include + +struct +test_exception: + std::exception, + boost::exception + { + char const * + what() const throw() + { + return "test_exception"; + } + }; + +int +main() + { + test_exception x; + std::exception & sx(x); + boost::exception & bx(x); + BOOST_TEST(std::string(sx.what())=="test_exception"); + BOOST_TEST(std::string(bx.what())=="test_exception"); + return boost::report_errors(); + }