Boost logo

Boost-Commit :

From: emil_at_[hidden]
Date: 2008-04-08 17:29:40


Author: emildotchevski
Date: 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
New Revision: 44114
URL: http://svn.boost.org/trac/boost/changeset/44114

Log:
fixed compile errors, removed tabs as required.
Text files modified:
   trunk/boost/exception/cloning.hpp | 84 +++---
   trunk/boost/exception/detail/cloning_base.hpp | 26 +-
   trunk/boost/exception/detail/counted_base.hpp | 48 ++--
   trunk/boost/exception/enable_error_info.hpp | 110 +++++-----
   trunk/boost/exception/enable_exception_cloning.hpp | 260 ++++++++++++------------
   trunk/boost/exception/error_info.hpp | 8
   trunk/boost/exception/exception.hpp | 148 +++++++-------
   trunk/boost/exception/info.hpp | 422 ++++++++++++++++++++--------------------
   trunk/boost/exception/info_tuple.hpp | 94 ++++----
   trunk/boost/exception/to_string.hpp | 26 +-
   trunk/boost/exception/to_string_stub.hpp | 263 ++++++++++++------------
   trunk/libs/exception/example/cloning_1.cpp | 4
   trunk/libs/exception/example/cloning_2.cpp | 20
   trunk/libs/exception/example/enable_error_info.cpp | 16
   trunk/libs/exception/example/error_info_1.cpp | 22 +-
   trunk/libs/exception/example/error_info_2.cpp | 20
   trunk/libs/exception/example/example_io.cpp | 278 +++++++++++++-------------
   trunk/libs/exception/example/logging.cpp | 14
   trunk/libs/exception/test/boost_error_info_test.cpp | 48 ++--
   trunk/libs/exception/test/cloning_test.cpp | 58 ++--
   trunk/libs/exception/test/enable_error_info_test.cpp | 70 +++---
   trunk/libs/exception/test/errno_test.cpp | 34 +-
   trunk/libs/exception/test/error_info_test.cpp | 322 +++++++++++++++---------------
   trunk/libs/exception/test/exception_fail.cpp | 6
   trunk/libs/exception/test/exception_test.cpp | 38 +-
   trunk/libs/exception/test/helper1.cpp | 23 +-
   trunk/libs/exception/test/helper1.hpp | 14
   trunk/libs/exception/test/helper2.cpp | 86 ++++----
   trunk/libs/exception/test/helper2.hpp | 66 +++---
   trunk/libs/exception/test/throw_exception_test.cpp | 100 ++++----
   trunk/libs/exception/test/to_string_test.cpp | 140 ++++++------
   trunk/libs/exception/test/unknown_exception_test.cpp | 124 +++++-----
   trunk/libs/exception/test/what_test.cpp | 24 +-
   33 files changed, 1507 insertions(+), 1509 deletions(-)

Modified: trunk/boost/exception/cloning.hpp
==============================================================================
--- trunk/boost/exception/cloning.hpp (original)
+++ trunk/boost/exception/cloning.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -13,47 +13,47 @@
 
 namespace
 boost
- {
- class
- unknown_exception:
- public exception,
- public std::exception
- {
- public:
-
- explicit
- unknown_exception()
- {
- }
-
- explicit
- unknown_exception( boost::exception const & x ):
- boost::exception(x)
- {
- }
- };
-
- typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
-
- template <class T>
- exception_ptr
- clone_exception( T const & e )
- {
- if( boost::exception_detail::cloning_base const * cb = dynamic_cast<boost::exception_detail::cloning_base const *>(&e) )
- if( exception_detail::clone_base const * c = cb->clone() )
- return exception_ptr(c);
- if( boost::exception const * be = dynamic_cast<boost::exception const *>(&e) )
- return exception_ptr(exception_detail::make_clone(unknown_exception(*be)));
- else
- return exception_ptr(exception_detail::make_clone(unknown_exception()));
- }
-
- inline
- void
- rethrow_exception( exception_ptr const & p )
- {
- p->rethrow();
- }
- }
+ {
+ class
+ unknown_exception:
+ public exception,
+ public std::exception
+ {
+ public:
+
+ explicit
+ unknown_exception()
+ {
+ }
+
+ explicit
+ unknown_exception( boost::exception const & x ):
+ boost::exception(x)
+ {
+ }
+ };
+
+ typedef intrusive_ptr<exception_detail::clone_base const> exception_ptr;
+
+ template <class T>
+ exception_ptr
+ clone_exception( T const & e )
+ {
+ if( boost::exception_detail::cloning_base const * cb = dynamic_cast<boost::exception_detail::cloning_base const *>(&e) )
+ if( exception_detail::clone_base const * c = cb->clone() )
+ return exception_ptr(c);
+ if( boost::exception const * be = dynamic_cast<boost::exception const *>(&e) )
+ return exception_ptr(exception_detail::make_clone(unknown_exception(*be)));
+ else
+ return exception_ptr(exception_detail::make_clone(unknown_exception()));
+ }
+
+ inline
+ void
+ rethrow_exception( exception_ptr const & p )
+ {
+ p->rethrow();
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/detail/cloning_base.hpp
==============================================================================
--- trunk/boost/exception/detail/cloning_base.hpp (original)
+++ trunk/boost/exception/detail/cloning_base.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,20 +8,20 @@
 
 namespace
 boost
- {
- namespace
- exception_detail
- {
- class clone_base;
+ {
+ namespace
+ exception_detail
+ {
+ class clone_base;
 
- class
- cloning_base
- {
- public:
+ class
+ cloning_base
+ {
+ public:
 
- virtual clone_base const * clone() const = 0;
- };
- }
- }
+ virtual clone_base const * clone() const = 0;
+ };
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/detail/counted_base.hpp
==============================================================================
--- trunk/boost/exception/detail/counted_base.hpp (original)
+++ trunk/boost/exception/detail/counted_base.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,31 +8,31 @@
 
 namespace
 boost
- {
- namespace
- exception_detail
- {
- class
- counted_base
- {
- friend
- void
- intrusive_ptr_add_ref( counted_base const * c )
- {
- c->add_ref();
- }
+ {
+ 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();
- }
+ friend
+ void
+ intrusive_ptr_release( counted_base const * c )
+ {
+ c->release();
+ }
 
- virtual void add_ref() const=0;
- virtual void release() const=0;
- };
- }
- }
+ virtual void add_ref() const=0;
+ virtual void release() const=0;
+ };
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/enable_error_info.hpp
==============================================================================
--- trunk/boost/exception/enable_error_info.hpp (original)
+++ trunk/boost/exception/enable_error_info.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -10,60 +10,60 @@
 
 namespace
 boost
- {
- namespace
- exception_detail
- {
- template <class T>
- struct
- error_info_injector:
- public T,
- public exception
- {
- explicit
- error_info_injector( T const & x ):
- T(x)
- {
- }
- };
-
- struct large_size { char c[256]; };
- large_size dispatch( exception * );
-
- struct small_size { };
- small_size dispatch( void * );
-
- template <class,size_t>
- struct enable_error_info_helper;
-
- template <class T>
- struct
- enable_error_info_helper<T,sizeof(large_size)>
- {
- typedef T type;
- };
-
- template <class T>
- struct
- enable_error_info_helper<T,sizeof(small_size)>
- {
- typedef error_info_injector<T> type;
- };
-
- template <class T>
- struct
- enable_error_info_return_type
- {
- typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
- };
- }
-
- template <class T>
- typename exception_detail::enable_error_info_return_type<T>::type
- enable_error_info( T const & x )
- {
- return typename exception_detail::enable_error_info_return_type<T>::type(x);
- }
- }
+ {
+ namespace
+ exception_detail
+ {
+ template <class T>
+ struct
+ error_info_injector:
+ public T,
+ public exception
+ {
+ explicit
+ error_info_injector( T const & x ):
+ T(x)
+ {
+ }
+ };
+
+ struct large_size { char c[256]; };
+ large_size dispatch( exception * );
+
+ struct small_size { };
+ small_size dispatch( void * );
+
+ template <class,size_t>
+ struct enable_error_info_helper;
+
+ template <class T>
+ struct
+ enable_error_info_helper<T,sizeof(large_size)>
+ {
+ typedef T type;
+ };
+
+ template <class T>
+ struct
+ enable_error_info_helper<T,sizeof(small_size)>
+ {
+ typedef error_info_injector<T> type;
+ };
+
+ template <class T>
+ struct
+ enable_error_info_return_type
+ {
+ typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
+ };
+ }
+
+ template <class T>
+ typename exception_detail::enable_error_info_return_type<T>::type
+ enable_error_info( T const & x )
+ {
+ return typename exception_detail::enable_error_info_return_type<T>::type(x);
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/enable_exception_cloning.hpp
==============================================================================
--- trunk/boost/exception/enable_exception_cloning.hpp (original)
+++ trunk/boost/exception/enable_exception_cloning.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -14,135 +14,135 @@
 
 namespace
 boost
- {
- namespace
- exception_detail
- {
- class
- clone_base:
- public counted_base
- {
- public:
-
- virtual void rethrow() const=0;
- };
-
- struct
- bad_alloc_impl:
- public clone_base,
- public std::bad_alloc
- {
- void
- add_ref() const
- {
- }
-
- void
- release() const
- {
- }
-
- void
- rethrow() const
- {
- throw *this;
- }
- };
-
- template <class T>
- clone_base * make_clone( T const & );
-
- template <class T>
- class
- clone_impl:
- public T,
- public cloning_base
- {
- public:
-
- explicit
- clone_impl( T const & x ):
- T(x)
- {
- }
-
- private:
-
- clone_base const *
- clone() const
- {
- return make_clone<T>(*this);
- }
- };
-
- template <class T>
- class
- exception_clone:
- public T,
- public clone_base
- {
- public:
-
- explicit
- exception_clone( T const & x ):
- T(x),
- count_(0)
- {
- }
-
- private:
-
- detail::atomic_count mutable count_;
-
- void
- add_ref() const
- {
- ++count_;
- }
-
- void
- release() const
- {
- if( !--count_ )
- delete this;
- }
-
- void
- rethrow() const
- {
- throw clone_impl<T>(*this);
- }
- };
-
- template <class T>
- clone_base *
- make_clone( T const & x )
- {
- try
- {
- return new exception_clone<T>(x);
- }
- catch(
- std::bad_alloc & )
- {
- static bad_alloc_impl bad_alloc;
- return &bad_alloc;
- }
- catch(
- ... )
- {
- BOOST_ASSERT(0);
- return 0;
- }
- }
- }
-
- template <class T>
- exception_detail::clone_impl<T>
- enable_exception_cloning( T const & x )
- {
- return exception_detail::clone_impl<T>(x);
- }
- }
+ {
+ namespace
+ exception_detail
+ {
+ class
+ clone_base:
+ public counted_base
+ {
+ public:
+
+ virtual void rethrow() const=0;
+ };
+
+ struct
+ bad_alloc_impl:
+ public clone_base,
+ public std::bad_alloc
+ {
+ void
+ add_ref() const
+ {
+ }
+
+ void
+ release() const
+ {
+ }
+
+ void
+ rethrow() const
+ {
+ throw *this;
+ }
+ };
+
+ template <class T>
+ clone_base * make_clone( T const & );
+
+ template <class T>
+ class
+ clone_impl:
+ public T,
+ public cloning_base
+ {
+ public:
+
+ explicit
+ clone_impl( T const & x ):
+ T(x)
+ {
+ }
+
+ private:
+
+ clone_base const *
+ clone() const
+ {
+ return make_clone<T>(*this);
+ }
+ };
+
+ template <class T>
+ class
+ exception_clone:
+ public T,
+ public clone_base
+ {
+ public:
+
+ explicit
+ exception_clone( T const & x ):
+ T(x),
+ count_(0)
+ {
+ }
+
+ private:
+
+ detail::atomic_count mutable count_;
+
+ void
+ add_ref() const
+ {
+ ++count_;
+ }
+
+ void
+ release() const
+ {
+ if( !--count_ )
+ delete this;
+ }
+
+ void
+ rethrow() const
+ {
+ throw clone_impl<T>(*this);
+ }
+ };
+
+ template <class T>
+ clone_base *
+ make_clone( T const & x )
+ {
+ try
+ {
+ return new exception_clone<T>(x);
+ }
+ catch(
+ std::bad_alloc & )
+ {
+ static bad_alloc_impl bad_alloc;
+ return &bad_alloc;
+ }
+ catch(
+ ... )
+ {
+ BOOST_ASSERT(0);
+ return 0;
+ }
+ }
+ }
+
+ template <class T>
+ exception_detail::clone_impl<T>
+ enable_exception_cloning( T const & x )
+ {
+ return exception_detail::clone_impl<T>(x);
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/error_info.hpp
==============================================================================
--- trunk/boost/exception/error_info.hpp (original)
+++ trunk/boost/exception/error_info.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,9 +8,9 @@
 
 namespace
 boost
- {
- template <class Tag,class T>
- class error_info;
- }
+ {
+ template <class Tag,class T>
+ class error_info;
+ }
 
 #endif

Modified: trunk/boost/exception/exception.hpp
==============================================================================
--- trunk/boost/exception/exception.hpp (original)
+++ trunk/boost/exception/exception.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -12,79 +12,79 @@
 
 namespace
 boost
- {
- template <class T>
- class shared_ptr;
-
- namespace
- exception_detail
- {
- class error_info_base;
-
- struct
- error_info_container:
- public exception_detail::counted_base
- {
- virtual char const * what( std::type_info const & ) const = 0;
- virtual shared_ptr<error_info_base const> get( std::type_info const & ) const = 0;
- virtual void set( shared_ptr<error_info_base const> const & ) = 0;
- };
- }
-
- template <class Tag,class T>
- class error_info;
-
- template <class E,class Tag,class T>
- E const & operator<<( E const &, error_info<Tag,T> const & );
-
- template <class ErrorInfo,class E>
- shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
-
- class
- exception
- {
- public:
-
- virtual ~exception() throw()=0;
- virtual char const * what() const throw();
-
- private:
-
- shared_ptr<exception_detail::error_info_base const> get( std::type_info const & ) const;
- void set( shared_ptr<exception_detail::error_info_base const> const & ) const;
-
- template <class E,class Tag,class T>
- friend E const & operator<<( E const &, error_info<Tag,T> const & );
-
- template <class ErrorInfo,class E>
- friend shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
-
- intrusive_ptr<exception_detail::error_info_container> mutable data_;
- };
-
- inline
- exception::
- ~exception() throw()
- {
- }
-
- inline
- char const *
- exception::
- what() const throw()
- {
- if( data_ )
- try
- {
- char const * w = data_->what(typeid(*this));
- BOOST_ASSERT(0!=w);
- return w;
- }
- catch(...)
- {
- }
- return typeid(*this).name();
- }
- }
+ {
+ template <class T>
+ class shared_ptr;
+
+ namespace
+ exception_detail
+ {
+ class error_info_base;
+
+ struct
+ error_info_container:
+ public exception_detail::counted_base
+ {
+ virtual char const * what( std::type_info const & ) const = 0;
+ virtual shared_ptr<error_info_base const> get( std::type_info const & ) const = 0;
+ virtual void set( shared_ptr<error_info_base const> const & ) = 0;
+ };
+ }
+
+ template <class Tag,class T>
+ class error_info;
+
+ template <class E,class Tag,class T>
+ E const & operator<<( E const &, error_info<Tag,T> const & );
+
+ template <class ErrorInfo,class E>
+ shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
+
+ class
+ exception
+ {
+ public:
+
+ virtual ~exception() throw()=0;
+ virtual char const * what() const throw();
+
+ private:
+
+ shared_ptr<exception_detail::error_info_base const> get( std::type_info const & ) const;
+ void set( shared_ptr<exception_detail::error_info_base const> const & ) const;
+
+ template <class E,class Tag,class T>
+ friend E const & operator<<( E const &, error_info<Tag,T> const & );
+
+ template <class ErrorInfo,class E>
+ friend shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & );
+
+ intrusive_ptr<exception_detail::error_info_container> mutable data_;
+ };
+
+ inline
+ exception::
+ ~exception() throw()
+ {
+ }
+
+ inline
+ char const *
+ exception::
+ what() const throw()
+ {
+ if( data_ )
+ try
+ {
+ char const * w = data_->what(typeid(*this));
+ BOOST_ASSERT(0!=w);
+ return w;
+ }
+ catch(...)
+ {
+ }
+ return typeid(*this).name();
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/info.hpp
==============================================================================
--- trunk/boost/exception/info.hpp (original)
+++ trunk/boost/exception/info.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -15,219 +15,219 @@
 #include <map>
 
 #define BOOST_ERROR_INFO\
- ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
- ::boost::throw_file(__FILE__) <<\
- ::boost::throw_line((int)__LINE__)
+ ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
+ ::boost::throw_file(__FILE__) <<\
+ ::boost::throw_line((int)__LINE__)
 
 namespace
 boost
- {
- typedef error_info<struct tag_throw_function,char const *> throw_function;
- typedef error_info<struct tag_throw_file,char const *> throw_file;
- typedef error_info<struct tag_throw_line,int> throw_line;
-
- namespace
- exception_detail
- {
- class
- error_info_base
- {
- public:
-
- virtual std::type_info const & tag_typeid() const = 0;
- virtual std::string value_as_string() const = 0;
- };
- }
-
- template <class Tag,class T>
- class
- error_info:
- public exception_detail::error_info_base
- {
- public:
-
- typedef T value_type;
-
- error_info( value_type const & value ):
- value_(value)
- {
- }
-
- value_type const &
- value() const
- {
- return value_;
- }
-
- private:
-
- std::type_info const &
- tag_typeid() const
- {
- return typeid(type<Tag>);
- }
-
- std::string
- value_as_string() const
- {
- return to_string_stub(value_);
- }
-
- value_type const value_;
- };
-
- template <class ErrorInfo>
- struct
- error_info_type
- {
- typedef typename ErrorInfo::value_type value_type;
- };
-
- template <class E,class Tag,class T>
- E const &
- operator<<( E const & x, error_info<Tag,T> const & v )
- {
- shared_ptr< error_info<Tag,T> > p( new error_info<Tag,T>(v) );
- x.set(p);
- return x;
- }
-
- template <class ErrorInfo,class E>
- shared_ptr<typename ErrorInfo::value_type const>
- get_error_info( E const & some_exception )
- {
- if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
- if( shared_ptr<exception_detail::error_info_base const> eib = x->get(typeid(ErrorInfo)) )
- {
- BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo const *>(eib.get()) );
- ErrorInfo const * w = static_cast<ErrorInfo const *>(eib.get());
- return shared_ptr<typename ErrorInfo::value_type const>(eib,&w->value());
- }
- return shared_ptr<typename ErrorInfo::value_type const>();
- }
-
- namespace
- exception_detail
- {
- class
- error_info_container_impl:
- public error_info_container
- {
- public:
-
- error_info_container_impl():
- count_(0)
- {
- }
-
- ~error_info_container_impl() throw()
- {
- }
-
- shared_ptr<error_info_base const>
- get( std::type_info const & ti ) const
- {
- error_info_map::const_iterator i=info_.find(typeinfo(ti));
- if( info_.end()!=i )
- {
- shared_ptr<error_info_base const> const & p = i->second;
- BOOST_ASSERT( typeid(*p)==ti );
- return p;
- }
- return shared_ptr<error_info_base const>();
- }
-
- void
- set( shared_ptr<error_info_base const> const & x )
- {
- BOOST_ASSERT(x);
- info_[typeinfo(typeid(*x))] = x;
- what_.clear();
- }
-
- char const *
- what( std::type_info const & exception_type ) const
- {
- if( what_.empty() )
- {
- std::string tmp(exception_type.name());
- tmp += '\n';
- for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
- {
- shared_ptr<error_info_base const> const & x = i->second;
- tmp += '[';
- tmp += x->tag_typeid().name();
- tmp += "] = ";
- tmp += x->value_as_string();
- tmp += '\n';
- }
- what_.swap(tmp);
- }
- return what_.c_str();
- }
-
- private:
-
- friend class exception;
-
- struct
- typeinfo
- {
- std::type_info const * type;
-
- explicit
- typeinfo( std::type_info const & t ):
- type(&t)
- {
- }
-
- bool
- operator<( typeinfo const & b ) const
- {
- return 0!=(type->before(*b.type));
- }
- };
-
- typedef std::map< typeinfo, shared_ptr<error_info_base const> > error_info_map;
- error_info_map info_;
- std::string mutable what_;
- int mutable count_;
-
- void
- add_ref() const
- {
- ++count_;
- }
-
- void
- release() const
- {
- if( !--count_ )
- delete this;
- }
- };
- }
-
- inline
- void
- exception::
- set( shared_ptr<exception_detail::error_info_base const> const & x ) const
- {
- if( !data_ )
- data_ = intrusive_ptr<exception_detail::error_info_container>(new exception_detail::error_info_container_impl);
- data_->set(x);
- }
-
- inline
- shared_ptr<exception_detail::error_info_base const>
- exception::
- get( std::type_info const & ti ) const
- {
- if( data_ )
- return data_->get(ti);
- else
- return shared_ptr<exception_detail::error_info_base const>();
- }
- }
+ {
+ typedef error_info<struct tag_throw_function,char const *> throw_function;
+ typedef error_info<struct tag_throw_file,char const *> throw_file;
+ typedef error_info<struct tag_throw_line,int> throw_line;
+
+ namespace
+ exception_detail
+ {
+ class
+ error_info_base
+ {
+ public:
+
+ virtual std::type_info const & tag_typeid() const = 0;
+ virtual std::string value_as_string() const = 0;
+ };
+ }
+
+ template <class Tag,class T>
+ class
+ error_info:
+ public exception_detail::error_info_base
+ {
+ public:
+
+ typedef T value_type;
+
+ error_info( value_type const & value ):
+ value_(value)
+ {
+ }
+
+ value_type const &
+ value() const
+ {
+ return value_;
+ }
+
+ private:
+
+ std::type_info const &
+ tag_typeid() const
+ {
+ return typeid(type<Tag>);
+ }
+
+ std::string
+ value_as_string() const
+ {
+ return to_string_stub(value_);
+ }
+
+ value_type const value_;
+ };
+
+ template <class ErrorInfo>
+ struct
+ error_info_type
+ {
+ typedef typename ErrorInfo::value_type value_type;
+ };
+
+ template <class E,class Tag,class T>
+ E const &
+ operator<<( E const & x, error_info<Tag,T> const & v )
+ {
+ shared_ptr< error_info<Tag,T> > p( new error_info<Tag,T>(v) );
+ x.set(p);
+ return x;
+ }
+
+ template <class ErrorInfo,class E>
+ shared_ptr<typename ErrorInfo::value_type const>
+ get_error_info( E const & some_exception )
+ {
+ if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
+ if( shared_ptr<exception_detail::error_info_base const> eib = x->get(typeid(ErrorInfo)) )
+ {
+ BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo const *>(eib.get()) );
+ ErrorInfo const * w = static_cast<ErrorInfo const *>(eib.get());
+ return shared_ptr<typename ErrorInfo::value_type const>(eib,&w->value());
+ }
+ return shared_ptr<typename ErrorInfo::value_type const>();
+ }
+
+ namespace
+ exception_detail
+ {
+ class
+ error_info_container_impl:
+ public error_info_container
+ {
+ public:
+
+ error_info_container_impl():
+ count_(0)
+ {
+ }
+
+ ~error_info_container_impl() throw()
+ {
+ }
+
+ shared_ptr<error_info_base const>
+ get( std::type_info const & ti ) const
+ {
+ error_info_map::const_iterator i=info_.find(typeinfo(ti));
+ if( info_.end()!=i )
+ {
+ shared_ptr<error_info_base const> const & p = i->second;
+ BOOST_ASSERT( typeid(*p)==ti );
+ return p;
+ }
+ return shared_ptr<error_info_base const>();
+ }
+
+ void
+ set( shared_ptr<error_info_base const> const & x )
+ {
+ BOOST_ASSERT(x);
+ info_[typeinfo(typeid(*x))] = x;
+ what_.clear();
+ }
+
+ char const *
+ what( std::type_info const & exception_type ) const
+ {
+ if( what_.empty() )
+ {
+ std::string tmp(exception_type.name());
+ tmp += '\n';
+ for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
+ {
+ shared_ptr<error_info_base const> const & x = i->second;
+ tmp += '[';
+ tmp += x->tag_typeid().name();
+ tmp += "] = ";
+ tmp += x->value_as_string();
+ tmp += '\n';
+ }
+ what_.swap(tmp);
+ }
+ return what_.c_str();
+ }
+
+ private:
+
+ friend class exception;
+
+ struct
+ typeinfo
+ {
+ std::type_info const * type;
+
+ explicit
+ typeinfo( std::type_info const & t ):
+ type(&t)
+ {
+ }
+
+ bool
+ operator<( typeinfo const & b ) const
+ {
+ return 0!=(type->before(*b.type));
+ }
+ };
+
+ typedef std::map< typeinfo, shared_ptr<error_info_base const> > error_info_map;
+ error_info_map info_;
+ std::string mutable what_;
+ int mutable count_;
+
+ void
+ add_ref() const
+ {
+ ++count_;
+ }
+
+ void
+ release() const
+ {
+ if( !--count_ )
+ delete this;
+ }
+ };
+ }
+
+ inline
+ void
+ exception::
+ set( shared_ptr<exception_detail::error_info_base const> const & x ) const
+ {
+ if( !data_ )
+ data_ = intrusive_ptr<exception_detail::error_info_container>(new exception_detail::error_info_container_impl);
+ data_->set(x);
+ }
+
+ inline
+ shared_ptr<exception_detail::error_info_base const>
+ exception::
+ get( std::type_info const & ti ) const
+ {
+ if( data_ )
+ return data_->get(ti);
+ else
+ return shared_ptr<exception_detail::error_info_base const>();
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/info_tuple.hpp
==============================================================================
--- trunk/boost/exception/info_tuple.hpp (original)
+++ trunk/boost/exception/info_tuple.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -11,54 +11,54 @@
 
 namespace
 boost
- {
- template <
- class E,
- class Tag1,class T1,
- class Tag2,class T2 >
- E const &
- operator<<(
- E const & x,
- tuple<
- error_info<Tag1,T1>,
- error_info<Tag2,T2> > const & v )
- {
- return x << v.template get<0>() << v.template get<1>();
- }
+ {
+ template <
+ class E,
+ class Tag1,class T1,
+ class Tag2,class T2 >
+ E const &
+ operator<<(
+ E const & x,
+ tuple<
+ error_info<Tag1,T1>,
+ error_info<Tag2,T2> > const & v )
+ {
+ return x << v.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<Tag1,T1>,
- error_info<Tag2,T2>,
- error_info<Tag3,T3> > 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 >
+ E const &
+ operator<<(
+ E const & x,
+ tuple<
+ error_info<Tag1,T1>,
+ error_info<Tag2,T2>,
+ error_info<Tag3,T3> > 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<Tag1,T1>,
- error_info<Tag2,T2>,
- error_info<Tag3,T3>,
- error_info<Tag4,T4> > const & v )
- {
- return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>();
- }
- }
+ template <
+ class E,
+ class Tag1,class T1,
+ class Tag2,class T2,
+ class Tag3,class T3,
+ class Tag4,class T4 >
+ E const &
+ operator<<(
+ E const & x,
+ tuple<
+ error_info<Tag1,T1>,
+ error_info<Tag2,T2>,
+ error_info<Tag3,T3>,
+ error_info<Tag4,T4> > const & v )
+ {
+ return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>();
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/to_string.hpp
==============================================================================
--- trunk/boost/exception/to_string.hpp (original)
+++ trunk/boost/exception/to_string.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -10,18 +10,18 @@
 
 namespace
 boost
- {
- namespace
- {
- template <class T>
- std::string
- to_string( T const & x )
- {
- std::ostringstream out;
- out << x;
- return out.str();
- }
- }
- }
+ {
+ namespace
+ {
+ template <class T>
+ std::string
+ to_string( T const & x )
+ {
+ std::ostringstream out;
+ out << x;
+ return out.str();
+ }
+ }
+ }
 
 #endif

Modified: trunk/boost/exception/to_string_stub.hpp
==============================================================================
--- trunk/boost/exception/to_string_stub.hpp (original)
+++ trunk/boost/exception/to_string_stub.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -12,138 +12,135 @@
 
 namespace
 boost
- {
- namespace
- exception_detail
- {
- template <bool ShiftLeftAvailable>
- struct shift_left_dispatcher;
-
- template <>
- struct
- shift_left_dispatcher<true>
- {
- template <class T,class CharT,class Traits,class Stub>
- static
- void
- convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub )
- {
- out << x;
- }
- };
-
- template <>
- struct
- shift_left_dispatcher<false>
- {
- template <class T,class CharT,class Traits,class Stub>
- static
- void
- convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
- {
- out << s(x);
- }
- };
-
- namespace
- shift_left_dispatch
- {
- template <class T,class CharT,class Traits>
- char operator<<( std::basic_ostream<CharT,Traits> &, T );
-
- template <class T,class CharT,class Traits,class Stub>
- void
- dispatch( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
- {
- shift_left_dispatcher<1!=sizeof(out<<x)>::convert(out,x,s);
- }
- }
- }
-
- namespace
- exception_detail
- {
- template <bool ToStringAvailable>
- struct to_string_dispatcher;
-
- template <>
- struct
- to_string_dispatcher<true>
- {
- template <class T,class Stub>
- static
- std::string
- convert( T const & x, Stub )
- {
- return to_string(x);
- }
- };
-
- template <>
- struct
- to_string_dispatcher<false>
- {
- template <class T,class Stub>
- static
- std::string
- convert( T const & x, Stub s )
- {
- std::ostringstream out;
- shift_left_dispatch::dispatch(out,x,s);
- return out.str();
- }
- };
-
- namespace
- to_string_dispatch
- {
- template <class T>
- char to_string( T );
-
- template <class T,class Stub>
- std::string
- dispatch( T const & x, Stub s )
- {
- return to_string_dispatcher<1!=sizeof(to_string(x))>::convert(x,s);
- }
- }
-
- template <class T>
- std::string
- string_stub_dump( T const & x )
- {
- std::ostringstream s;
- s << "[ type: " << typeid(x).name() << ", size: " << sizeof(T) << ", dump: ";
- size_t n=sizeof(T)>16?16:sizeof(T);
- s.fill('0');
- s.width(2);
- for( unsigned char const * b=reinterpret_cast<unsigned char const *>(&x),* e=b+n; b!=e; ++b )
- s << std::setw(2) << std::hex << (unsigned int)*b << " ";
- s << "]";
- return s.str();
- }
- }
-
- template <class T>
- std::string
- to_string_stub( T const & x )
- {
- return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>);
- }
-
- template <class T,class Stub>
- std::string
- to_string_stub( T const & x, Stub s )
- {
- return exception_detail::to_string_dispatch::dispatch(x,s);
- }
-
- template <class T,class U>
- std::string
- to_string( std::pair<T,U> const & x )
- {
- return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
- }
- }
+ {
+ namespace
+ exception_detail
+ {
+ template <bool ShiftLeftAvailable>
+ struct shift_left_dispatcher;
+
+ template <>
+ struct
+ shift_left_dispatcher<true>
+ {
+ template <class T,class CharT,class Traits,class Stub>
+ static
+ void
+ convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub )
+ {
+ out << x;
+ }
+ };
+
+ template <>
+ struct
+ shift_left_dispatcher<false>
+ {
+ template <class T,class CharT,class Traits,class Stub>
+ static
+ void
+ convert( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
+ {
+ out << s(x);
+ }
+ };
+
+ namespace
+ shift_left_dispatch
+ {
+ template <class T,class CharT,class Traits>
+ char operator<<( std::basic_ostream<CharT,Traits> &, T );
+
+ template <class T,class CharT,class Traits,class Stub>
+ void
+ dispatch( std::basic_ostream<CharT,Traits> & out, T const & x, Stub s )
+ {
+ shift_left_dispatcher<1!=sizeof(out<<x)>::convert(out,x,s);
+ }
+ }
+ }
+
+ namespace
+ exception_detail
+ {
+ template <bool ToStringAvailable>
+ struct
+ to_string_dispatcher
+ {
+ template <class T,class Stub>
+ static
+ std::string
+ convert( T const & x, Stub )
+ {
+ return to_string(x);
+ }
+ };
+
+ template <>
+ struct
+ to_string_dispatcher<false>
+ {
+ template <class T,class Stub>
+ static
+ std::string
+ convert( T const & x, Stub s )
+ {
+ std::ostringstream out;
+ shift_left_dispatch::dispatch(out,x,s);
+ return out.str();
+ }
+ };
+
+ namespace
+ to_string_dispatch
+ {
+ template <class T>
+ char to_string( T );
+
+ template <class T,class Stub>
+ std::string
+ dispatch( T const & x, Stub s )
+ {
+ return to_string_dispatcher<1!=sizeof(to_string(x))>::convert(x,s);
+ }
+ }
+
+ template <class T>
+ std::string
+ string_stub_dump( T const & x )
+ {
+ std::ostringstream s;
+ s << "[ type: " << typeid(x).name() << ", size: " << sizeof(T) << ", dump: ";
+ size_t n=sizeof(T)>16?16:sizeof(T);
+ s.fill('0');
+ s.width(2);
+ for( unsigned char const * b=reinterpret_cast<unsigned char const *>(&x),* e=b+n; b!=e; ++b )
+ s << std::setw(2) << std::hex << (unsigned int)*b << " ";
+ s << "]";
+ return s.str();
+ }
+ }
+
+ template <class T>
+ std::string
+ to_string_stub( T const & x )
+ {
+ return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>);
+ }
+
+ template <class T,class Stub>
+ std::string
+ to_string_stub( T const & x, Stub s )
+ {
+ return exception_detail::to_string_dispatch::dispatch(x,s);
+ }
+
+ template <class T,class U>
+ std::string
+ to_string( std::pair<T,U> const & x )
+ {
+ return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
+ }
+ }
 
 #endif

Modified: trunk/libs/exception/example/cloning_1.cpp
==============================================================================
--- trunk/libs/exception/example/cloning_1.cpp (original)
+++ trunk/libs/exception/example/cloning_1.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -16,7 +16,7 @@
 
 void
 file_read( FILE * f, void * buffer, size_t size )
- {
+ {
     if( size!=fread(buffer,1,size,f) )
         throw boost::enable_exception_cloning(file_read_error()) << errno_info(errno);
- }
+ }

Modified: trunk/libs/exception/example/cloning_2.cpp
==============================================================================
--- trunk/libs/exception/example/cloning_2.cpp (original)
+++ trunk/libs/exception/example/cloning_2.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -13,27 +13,27 @@
 
 void
 worker_thread( boost::exception_ptr & error )
- {
- try
- {
+ {
+ try
+ {
         do_work();
         error = boost::exception_ptr();
- }
+ }
     catch(
- boost::exception & e )
- {
+ boost::exception & e )
+ {
         error = boost::clone_exception(e);
- }
- }
+ }
+ }
 
 //
 
 void
 work()
- {
+ {
     boost::exception_ptr error;
     boost::thread t( boost::bind(worker_thread,boost::ref(error)) );
     t.join();
     if( error )
         boost::rethrow_exception(error);
- }
+ }

Modified: trunk/libs/exception/example/enable_error_info.cpp
==============================================================================
--- trunk/libs/exception/example/enable_error_info.cpp (original)
+++ trunk/libs/exception/example/enable_error_info.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -17,19 +17,19 @@
 template <class T>
 class
 my_container
- {
- public:
+ {
+ public:
 
- size_t size() const;
+ size_t size() const;
 
     T const &
- operator[]( size_t i ) 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);
- //....
- }
- };
+ //....
+ }
+ };

Modified: trunk/libs/exception/example/error_info_1.cpp
==============================================================================
--- trunk/libs/exception/example/error_info_1.cpp (original)
+++ trunk/libs/exception/example/error_info_1.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -16,21 +16,21 @@
 
 void
 f()
- {
+ {
     throw my_error() << errno_info(errno); //(3)
- }
-
+ }
+
 void
 g()
- {
+ {
     try
- {
+ {
         f();
- }
+ }
     catch(
- my_error & x )
- {
- if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
+ my_error & x )
+ {
+ if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
             std::cerr << "Error code: " << *err;
- }
- }
+ }
+ }

Modified: trunk/libs/exception/example/error_info_2.cpp
==============================================================================
--- trunk/libs/exception/example/error_info_2.cpp (original)
+++ trunk/libs/exception/example/error_info_2.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -18,10 +18,10 @@
 
 void
 file_read( FILE * f, void * buffer, size_t size )
- {
+ {
     if( size!=fread(buffer,1,size,f) )
         throw file_read_error() << errno_info(errno);
- }
+ }
 
 //
 
@@ -32,18 +32,18 @@
 
 void
 parse_file( char const * file_name )
- {
+ {
     boost::shared_ptr<FILE> f = file_open(file_name,"rb");
     assert(f);
     try
- {
- char buf[1024];
+ {
+ char buf[1024];
         file_read( f.get(), buf, sizeof(buf) );
- }
+ }
     catch(
- boost::exception & e )
- {
+ boost::exception & e )
+ {
         e << file_name_info(file_name);
         throw;
- }
- }
+ }
+ }

Modified: trunk/libs/exception/example/example_io.cpp
==============================================================================
--- trunk/libs/exception/example/example_io.cpp (original)
+++ trunk/libs/exception/example/example_io.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,7 +8,7 @@
 //
 //The documentation for boost::exception can be found at:
 //
-// http://www.revergestudios.com/boost-exception/boost-exception.htm.
+// http://www.revergestudios.com/boost-exception/boost-exception.htm.
 //
 //The output from this program can vary depending on the compiler/OS combination.
 
@@ -33,23 +33,23 @@
 
 class
 error: //Base for all exception objects we throw.
- public std::exception,
- public boost::exception
- {
- public:
-
- char const *
- what() const throw()
- {
- return boost::exception::what();
- }
-
- protected:
-
- ~error() throw()
- {
- }
- };
+ public std::exception,
+ public boost::exception
+ {
+ public:
+
+ char const *
+ what() const throw()
+ {
+ return boost::exception::what();
+ }
+
+ protected:
+
+ ~error() throw()
+ {
+ }
+ };
 
 class open_error: public error { };
 class read_error: public error { };
@@ -62,154 +62,154 @@
 
 boost::shared_ptr<FILE>
 my_fopen( char const * name, char const * mode )
- {
- if( FILE * f = ::fopen(name,mode) )
- return boost::shared_ptr<FILE>(f,fclose);
- else
- throw fopen_error() << BOOST_ERROR_INFO <<
- errno_info(errno) <<
- file_name_info(name) <<
- open_mode_info(mode) <<
- function_info("fopen");
- }
+ {
+ if( FILE * f = ::fopen(name,mode) )
+ return boost::shared_ptr<FILE>(f,fclose);
+ else
+ throw fopen_error() << BOOST_ERROR_INFO <<
+ errno_info(errno) <<
+ file_name_info(name) <<
+ open_mode_info(mode) <<
+ function_info("fopen");
+ }
 
 void
 my_fread( void * buffer, size_t size, size_t count, boost::shared_ptr<FILE> const & stream )
- {
- assert(stream);
- if( count!=fread(buffer,size,count,stream.get()) || ferror(stream.get()) )
- throw fread_error() << BOOST_ERROR_INFO <<
- function_info("fread") <<
- errno_info(errno) <<
- file_stream_info(boost::weak_ptr<FILE>(stream));
- }
+ {
+ assert(stream);
+ if( count!=fread(buffer,size,count,stream.get()) || ferror(stream.get()) )
+ throw fread_error() << BOOST_ERROR_INFO <<
+ function_info("fread") <<
+ errno_info(errno) <<
+ file_stream_info(boost::weak_ptr<FILE>(stream));
+ }
 
 void
 my_fwrite( void const * buffer, size_t size, size_t count, boost::shared_ptr<FILE> const & stream )
- {
- assert(stream);
- if( count!=fwrite(buffer,size,count,stream.get()) || ferror(stream.get()) )
- throw fwrite_error() << BOOST_ERROR_INFO <<
- function_info("fwrite") <<
- errno_info(errno) <<
- file_stream_info(boost::weak_ptr<FILE>(stream));
- }
+ {
+ assert(stream);
+ if( count!=fwrite(buffer,size,count,stream.get()) || ferror(stream.get()) )
+ throw fwrite_error() << BOOST_ERROR_INFO <<
+ function_info("fwrite") <<
+ errno_info(errno) <<
+ file_stream_info(boost::weak_ptr<FILE>(stream));
+ }
 
 void
 reset_file( char const * file_name )
- {
- (void) my_fopen(file_name,"wb");
- }
+ {
+ (void) my_fopen(file_name,"wb");
+ }
 
 void
 create_data( char const * file_name )
- {
- boost::shared_ptr<FILE> f = my_fopen(file_name,"wb");
- my_fwrite( data, 1, data_size, f );
- }
+ {
+ boost::shared_ptr<FILE> f = my_fopen(file_name,"wb");
+ my_fwrite( data, 1, data_size, f );
+ }
 
 void
 copy_data( char const * src_file_name, char const * dst_file_name )
- {
- boost::shared_ptr<FILE> src = my_fopen(src_file_name,"rb");
- boost::shared_ptr<FILE> dst = my_fopen(dst_file_name,"wb");
- try
- {
- char buffer[data_size];
- my_fread( buffer, 1, data_size, src );
- my_fwrite( buffer, 1, data_size, dst );
- }
- catch(
- boost::exception & x )
- {
- if( boost::shared_ptr<boost::weak_ptr<FILE> const> f=boost::get_error_info<file_stream_info>(x) )
- if( boost::shared_ptr<FILE> fs = f->lock() )
- {
- if( fs==src )
- x << file_name_info(src_file_name);
- else if( fs==dst )
- x << file_name_info(dst_file_name);
- }
- x <<
- file_name_src_info(src_file_name) <<
- file_name_dst_info(dst_file_name);
- throw;
- }
- }
+ {
+ boost::shared_ptr<FILE> src = my_fopen(src_file_name,"rb");
+ boost::shared_ptr<FILE> dst = my_fopen(dst_file_name,"wb");
+ try
+ {
+ char buffer[data_size];
+ my_fread( buffer, 1, data_size, src );
+ my_fwrite( buffer, 1, data_size, dst );
+ }
+ catch(
+ boost::exception & x )
+ {
+ if( boost::shared_ptr<boost::weak_ptr<FILE> const> f=boost::get_error_info<file_stream_info>(x) )
+ if( boost::shared_ptr<FILE> fs = f->lock() )
+ {
+ if( fs==src )
+ x << file_name_info(src_file_name);
+ else if( fs==dst )
+ x << file_name_info(dst_file_name);
+ }
+ x <<
+ file_name_src_info(src_file_name) <<
+ file_name_dst_info(dst_file_name);
+ throw;
+ }
+ }
 
 void
 dump_copy_info( boost::exception const & x )
- {
- if( boost::shared_ptr<std::string const> src = boost::get_error_info<file_name_src_info>(x) )
- std::cout << "Source file name: " << *src << "\n";
- if( boost::shared_ptr<std::string const> dst = boost::get_error_info<file_name_dst_info>(x) )
- std::cout << "Destination file name: " << *dst << "\n";
- }
+ {
+ if( boost::shared_ptr<std::string const> src = boost::get_error_info<file_name_src_info>(x) )
+ std::cout << "Source file name: " << *src << "\n";
+ if( boost::shared_ptr<std::string const> dst = boost::get_error_info<file_name_dst_info>(x) )
+ std::cout << "Destination file name: " << *dst << "\n";
+ }
 
 void
 dump_file_info( boost::exception const & x )
- {
- if( boost::shared_ptr<std::string const> fn = boost::get_error_info<file_name_info>(x) )
- std::cout << "Source file name: " << *fn << "\n";
- }
+ {
+ if( boost::shared_ptr<std::string const> fn = boost::get_error_info<file_name_info>(x) )
+ std::cout << "Source file name: " << *fn << "\n";
+ }
 
 void
 dump_clib_info( boost::exception const & x )
- {
- if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
- std::cout << "OS error: " << *err << "\n";
- if( boost::shared_ptr<std::string const> fn=boost::get_error_info<function_info>(x) )
- std::cout << "Failed function: " << *fn << "\n";
- }
+ {
+ if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
+ std::cout << "OS error: " << *err << "\n";
+ if( boost::shared_ptr<std::string const> fn=boost::get_error_info<function_info>(x) )
+ std::cout << "Failed function: " << *fn << "\n";
+ }
 
 void
 dump_all_info( boost::exception const & x )
- {
- std::cout << "-------------------------------------------------\n";
- dump_copy_info(x);
- dump_file_info(x);
- dump_clib_info(x);
- std::cout << "\nOutput from what():\n";
- std::cout << x.what();
- }
+ {
+ std::cout << "-------------------------------------------------\n";
+ dump_copy_info(x);
+ dump_file_info(x);
+ dump_clib_info(x);
+ std::cout << "\nOutput from what():\n";
+ std::cout << x.what();
+ }
 
 int
 main()
- {
- try
- {
- create_data( "tmp1.txt" );
- copy_data( "tmp1.txt", "tmp2.txt" ); //This should succeed.
-
- reset_file( "tmp1.txt" ); //Creates empty file.
- try
- {
- copy_data( "tmp1.txt", "tmp2.txt" ); //This should fail, tmp1.txt is empty.
- }
- catch(
- read_error & x )
- {
- std::cout << "\nCaught 'read_error' exception.\n";
- dump_all_info(x);
- }
-
- remove( "tmp1.txt" );
- remove( "tmp2.txt" );
- try
- {
- copy_data( "tmp1.txt", "tmp2.txt" ); //This should fail, tmp1.txt does not exist.
- }
- catch(
- open_error & x )
- {
- std::cout << "\nCaught 'open_error' exception.\n";
- dump_all_info(x);
- }
- }
- catch(
- boost::exception & x )
- {
- std::cout << "\nCaught unexpected boost::exception!\n";
- dump_all_info(x);
- }
- }
+ {
+ 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);
+ }
+ }

Modified: trunk/libs/exception/example/logging.cpp
==============================================================================
--- trunk/libs/exception/example/logging.cpp (original)
+++ trunk/libs/exception/example/logging.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -12,14 +12,14 @@
 
 void
 g()
- {
+ {
     try
- {
+ {
         f();
- }
+ }
     catch(
- boost::exception & e )
- {
+ boost::exception & e )
+ {
         std::cerr << e.what();
- }
- }
+ }
+ }

