Chris@16: // Copyright (c) 2001-2011 Hartmut Kaiser Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM) Chris@16: #define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace spirit { namespace karma { namespace detail Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // These utility functions insert the given parameter into the supplied Chris@16: // output iterator. Chris@16: // If the attribute is spirit's unused_type, this is a no_op. Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template < Chris@16: typename OutputIterator, typename Attribute, typename CharEncoding Chris@16: , typename Tag> Chris@16: inline bool Chris@16: generate_to(OutputIterator& sink, Attribute const& p, CharEncoding, Tag) Chris@16: { Chris@16: *sink = spirit::char_class::convert::to(Tag(), p); Chris@16: ++sink; Chris@16: return detail::sink_is_good(sink); Chris@16: } Chris@16: Chris@16: template Chris@16: inline bool Chris@16: generate_to(OutputIterator& sink, Attribute const& p, unused_type, unused_type) Chris@16: { Chris@16: *sink = p; Chris@16: ++sink; Chris@16: return detail::sink_is_good(sink); Chris@16: } Chris@16: Chris@16: template Chris@16: inline bool generate_to(OutputIterator&, unused_type, CharEncoding, Tag) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: Chris@16: template Chris@16: inline bool Chris@16: generate_to(OutputIterator& sink, Attribute const& p) Chris@16: { Chris@16: *sink = p; Chris@16: ++sink; Chris@16: return detail::sink_is_good(sink); Chris@16: } Chris@16: Chris@16: template Chris@16: inline bool generate_to(OutputIterator&, unused_type) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: Chris@16: }}}} // namespace boost::spirit::karma::detail Chris@16: Chris@16: #endif // KARMA_CORE_DETAIL_INSERT_TO_HPP