Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:32:55

0001 /*
0002  *
0003  * Copyright (c) 1998-2002
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the 
0007  * Boost Software License, Version 1.0. (See accompanying file 
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011  
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         pattern_except.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Declares pattern-matching exception classes.
0017   */
0018 
0019 #ifndef BOOST_RE_V5_PAT_EXCEPT_HPP
0020 #define BOOST_RE_V5_PAT_EXCEPT_HPP
0021 
0022 #ifndef BOOST_REGEX_CONFIG_HPP
0023 #include <boost/regex/config.hpp>
0024 #endif
0025 
0026 #include <cstddef>
0027 #include <stdexcept>
0028 #include <boost/regex/v5/error_type.hpp>
0029 #include <boost/regex/v5/regex_traits_defaults.hpp>
0030 
0031 namespace boost{
0032 
0033 #ifdef BOOST_REGEX_MSVC
0034 #pragma warning(push)
0035 #pragma warning(disable : 4275)
0036 #if BOOST_REGEX_MSVC >= 1800
0037 #pragma warning(disable : 26812 4459)
0038 #endif
0039 #endif
0040 class regex_error : public std::runtime_error
0041 {
0042 public:
0043    explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0)
0044       : std::runtime_error(s)
0045       , m_error_code(err)
0046       , m_position(pos)
0047    {
0048    }
0049    explicit regex_error(regex_constants::error_type err)
0050       : std::runtime_error(::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(err))
0051       , m_error_code(err)
0052       , m_position(0)
0053    {
0054    }
0055    ~regex_error() noexcept override {}
0056    regex_constants::error_type code()const
0057    { return m_error_code; }
0058    std::ptrdiff_t position()const
0059    { return m_position; }
0060    void raise()const 
0061    {
0062 #ifndef BOOST_NO_EXCEPTIONS
0063 #ifndef BOOST_REGEX_STANDALONE
0064       ::boost::throw_exception(*this);
0065 #else
0066       throw* this;
0067 #endif
0068 #endif
0069    }
0070 private:
0071    regex_constants::error_type m_error_code;
0072    std::ptrdiff_t m_position;
0073 };
0074 
0075 typedef regex_error bad_pattern;
0076 typedef regex_error bad_expression;
0077 
0078 namespace BOOST_REGEX_DETAIL_NS{
0079 
0080 template <class E>
0081 inline void raise_runtime_error(const E& ex)
0082 {
0083 #ifndef BOOST_REGEX_STANDALONE
0084    ::boost::throw_exception(ex);
0085 #else
0086    throw ex;
0087 #endif
0088 }
0089 
0090 template <class traits>
0091 void raise_error(const traits& t, regex_constants::error_type code)
0092 {
0093    (void)t;  // warning suppression
0094    regex_error e(t.error_string(code), code, 0);
0095    ::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(e);
0096 }
0097 
0098 }
0099 
0100 #ifdef BOOST_REGEX_MSVC
0101 #pragma warning(pop)
0102 #endif
0103 
0104 } // namespace boost
0105 
0106 #endif