Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 // 
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM)
0007 #define BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/spirit/home/support/common_terminals.hpp>
0014 #include <boost/spirit/home/support/info.hpp>
0015 #include <boost/spirit/home/support/unused.hpp>
0016 #include <boost/spirit/home/karma/detail/attributes.hpp>
0017 #include <boost/spirit/home/karma/domain.hpp>
0018 #include <boost/spirit/home/karma/meta_compiler.hpp>
0019 #include <boost/spirit/home/karma/delimit_out.hpp>
0020 #include <boost/spirit/home/karma/detail/generate_to.hpp>
0021 
0022 namespace boost { namespace spirit 
0023 {
0024     ///////////////////////////////////////////////////////////////////////////
0025     // Enablers
0026     ///////////////////////////////////////////////////////////////////////////
0027     template <>
0028     struct use_terminal<karma::domain, tag::eol>       // enables eol
0029       : mpl::true_ {};
0030 
0031 }}
0032 
0033 ///////////////////////////////////////////////////////////////////////////////
0034 namespace boost { namespace spirit { namespace karma
0035 {
0036 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0037     using boost::spirit::eol;
0038 #endif
0039     using boost::spirit::eol_type;
0040 
0041     struct eol_generator : primitive_generator<eol_generator>
0042     {
0043         template <typename Context, typename Unused>
0044         struct attribute
0045         {
0046             typedef unused_type type;
0047         };
0048 
0049         template <
0050             typename OutputIterator, typename Context, typename Delimiter
0051           , typename Attribute>
0052         static bool generate(OutputIterator& sink, Context&, Delimiter const& d
0053           , Attribute const& /*attr*/)
0054         {
0055             return detail::generate_to(sink, '\n') &&
0056                    karma::delimit_out(sink, d);   // always do post-delimiting
0057         }
0058 
0059         template <typename Context>
0060         info what(Context const& /*context*/) const
0061         {
0062             return info("eol");
0063         }
0064     };
0065 
0066     ///////////////////////////////////////////////////////////////////////////
0067     // Generator generators: make_xxx function (objects)
0068     ///////////////////////////////////////////////////////////////////////////
0069     template <typename Modifiers>
0070     struct make_primitive<tag::eol, Modifiers>
0071     {
0072         typedef eol_generator result_type;
0073         result_type operator()(unused_type, unused_type) const
0074         {
0075             return result_type();
0076         }
0077     };
0078 
0079 }}}
0080 
0081 #endif