BVB Source Codes

mars Show get_error_info.hpp Source code

Return Download mars: download get_error_info.hpp Source code - Download mars Source code - Type:.hpp
  1. //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
  2.  
  3. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5.  
  6. #ifndef UUID_1A590226753311DD9E4CCF6156D89593
  7. #define UUID_1A590226753311DD9E4CCF6156D89593
  8. #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  9. #pragma GCC system_header
  10. #endif
  11. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  12. #pragma warning(push,1)
  13. #endif
  14.  
  15. #include <boost/exception/exception.hpp>
  16. #include <boost/exception/detail/error_info_impl.hpp>
  17. #include <boost/exception/detail/type_info.hpp>
  18. #include <boost/shared_ptr.hpp>
  19.  
  20. namespace mars_boost {} namespace boost = mars_boost; namespace
  21. mars_boost
  22.     {
  23.     namespace
  24.     exception_detail
  25.         {
  26.         template <class ErrorInfo>
  27.         struct
  28.         get_info
  29.             {
  30.             static
  31.             typename ErrorInfo::value_type *
  32.             get( exception const & x )
  33.                 {
  34.                 if( exception_detail::error_info_container * c=x.data_.get() )
  35.                     if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
  36.                         {
  37. #ifndef BOOST_NO_RTTI
  38.                         BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
  39. #endif
  40.                         ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
  41.                         return &w->value();
  42.                         }
  43.                 return 0;
  44.                 }
  45.             };
  46.  
  47.         template <>
  48.         struct
  49.         get_info<throw_function>
  50.             {
  51.             static
  52.             char const * *
  53.             get( exception const & x )
  54.                 {
  55.                 return x.throw_function_ ? &x.throw_function_ : 0;
  56.                 }
  57.             };
  58.  
  59.         template <>
  60.         struct
  61.         get_info<throw_file>
  62.             {
  63.             static
  64.             char const * *
  65.             get( exception const & x )
  66.                 {
  67.                 return x.throw_file_ ? &x.throw_file_ : 0;
  68.                 }
  69.             };
  70.  
  71.         template <>
  72.         struct
  73.         get_info<throw_line>
  74.             {
  75.             static
  76.             int *
  77.             get( exception const & x )
  78.                 {
  79.                 return x.throw_line_!=-1 ? &x.throw_line_ : 0;
  80.                 }
  81.             };
  82.  
  83.         template <class T,class R>
  84.         struct
  85.         get_error_info_return_type
  86.             {
  87.             typedef R * type;
  88.             };
  89.  
  90.         template <class T,class R>
  91.         struct
  92.         get_error_info_return_type<T const,R>
  93.             {
  94.             typedef R const * type;
  95.             };
  96.         }
  97.  
  98. #ifdef BOOST_NO_RTTI
  99.     template <class ErrorInfo>
  100.     inline
  101.     typename ErrorInfo::value_type const *
  102.     get_error_info( mars_boost::exception const & x )
  103.         {
  104.         return exception_detail::get_info<ErrorInfo>::get(x);
  105.         }
  106.     template <class ErrorInfo>
  107.     inline
  108.     typename ErrorInfo::value_type *
  109.     get_error_info( mars_boost::exception & x )
  110.         {
  111.         return exception_detail::get_info<ErrorInfo>::get(x);
  112.         }
  113. #else
  114.     template <class ErrorInfo,class E>
  115.     inline
  116.     typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
  117.     get_error_info( E & some_exception )
  118.         {
  119.         if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
  120.             return exception_detail::get_info<ErrorInfo>::get(*x);
  121.         else
  122.             return 0;
  123.         }
  124. #endif
  125.     }
  126.  
  127. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  128. #pragma warning(pop)
  129. #endif
  130. #endif
  131.  
downloadget_error_info.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top