From 6434a2031cb13932cbec0d9378b838de6f4325ef Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 29 Sep 2009 20:38:11 +0000 Subject: [PATCH] Merging from trunk: new function diagnostic_information_what, and mutable error info access. [SVN r56477] --- ..._exception_diagnostic_information_hpp.html | 3 + ...st_exception_errinfo_api_function_hpp.html | 2 +- doc/boost_exception_get_error_info_hpp.html | 5 +- doc/boost_exception_info_hpp.html | 3 +- doc/diagnostic_information.html | 1 + doc/diagnostic_information_what.html | 59 + doc/errinfo_api_function.html | 2 +- doc/error_info.html | 4 +- doc/error_info_value.html | 5 +- doc/error_info_value_type.html | 1 - doc/exception.html | 1 + doc/functions.html | 1 + doc/get_error_info.html | 5 +- doc/page_idx.html | 1 + doc/source/boost-exception.reno | 19010 ++++++++-------- doc/synopsis.html | 7 +- example/cloning_1.cpp | 2 +- example/errinfos.cpp | 42 +- example/error_info_2.cpp | 4 +- example/example_io.cpp | 10 +- example/info_tuple.cpp | 2 +- .../exception/detail/error_info_impl.hpp | 8 +- .../exception/diagnostic_information.hpp | 48 +- include/boost/exception/exception.hpp | 10 +- include/boost/exception/get_error_info.hpp | 39 +- include/boost/exception/info.hpp | 16 +- test/CMakeLists.txt | 12 +- test/Jamfile.v2 | 1 + test/diagnostic_information_test.cpp | 99 + test/errinfos_test.cpp | 14 +- test/error_info_const_fail.cpp | 14 + test/error_info_test.cpp | 40 + 32 files changed, 9991 insertions(+), 9480 deletions(-) create mode 100644 doc/diagnostic_information_what.html create mode 100644 test/error_info_const_fail.cpp diff --git a/doc/boost_exception_diagnostic_information_hpp.html b/doc/boost_exception_diagnostic_information_hpp.html index e0761eb..01f7d64 100644 --- a/doc/boost_exception_diagnostic_information_hpp.html +++ b/doc/boost_exception_diagnostic_information_hpp.html @@ -34,6 +34,8 @@ boost std::string diagnostic_information( exception_ptr const & p ); + char const * diagnostic_information_what( boost::exception const & e ) throw(); + std::string current_exception_diagnostic_information(); }

@@ -41,6 +43,7 @@ boost
diff --git a/doc/boost_exception_errinfo_api_function_hpp.html b/doc/boost_exception_errinfo_api_function_hpp.html index 55b42b9..bd6398c 100644 --- a/doc/boost_exception_errinfo_api_function_hpp.html +++ b/doc/boost_exception_errinfo_api_function_hpp.html @@ -27,7 +27,7 @@ namespace boost { - typedef error_info<struct errinfo_api_function_,int> errinfo_api_function; + typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function; }

See Also:

diff --git a/doc/boost_exception_get_error_info_hpp.html b/doc/boost_exception_get_error_info_hpp.html index 8acdee3..1ef8347 100644 --- a/doc/boost_exception_get_error_info_hpp.html +++ b/doc/boost_exception_get_error_info_hpp.html @@ -28,7 +28,10 @@ namespace boost { template <class ErrorInfo,class E> - typename ErrorInfo::value_type const * get_error_info( E const & x ); + typename ErrorInfo::error_info::value_type const * get_error_info( E const & x ); + + template <class ErrorInfo,class E> + typename ErrorInfo::error_info::value_type * get_error_info( E & x ); }

See Also:

diff --git a/doc/boost_exception_info_hpp.html b/doc/boost_exception_info_hpp.html index 275c420..2a448fe 100644 --- a/doc/boost_exception_info_hpp.html +++ b/doc/boost_exception_info_hpp.html @@ -36,7 +36,8 @@ boost typedef T value_type; error_info( value_type const & v ); - value_type const & value() const; + value_type const & value() const; + value_type & value(); }; template <class E, class Tag, class T> diff --git a/doc/diagnostic_information.html b/doc/diagnostic_information.html index 6dcc670..9a3dc3a 100644 --- a/doc/diagnostic_information.html +++ b/doc/diagnostic_information.html @@ -78,6 +78,7 @@ std::exception::what: example_io error Configuration Macros
current_exception_diagnostic_information
Diagnostic Information
+
diagnostic_information_what
Frequently Asked Questions
Motivation
throw_exception
diff --git a/doc/diagnostic_information_what.html b/doc/diagnostic_information_what.html new file mode 100644 index 0000000..aaac214 --- /dev/null +++ b/doc/diagnostic_information_what.html @@ -0,0 +1,59 @@ + + + + + diagnostic_information_what + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

