]>
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_FORMAT_MANIP_AUTO_DEC_02_2009_1246PM) | |
7 | #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_AUTO_DEC_02_2009_1246PM | |
8 | ||
9 | #if defined(_MSC_VER) | |
10 | #pragma once | |
11 | #endif | |
12 | ||
13 | #include <boost/spirit/home/karma/stream/detail/format_manip.hpp> | |
14 | #include <boost/spirit/home/karma/auto/create_generator.hpp> | |
15 | #include <boost/utility/enable_if.hpp> | |
16 | ||
17 | /////////////////////////////////////////////////////////////////////////////// | |
18 | namespace boost { namespace spirit { namespace karma { namespace detail | |
19 | { | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | template <typename Expr> | |
22 | struct format<Expr | |
23 | , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type> | |
24 | { | |
25 | typedef typename result_of::create_generator<Expr>::type expr_type; | |
26 | typedef format_manip< | |
27 | expr_type, mpl::true_, mpl::false_, unused_type, Expr | |
28 | > type; | |
29 | ||
30 | static type call(Expr const& expr) | |
31 | { | |
32 | return type(create_generator<Expr>(), unused, expr); | |
33 | } | |
34 | }; | |
35 | ||
36 | /////////////////////////////////////////////////////////////////////////// | |
37 | template <typename Expr, typename Delimiter> | |
38 | struct format_delimited<Expr, Delimiter | |
39 | , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type> | |
40 | { | |
41 | typedef typename result_of::create_generator<Expr>::type expr_type; | |
42 | typedef format_manip< | |
43 | expr_type, mpl::true_, mpl::false_, Delimiter, Expr | |
44 | > type; | |
45 | ||
46 | static type call(Expr const& expr | |
47 | , Delimiter const& delimiter | |
48 | , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit) | |
49 | { | |
50 | return type(create_generator<Expr>(), delimiter, pre_delimit, expr); | |
51 | } | |
52 | }; | |
53 | ||
54 | }}}} | |
55 | ||
56 | #endif |