File indexing completed on 2025-01-18 09:53:48
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_CHARSET_MATCHER_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_CHARSET_MATCHER_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/xpressive/detail/detail_fwd.hpp>
0017 #include <boost/xpressive/detail/core/quant_style.hpp>
0018 #include <boost/xpressive/detail/core/state.hpp>
0019
0020 namespace boost { namespace xpressive { namespace detail
0021 {
0022
0023
0024
0025
0026 template<typename Traits, typename ICase, typename CharSet>
0027 struct charset_matcher
0028 : quant_style_fixed_width<1>
0029 {
0030 typedef typename Traits::char_type char_type;
0031 typedef Traits traits_type;
0032 typedef ICase icase_type;
0033
0034 charset_matcher(CharSet const &charset = CharSet())
0035 : charset_(charset)
0036 {
0037 }
0038
0039 void inverse()
0040 {
0041 this->charset_.inverse();
0042 }
0043
0044 template<typename BidiIter, typename Next>
0045 bool match(match_state<BidiIter> &state, Next const &next) const
0046 {
0047 if(state.eos() || !this->charset_.test(*state.cur_, traits_cast<Traits>(state), icase_type()))
0048 {
0049 return false;
0050 }
0051
0052 ++state.cur_;
0053 if(next.match(state))
0054 {
0055 return true;
0056 }
0057
0058 --state.cur_;
0059 return false;
0060 }
0061
0062 CharSet charset_;
0063 };
0064
0065 }}}
0066
0067 #endif