forked from boostorg/throw_exception
updating from trunk.
[SVN r60338]
This commit is contained in:
committed by
Peter Dimov
parent
89e6b4ef35
commit
a53446874b
@ -132,18 +132,6 @@ boost
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class E,class Tag,class T>
|
|
||||||
E const & operator<<( E const &, error_info<Tag,T> const & );
|
|
||||||
|
|
||||||
template <class E>
|
|
||||||
E const & operator<<( E const &, throw_function const & );
|
|
||||||
|
|
||||||
template <class E>
|
|
||||||
E const & operator<<( E const &, throw_file const & );
|
|
||||||
|
|
||||||
template <class E>
|
|
||||||
E const & operator<<( E const &, throw_line const & );
|
|
||||||
|
|
||||||
class exception;
|
class exception;
|
||||||
|
|
||||||
template <class>
|
template <class>
|
||||||
@ -163,6 +151,7 @@ boost
|
|||||||
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
||||||
virtual void add_ref() const = 0;
|
virtual void add_ref() const = 0;
|
||||||
virtual void release() const = 0;
|
virtual void release() const = 0;
|
||||||
|
virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -184,6 +173,20 @@ boost
|
|||||||
struct get_info<throw_line>;
|
struct get_info<throw_line>;
|
||||||
|
|
||||||
char const * get_diagnostic_information( exception const &, char const * );
|
char const * get_diagnostic_information( exception const &, char const * );
|
||||||
|
|
||||||
|
void copy_boost_exception( exception *, exception const * );
|
||||||
|
|
||||||
|
template <class E,class Tag,class T>
|
||||||
|
E const & set_info( E const &, error_info<Tag,T> const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & set_info( E const &, throw_function const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & set_info( E const &, throw_file const & );
|
||||||
|
|
||||||
|
template <class E>
|
||||||
|
E const & set_info( E const &, throw_line const & );
|
||||||
}
|
}
|
||||||
|
|
||||||
class
|
class
|
||||||
@ -216,30 +219,31 @@ boost
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
#if defined(__MWERKS__) && __MWERKS__<=0x3207
|
#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
|
||||||
public:
|
public:
|
||||||
#else
|
#else
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend E const & operator<<( E const &, throw_function const & );
|
friend E const & exception_detail::set_info( E const &, throw_function const & );
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend E const & operator<<( E const &, throw_file const & );
|
friend E const & exception_detail::set_info( E const &, throw_file const & );
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
friend E const & operator<<( E const &, throw_line const & );
|
friend E const & exception_detail::set_info( E const &, throw_line const & );
|
||||||
|
|
||||||
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
|
||||||
|
|
||||||
template <class E,class Tag,class T>
|
template <class E,class Tag,class T>
|
||||||
friend E const & operator<<( E const &, error_info<Tag,T> const & );
|
friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );
|
||||||
|
|
||||||
|
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
||||||
|
|
||||||
template <class>
|
template <class>
|
||||||
friend struct exception_detail::get_info;
|
friend struct exception_detail::get_info;
|
||||||
friend struct exception_detail::get_info<throw_function>;
|
friend struct exception_detail::get_info<throw_function>;
|
||||||
friend struct exception_detail::get_info<throw_file>;
|
friend struct exception_detail::get_info<throw_file>;
|
||||||
friend struct exception_detail::get_info<throw_line>;
|
friend struct exception_detail::get_info<throw_line>;
|
||||||
|
friend void exception_detail::copy_boost_exception( exception *, exception const * );
|
||||||
#endif
|
#endif
|
||||||
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
||||||
mutable char const * throw_function_;
|
mutable char const * throw_function_;
|
||||||
@ -253,28 +257,32 @@ boost
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class E>
|
namespace
|
||||||
E const &
|
exception_detail
|
||||||
operator<<( E const & x, throw_function const & y )
|
|
||||||
{
|
{
|
||||||
x.throw_function_=y.v_;
|
template <class E>
|
||||||
return x;
|
E const &
|
||||||
}
|
set_info( E const & x, throw_function const & y )
|
||||||
|
{
|
||||||
|
x.throw_function_=y.v_;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
E const &
|
E const &
|
||||||
operator<<( E const & x, throw_file const & y )
|
set_info( E const & x, throw_file const & y )
|
||||||
{
|
{
|
||||||
x.throw_file_=y.v_;
|
x.throw_file_=y.v_;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class E>
|
template <class E>
|
||||||
E const &
|
E const &
|
||||||
operator<<( E const & x, throw_line const & y )
|
set_info( E const & x, throw_line const & y )
|
||||||
{
|
{
|
||||||
x.throw_line_=y.v_;
|
x.throw_line_=y.v_;
|
||||||
return x;
|
return x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@ -300,10 +308,10 @@ boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct large_size { char c[256]; };
|
struct large_size { char c[256]; };
|
||||||
large_size dispatch( exception * );
|
large_size dispatch_boost_exception( exception const * );
|
||||||
|
|
||||||
struct small_size { };
|
struct small_size { };
|
||||||
small_size dispatch( void * );
|
small_size dispatch_boost_exception( void const * );
|
||||||
|
|
||||||
template <class,int>
|
template <class,int>
|
||||||
struct enable_error_info_helper;
|
struct enable_error_info_helper;
|
||||||
@ -326,7 +334,7 @@ boost
|
|||||||
struct
|
struct
|
||||||
enable_error_info_return_type
|
enable_error_info_return_type
|
||||||
{
|
{
|
||||||
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type;
|
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +371,13 @@ boost
|
|||||||
void
|
void
|
||||||
copy_boost_exception( exception * a, exception const * b )
|
copy_boost_exception( exception * a, exception const * b )
|
||||||
{
|
{
|
||||||
*a = *b;
|
refcount_ptr<error_info_container> data;
|
||||||
|
if( error_info_container * d=b->data_.get() )
|
||||||
|
data = d->clone();
|
||||||
|
a->throw_file_ = b->throw_file_;
|
||||||
|
a->throw_line_ = b->throw_line_;
|
||||||
|
a->throw_function_ = b->throw_function_;
|
||||||
|
a->data_ = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -36,16 +36,32 @@
|
|||||||
#if !defined( BOOST_EXCEPTION_DISABLE )
|
#if !defined( BOOST_EXCEPTION_DISABLE )
|
||||||
# include <boost/exception/exception.hpp>
|
# include <boost/exception/exception.hpp>
|
||||||
# include <boost/current_function.hpp>
|
# include <boost/current_function.hpp>
|
||||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
|
# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_CURRENT_FUNCTION,__FILE__,__LINE__)
|
||||||
::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
|
|
||||||
::boost::throw_file(__FILE__) <<\
|
|
||||||
::boost::throw_line(__LINE__))
|
|
||||||
#else
|
#else
|
||||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
|
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
#if !defined( BOOST_EXCEPTION_DISABLE )
|
||||||
|
namespace
|
||||||
|
exception_detail
|
||||||
|
{
|
||||||
|
template <class E>
|
||||||
|
void
|
||||||
|
throw_exception_( E const & x, char const * current_function, char const * file, int line )
|
||||||
|
{
|
||||||
|
throw_exception(
|
||||||
|
set_info(
|
||||||
|
set_info(
|
||||||
|
set_info(
|
||||||
|
enable_error_info(x),
|
||||||
|
throw_function(current_function)),
|
||||||
|
throw_file(file)),
|
||||||
|
throw_line(line)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user