Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //  Copyright (c) 2001-2011 Joel de Guzman
0002 //  Copyright (c) 2001-2011 Hartmut Kaiser
0003 //  Copyright (c) 2009 Francois Barel
0004 // 
0005 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0006 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #if !defined(BOOST_SPIRIT_KARMA_PARAMETERIZED_AUGUST_09_2009_0601AM)
0009 #define BOOST_SPIRIT_KARMA_PARAMETERIZED_AUGUST_09_2009_0601AM
0010 
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014 
0015 #include <boost/ref.hpp>
0016 
0017 #include <boost/spirit/home/support/handles_container.hpp>
0018 #include <boost/spirit/home/karma/generator.hpp>
0019 
0020 namespace boost { namespace spirit { namespace karma
0021 {
0022     ///////////////////////////////////////////////////////////////////////////
0023     // parameterized_nonterminal: generator representing the invocation of a
0024     // nonterminal, passing inherited attributes
0025     ///////////////////////////////////////////////////////////////////////////
0026     template <typename Subject, typename Params>
0027     struct parameterized_nonterminal
0028       : generator<parameterized_nonterminal<Subject, Params> >
0029     {
0030         typedef mpl::int_<generator_properties::all_properties> properties;
0031 
0032         parameterized_nonterminal(Subject const& subject, Params const& params)
0033           : ref(subject), params(params)
0034         {
0035         }
0036 
0037         template <typename Context, typename Unused>
0038         struct attribute
0039             // Forward to subject.
0040           : Subject::template attribute<Context, Unused> {};
0041 
0042         template <typename OutputIterator, typename Context, typename Delimiter
0043           , typename Attribute>
0044         bool generate(OutputIterator& sink, Context& context
0045           , Delimiter const& delim, Attribute const& attr) const
0046         {
0047             // Forward to subject, passing the additional
0048             // params argument to generate.
0049             return ref.get().generate(sink, context, delim, attr, params);
0050         }
0051 
0052         template <typename Context>
0053         info what(Context& context) const
0054         {
0055             // Forward to subject.
0056             return ref.get().what(context);
0057         }
0058 
0059         boost::reference_wrapper<Subject const> ref;
0060         Params params;
0061     };
0062 }}}
0063 
0064 namespace boost { namespace spirit { namespace traits
0065 {
0066     ///////////////////////////////////////////////////////////////////////////
0067     template <typename Subject, typename Params, typename Attribute
0068       , typename Context, typename Iterator>
0069     struct handles_container<karma::parameterized_nonterminal<Subject, Params>
0070           , Attribute, Context, Iterator>
0071       : handles_container<typename remove_const<Subject>::type
0072         , Attribute, Context, Iterator> 
0073     {};
0074 }}}
0075 
0076 #endif