|
Boost-Commit : |
From: emil_at_[hidden]
Date: 2008-04-15 14:47:17
Author: emildotchevski
Date: 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
New Revision: 44439
URL: http://svn.boost.org/trac/boost/changeset/44439
Log:
introduced boost/exception_ptr.hpp, using Boost Exception
Added:
trunk/boost/exception_ptr.hpp (contents, props changed)
Removed:
trunk/boost/exception/cloning.hpp
Text files modified:
trunk/libs/exception/test/cloning_test.cpp | 2 +-
trunk/libs/exception/test/copy_exception_test.cpp | 2 +-
trunk/libs/exception/test/throw_exception_test.cpp | 2 +-
trunk/libs/exception/test/unknown_exception_test.cpp | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
Deleted: trunk/boost/exception/cloning.hpp
==============================================================================
--- trunk/boost/exception/cloning.hpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
+++ (empty file)
@@ -1,193 +0,0 @@
-//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
-
-//Distributed under the Boost Software License, Version 1.0. (See accompanying
-//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
-#define UUID_FA5836A2CADA11DC8CD47C8555D89593
-
-#include <boost/exception/enable_current_exception.hpp>
-#include <boost/exception/exception.hpp>
-#include <boost/exception/detail/cloning_base.hpp>
-#include <stdexcept>
-
-namespace
-boost
- {
- class
- unknown_exception:
- public exception,
- public std::exception
- {
- public:
-
- unknown_exception()
- {
- }
-
- explicit
- unknown_exception( boost::exception const & e ):
- boost::exception(e)
- {
- }
- };
-
- typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
-
- namespace
- exception_detail
- {
- template <class T>
- 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)
- {
- }
- };
-
- template <class T>
- exception_ptr
- current_exception_std_exception( T const & e1 )
- {
- if( boost::exception const * e2 = dynamic_cast<boost::exception const *>(&e1) )
- return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(e1,*e2)));
- else
- return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(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<boost::exception const *>(&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(
- ... )
- {
- }
- try
- {
- throw;
- }
- 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 <class T>
- 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
Added: trunk/boost/exception_ptr.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception_ptr.hpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
@@ -0,0 +1,185 @@
+//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
+
+//Distributed under the Boost Software License, Version 1.0. (See accompanying
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
+#define UUID_FA5836A2CADA11DC8CD47C8555D89593
+
+#include <boost/exception/enable_current_exception.hpp>
+#include <boost/exception/exception.hpp>
+#include <boost/exception/detail/cloning_base.hpp>
+#include <stdexcept>
+
+namespace
+boost
+ {
+ class
+ unknown_exception:
+ public exception,
+ public std::exception
+ {
+ public:
+
+ unknown_exception()
+ {
+ }
+
+ explicit
+ unknown_exception( boost::exception const & e ):
+ boost::exception(e)
+ {
+ }
+ };
+
+ typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
+
+ namespace
+ exception_detail
+ {
+ template <class T>
+ 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)
+ {
+ }
+ };
+
+ template <class T>
+ exception_ptr
+ current_exception_std_exception( T const & e1 )
+ {
+ if( boost::exception const * e2 = dynamic_cast<boost::exception const *>(&e1) )
+ return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(e1,*e2)));
+ else
+ return exception_ptr(exception_detail::make_clone(current_exception_std_exception_wrapper<T>(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<boost::exception const *>(&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 <class T>
+ 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
Modified: trunk/libs/exception/test/cloning_test.cpp
==============================================================================
--- trunk/libs/exception/test/cloning_test.cpp (original)
+++ trunk/libs/exception/test/cloning_test.cpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
@@ -3,7 +3,7 @@
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/exception/cloning.hpp>
+#include <boost/exception_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
struct
Modified: trunk/libs/exception/test/copy_exception_test.cpp
==============================================================================
--- trunk/libs/exception/test/copy_exception_test.cpp (original)
+++ trunk/libs/exception/test/copy_exception_test.cpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
@@ -3,7 +3,7 @@
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/exception/cloning.hpp>
+#include <boost/exception_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
struct
Modified: trunk/libs/exception/test/throw_exception_test.cpp
==============================================================================
--- trunk/libs/exception/test/throw_exception_test.cpp (original)
+++ trunk/libs/exception/test/throw_exception_test.cpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
@@ -5,7 +5,7 @@
#include "helper2.hpp"
#include <boost/exception/info.hpp>
-#include <boost/exception/cloning.hpp>
+#include <boost/exception_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
typedef boost::error_info<struct tag_test_int,int> test_int;
Modified: trunk/libs/exception/test/unknown_exception_test.cpp
==============================================================================
--- trunk/libs/exception/test/unknown_exception_test.cpp (original)
+++ trunk/libs/exception/test/unknown_exception_test.cpp 2008-04-15 14:47:16 EDT (Tue, 15 Apr 2008)
@@ -3,7 +3,7 @@
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/exception/cloning.hpp>
+#include <boost/exception_ptr.hpp>
#include <boost/exception/info.hpp>
#include <boost/detail/lightweight_test.hpp>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk