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/core/enable_if.hpp>
16#include <boost/mpl/bool.hpp>
17
18///////////////////////////////////////////////////////////////////////////////
19namespace boost { namespace spirit { namespace karma { namespace detail
20{
21 ///////////////////////////////////////////////////////////////////////////
22 template <typename Expr>
23 struct format<Expr
24 , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
25 {
26 typedef typename result_of::create_generator<Expr>::type expr_type;
27 typedef format_manip<
28 expr_type, mpl::true_, mpl::false_, unused_type, Expr
29 > type;
30
31 static type call(Expr const& expr)
32 {
33 return type(create_generator<Expr>(), unused, expr);
34 }
35 };
36
37 ///////////////////////////////////////////////////////////////////////////
38 template <typename Expr, typename Delimiter>
39 struct format_delimited<Expr, Delimiter
40 , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
41 {
42 typedef typename result_of::create_generator<Expr>::type expr_type;
43 typedef format_manip<
44 expr_type, mpl::true_, mpl::false_, Delimiter, Expr
45 > type;
46
47 static type call(Expr const& expr
48 , Delimiter const& delimiter
49 , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
50 {
51 return type(create_generator<Expr>(), delimiter, pre_delimit, expr);
52 }
53 };
54
55}}}}
56
57#endif
58

source code of boost/libs/spirit/include/boost/spirit/home/karma/stream/detail/format_manip_auto.hpp