Files
boost_regex/include/boost/regex/pattern_except.hpp
T

90 lines
1.9 KiB
C++
Raw Normal View History

2000-09-26 11:48:28 +00:00
/*
*
* Copyright (c) 1998-2002
2000-09-26 11:48:28 +00:00
* Dr John Maddock
*
2003-10-04 11:29:20 +00:00
* Use, modification and distribution are subject to the
2003-09-30 13:02:51 +00:00
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
2000-09-26 11:48:28 +00:00
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
2001-09-19 11:48:51 +00:00
* FILE pattern_except.hpp
* VERSION see <boost/version.hpp>
2000-09-26 11:48:28 +00:00
* DESCRIPTION: Declares pattern-matching exception classes.
*/
#ifndef BOOST_RE_PAT_EXCEPT_HPP
#define BOOST_RE_PAT_EXCEPT_HPP
2003-05-17 11:45:48 +00:00
#ifndef BOOST_REGEX_CONFIG_HPP
#include <boost/regex/config.hpp>
2003-05-17 11:45:48 +00:00
#endif
2000-09-26 11:48:28 +00:00
#include <stdexcept>
#include <cstddef>
#include <boost/regex/v4/error_type.hpp>
2000-09-26 11:48:28 +00:00
namespace boost{
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
2000-09-26 11:48:28 +00:00
#endif
2002-10-21 11:03:05 +00:00
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4275)
#endif
class BOOST_REGEX_DECL bad_pattern : public std::runtime_error
2000-09-26 11:48:28 +00:00
{
public:
explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
~bad_pattern() throw();
2000-09-26 11:48:28 +00:00
};
2002-10-21 11:03:05 +00:00
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
2000-09-26 11:48:28 +00:00
class BOOST_REGEX_DECL bad_expression : public bad_pattern
2000-09-26 11:48:28 +00:00
{
public:
explicit bad_expression(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos)
: bad_pattern(s), m_error_code(err), m_position(pos) {}
~bad_expression() throw();
regex_constants::error_type errorno()const
{ return m_error_code; }
std::ptrdiff_t position()const
{ return m_position; }
private:
regex_constants::error_type m_error_code;
std::ptrdiff_t m_position;
2000-09-26 11:48:28 +00:00
};
namespace re_detail{
BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex);
template <class traits>
void raise_error(const traits& t, unsigned code)
{
(void)t; // warning suppression
std::runtime_error e(t.error_string(code));
::boost::re_detail::raise_runtime_error(e);
}
}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
2000-09-26 11:48:28 +00:00
#endif
} // namespace boost
#endif
2001-09-19 11:48:51 +00:00
2003-09-30 13:02:51 +00:00