Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:44

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 =============================================================================*/
0007 #ifndef BOOST_SPIRIT_QI_DETAIL_PASS_FUNCTION_HPP
0008 #define BOOST_SPIRIT_QI_DETAIL_PASS_FUNCTION_HPP
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/spirit/home/support/unused.hpp>
0015 #include <boost/optional.hpp>
0016 
0017 namespace boost { namespace spirit { namespace qi { namespace detail
0018 {
0019 #ifdef _MSC_VER
0020 #  pragma warning(push)
0021 #  pragma warning(disable: 4512) // assignment operator could not be generated.
0022 #endif
0023     template <typename Iterator, typename Context, typename Skipper>
0024     struct pass_function
0025     {
0026         pass_function(
0027             Iterator& first_, Iterator const& last_
0028           , Context& context_, Skipper const& skipper_)
0029           : first(first_)
0030           , last(last_)
0031           , context(context_)
0032           , skipper(skipper_)
0033         {
0034         }
0035 
0036         template <typename Component, typename Attribute>
0037         bool operator()(Component const& component, Attribute& attr)
0038         {
0039             // return true if the parser succeeds
0040             return component.parse(first, last, context, skipper, attr);
0041         }
0042 
0043         template <typename Component, typename Attribute>
0044         bool operator()(Component const& component, boost::optional<Attribute>& attr)
0045         {
0046             // return true if the parser succeeds
0047             Attribute val;
0048             if (component.parse(first, last, context, skipper, val))
0049             {
0050                 attr = val;
0051                 return true;
0052             }
0053             return false;
0054         }
0055 
0056         template <typename Component>
0057         bool operator()(Component const& component)
0058         {
0059             // return true if the parser succeeds
0060             return component.parse(first, last, context, skipper, unused);
0061         }
0062 
0063         Iterator& first;
0064         Iterator const& last;
0065         Context& context;
0066         Skipper const& skipper;
0067     };
0068 #ifdef _MSC_VER
0069 #  pragma warning(pop)
0070 #endif
0071 }}}}
0072 
0073 #endif