3 * Copyright (c) 1998-2002
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE pattern_except.hpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Declares pattern-matching exception classes.
19 #ifndef BOOST_RE_PAT_EXCEPT_HPP
20 #define BOOST_RE_PAT_EXCEPT_HPP
22 #ifndef BOOST_REGEX_CONFIG_HPP
23 #include <boost/regex/config.hpp>
28 #include <boost/regex/v4/error_type.hpp>
34 #pragma warning(disable: 4103)
36 #ifdef BOOST_HAS_ABI_HEADERS
37 # include BOOST_ABI_PREFIX
45 #pragma warning(disable : 4275)
47 class BOOST_REGEX_DECL regex_error : public std::runtime_error
50 explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
51 explicit regex_error(regex_constants::error_type err);
52 ~regex_error() throw();
53 regex_constants::error_type code()const
54 { return m_error_code; }
55 std::ptrdiff_t position()const
56 { return m_position; }
59 regex_constants::error_type m_error_code;
60 std::ptrdiff_t m_position;
63 typedef regex_error bad_pattern;
64 typedef regex_error bad_expression;
68 BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex);
70 template <class traits>
71 void raise_error(const traits& t, regex_constants::error_type code)
73 (void)t; // warning suppression
74 std::runtime_error e(t.error_string(code));
75 ::boost::re_detail::raise_runtime_error(e);
86 #pragma warning(disable: 4103)
88 #ifdef BOOST_HAS_ABI_HEADERS
89 # include BOOST_ABI_SUFFIX