Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:48

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // attr_begin_matcher.hpp
0003 //
0004 //  Copyright 2008 Eric Niebler. Distributed under the Boost
0005 //  Software License, Version 1.0. (See accompanying file
0006 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007
0009 #define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007
0010 
0011 // MS compatible compilers support #pragma once
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     // attr_begin_matcher
0025     //
0026     template<typename Nbr>
0027     struct attr_begin_matcher
0028       : quant_style<quant_none, 0, false>
0029     {
0030         template<typename BidiIter, typename Next>
0031         static bool match(match_state<BidiIter> &state, Next const &next)
0032         {
0033             void const *attr_slots[Nbr::value] = {};
0034             attr_context old_attr_context = state.attr_context_;
0035             state.attr_context_.attr_slots_ = attr_slots;
0036             state.attr_context_.prev_attr_context_ = &old_attr_context;
0037 
0038             if(next.match(state))
0039             {
0040                 return true;
0041             }
0042 
0043             state.attr_context_ = old_attr_context;
0044             return false;
0045         }
0046     };
0047 
0048 }}}
0049 
0050 #endif