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_AUTO_DEC_01_2009_0743PM)
|
Chris@16
|
7 #define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_AUTO_DEC_01_2009_0743PM
|
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/karma/generate.hpp>
|
Chris@16
|
14 #include <boost/spirit/home/karma/auto/create_generator.hpp>
|
Chris@16
|
15 #include <boost/utility/enable_if.hpp>
|
Chris@16
|
16 #include <boost/mpl/not.hpp>
|
Chris@16
|
17 #include <boost/mpl/and.hpp>
|
Chris@16
|
18
|
Chris@16
|
19 namespace boost { namespace spirit { namespace karma { namespace detail
|
Chris@16
|
20 {
|
Chris@16
|
21 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
22 template <typename Expr>
|
Chris@16
|
23 struct generate_impl<Expr
|
Chris@16
|
24 , typename enable_if<
|
Chris@16
|
25 mpl::and_<
|
Chris@16
|
26 traits::meta_create_exists<karma::domain, Expr>
|
Chris@16
|
27 , mpl::not_<traits::matches<karma::domain, Expr> > >
|
Chris@16
|
28 >::type>
|
Chris@16
|
29 {
|
Chris@16
|
30 template <typename OutputIterator>
|
Chris@16
|
31 static bool call(
|
Chris@16
|
32 OutputIterator& sink
|
Chris@16
|
33 , Expr const& expr)
|
Chris@16
|
34 {
|
Chris@16
|
35 return karma::generate(sink, create_generator<Expr>(), expr);
|
Chris@16
|
36 }
|
Chris@16
|
37 };
|
Chris@16
|
38
|
Chris@16
|
39 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
40 template <typename Expr>
|
Chris@16
|
41 struct generate_delimited_impl<Expr
|
Chris@16
|
42 , typename enable_if<
|
Chris@16
|
43 mpl::and_<
|
Chris@16
|
44 traits::meta_create_exists<karma::domain, Expr>
|
Chris@16
|
45 , mpl::not_<traits::matches<karma::domain, Expr> > >
|
Chris@16
|
46 >::type>
|
Chris@16
|
47 {
|
Chris@16
|
48 template <typename OutputIterator, typename Delimiter>
|
Chris@16
|
49 static bool call(
|
Chris@16
|
50 OutputIterator& sink
|
Chris@16
|
51 , Expr const& expr
|
Chris@16
|
52 , Delimiter const& delimiter
|
Chris@16
|
53 , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
|
Chris@16
|
54 {
|
Chris@16
|
55 return karma::generate_delimited(
|
Chris@16
|
56 sink, create_generator<Expr>(), delimiter, pre_delimit, expr);
|
Chris@16
|
57 }
|
Chris@16
|
58 };
|
Chris@16
|
59
|
Chris@16
|
60 }}}}
|
Chris@16
|
61
|
Chris@16
|
62 #endif
|
Chris@16
|
63
|