]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/exception/get_error_info.hpp
boost: update to 1.42.0
[lyx.git] / boost / boost / exception / get_error_info.hpp
index aba9dec670ae8c77f903f70b91c9f6016ee7a408..046f05aeefd0bf9153c4fba259bd5b45fe32f3cb 100644 (file)
-//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_1A590226753311DD9E4CCF6156D89593\r
-#define UUID_1A590226753311DD9E4CCF6156D89593\r
-\r
-#include <boost/exception/exception.hpp>\r
-#include <boost/exception/detail/error_info_impl.hpp>\r
-#include <boost/exception/detail/type_info.hpp>\r
-#include <boost/shared_ptr.hpp>\r
-\r
-namespace\r
-boost\r
-    {\r
-    namespace\r
-    exception_detail\r
-        {\r
-        template <class ErrorInfo>\r
-        struct\r
-        get_info\r
-            {\r
-            static\r
-            typename ErrorInfo::value_type *\r
-            get( exception const & x )\r
-                {\r
-                if( exception_detail::error_info_container * c=x.data_.get() )\r
-                    if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )\r
-                        {\r
-#ifndef BOOST_NO_RTTI\r
-                        BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );\r
-#endif\r
-                        ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());\r
-                        return &w->value();\r
-                        }\r
-                return 0;\r
-                }\r
-            };\r
-\r
-        template <>\r
-        struct\r
-        get_info<throw_function>\r
-            {\r
-            static\r
-            char const * *\r
-            get( exception const & x )\r
-                {\r
-                return x.throw_function_ ? &x.throw_function_ : 0;\r
-                }\r
-            };\r
-\r
-        template <>\r
-        struct\r
-        get_info<throw_file>\r
-            {\r
-            static\r
-            char const * *\r
-            get( exception const & x )\r
-                {\r
-                return x.throw_file_ ? &x.throw_file_ : 0;\r
-                }\r
-            };\r
-\r
-        template <>\r
-        struct\r
-        get_info<throw_line>\r
-            {\r
-            static\r
-            int *\r
-            get( exception const & x )\r
-                {\r
-                return x.throw_line_!=-1 ? &x.throw_line_ : 0;\r
-                }\r
-            };\r
-\r
-        template <class T,class R>\r
-        struct\r
-        get_error_info_return_type\r
-            {\r
-            typedef R * type;\r
-            };\r
-\r
-        template <class T,class R>\r
-        struct\r
-        get_error_info_return_type<T const,R>\r
-            {\r
-            typedef R const * type;\r
-            };\r
-        }\r
-\r
-#ifdef BOOST_NO_RTTI\r
-    template <class ErrorInfo>\r
-    inline\r
-    typename ErrorInfo::value_type const *\r
-    get_error_info( boost::exception const & x )\r
-        {\r
-        return exception_detail::get_info<ErrorInfo>::get(x);\r
-        }\r
-    template <class ErrorInfo>\r
-    inline\r
-    typename ErrorInfo::value_type *\r
-    get_error_info( boost::exception & x )\r
-        {\r
-        return exception_detail::get_info<ErrorInfo>::get(x);\r
-        }\r
-#else\r
-    template <class ErrorInfo,class E>\r
-    inline\r
-    typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type\r
-    get_error_info( E & some_exception )\r
-        {\r
-        if( exception const * x = dynamic_cast<exception const *>(&some_exception) )\r
-            return exception_detail::get_info<ErrorInfo>::get(*x);\r
-        else\r
-            return 0;\r
-        }\r
-#endif\r
-    }\r
-\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_1A590226753311DD9E4CCF6156D89593
+#define UUID_1A590226753311DD9E4CCF6156D89593
+#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
+
+#include <boost/exception/exception.hpp>
+#include <boost/exception/detail/error_info_impl.hpp>
+#include <boost/exception/detail/type_info.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace
+boost
+    {
+    namespace
+    exception_detail
+        {
+        template <class ErrorInfo>
+        struct
+        get_info
+            {
+            static
+            typename ErrorInfo::value_type *
+            get( exception const & x )
+                {
+                if( exception_detail::error_info_container * c=x.data_.get() )
+                    if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
+                        {
+#ifndef BOOST_NO_RTTI
+                        BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
+#endif
+                        ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
+                        return &w->value();
+                        }
+                return 0;
+                }
+            };
+
+        template <>
+        struct
+        get_info<throw_function>
+            {
+            static
+            char const * *
+            get( exception const & x )
+                {
+                return x.throw_function_ ? &x.throw_function_ : 0;
+                }
+            };
+
+        template <>
+        struct
+        get_info<throw_file>
+            {
+            static
+            char const * *
+            get( exception const & x )
+                {
+                return x.throw_file_ ? &x.throw_file_ : 0;
+                }
+            };
+
+        template <>
+        struct
+        get_info<throw_line>
+            {
+            static
+            int *
+            get( exception const & x )
+                {
+                return x.throw_line_!=-1 ? &x.throw_line_ : 0;
+                }
+            };
+
+        template <class T,class R>
+        struct
+        get_error_info_return_type
+            {
+            typedef R * type;
+            };
+
+        template <class T,class R>
+        struct
+        get_error_info_return_type<T const,R>
+            {
+            typedef R const * type;
+            };
+        }
+
+#ifdef BOOST_NO_RTTI
+    template <class ErrorInfo>
+    inline
+    typename ErrorInfo::value_type const *
+    get_error_info( boost::exception const & x )
+        {
+        return exception_detail::get_info<ErrorInfo>::get(x);
+        }
+    template <class ErrorInfo>
+    inline
+    typename ErrorInfo::value_type *
+    get_error_info( boost::exception & x )
+        {
+        return exception_detail::get_info<ErrorInfo>::get(x);
+        }
+#else
+    template <class ErrorInfo,class E>
+    inline
+    typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
+    get_error_info( E & some_exception )
+        {
+        if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
+            return exception_detail::get_info<ErrorInfo>::get(*x);
+        else
+            return 0;
+        }
+#endif
+    }
+
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
+#endif