Modified: trunk/libs/exception/test/boost_error_info_test.cpp
==============================================================================
--- trunk/libs/exception/test/boost_error_info_test.cpp (original)
+++ trunk/libs/exception/test/boost_error_info_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -9,32 +9,32 @@
 
 namespace
 test
- {
- class my_exception: public boost::exception { };
+ {
+ class my_exception: public boost::exception { };
 
- typedef boost::error_info<struct tag_my_info,int> my_info;
+ typedef boost::error_info<struct tag_my_info,int> my_info;
 
- void
- test_boost_error_info()
- {
- try
- {
- throw my_exception() << BOOST_ERROR_INFO << my_info(1);
- }
- catch(
- my_exception & x )
- {
- BOOST_TEST(1==*boost::get_error_info<my_info>(x));
- BOOST_TEST(boost::get_error_info<boost::throw_function>(x));
- BOOST_TEST(boost::get_error_info<boost::throw_file>(x));
- BOOST_TEST(boost::get_error_info<boost::throw_line>(x));
- }
- }
- }
+ void
+ test_boost_error_info()
+ {
+ try
+ {
+ throw my_exception() << BOOST_ERROR_INFO << my_info(1);
+ }
+ catch(
+ my_exception & x )
+ {
+ BOOST_TEST(1==*boost::get_error_info<my_info>(x));
+ BOOST_TEST(boost::get_error_info<boost::throw_function>(x));
+ BOOST_TEST(boost::get_error_info<boost::throw_file>(x));
+ BOOST_TEST(boost::get_error_info<boost::throw_line>(x));
+ }
+ }
+ }
 
 int
 main()
- {
- test::test_boost_error_info();
- return boost::report_errors();
- }
+ {
+ test::test_boost_error_info();
+ return boost::report_errors();
+ }

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-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,35 +8,35 @@
 
 struct
 test_exception:
- std::exception
- {
- };
+ std::exception
+ {
+ };
 
 int
 main()
- {
- try
- {
- throw boost::enable_exception_cloning(test_exception());
- }
- catch(
- std::exception & x )
- {
- boost::exception_ptr p = boost::clone_exception(x);
- try
- {
- rethrow_exception(p);
- BOOST_TEST(false);
- }
- catch(
- test_exception & )
- {
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- }
- return boost::report_errors();
- }
+ {
+ try
+ {
+ throw boost::enable_exception_cloning(test_exception());
+ }
+ catch(
+ std::exception & x )
+ {
+ boost::exception_ptr p = boost::clone_exception(x);
+ try
+ {
+ rethrow_exception(p);
+ BOOST_TEST(false);
+ }
+ catch(
+ test_exception & )
+ {
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ }
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/enable_error_info_test.cpp
==============================================================================
--- trunk/libs/exception/test/enable_error_info_test.cpp (original)
+++ trunk/libs/exception/test/enable_error_info_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,42 +8,42 @@
 #include <boost/detail/lightweight_test.hpp>
 
 namespace
- {
- typedef boost::error_info<struct tag_test_int,int> test_int;
+ {
+ typedef boost::error_info<struct tag_test_int,int> test_int;
 
- void
- throw_wrapper()
- {
- try
- {
- boost::exception_test::throw_length_error();
- }
- catch(
- boost::exception & x )
- {
- x << test_int(42);
- throw;
- }
- }
- }
+ void
+ throw_wrapper()
+ {
+ try
+ {
+ boost::exception_test::throw_length_error();
+ }
+ catch(
+ boost::exception & x )
+ {
+ x << test_int(42);
+ throw;
+ }
+ }
+ }
 
 int
 main()
- {
- try
- {
- throw_wrapper();
- BOOST_TEST(false);
- }
- catch(
- std::exception & x )
- {
- BOOST_TEST( 42==*boost::get_error_info<test_int>(x) );
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- return boost::report_errors();
- }
+ {
+ try
+ {
+ throw_wrapper();
+ BOOST_TEST(false);
+ }
+ catch(
+ std::exception & x )
+ {
+ BOOST_TEST( 42==*boost::get_error_info<test_int>(x) );
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/errno_test.cpp
==============================================================================
--- trunk/libs/exception/test/errno_test.cpp (original)
+++ trunk/libs/exception/test/errno_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -11,23 +11,23 @@
 
 class
 my_exception:
- public boost::exception
- {
- };
+ public boost::exception
+ {
+ };
 
 int
 main()
- {
- try
- {
- errno=1;
- throw my_exception() << info_errno(errno);
- BOOST_TEST(false);
- }
- catch(
- my_exception & x )
- {
- BOOST_TEST(1==*boost::get_error_info<info_errno>(x));
- }
- return boost::report_errors();
- }
+ {
+ try
+ {
+ errno=1;
+ throw my_exception() << info_errno(errno);
+ BOOST_TEST(false);
+ }
+ catch(
+ my_exception & x )
+ {
+ BOOST_TEST(1==*boost::get_error_info<info_errno>(x));
+ }
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/error_info_test.cpp
==============================================================================
--- trunk/libs/exception/test/error_info_test.cpp (original)
+++ trunk/libs/exception/test/error_info_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -18,200 +18,200 @@
 
 struct
 test_exception:
- public boost::exception
- {
- };
+ public boost::exception
+ {
+ };
 
 struct
 throws_on_copy
- {
- throws_on_copy()
- {
- }
-
- throws_on_copy( throws_on_copy const & )
- {
- throw test_exception();
- }
- };
+ {
+ throws_on_copy()
+ {
+ }
+
+ throws_on_copy( throws_on_copy const & )
+ {
+ throw test_exception();
+ }
+ };
 
 void
 basic_test()
- {
- test_exception x;
- x << test_1(1) << test_2(2u) << test_3(3.14159f);
- BOOST_TEST(*boost::get_error_info<test_1>(x)==1);
- BOOST_TEST(*boost::get_error_info<test_2>(x)==2u);
- BOOST_TEST(*boost::get_error_info<test_3>(x)==3.14159f);
- BOOST_TEST(!boost::get_error_info<test_4>(x));
- }
+ {
+ test_exception x;
+ x << test_1(1) << test_2(2u) << test_3(3.14159f);
+ BOOST_TEST(*boost::get_error_info<test_1>(x)==1);
+ BOOST_TEST(*boost::get_error_info<test_2>(x)==2u);
+ BOOST_TEST(*boost::get_error_info<test_3>(x)==3.14159f);
+ BOOST_TEST(!boost::get_error_info<test_4>(x));
+ }
 
 void
 exception_safety_test()
- {
- test_exception x;
- try
- {
- x << test_4(throws_on_copy());
- BOOST_TEST(false);
- }
- catch(
- test_exception & )
- {
- }
- BOOST_TEST(!boost::get_error_info<test_4>(x));
- }
+ {
+ test_exception x;
+ try
+ {
+ x << test_4(throws_on_copy());
+ BOOST_TEST(false);
+ }
+ catch(
+ test_exception & )
+ {
+ }
+ BOOST_TEST(!boost::get_error_info<test_4>(x));
+ }
 
 void
 throw_empty()
- {
- throw test_exception();
- }
+ {
+ throw test_exception();
+ }
 
 void
 throw_test_1( char const * value )
- {
- throw test_exception() << test_5(std::string(value));
- }
+ {
+ throw test_exception() << test_5(std::string(value));
+ }
 
 void
 throw_test_2()
- {
- throw test_exception() << test_6(non_printable());
- }
+ {
+ 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;
- }
- }
+ {
+ try
+ {
+ throw_empty();
+ BOOST_TEST(false);
+ }
+ catch(
+ boost::exception & x )
+ {
+ x << test_5(std::string(name));
+ throw;
+ }
+ }
 
 void
 test_empty()
- {
- try
- {
- throw_empty();
- BOOST_TEST(false);
- }
- catch(
- boost::exception & x )
- {
- BOOST_TEST( dynamic_cast<test_exception *>(&x) );
- BOOST_TEST( !boost::get_error_info<test_1>(x) );
- }
-
- try
- {
- throw_empty();
- BOOST_TEST(false);
- }
- catch(
- test_exception & x )
- {
- BOOST_TEST( dynamic_cast<boost::exception *>(&x) );
- }
- }
+ {
+ try
+ {
+ throw_empty();
+ BOOST_TEST(false);
+ }
+ catch(
+ boost::exception & x )
+ {
+ BOOST_TEST( dynamic_cast<test_exception *>(&x) );
+ BOOST_TEST( !boost::get_error_info<test_1>(x) );
+ }
+
+ try
+ {
+ throw_empty();
+ BOOST_TEST(false);
+ }
+ catch(
+ test_exception & x )
+ {
+ BOOST_TEST( dynamic_cast<boost::exception *>(&x) );
+ }
+ }
 
 void
 test_basic_throw_catch()
- {
- try
- {
- throw_test_1("test");
- BOOST_ASSERT(false);
- }
- catch(
- boost::exception & x )
- {
- BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
- }
- try
- {
- throw_test_2();
- BOOST_ASSERT(false);
- }
- catch(
- boost::exception & x )
- {
- BOOST_TEST(boost::get_error_info<test_6>(x));
- }
- }
+ {
+ try
+ {
+ throw_test_1("test");
+ BOOST_ASSERT(false);
+ }
+ catch(
+ boost::exception & x )
+ {
+ BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
+ }
+ try
+ {
+ throw_test_2();
+ BOOST_ASSERT(false);
+ }
+ catch(
+ boost::exception & x )
+ {
+ BOOST_TEST(boost::get_error_info<test_6>(x));
+ }
+ }
 
 void
 test_catch_add_info()
- {
- try
- {
- throw_catch_add_file_name("test");
- BOOST_TEST(false);
- }
- catch(
- boost::exception & x )
- {
- BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
- }
- }
+ {
+ try
+ {
+ throw_catch_add_file_name("test");
+ BOOST_TEST(false);
+ }
+ catch(
+ boost::exception & x )
+ {
+ BOOST_TEST(*boost::get_error_info<test_5>(x)==std::string("test"));
+ }
+ }
 
 void
 test_add_tuple()
- {
- typedef boost::tuple<test_1,test_2> test_12;
- typedef boost::tuple<test_1,test_2,test_3> test_123;
- typedef boost::tuple<test_1,test_2,test_3,test_5> test_1235;
- try
- {
- throw test_exception() << test_12(42,42u);
- }
- catch(
- test_exception & x )
- {
- BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
- BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
- }
- try
- {
- throw test_exception() << test_123(42,42u,42.0f);
- }
- catch(
- test_exception & x )
- {
- BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
- BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
- BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
- }
- try
- {
- throw test_exception() << test_1235(42,42u,42.0f,std::string("42"));
- }
- catch(
- test_exception & x )
- {
- BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
- BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
- BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
- BOOST_TEST( *boost::get_error_info<test_5>(x)=="42" );
- }
- }
+ {
+ typedef boost::tuple<test_1,test_2> test_12;
+ typedef boost::tuple<test_1,test_2,test_3> test_123;
+ typedef boost::tuple<test_1,test_2,test_3,test_5> test_1235;
+ try
+ {
+ throw test_exception() << test_12(42,42u);
+ }
+ catch(
+ test_exception & x )
+ {
+ BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
+ BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
+ }
+ try
+ {
+ throw test_exception() << test_123(42,42u,42.0f);
+ }
+ catch(
+ test_exception & x )
+ {
+ BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
+ BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
+ BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
+ }
+ try
+ {
+ throw test_exception() << test_1235(42,42u,42.0f,std::string("42"));
+ }
+ catch(
+ test_exception & x )
+ {
+ BOOST_TEST( *boost::get_error_info<test_1>(x)==42 );
+ BOOST_TEST( *boost::get_error_info<test_2>(x)==42u );
+ BOOST_TEST( *boost::get_error_info<test_3>(x)==42.0f );
+ BOOST_TEST( *boost::get_error_info<test_5>(x)=="42" );
+ }
+ }
 
 int
 main()
- {
- basic_test();
- exception_safety_test();
- test_empty();
- test_basic_throw_catch();
- test_catch_add_info();
- test_add_tuple();
- return boost::report_errors();
- }
+ {
+ basic_test();
+ exception_safety_test();
+ test_empty();
+ test_basic_throw_catch();
+ test_catch_add_info();
+ test_add_tuple();
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/exception_fail.cpp
==============================================================================
--- trunk/libs/exception/test/exception_fail.cpp (original)
+++ trunk/libs/exception/test/exception_fail.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -7,6 +7,6 @@
 
 void
 tester( boost::exception & x )
- {
- throw x; //must not compile.
- }
+ {
+ throw x; //must not compile.
+ }

Modified: trunk/libs/exception/test/exception_test.cpp
==============================================================================
--- trunk/libs/exception/test/exception_test.cpp (original)
+++ trunk/libs/exception/test/exception_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,28 +8,28 @@
 
 class
 test_exception:
- public boost::exception
- {
- };
+ public boost::exception
+ {
+ };
 
 void
 test_throw()
- {
- throw test_exception();
- }
+ {
+ throw test_exception();
+ }
 
 int
 main()
- {
- try
- {
- test_throw();
- BOOST_TEST(false);
- }
- catch(
- test_exception & )
- {
- BOOST_TEST(true);
- }
- return boost::report_errors();
- }
+ {
+ try
+ {
+ test_throw();
+ BOOST_TEST(false);
+ }
+ catch(
+ test_exception & )
+ {
+ BOOST_TEST(true);
+ }
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/helper1.cpp
==============================================================================
--- trunk/libs/exception/test/helper1.cpp (original)
+++ trunk/libs/exception/test/helper1.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -5,17 +5,18 @@
 
 #include <boost/exception/enable_error_info.hpp>
 #include <stdexcept>
+#include <string>
 
 namespace
 boost
- {
- namespace
- exception_test
- {
- void
- throw_length_error()
- {
- throw enable_error_info( std::length_error("my length error") );
- }
- }
- }
+ {
+ namespace
+ exception_test
+ {
+ void
+ throw_length_error()
+ {
+ throw enable_error_info( std::length_error("my length error") );
+ }
+ }
+ }

Modified: trunk/libs/exception/test/helper1.hpp
==============================================================================
--- trunk/libs/exception/test/helper1.hpp (original)
+++ trunk/libs/exception/test/helper1.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,12 +8,12 @@
 
 namespace
 boost
- {
- namespace
- exception_test
- {
- void throw_length_error();
- }
- }
+ {
+ namespace
+ exception_test
+ {
+ void throw_length_error();
+ }
+ }
 
 #endif

Modified: trunk/libs/exception/test/helper2.cpp
==============================================================================
--- trunk/libs/exception/test/helper2.cpp (original)
+++ trunk/libs/exception/test/helper2.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -8,46 +8,46 @@
 
 namespace
 boost
- {
- namespace
- exception_test
- {
- inline
- some_boost_exception::
- some_boost_exception( int x ):
- x_(x)
- {
- }
-
- some_boost_exception::
- ~some_boost_exception() throw()
- {
- }
-
- inline
- some_std_exception::
- some_std_exception( int x ):
- x_(x)
- {
- }
-
- some_std_exception::
- ~some_std_exception() throw()
- {
- }
-
- template <>
- void
- throw_test_exception<some_boost_exception>( int x )
- {
- boost::throw_exception( some_boost_exception(x) );
- }
-
- template <>
- void
- throw_test_exception<some_std_exception>( int x )
- {
- boost::throw_exception( some_std_exception(x) );
- }
- }
- }
+ {
+ namespace
+ exception_test
+ {
+ inline
+ some_boost_exception::
+ some_boost_exception( int x ):
+ x_(x)
+ {
+ }
+
+ some_boost_exception::
+ ~some_boost_exception() throw()
+ {
+ }
+
+ inline
+ some_std_exception::
+ some_std_exception( int x ):
+ x_(x)
+ {
+ }
+
+ some_std_exception::
+ ~some_std_exception() throw()
+ {
+ }
+
+ template <>
+ void
+ throw_test_exception<some_boost_exception>( int x )
+ {
+ boost::throw_exception( some_boost_exception(x) );
+ }
+
+ template <>
+ void
+ throw_test_exception<some_std_exception>( int x )
+ {
+ boost::throw_exception( some_std_exception(x) );
+ }
+ }
+ }

Modified: trunk/libs/exception/test/helper2.hpp
==============================================================================
--- trunk/libs/exception/test/helper2.hpp (original)
+++ trunk/libs/exception/test/helper2.hpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -10,38 +10,38 @@
 
 namespace
 boost
- {
- namespace
- exception_test
- {
- struct
- some_boost_exception:
- public boost::exception,
- public std::exception
- {
- explicit some_boost_exception( int x );
- virtual ~some_boost_exception() throw();
- int x_;
- };
-
- struct
- some_std_exception:
- public std::exception
- {
- explicit some_std_exception( int x );
- virtual ~some_std_exception() throw();
- int x_;
- };
-
- template <class>
- void throw_test_exception( int );
-
- template <>
- void throw_test_exception<some_boost_exception>( int );
-
- template <>
- void throw_test_exception<some_std_exception>( int );
- }
- }
+ {
+ namespace
+ exception_test
+ {
+ struct
+ some_boost_exception:
+ public boost::exception,
+ public std::exception
+ {
+ explicit some_boost_exception( int x );
+ virtual ~some_boost_exception() throw();
+ int x_;
+ };
+
+ struct
+ some_std_exception:
+ public std::exception
+ {
+ explicit some_std_exception( int x );
+ virtual ~some_std_exception() throw();
+ int x_;
+ };
+
+ template <class>
+ void throw_test_exception( int );
+
+ template <>
+ void throw_test_exception<some_boost_exception>( int );
+
+ template <>
+ void throw_test_exception<some_std_exception>( int );
+ }
+ }
 
 #endif

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-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -12,60 +12,60 @@
 
 void
 throw_fwd( void (*thrower)(int) )
- {
- try
- {
- thrower(42);
- }
- catch(
- boost::exception & x )
- {
- x << test_int(42);
- throw;
- }
- }
+ {
+ try
+ {
+ thrower(42);
+ }
+ catch(
+ boost::exception & x )
+ {
+ x << test_int(42);
+ throw;
+ }
+ }
 
 template <class T>
 void
 tester()
- {
- try
- {
- throw_fwd( &boost::exception_test::throw_test_exception<T> );
- BOOST_ASSERT(false);
- }
- catch(
- std::exception & x )
- {
- boost::exception_ptr p = boost::clone_exception(x);
- try
- {
- rethrow_exception(p);
- BOOST_TEST(false);
- }
- catch(
- T & y )
- {
- BOOST_TEST(*boost::get_error_info<test_int>(y)==42);
- BOOST_TEST(y.x_==42);
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- }
+ {
+ try
+ {
+ throw_fwd( &boost::exception_test::throw_test_exception<T> );
+ BOOST_ASSERT(false);
+ }
+ catch(
+ std::exception & x )
+ {
+ boost::exception_ptr p = boost::clone_exception(x);
+ try
+ {
+ rethrow_exception(p);
+ BOOST_TEST(false);
+ }
+ catch(
+ T & y )
+ {
+ BOOST_TEST(*boost::get_error_info<test_int>(y)==42);
+ BOOST_TEST(y.x_==42);
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ }
 
 int
 main()
- {
- tester<boost::exception_test::some_boost_exception>();
- tester<boost::exception_test::some_std_exception>();
- return boost::report_errors();
- }
+ {
+ tester<boost::exception_test::some_boost_exception>();
+ tester<boost::exception_test::some_std_exception>();
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/to_string_test.cpp
==============================================================================
--- trunk/libs/exception/test/to_string_test.cpp (original)
+++ trunk/libs/exception/test/to_string_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -9,89 +9,89 @@
 
 namespace
 n1
- {
- class
- c1
- {
- };
-
- std::string
- to_string( c1 const & )
- {
- return "c1";
- }
- }
+ {
+ 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;
- }
- }
+ {
+ 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";
- }
- }
+ {
+ 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
- {
- };
- }
+ {
+ class
+ to_string_tester
+ {
+ };
+ }
 
 template <class T>
 struct
 my_stub
- {
- std::string
- operator()( T const & )
- {
- return "stub";
- }
- };
+ {
+ std::string
+ operator()( T const & )
+ {
+ return "stub";
+ }
+ };
 
 int
 main()
- {
- using namespace boost;
- BOOST_TEST( to_string(5)=="5" );
- BOOST_TEST( to_string(n1::c1())=="c1" );
- BOOST_TEST( to_string(n2::c2())=="c2" );
- BOOST_TEST( to_string(n3::c3())=="c3" );
- BOOST_TEST( to_string_stub(5)=="5" );
- BOOST_TEST( to_string_stub(n1::c1())=="c1" );
- BOOST_TEST( to_string_stub(n2::c2())=="c2" );
- BOOST_TEST( to_string_stub(n3::c3())=="c3" );
- BOOST_TEST( to_string_stub(to_string_tester(),my_stub<to_string_tester>())=="stub" );
- return boost::report_errors();
- }
+ {
+ using namespace boost;
+ BOOST_TEST( to_string(5)=="5" );
+ BOOST_TEST( to_string(n1::c1())=="c1" );
+ BOOST_TEST( to_string(n2::c2())=="c2" );
+ BOOST_TEST( to_string(n3::c3())=="c3" );
+ BOOST_TEST( to_string_stub(5)=="5" );
+ BOOST_TEST( to_string_stub(n1::c1())=="c1" );
+ BOOST_TEST( to_string_stub(n2::c2())=="c2" );
+ BOOST_TEST( to_string_stub(n3::c3())=="c3" );
+ BOOST_TEST( to_string_stub(to_string_tester(),my_stub<to_string_tester>())=="stub" );
+ return boost::report_errors();
+ }

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-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -11,74 +11,74 @@
 
 struct
 test_boost_exception:
- boost::exception
- {
- };
+ boost::exception
+ {
+ };
 
 void
 throw_boost_exception()
- {
- throw test_boost_exception() << test(42);
- }
+ {
+ throw test_boost_exception() << test(42);
+ }
 
 void
 throw_unknown_exception()
- {
- struct
- test_exception:
- std::exception
- {
- };
- throw test_exception();
- }
+ {
+ struct
+ test_exception:
+ std::exception
+ {
+ };
+ throw test_exception();
+ }
 
 int
 main()
- {
- try
- {
- throw_boost_exception();
- }
- catch(
- boost::exception & x )
- {
- boost::exception_ptr ep=boost::clone_exception(x);
- try
- {
- rethrow_exception(ep);
- }
- catch(
- boost::unknown_exception & x )
- {
- BOOST_TEST( 42==*boost::get_error_info<test>(x) );
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- }
- try
- {
- throw_unknown_exception();
- }
- catch(
- std::exception & x )
- {
- boost::exception_ptr ep=boost::clone_exception(x);
- try
- {
- rethrow_exception(ep);
- }
- catch(
- boost::unknown_exception & )
- {
- }
- catch(
- ... )
- {
- BOOST_TEST(false);
- }
- }
- return boost::report_errors();
- }
+ {
+ try
+ {
+ throw_boost_exception();
+ }
+ catch(
+ boost::exception & x )
+ {
+ boost::exception_ptr ep=boost::clone_exception(x);
+ try
+ {
+ rethrow_exception(ep);
+ }
+ catch(
+ boost::unknown_exception & x )
+ {
+ BOOST_TEST( 42==*boost::get_error_info<test>(x) );
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ }
+ try
+ {
+ throw_unknown_exception();
+ }
+ catch(
+ std::exception & x )
+ {
+ boost::exception_ptr ep=boost::clone_exception(x);
+ try
+ {
+ rethrow_exception(ep);
+ }
+ catch(
+ boost::unknown_exception & )
+ {
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ }
+ return boost::report_errors();
+ }

Modified: trunk/libs/exception/test/what_test.cpp
==============================================================================
--- trunk/libs/exception/test/what_test.cpp (original)
+++ trunk/libs/exception/test/what_test.cpp 2008-04-08 17:29:37 EDT (Tue, 08 Apr 2008)
@@ -10,18 +10,18 @@
 
 class
 my_exception:
- public boost::exception
- {
- };
+ public boost::exception
+ {
+ };
 
 int
 main()
- {
- my_exception x;
- x << test(1);
- std::string w1 = x.what();
- x << test(2);
- std::string w2 = x.what();
- BOOST_TEST( w1!=w2 );
- return boost::report_errors();
- }
+ {
+ my_exception x;
+ x << test(1);
+ std::string w1 = x.what();
+ x << test(2);
+ std::string w2 = x.what();
+ BOOST_TEST( w1!=w2 );
+ return boost::report_errors();
+ }


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