File indexing completed on 2025-01-18 09:53:54
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_XPRESSIVE_REGEX_ERROR_HPP_EAN_10_04_2005
0010 #define BOOST_XPRESSIVE_REGEX_ERROR_HPP_EAN_10_04_2005
0011
0012
0013 #if defined(_MSC_VER)
0014 # pragma once
0015 #endif
0016
0017 #include <string>
0018 #include <stdexcept>
0019 #include <boost/throw_exception.hpp>
0020 #include <boost/current_function.hpp>
0021 #include <boost/exception/exception.hpp>
0022 #include <boost/exception/info.hpp>
0023 #include <boost/xpressive/regex_constants.hpp>
0024
0025
0026
0027
0028
0029 #ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
0030
0031 namespace std
0032 {
0033
0034 struct runtime_error {};
0035 }
0036 #endif
0037
0038
0039 namespace boost { namespace xpressive
0040 {
0041
0042
0043
0044
0045
0046
0047
0048 struct regex_error
0049 : std::runtime_error
0050 , boost::exception
0051 {
0052
0053
0054
0055
0056 explicit regex_error(regex_constants::error_type code, char const *str = "")
0057 : std::runtime_error(str)
0058 , boost::exception()
0059 , code_(code)
0060 {
0061 }
0062
0063
0064
0065
0066 regex_constants::error_type code() const
0067 {
0068 return this->code_;
0069 }
0070
0071
0072
0073 virtual ~regex_error() throw()
0074 {}
0075
0076 private:
0077
0078 regex_constants::error_type code_;
0079 };
0080
0081 namespace detail
0082 {
0083 inline bool ensure_(
0084 bool cond
0085 , regex_constants::error_type code
0086 , char const *msg
0087 , char const *fun
0088 , char const *file
0089 , unsigned long line
0090 )
0091 {
0092 if(!cond)
0093 {
0094 #ifndef BOOST_EXCEPTION_DISABLE
0095 boost::throw_exception(
0096 boost::xpressive::regex_error(code, msg)
0097 << boost::throw_function(fun)
0098 << boost::throw_file(file)
0099 << boost::throw_line((int)line)
0100 );
0101 #else
0102 boost::throw_exception(boost::xpressive::regex_error(code, msg));
0103 #endif
0104 }
0105 return true;
0106 }
0107 }
0108
0109 #define BOOST_XPR_ENSURE_(pred, code, msg) \
0110 boost::xpressive::detail::ensure_(!!(pred), code, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) \
0111
0112
0113 }}
0114
0115 #endif