1 ///////////////////////////////////////////////////////////////////////////////
4 // Copyright 2008 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_RANGE_MATCHER_HPP_EAN_10_04_2005
9 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_RANGE_MATCHER_HPP_EAN_10_04_2005
11 // MS compatible compilers support #pragma once
14 # pragma warning(push)
15 # pragma warning(disable : 4100) // unreferenced formal parameter
18 #include <boost/mpl/bool.hpp>
19 #include <boost/xpressive/detail/detail_fwd.hpp>
20 #include <boost/xpressive/detail/core/quant_style.hpp>
21 #include <boost/xpressive/detail/core/state.hpp>
23 namespace boost { namespace xpressive { namespace detail
26 ///////////////////////////////////////////////////////////////////////////////
29 template<typename Traits, typename ICase>
31 : quant_style_fixed_width<1>
33 typedef typename Traits::char_type char_type;
34 typedef ICase icase_type;
39 range_matcher(char_type ch_min, char_type ch_max, bool no, Traits const &)
48 this->not_ = !this->not_;
51 bool in_range(Traits const &tr, char_type ch, mpl::false_) const // case-sensitive
53 return tr.in_range(this->ch_min_, this->ch_max_, ch);
56 bool in_range(Traits const &tr, char_type ch, mpl::true_) const // case-insensitive
58 return tr.in_range_nocase(this->ch_min_, this->ch_max_, ch);
61 template<typename BidiIter, typename Next>
62 bool match(match_state<BidiIter> &state, Next const &next) const
64 if(state.eos() || this->not_ ==
65 this->in_range(traits_cast<Traits>(state), *state.cur_, icase_type()))