Chris@16
|
1 // Copyright (c) 2001-2011 Hartmut Kaiser
|
Chris@16
|
2 //
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM)
|
Chris@16
|
7 #define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM
|
Chris@16
|
8
|
Chris@16
|
9 #if defined(_MSC_VER)
|
Chris@16
|
10 #pragma once
|
Chris@16
|
11 #endif
|
Chris@16
|
12
|
Chris@16
|
13 #include <boost/spirit/home/support/unused.hpp>
|
Chris@16
|
14 #include <boost/spirit/home/support/char_class.hpp>
|
Chris@16
|
15 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost { namespace spirit { namespace karma { namespace detail
|
Chris@16
|
18 {
|
Chris@16
|
19 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
20 // These utility functions insert the given parameter into the supplied
|
Chris@16
|
21 // output iterator.
|
Chris@16
|
22 // If the attribute is spirit's unused_type, this is a no_op.
|
Chris@16
|
23 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
24 template <
|
Chris@16
|
25 typename OutputIterator, typename Attribute, typename CharEncoding
|
Chris@16
|
26 , typename Tag>
|
Chris@16
|
27 inline bool
|
Chris@16
|
28 generate_to(OutputIterator& sink, Attribute const& p, CharEncoding, Tag)
|
Chris@16
|
29 {
|
Chris@16
|
30 *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), p);
|
Chris@16
|
31 ++sink;
|
Chris@16
|
32 return detail::sink_is_good(sink);
|
Chris@16
|
33 }
|
Chris@16
|
34
|
Chris@16
|
35 template <typename OutputIterator, typename Attribute>
|
Chris@16
|
36 inline bool
|
Chris@16
|
37 generate_to(OutputIterator& sink, Attribute const& p, unused_type, unused_type)
|
Chris@16
|
38 {
|
Chris@16
|
39 *sink = p;
|
Chris@16
|
40 ++sink;
|
Chris@16
|
41 return detail::sink_is_good(sink);
|
Chris@16
|
42 }
|
Chris@16
|
43
|
Chris@16
|
44 template <typename OutputIterator, typename CharEncoding, typename Tag>
|
Chris@16
|
45 inline bool generate_to(OutputIterator&, unused_type, CharEncoding, Tag)
|
Chris@16
|
46 {
|
Chris@16
|
47 return true;
|
Chris@16
|
48 }
|
Chris@16
|
49
|
Chris@16
|
50 template <typename OutputIterator, typename Attribute>
|
Chris@16
|
51 inline bool
|
Chris@16
|
52 generate_to(OutputIterator& sink, Attribute const& p)
|
Chris@16
|
53 {
|
Chris@16
|
54 *sink = p;
|
Chris@16
|
55 ++sink;
|
Chris@16
|
56 return detail::sink_is_good(sink);
|
Chris@16
|
57 }
|
Chris@16
|
58
|
Chris@16
|
59 template <typename OutputIterator>
|
Chris@16
|
60 inline bool generate_to(OutputIterator&, unused_type)
|
Chris@16
|
61 {
|
Chris@16
|
62 return true;
|
Chris@16
|
63 }
|
Chris@16
|
64
|
Chris@16
|
65 }}}} // namespace boost::spirit::karma::detail
|
Chris@16
|
66
|
Chris@16
|
67 #endif // KARMA_CORE_DETAIL_INSERT_TO_HPP
|