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_DETAIL_GENERATE_TO_FEB_20_2007_0417PM)
7 #define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM
13 #include <boost/spirit/home/support/unused.hpp>
14 #include <boost/spirit/home/support/char_class.hpp>
15 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
17 namespace boost { namespace spirit { namespace karma { namespace detail
19 ///////////////////////////////////////////////////////////////////////////
20 // These utility functions insert the given parameter into the supplied
22 // If the attribute is spirit's unused_type, this is a no_op.
23 ///////////////////////////////////////////////////////////////////////////
25 typename OutputIterator, typename Attribute, typename CharEncoding
28 generate_to(OutputIterator& sink, Attribute const& p, CharEncoding, Tag)
30 *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), p);
32 return detail::sink_is_good(sink);
35 template <typename OutputIterator, typename Attribute>
37 generate_to(OutputIterator& sink, Attribute const& p, unused_type, unused_type)
41 return detail::sink_is_good(sink);
44 template <typename OutputIterator, typename CharEncoding, typename Tag>
45 inline bool generate_to(OutputIterator&, unused_type, CharEncoding, Tag)
50 template <typename OutputIterator, typename Attribute>
52 generate_to(OutputIterator& sink, Attribute const& p)
56 return detail::sink_is_good(sink);
59 template <typename OutputIterator>
60 inline bool generate_to(OutputIterator&, unused_type)
65 }}}} // namespace boost::spirit::karma::detail
67 #endif // KARMA_CORE_DETAIL_INSERT_TO_HPP