File indexing completed on 2025-01-19 09:47:37
0001
0002
0003
0004
0005
0006
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
0024
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
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
0048
0049 return ref.get().generate(sink, context, delim, attr, params);
0050 }
0051
0052 template <typename Context>
0053 info what(Context& context) const
0054 {
0055
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