]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/xpressive/include/boost/xpressive/detail/core/matcher/literal_matcher.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / xpressive / include / boost / xpressive / detail / core / matcher / literal_matcher.hpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////////////////////
2// literal_matcher.hpp
3//
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)
7
8#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LITERAL_MATCHER_HPP_EAN_10_04_2005
9#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LITERAL_MATCHER_HPP_EAN_10_04_2005
10
11// MS compatible compilers support #pragma once
12#if defined(_MSC_VER)
13# pragma once
14#endif
15
16#include <boost/xpressive/detail/detail_fwd.hpp>
17#include <boost/xpressive/detail/core/quant_style.hpp>
18#include <boost/xpressive/detail/core/state.hpp>
19#include <boost/xpressive/detail/utility/traits_utils.hpp>
20
21namespace boost { namespace xpressive { namespace detail
22{
23
24 ///////////////////////////////////////////////////////////////////////////////
25 // literal_matcher
26 //
27 template<typename Traits, typename ICase, typename Not>
28 struct literal_matcher
29 : quant_style_fixed_width<1>
30 {
31 typedef typename Traits::char_type char_type;
32 typedef Not not_type;
33 typedef ICase icase_type;
34 char_type ch_;
35
36 explicit literal_matcher(char_type ch)
37 : ch_(ch)
38 {}
39
40 literal_matcher(char_type ch, Traits const &tr)
41 : ch_(detail::translate(ch, tr, icase_type()))
42 {}
43
44 template<typename BidiIter, typename Next>
45 bool match(match_state<BidiIter> &state, Next const &next) const
46 {
47 if(state.eos() || Not::value ==
48 (detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) == this->ch_))
49 {
50 return false;
51 }
52
53 ++state.cur_;
54 if(next.match(state))
55 {
56 return true;
57 }
58
59 --state.cur_;
60 return false;
61 }
62 };
63
64}}}
65
66#endif