]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
2 | // | |
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) | |
5 | ||
6 | #if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_AUTO_DEC_01_2009_0743PM) | |
7 | #define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_AUTO_DEC_01_2009_0743PM | |
8 | ||
9 | #if defined(_MSC_VER) | |
10 | #pragma once | |
11 | #endif | |
12 | ||
13 | #include <boost/spirit/home/karma/generate.hpp> | |
14 | #include <boost/spirit/home/karma/auto/create_generator.hpp> | |
15 | #include <boost/utility/enable_if.hpp> | |
16 | #include <boost/mpl/not.hpp> | |
17 | #include <boost/mpl/and.hpp> | |
18 | ||
19 | namespace boost { namespace spirit { namespace karma { namespace detail | |
20 | { | |
21 | /////////////////////////////////////////////////////////////////////////// | |
22 | template <typename Expr> | |
23 | struct generate_impl<Expr | |
24 | , typename enable_if< | |
25 | mpl::and_< | |
26 | traits::meta_create_exists<karma::domain, Expr> | |
27 | , mpl::not_<traits::matches<karma::domain, Expr> > > | |
28 | >::type> | |
29 | { | |
30 | template <typename OutputIterator> | |
31 | static bool call( | |
32 | OutputIterator& sink | |
33 | , Expr const& expr) | |
34 | { | |
35 | return karma::generate(sink, create_generator<Expr>(), expr); | |
36 | } | |
37 | }; | |
38 | ||
39 | /////////////////////////////////////////////////////////////////////////// | |
40 | template <typename Expr> | |
41 | struct generate_delimited_impl<Expr | |
42 | , typename enable_if< | |
43 | mpl::and_< | |
44 | traits::meta_create_exists<karma::domain, Expr> | |
45 | , mpl::not_<traits::matches<karma::domain, Expr> > > | |
46 | >::type> | |
47 | { | |
48 | template <typename OutputIterator, typename Delimiter> | |
49 | static bool call( | |
50 | OutputIterator& sink | |
51 | , Expr const& expr | |
52 | , Delimiter const& delimiter | |
53 | , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit) | |
54 | { | |
55 | return karma::generate_delimited( | |
56 | sink, create_generator<Expr>(), delimiter, pre_delimit, expr); | |
57 | } | |
58 | }; | |
59 | ||
60 | }}}} | |
61 | ||
62 | #endif | |
63 |