diagnostic_information_what

+
+

#include <boost/exception/diagnostic_information.hpp> 

+
namespace
+boost
+    {
+    char const * diagnostic_information_what( boost::exception const & e ) throw();
+    }
+

The diagnostic_information_what function is intended to be called from a user-defined std::exception::what() override. This allows diagnostic information to be returned as the what() string.

+

Returns:

+

A pointer to a zero-terminated buffer that contains a string similar to the std::string returned by the diagnostic_information function, or null to indicate a failure.

+

Throws:

+

Nothing.

+

Note:

+

The returned pointer becomes invalid if any error_info is modified or added to the exception object, or if another diagnostic information function is called.

+
+ + + + +
+
+
+ + diff --git a/doc/errinfo_api_function.html b/doc/errinfo_api_function.html index 5071481..e96ddbf 100644 --- a/doc/errinfo_api_function.html +++ b/doc/errinfo_api_function.html @@ -27,7 +27,7 @@ namespace boost { - typedef error_info<struct errinfo_api_function_,int> errinfo_api_function; + typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function; }

This type is designed to be used as a standard error_info instance for transporting the name of a relevant API function (which does not use exceptions to report errors) in exceptions deriving from boost::exception.

Example:

diff --git a/doc/error_info.html b/doc/error_info.html index 15a36ee..d6b21eb 100644 --- a/doc/error_info.html +++ b/doc/error_info.html @@ -34,7 +34,8 @@ boost typedef T value_type; error_info( value_type const & v ); - value_type const & value() const; + value_type const & value() const; + value_type & value(); }; }

Requirements:

@@ -75,6 +76,7 @@ typedef boost::error_info<struct tag_errno,int& boost/exception/exception.hpp
boost/exception/info.hpp
diagnostic_information
+
diagnostic_information_what
error_info::error_info
error_info::value
error_info::value_type
diff --git a/doc/error_info_value.html b/doc/error_info_value.html index 0d19a84..1a5b4c1 100644 --- a/doc/error_info_value.html +++ b/doc/error_info_value.html @@ -22,9 +22,10 @@

error_info::value

#include <boost/exception/info.hpp>

-
value_type const & value() const;
+
value_type const & value() const;
+value_type & value();

Description:

-

Returns a const reference to the copy of the value passed to error_info's constructor stored in the error_info object.

+

Returns a (const) reference to the copy of the value passed to error_info's constructor stored in the error_info object.

Throws:

Nothing.


diff --git a/doc/error_info_value_type.html b/doc/error_info_value_type.html index 96eab3c..e5f900b 100644 --- a/doc/error_info_value_type.html +++ b/doc/error_info_value_type.html @@ -30,7 +30,6 @@
diff --git a/doc/exception.html b/doc/exception.html index 76f6ea8..7ad5346 100644 --- a/doc/exception.html +++ b/doc/exception.html @@ -48,6 +48,7 @@ boost current_exception_diagnostic_information
Diagnostic Information
diagnostic_information
+
diagnostic_information_what
Exception Types as Simple Semantic Tags
enable_current_exception
enable_error_info
diff --git a/doc/functions.html b/doc/functions.html index 377737d..03d6741 100644 --- a/doc/functions.html +++ b/doc/functions.html @@ -28,6 +28,7 @@

current_exception_diagnostic_information

d

diagnostic_information

+

diagnostic_information_what

e

enable_current_exception

enable_error_info

diff --git a/doc/get_error_info.html b/doc/get_error_info.html index 8f64bc1..31cda0d 100644 --- a/doc/get_error_info.html +++ b/doc/get_error_info.html @@ -25,7 +25,10 @@ boost { template <class ErrorInfo,class E> - typename ErrorInfo::value_type const * get_error_info( E const & x ); + typename ErrorInfo::error_info::value_type const * get_error_info( E const & x ); + + template <class ErrorInfo,class E> + typename ErrorInfo::error_info::value_type * get_error_info( E & x ); }

Requirements: