]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // attr_begin_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_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007 | |
9 | #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007 | |
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 | ||
20 | namespace boost { namespace xpressive { namespace detail | |
21 | { | |
22 | ||
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | // attr_begin_matcher | |
25 | // | |
26 | template<typename Nbr> | |
27 | struct attr_begin_matcher | |
28 | : quant_style<quant_none, 0, false> | |
29 | { | |
30 | template<typename BidiIter, typename Next> | |
31 | static bool match(match_state<BidiIter> &state, Next const &next) | |
32 | { | |
33 | void const *attr_slots[Nbr::value] = {}; | |
34 | attr_context old_attr_context = state.attr_context_; | |
35 | state.attr_context_.attr_slots_ = attr_slots; | |
36 | state.attr_context_.prev_attr_context_ = &old_attr_context; | |
37 | ||
38 | if(next.match(state)) | |
39 | { | |
40 | return true; | |
41 | } | |
42 | ||
43 | state.attr_context_ = old_attr_context; | |
44 | return false; | |
45 | } | |
46 | }; | |
47 | ||
48 | }}} | |
49 | ||
50 | #endif |