-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
-\r
-//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
-//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
-\r
-#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593\r
-#define UUID_274DA366004E11DCB1DDFE2E56D89593\r
-#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)\r
-#pragma GCC system_header\r
-#endif\r
-#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)\r
-#pragma warning(push,1)\r
-#endif\r
-\r
-namespace\r
-boost\r
- {\r
- namespace\r
- exception_detail\r
- {\r
- template <class T>\r
- class\r
- refcount_ptr\r
- {\r
- public:\r
-\r
- refcount_ptr():\r
- px_(0)\r
- {\r
- }\r
-\r
- ~refcount_ptr()\r
- {\r
- release();\r
- }\r
-\r
- refcount_ptr( refcount_ptr const & x ):\r
- px_(x.px_)\r
- {\r
- add_ref();\r
- }\r
-\r
- refcount_ptr &\r
- operator=( refcount_ptr const & x )\r
- {\r
- adopt(x.px_);\r
- return *this;\r
- }\r
-\r
- void\r
- adopt( T * px )\r
- {\r
- release();\r
- px_=px;\r
- add_ref();\r
- }\r
-\r
- T *\r
- get() const\r
- {\r
- return px_;\r
- }\r
-\r
- private:\r
-\r
- T * px_;\r
-\r
- void\r
- add_ref()\r
- {\r
- if( px_ )\r
- px_->add_ref();\r
- }\r
-\r
- void\r
- release()\r
- {\r
- if( px_ && px_->release() )\r
- px_=0;\r
- }\r
- };\r
- }\r
-\r
- ////////////////////////////////////////////////////////////////////////\r
-\r
- template <class Tag,class T>\r
- class error_info;\r
-\r
- typedef error_info<struct throw_function_,char const *> throw_function;\r
- typedef error_info<struct throw_file_,char const *> throw_file;\r
- typedef error_info<struct throw_line_,int> throw_line;\r
-\r
- template <>\r
- class\r
- error_info<throw_function_,char const *>\r
- {\r
- public:\r
- typedef char const * value_type;\r
- value_type v_;\r
- explicit\r
- error_info( value_type v ):\r
- v_(v)\r
- {\r
- }\r
- };\r
-\r
- template <>\r
- class\r
- error_info<throw_file_,char const *>\r
- {\r
- public:\r
- typedef char const * value_type;\r
- value_type v_;\r
- explicit\r
- error_info( value_type v ):\r
- v_(v)\r
- {\r
- }\r
- };\r
-\r
- template <>\r
- class\r
- error_info<throw_line_,int>\r
- {\r
- public:\r
- typedef int value_type;\r
- value_type v_;\r
- explicit\r
- error_info( value_type v ):\r
- v_(v)\r
- {\r
- }\r
- };\r
-\r
-#if defined(__GNUC__)\r
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)\r
-# pragma GCC visibility push (default)\r
-# endif\r
-#endif\r
- class exception;\r
-#if defined(__GNUC__)\r
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)\r
-# pragma GCC visibility pop\r
-# endif\r
-#endif\r
-\r
- template <class T>\r
- class shared_ptr;\r
-\r
- namespace\r
- exception_detail\r
- {\r
- class error_info_base;\r
- struct type_info_;\r
-\r
- struct\r
- error_info_container\r
- {\r
- virtual char const * diagnostic_information( char const * ) const = 0;\r
- virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;\r
- virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;\r
- virtual void add_ref() const = 0;\r
- virtual bool release() const = 0;\r
- virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;\r
-\r
- protected:\r
-\r
- ~error_info_container() throw()\r
- {\r
- }\r
- };\r
-\r
- template <class>\r
- struct get_info;\r
-\r
- template <>\r
- struct get_info<throw_function>;\r
-\r
- template <>\r
- struct get_info<throw_file>;\r
-\r
- template <>\r
- struct get_info<throw_line>;\r
-\r
- char const * get_diagnostic_information( exception const &, char const * );\r
-\r
- void copy_boost_exception( exception *, exception const * );\r
-\r
- template <class E,class Tag,class T>\r
- E const & set_info( E const &, error_info<Tag,T> const & );\r
-\r
- template <class E>\r
- E const & set_info( E const &, throw_function const & );\r
-\r
- template <class E>\r
- E const & set_info( E const &, throw_file const & );\r
-\r
- template <class E>\r
- E const & set_info( E const &, throw_line const & );\r
- }\r
-\r
-#if defined(__GNUC__)\r
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)\r
-# pragma GCC visibility push (default)\r
-# endif\r
-#endif\r
- class\r
- exception\r
- {\r
- protected:\r
-\r
- exception():\r
- throw_function_(0),\r
- throw_file_(0),\r
- throw_line_(-1)\r
- {\r
- }\r
-\r
-#ifdef __HP_aCC\r
- //On HP aCC, this protected copy constructor prevents throwing boost::exception.\r
- //On all other platforms, the same effect is achieved by the pure virtual destructor.\r
- exception( exception const & x ) throw():\r
- data_(x.data_),\r
- throw_function_(x.throw_function_),\r
- throw_file_(x.throw_file_),\r
- throw_line_(x.throw_line_)\r
- {\r
- }\r
-#endif\r
-\r
- virtual ~exception() throw()\r
-#ifndef __HP_aCC\r
- = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.\r
-#endif\r
- ;\r
-\r
-#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)\r
- public:\r
-#else\r
- private:\r
-\r
- template <class E>\r
- friend E const & exception_detail::set_info( E const &, throw_function const & );\r
-\r
- template <class E>\r
- friend E const & exception_detail::set_info( E const &, throw_file const & );\r
-\r
- template <class E>\r
- friend E const & exception_detail::set_info( E const &, throw_line const & );\r
-\r
- template <class E,class Tag,class T>\r
- friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );\r
-\r
- friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );\r
-\r
- template <class>\r
- friend struct exception_detail::get_info;\r
- friend struct exception_detail::get_info<throw_function>;\r
- friend struct exception_detail::get_info<throw_file>;\r
- friend struct exception_detail::get_info<throw_line>;\r
- friend void exception_detail::copy_boost_exception( exception *, exception const * );\r
-#endif\r
- mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;\r
- mutable char const * throw_function_;\r
- mutable char const * throw_file_;\r
- mutable int throw_line_;\r
- };\r
-#if defined(__GNUC__)\r
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)\r
-# pragma GCC visibility pop\r
-# endif\r
-#endif\r
-\r
- inline\r
- exception::\r
- ~exception() throw()\r
- {\r
- }\r
-\r
- namespace\r
- exception_detail\r
- {\r
- template <class E>\r
- E const &\r
- set_info( E const & x, throw_function const & y )\r
- {\r
- x.throw_function_=y.v_;\r
- return x;\r
- }\r
-\r
- template <class E>\r
- E const &\r
- set_info( E const & x, throw_file const & y )\r
- {\r
- x.throw_file_=y.v_;\r
- return x;\r
- }\r
-\r
- template <class E>\r
- E const &\r
- set_info( E const & x, throw_line const & y )\r
- {\r
- x.throw_line_=y.v_;\r
- return x;\r
- }\r
- }\r
-\r
- ////////////////////////////////////////////////////////////////////////\r
-\r
- namespace\r
- exception_detail\r
- {\r
- template <class T>\r
- struct\r
- error_info_injector:\r
- public T,\r
- public exception\r
- {\r
- explicit\r
- error_info_injector( T const & x ):\r
- T(x)\r
- {\r
- }\r
-\r
- ~error_info_injector() throw()\r
- {\r
- }\r
- };\r
-\r
- struct large_size { char c[256]; };\r
- large_size dispatch_boost_exception( exception const * );\r
-\r
- struct small_size { };\r
- small_size dispatch_boost_exception( void const * );\r
-\r
- template <class,int>\r
- struct enable_error_info_helper;\r
-\r
- template <class T>\r
- struct\r
- enable_error_info_helper<T,sizeof(large_size)>\r
- {\r
- typedef T type;\r
- };\r
-\r
- template <class T>\r
- struct\r
- enable_error_info_helper<T,sizeof(small_size)>\r
- {\r
- typedef error_info_injector<T> type;\r
- };\r
-\r
- template <class T>\r
- struct\r
- enable_error_info_return_type\r
- {\r
- typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type;\r
- };\r
- }\r
-\r
- template <class T>\r
- inline\r
- typename\r
- exception_detail::enable_error_info_return_type<T>::type\r
- enable_error_info( T const & x )\r
- {\r
- typedef typename exception_detail::enable_error_info_return_type<T>::type rt;\r
- return rt(x);\r
- }\r
-\r
- ////////////////////////////////////////////////////////////////////////\r
-\r
- namespace\r
- exception_detail\r
- {\r
- class\r
- clone_base\r
- {\r
- public:\r
-\r
- virtual clone_base const * clone() const = 0;\r
- virtual void rethrow() const = 0;\r
-\r
- virtual\r
- ~clone_base() throw()\r
- {\r
- }\r
- };\r
-\r
- inline\r
- void\r
- copy_boost_exception( exception * a, exception const * b )\r
- {\r
- refcount_ptr<error_info_container> data;\r
- if( error_info_container * d=b->data_.get() )\r
- data = d->clone();\r
- a->throw_file_ = b->throw_file_;\r
- a->throw_line_ = b->throw_line_;\r
- a->throw_function_ = b->throw_function_;\r
- a->data_ = data;\r
- }\r
-\r
- inline\r
- void\r
- copy_boost_exception( void *, void const * )\r
- {\r
- }\r
-\r
- template <class T>\r
- class\r
- clone_impl:\r
- public T,\r
- public clone_base\r
- {\r
- public:\r
-\r
- explicit\r
- clone_impl( T const & x ):\r
- T(x)\r
- {\r
- copy_boost_exception(this,&x);\r
- }\r
-\r
- ~clone_impl() throw()\r
- {\r
- }\r
-\r
- private:\r
-\r
- clone_base const *\r
- clone() const\r
- {\r
- return new clone_impl(*this);\r
- }\r
-\r
- void\r
- rethrow() const\r
- {\r
- throw*this;\r
- }\r
- };\r
- }\r
-\r
- template <class T>\r
- inline\r
- exception_detail::clone_impl<T>\r
- enable_current_exception( T const & x )\r
- {\r
- return exception_detail::clone_impl<T>(x);\r
- }\r
- }\r
-\r
-#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)\r
-#pragma warning(pop)\r
-#endif\r
-#endif\r
+//Copyright (c) 2006-2009 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_274DA366004E11DCB1DDFE2E56D89593
+#define UUID_274DA366004E11DCB1DDFE2E56D89593
+#if defined(__ICC) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(disable:367) //GMX: For ICC15 "disable duplicate friend declaration" warning
+#endif
+#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
+
+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_ )
+ px_->add_ref();
+ }
+
+ void
+ release()
+ {
+ if( px_ && px_->release() )
+ px_=0;
+ }
+ };
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
+ template <class Tag,class T>
+ class error_info;
+
+ typedef error_info<struct throw_function_,char const *> throw_function;
+ typedef error_info<struct throw_file_,char const *> throw_file;
+ typedef error_info<struct throw_line_,int> throw_line;
+
+ template <>
+ class
+ error_info<throw_function_,char const *>
+ {
+ public:
+ typedef char const * value_type;
+ value_type v_;
+ explicit
+ error_info( value_type v ):
+ v_(v)
+ {
+ }
+ };
+
+ template <>
+ class
+ error_info<throw_file_,char const *>
+ {
+ public:
+ typedef char const * value_type;
+ value_type v_;
+ explicit
+ error_info( value_type v ):
+ v_(v)
+ {
+ }
+ };
+
+ template <>
+ class
+ error_info<throw_line_,int>
+ {
+ public:
+ typedef int value_type;
+ value_type v_;
+ explicit
+ error_info( value_type v ):
+ v_(v)
+ {
+ }
+ };
+
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+# endif
+#endif
+ class exception;
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility pop
+# endif
+#endif
+
+ template <class T>
+ class shared_ptr;
+
+ namespace
+ exception_detail
+ {
+ class error_info_base;
+ struct type_info_;
+
+ struct
+ error_info_container
+ {
+ virtual char const * diagnostic_information( char const * ) const = 0;
+ virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
+ virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
+ virtual void add_ref() const = 0;
+ virtual bool release() const = 0;
+ virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
+
+ protected:
+
+ ~error_info_container() throw()
+ {
+ }
+ };
+
+ template <class>
+ struct get_info;
+
+ template <>
+ struct get_info<throw_function>;
+
+ template <>
+ struct get_info<throw_file>;
+
+ template <>
+ struct get_info<throw_line>;
+
+ 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 & );
+ }
+
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+# endif
+#endif
+ class
+ exception
+ {
+ protected:
+
+ exception():
+ throw_function_(0),
+ throw_file_(0),
+ throw_line_(-1)
+ {
+ }
+
+#ifdef __HP_aCC
+ //On HP aCC, this protected copy constructor prevents throwing boost::exception.
+ //On all other platforms, the same effect is achieved by the pure virtual destructor.
+ exception( exception const & x ) throw():
+ data_(x.data_),
+ throw_function_(x.throw_function_),
+ throw_file_(x.throw_file_),
+ throw_line_(x.throw_line_)
+ {
+ }
+#endif
+
+ virtual ~exception() throw()
+#ifndef __HP_aCC
+ = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
+#endif
+ ;
+
+#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
+ public:
+#else
+ private:
+
+ template <class E>
+ friend E const & exception_detail::set_info( E const &, throw_function const & );
+
+ template <class E>
+ friend E const & exception_detail::set_info( E const &, throw_file const & );
+
+ template <class E>
+ friend E const & exception_detail::set_info( E const &, throw_line const & );
+
+ template <class E,class Tag,class T>
+ 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>
+ friend struct exception_detail::get_info;
+ friend struct exception_detail::get_info<throw_function>;
+ friend struct exception_detail::get_info<throw_file>;
+ friend struct exception_detail::get_info<throw_line>;
+ friend void exception_detail::copy_boost_exception( exception *, exception const * );
+#endif
+ mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
+ mutable char const * throw_function_;
+ mutable char const * throw_file_;
+ mutable int throw_line_;
+ };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility pop
+# endif
+#endif
+
+ inline
+ exception::
+ ~exception() throw()
+ {
+ }
+
+ namespace
+ exception_detail
+ {
+ template <class E>
+ E const &
+ set_info( E const & x, throw_function const & y )
+ {
+ x.throw_function_=y.v_;
+ return x;
+ }
+
+ template <class E>
+ E const &
+ set_info( E const & x, throw_file const & y )
+ {
+ x.throw_file_=y.v_;
+ return x;
+ }
+
+ template <class E>
+ E const &
+ set_info( E const & x, throw_line const & y )
+ {
+ x.throw_line_=y.v_;
+ return x;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
+ namespace
+ exception_detail
+ {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+# endif
+#endif
+ template <class T>
+ struct
+ error_info_injector:
+ public T,
+ public exception
+ {
+ explicit
+ error_info_injector( T const & x ):
+ T(x)
+ {
+ }
+
+ ~error_info_injector() throw()
+ {
+ }
+ };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility pop
+# endif
+#endif
+
+ struct large_size { char c[256]; };
+ large_size dispatch_boost_exception( exception const * );
+
+ struct small_size { };
+ small_size dispatch_boost_exception( void const * );
+
+ 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(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type;
+ };
+ }
+
+ template <class T>
+ inline
+ typename
+ exception_detail::enable_error_info_return_type<T>::type
+ enable_error_info( T const & x )
+ {
+ typedef typename exception_detail::enable_error_info_return_type<T>::type rt;
+ return rt(x);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+
+ namespace
+ exception_detail
+ {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+# endif
+#endif
+ class
+ clone_base
+ {
+ public:
+
+ virtual clone_base const * clone() const = 0;
+ virtual void rethrow() const = 0;
+
+ virtual
+ ~clone_base() throw()
+ {
+ }
+ };
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility pop
+# endif
+#endif
+
+ inline
+ void
+ copy_boost_exception( exception * a, exception const * 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
+ void
+ copy_boost_exception( void *, void const * )
+ {
+ }
+
+ template <class T>
+ class
+ clone_impl:
+ public T,
+ public virtual clone_base
+ {
+ struct clone_tag { };
+ clone_impl( clone_impl const & x, clone_tag ):
+ T(x)
+ {
+ copy_boost_exception(this,&x);
+ }
+
+ 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,clone_tag());
+ }
+
+ 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);
+ }
+ }
+
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
+#endif