File indexing completed on 2025-01-18 09:51:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_RE_V4_PAT_EXCEPT_HPP
0020 #define BOOST_RE_V4_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/v4/error_type.hpp>
0029 #include <boost/regex/v4/regex_traits_defaults.hpp>
0030
0031 namespace boost{
0032
0033 #ifdef BOOST_MSVC
0034 #pragma warning(push)
0035 #pragma warning(disable: 4103)
0036 #endif
0037 #ifdef BOOST_HAS_ABI_HEADERS
0038 # include BOOST_ABI_PREFIX
0039 #endif
0040 #ifdef BOOST_MSVC
0041 #pragma warning(pop)
0042 #endif
0043
0044 #ifdef BOOST_MSVC
0045 #pragma warning(push)
0046 #pragma warning(disable : 4275)
0047 #if BOOST_MSVC >= 1800
0048 #pragma warning(disable : 26812)
0049 #endif
0050 #endif
0051 class regex_error : public std::runtime_error
0052 {
0053 public:
0054 explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0)
0055 : std::runtime_error(s)
0056 , m_error_code(err)
0057 , m_position(pos)
0058 {
0059 }
0060 explicit regex_error(regex_constants::error_type err)
0061 : std::runtime_error(::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(err))
0062 , m_error_code(err)
0063 , m_position(0)
0064 {
0065 }
0066 ~regex_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {}
0067 regex_constants::error_type code()const
0068 { return m_error_code; }
0069 std::ptrdiff_t position()const
0070 { return m_position; }
0071 void raise()const
0072 {
0073 #ifndef BOOST_NO_EXCEPTIONS
0074 #ifndef BOOST_REGEX_STANDALONE
0075 ::boost::throw_exception(*this);
0076 #else
0077 throw* this;
0078 #endif
0079 #endif
0080 }
0081 private:
0082 regex_constants::error_type m_error_code;
0083 std::ptrdiff_t m_position;
0084 };
0085
0086 typedef regex_error bad_pattern;
0087 typedef regex_error bad_expression;
0088
0089 namespace BOOST_REGEX_DETAIL_NS{
0090
0091 template <class E>
0092 inline void raise_runtime_error(const E& ex)
0093 {
0094 #ifndef BOOST_REGEX_STANDALONE
0095 ::boost::throw_exception(ex);
0096 #else
0097 throw ex;
0098 #endif
0099 }
0100
0101 template <class traits>
0102 void raise_error(const traits& t, regex_constants::error_type code)
0103 {
0104 (void)t;
0105 regex_error e(t.error_string(code), code, 0);
0106 ::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(e);
0107 }
0108
0109 }
0110
0111 #ifdef BOOST_MSVC
0112 #pragma warning(pop)
0113 #endif
0114
0115 #ifdef BOOST_MSVC
0116 #pragma warning(push)
0117 #pragma warning(disable: 4103)
0118 #endif
0119 #ifdef BOOST_HAS_ABI_HEADERS
0120 # include BOOST_ABI_SUFFIX
0121 #endif
0122 #ifdef BOOST_MSVC
0123 #pragma warning(pop)
0124 #endif
0125
0126 }
0127
0128 #endif