]> git.lyx.org Git - lyx.git/blob - boost/boost/regex/pattern_except.hpp
Upgrade to boost 1.33.1
[lyx.git] / boost / boost / regex / pattern_except.hpp
1 /*
2  *
3  * Copyright (c) 1998-2002
4  * John Maddock
5  *
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)
9  *
10  */
11  
12  /*
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.
17   */
18
19 #ifndef BOOST_RE_PAT_EXCEPT_HPP
20 #define BOOST_RE_PAT_EXCEPT_HPP
21
22 #ifndef BOOST_REGEX_CONFIG_HPP
23 #include <boost/regex/config.hpp>
24 #endif
25
26 #include <stdexcept>
27 #include <cstddef>
28 #include <boost/regex/v4/error_type.hpp>
29
30 namespace boost{
31
32 #ifdef BOOST_HAS_ABI_HEADERS
33 #  include BOOST_ABI_PREFIX
34 #endif
35
36 #ifdef BOOST_MSVC
37 #pragma warning(push)
38 #pragma warning(disable : 4275)
39 #endif
40    class BOOST_REGEX_DECL regex_error : public std::runtime_error
41 {
42 public:
43    explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
44    explicit regex_error(regex_constants::error_type err);
45    ~regex_error() throw();
46    regex_constants::error_type code()const
47    { return m_error_code; }
48    std::ptrdiff_t position()const
49    { return m_position; }
50    void raise()const;
51 private:
52    regex_constants::error_type m_error_code;
53    std::ptrdiff_t m_position;
54 };
55
56 typedef regex_error bad_pattern;
57 typedef regex_error bad_expression;
58
59 namespace re_detail{
60
61 BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex);
62
63 template <class traits>
64 void raise_error(const traits& t, regex_constants::error_type code)
65 {
66    (void)t;  // warning suppression
67    std::runtime_error e(t.error_string(code));
68    ::boost::re_detail::raise_runtime_error(e);
69 }
70
71 }
72
73
74 #ifdef BOOST_HAS_ABI_HEADERS
75 #  include BOOST_ABI_SUFFIX
76 #endif
77
78 } // namespace boost
79
80 #endif
81
82
83