]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/exception/exception.hpp
update boost to 1.44
[lyx.git] / boost / boost / exception / exception.hpp
index 6233f19b3abddb3d808be1c9f55a2dd283306e0b..adaac687bb627a73db4ee99b66915f1932b44192 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
 #define UUID_274DA366004E11DCB1DDFE2E56D89593
+#if defined(__GNUC__) && !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
@@ -69,8 +75,8 @@ boost
             void
             release()
                 {
-                if( px_ )
-                    px_->release();
+                if( px_ && px_->release() )
+                    px_=0;
                 }
             };
         }
@@ -126,12 +132,9 @@ boost
             }
         };
 
-    template <class E,class Tag,class T>
-    E const & operator<<( E const &, error_info<Tag,T> const & );
-
     class exception;
 
-    template <class>
+    template <class T>
     class shared_ptr;
 
     namespace
@@ -143,15 +146,15 @@ boost
         struct
         error_info_container
             {
-            virtual char const * diagnostic_information() const = 0;
-            virtual shared_ptr<error_info_base const> get( type_info_ const & ) const = 0;
-            virtual void set( shared_ptr<error_info_base const> const &, type_info_ const & ) = 0;
+            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 void release() const = 0;
+            virtual bool release() const = 0;
+            virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
 
             protected:
 
-            virtual
             ~error_info_container() throw()
                 {
                 }
@@ -169,7 +172,21 @@ boost
         template <>
         struct get_info<throw_line>;
 
-        char const * get_diagnostic_information( exception 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
@@ -202,46 +219,32 @@ boost
 #endif
             ;
 
+#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
+        public:
+#else
         private:
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_function const & y )
-            {
-            x.throw_function_=y.v_;
-            return x;
-            }
+        friend E const & exception_detail::set_info( E const &, throw_function const & );
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_file const & y )
-            {
-            x.throw_file_=y.v_;
-            return x;
-            }
+        friend E const & exception_detail::set_info( E const &, throw_file const & );
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_line const & y )
-            {
-            x.throw_line_=y.v_;
-            return x;
-            }
-
-        friend char const * exception_detail::get_diagnostic_information( exception const & );
+        friend E const & exception_detail::set_info( E const &, throw_line const & );
 
         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>
         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_;
@@ -254,6 +257,34 @@ boost
         {
         }
 
+    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
@@ -277,10 +308,10 @@ boost
             };
 
         struct large_size { char c[256]; };
-        large_size dispatch( exception * );
+        large_size dispatch_boost_exception( exception const * );
 
         struct small_size { };
-        small_size dispatch( void * );
+        small_size dispatch_boost_exception( void const * );
 
         template <class,int>
         struct enable_error_info_helper;
@@ -303,7 +334,7 @@ boost
         struct
         enable_error_info_return_type
             {
-            typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
+            typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
             };
         }
 
@@ -340,7 +371,13 @@ boost
         void
         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
@@ -393,4 +430,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif