1 // Copyright (c) 2001-2011 Hartmut Kaiser
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #if !defined(BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM)
7 #define BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM
13 #include <boost/spirit/home/support/common_terminals.hpp>
14 #include <boost/spirit/home/support/info.hpp>
15 #include <boost/spirit/home/support/unused.hpp>
16 #include <boost/spirit/home/karma/detail/attributes.hpp>
17 #include <boost/spirit/home/karma/domain.hpp>
18 #include <boost/spirit/home/karma/meta_compiler.hpp>
19 #include <boost/spirit/home/karma/delimit_out.hpp>
20 #include <boost/spirit/home/karma/detail/generate_to.hpp>
22 namespace boost { namespace spirit
24 ///////////////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////////////
28 struct use_terminal<karma::domain, tag::eol> // enables eol
33 ///////////////////////////////////////////////////////////////////////////////
34 namespace boost { namespace spirit { namespace karma
36 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
37 using boost::spirit::eol;
39 using boost::spirit::eol_type;
41 struct eol_generator : primitive_generator<eol_generator>
43 template <typename Context, typename Unused>
46 typedef unused_type type;
50 typename OutputIterator, typename Context, typename Delimiter
52 static bool generate(OutputIterator& sink, Context&, Delimiter const& d
53 , Attribute const& /*attr*/)
55 return detail::generate_to(sink, '\n') &&
56 karma::delimit_out(sink, d); // always do post-delimiting
59 template <typename Context>
60 info what(Context const& /*context*/) const
66 ///////////////////////////////////////////////////////////////////////////
67 // Generator generators: make_xxx function (objects)
68 ///////////////////////////////////////////////////////////////////////////
69 template <typename Modifiers>
70 struct make_primitive<tag::eol, Modifiers>
72 typedef eol_generator result_type;
73 result_type operator()(unused_type, unused_type) const