|
Boost-Commit : |
From: emil_at_[hidden]
Date: 2008-08-30 22:40:43
Author: emildotchevski
Date: 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
New Revision: 48485
URL: http://svn.boost.org/trac/boost/changeset/48485
Log:
simplified further
Removed:
trunk/boost/exception/detail/counted_base.hpp
trunk/boost/exception/detail/refcount_ptr.hpp
trunk/boost/exception/enable_current_exception.hpp
trunk/boost/exception/enable_error_info.hpp
trunk/libs/exception/test/enable_current_exception_hpp_test.cpp
trunk/libs/exception/test/enable_error_info_hpp_test.cpp
Text files modified:
trunk/boost/exception.hpp | 2
trunk/boost/exception/exception.hpp | 250 +++++++++++++++++++++++++++++++++++++++
trunk/boost/exception_ptr.hpp | 2
trunk/boost/throw_exception.hpp | 3
trunk/libs/exception/example/cloning_1.cpp | 1
trunk/libs/exception/test/Jamfile.v2 | 2
trunk/libs/exception/test/helper1.cpp | 2
trunk/libs/exception/test/refcount_ptr_test.cpp | 2
8 files changed, 251 insertions(+), 13 deletions(-)
Modified: trunk/boost/exception.hpp
==============================================================================
--- trunk/boost/exception.hpp (original)
+++ trunk/boost/exception.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -7,8 +7,6 @@
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
#include <boost/exception/diagnostic_information.hpp>
-#include <boost/exception/enable_current_exception.hpp>
-#include <boost/exception/enable_error_info.hpp>
#include <boost/exception/error_info.hpp>
#include <boost/exception/exception.hpp>
#include <boost/exception/get_error_info.hpp>
Deleted: trunk/boost/exception/detail/counted_base.hpp
==============================================================================
--- trunk/boost/exception/detail/counted_base.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,45 +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_DBA0D90C930911DCBA7B675A56D89593
-#define UUID_DBA0D90C930911DCBA7B675A56D89593
-
-namespace
-boost
- {
- namespace
- exception_detail
- {
- class
- counted_base
- {
- friend
- void
- intrusive_ptr_add_ref( counted_base const * c )
- {
- c->add_ref();
- }
-
- friend
- void
- intrusive_ptr_release( counted_base const * c )
- {
- c->release();
- }
-
- virtual void add_ref() const=0;
- virtual void release() const=0;
-
- protected:
-
- virtual
- ~counted_base() throw()
- {
- }
- };
- }
- }
-
-#endif
Deleted: trunk/boost/exception/detail/refcount_ptr.hpp
==============================================================================
--- trunk/boost/exception/detail/refcount_ptr.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,79 +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_490EADC876F011DDA2F00A4756D89593
-#define UUID_490EADC876F011DDA2F00A4756D89593
-
-namespace
-boost
- {
- namespace
- exception_detail
- {
- template <class T>
- class
- refcount_ptr
- {
- public:
-
- refcount_ptr():
- px_(0)
- {
- }
-
- ~refcount_ptr()
- {
- release();
- }
-
- refcount_ptr( refcount_ptr const & x ):
- px_(x.px_)
- {
- add_ref();
- }
-
- refcount_ptr &
- operator=( refcount_ptr const & x )
- {
- adopt(x.px_);
- return *this;
- }
-
- void
- adopt( T * px )
- {
- release();
- px_=px;
- add_ref();
- }
-
- T *
- get() const
- {
- return px_;
- }
-
- private:
-
- T * px_;
-
- void
- add_ref()
- {
- if( px_ )
- intrusive_ptr_add_ref(px_);
- }
-
- void
- release()
- {
- if( px_ )
- intrusive_ptr_release(px_);
- }
- };
- }
- }
-
-#endif
Deleted: trunk/boost/exception/enable_current_exception.hpp
==============================================================================
--- trunk/boost/exception/enable_current_exception.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,90 +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_78CC85B2914F11DC8F47B48E55D89593
-#define UUID_78CC85B2914F11DC8F47B48E55D89593
-
-#include <boost/exception/exception.hpp>
-
-namespace
-boost
- {
- namespace
- exception_detail
- {
- class
- clone_base
- {
- public:
-
- virtual clone_base const * clone() const = 0;
- virtual void rethrow() const = 0;
- virtual ~clone_base() throw() = 0;
- };
-
- inline
- clone_base::
- ~clone_base() throw()
- {
- }
-
- inline
- void
- copy_boost_exception( exception * a, exception const * b )
- {
- *a = *b;
- }
-
- inline
- void
- copy_boost_exception( void *, void const * )
- {
- }
-
- template <class T>
- class
- clone_impl:
- public T,
- public clone_base
- {
- public:
-
- explicit
- clone_impl( T const & x ):
- T(x)
- {
- copy_boost_exception(this,&x);
- }
-
- ~clone_impl() throw()
- {
- }
-
- private:
-
- clone_base const *
- clone() const
- {
- return new clone_impl(*this);
- }
-
- void
- rethrow() const
- {
- throw *this;
- }
- };
- }
-
- template <class T>
- inline
- exception_detail::clone_impl<T>
- enable_current_exception( T const & x )
- {
- return exception_detail::clone_impl<T>(x);
- }
- }
-
-#endif
Deleted: trunk/boost/exception/enable_error_info.hpp
==============================================================================
--- trunk/boost/exception/enable_error_info.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,75 +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_0C5D492E909711DCB658AD4556D89593
-#define UUID_0C5D492E909711DCB658AD4556D89593
-
-#include <boost/exception/exception.hpp>
-
-namespace
-boost
- {
- namespace
- exception_detail
- {
- template <class T>
- struct
- error_info_injector:
- public T,
- public exception
- {
- explicit
- error_info_injector( T const & x ):
- T(x)
- {
- }
-
- ~error_info_injector() throw()
- {
- }
- };
-
- struct large_size { char c[256]; };
- large_size dispatch( exception * );
-
- struct small_size { };
- small_size dispatch( void * );
-
- template <class,int>
- struct enable_error_info_helper;
-
- template <class T>
- struct
- enable_error_info_helper<T,sizeof(large_size)>
- {
- typedef T type;
- };
-
- template <class T>
- struct
- enable_error_info_helper<T,sizeof(small_size)>
- {
- typedef error_info_injector<T> type;
- };
-
- template <class T>
- struct
- enable_error_info_return_type
- {
- typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
- };
- }
-
- template <class T>
- inline
- typename
- exception_detail::enable_error_info_return_type<T>::type
- enable_error_info( T const & x )
- {
- return typename exception_detail::enable_error_info_return_type<T>::type(x);
- }
- }
-
-#endif
Modified: trunk/boost/exception/exception.hpp
==============================================================================
--- trunk/boost/exception/exception.hpp (original)
+++ trunk/boost/exception/exception.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -6,12 +6,114 @@
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
#define UUID_274DA366004E11DCB1DDFE2E56D89593
-#include <boost/exception/detail/counted_base.hpp>
-#include <boost/exception/detail/refcount_ptr.hpp>
-
namespace
boost
{
+
+ ////////////////////////////////////////////////////////////////////////
+
+ namespace
+ exception_detail
+ {
+ template <class T>
+ class
+ refcount_ptr
+ {
+ public:
+
+ refcount_ptr():
+ px_(0)
+ {
+ }
+
+ ~refcount_ptr()
+ {
+ release();
+ }
+
+ refcount_ptr( refcount_ptr const & x ):
+ px_(x.px_)
+ {
+ add_ref();
+ }
+
+ refcount_ptr &
+ operator=( refcount_ptr const & x )
+ {
+ adopt(x.px_);
+ return *this;
+ }
+
+ void
+ adopt( T * px )
+ {
+ release();
+ px_=px;
+ add_ref();
+ }
+
+ T *
+ get() const
+ {
+ return px_;
+ }
+
+ private:
+
+ T * px_;
+
+ void
+ add_ref()
+ {
+ if( px_ )
+ intrusive_ptr_add_ref(px_);
+ }
+
+ void
+ release()
+ {
+ if( px_ )
+ intrusive_ptr_release(px_);
+ }
+ };
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
+ 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:
+
+ virtual
+ ~counted_base() throw()
+ {
+ }
+ };
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
class exception;
template <class>
@@ -88,6 +190,148 @@
~exception() throw()
{
}
+
+ ////////////////////////////////////////////////////////////////////////
+
+ namespace
+ exception_detail
+ {
+ template <class T>
+ struct
+ error_info_injector:
+ public T,
+ public exception
+ {
+ explicit
+ error_info_injector( T const & x ):
+ T(x)
+ {
+ }
+
+ ~error_info_injector() throw()
+ {
+ }
+ };
+
+ struct large_size { char c[256]; };
+ large_size dispatch( exception * );
+
+ struct small_size { };
+ small_size dispatch( void * );
+
+ template <class,int>
+ struct enable_error_info_helper;
+
+ template <class T>
+ struct
+ enable_error_info_helper<T,sizeof(large_size)>
+ {
+ typedef T type;
+ };
+
+ template <class T>
+ struct
+ enable_error_info_helper<T,sizeof(small_size)>
+ {
+ typedef error_info_injector<T> type;
+ };
+
+ template <class T>
+ struct
+ enable_error_info_return_type
+ {
+ typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
+ };
+ }
+
+ template <class T>
+ inline
+ typename
+ exception_detail::enable_error_info_return_type<T>::type
+ enable_error_info( T const & x )
+ {
+ return typename exception_detail::enable_error_info_return_type<T>::type(x);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
+ namespace
+ exception_detail
+ {
+ class
+ clone_base
+ {
+ public:
+
+ virtual clone_base const * clone() const = 0;
+ virtual void rethrow() const = 0;
+ virtual ~clone_base() throw() = 0;
+ };
+
+ inline
+ clone_base::
+ ~clone_base() throw()
+ {
+ }
+
+ inline
+ void
+ copy_boost_exception( exception * a, exception const * b )
+ {
+ *a = *b;
+ }
+
+ inline
+ void
+ copy_boost_exception( void *, void const * )
+ {
+ }
+
+ template <class T>
+ class
+ clone_impl:
+ public T,
+ public clone_base
+ {
+ public:
+
+ explicit
+ clone_impl( T const & x ):
+ T(x)
+ {
+ copy_boost_exception(this,&x);
+ }
+
+ ~clone_impl() throw()
+ {
+ }
+
+ private:
+
+ clone_base const *
+ clone() const
+ {
+ return new clone_impl(*this);
+ }
+
+ void
+ rethrow() const
+ {
+ throw *this;
+ }
+ };
+ }
+
+ template <class T>
+ inline
+ exception_detail::clone_impl<T>
+ enable_current_exception( T const & x )
+ {
+ return exception_detail::clone_impl<T>(x);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
}
#endif
Modified: trunk/boost/exception_ptr.hpp
==============================================================================
--- trunk/boost/exception_ptr.hpp (original)
+++ trunk/boost/exception_ptr.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -6,7 +6,7 @@
#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
#define UUID_FA5836A2CADA11DC8CD47C8555D89593
-#include <boost/exception/enable_current_exception.hpp>
+#include <boost/exception/exception.hpp>
#include <boost/exception/detail/type_info.hpp>
#include <boost/detail/atomic_count.hpp>
#include <boost/intrusive_ptr.hpp>
Modified: trunk/boost/throw_exception.hpp
==============================================================================
--- trunk/boost/throw_exception.hpp (original)
+++ trunk/boost/throw_exception.hpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -37,8 +37,7 @@
#endif
#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
-# include <boost/exception/enable_current_exception.hpp>
-# include <boost/exception/enable_error_info.hpp>
+# include <boost/exception/exception.hpp>
#endif
namespace boost
Modified: trunk/libs/exception/example/cloning_1.cpp
==============================================================================
--- trunk/libs/exception/example/cloning_1.cpp (original)
+++ trunk/libs/exception/example/cloning_1.cpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -5,7 +5,6 @@
//This example shows how to enable cloning when throwing a boost::exception.
-#include <boost/exception/enable_current_exception.hpp>
#include <boost/exception/info.hpp>
#include <stdio.h>
#include <errno.h>
Modified: trunk/libs/exception/test/Jamfile.v2
==============================================================================
--- trunk/libs/exception/test/Jamfile.v2 (original)
+++ trunk/libs/exception/test/Jamfile.v2 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
@@ -37,8 +37,6 @@
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 get_error_info_hpp_test.cpp ;
Deleted: trunk/libs/exception/test/enable_current_exception_hpp_test.cpp
==============================================================================
--- trunk/libs/exception/test/enable_current_exception_hpp_test.cpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,6 +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)
-
-#include <boost/exception/enable_current_exception.hpp>
Deleted: trunk/libs/exception/test/enable_error_info_hpp_test.cpp
==============================================================================
--- trunk/libs/exception/test/enable_error_info_hpp_test.cpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 2008)
+++ (empty file)
@@ -1,6 +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)
-
-#include <boost/exception/enable_error_info.hpp>
Modified: trunk/libs/exception/test/helper1.cpp
==============================================================================
--- trunk/libs/exception/test/helper1.cpp (original)
+++ trunk/libs/exception/test/helper1.cpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 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/enable_error_info.hpp>
+#include <boost/exception/exception.hpp>
#include <stdexcept>
#include <string>
Modified: trunk/libs/exception/test/refcount_ptr_test.cpp
==============================================================================
--- trunk/libs/exception/test/refcount_ptr_test.cpp (original)
+++ trunk/libs/exception/test/refcount_ptr_test.cpp 2008-08-30 22:40:42 EDT (Sat, 30 Aug 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/detail/refcount_ptr.hpp>
+#include <boost/exception/exception.hpp>
#include <boost/detail/lightweight_test.hpp>
struct
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