]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/include/boost/spirit/home/karma/stream/format_manip_attr.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / karma / stream / format_manip_attr.hpp
CommitLineData
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_PP_IS_ITERATING)
7
8#if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM)
9#define BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM
10
11#include <boost/spirit/home/karma/stream/format_manip.hpp>
12
13#include <boost/fusion/include/vector.hpp>
14#include <boost/preprocessor/iterate.hpp>
15#include <boost/preprocessor/repetition/enum.hpp>
16#include <boost/preprocessor/repetition/enum_params.hpp>
17#include <boost/preprocessor/repetition/enum_binary_params.hpp>
18
19#define BOOST_PP_FILENAME_1 \
20 <boost/spirit/home/karma/stream/format_manip_attr.hpp>
21#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
22#include BOOST_PP_ITERATE()
23
24#endif
25
26///////////////////////////////////////////////////////////////////////////////
27//
28// Preprocessor vertical repetition code
29//
30///////////////////////////////////////////////////////////////////////////////
31#else // defined(BOOST_PP_IS_ITERATING)
32
33#define N BOOST_PP_ITERATION()
34#define BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE(z, n, A) \
35 BOOST_PP_CAT(A, n) const&
36
37///////////////////////////////////////////////////////////////////////////////
38namespace boost { namespace spirit { namespace karma
39{
40 ///////////////////////////////////////////////////////////////////////////
41 template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
42 inline detail::format_manip<Expr, mpl::false_, mpl::true_, unused_type
43 , fusion::vector<
44 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
45 > >
46 format(Expr const& xpr, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
47 {
48 using karma::detail::format_manip;
49
50 // Report invalid expression error as early as possible.
51 // If you got an error_invalid_expression error message here,
52 // then the expression (expr) is not a valid spirit karma expression.
53 BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
54
55 typedef fusion::vector<
56 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
57 > vector_type;
58
59 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
60 return format_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
61 xpr, unused, attr);
62 }
63
64 ///////////////////////////////////////////////////////////////////////////
65 template <typename Expr, typename Delimiter
66 , BOOST_PP_ENUM_PARAMS(N, typename A)>
67 inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
68 , fusion::vector<
69 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
70 > >
71 format_delimited(Expr const& xpr, Delimiter const& d
72 , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
73 , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
74 {
75 using karma::detail::format_manip;
76
77 // Report invalid expression error as early as possible.
78 // If you got an error_invalid_expression error message here,
79 // then the expression (expr) is not a valid spirit karma expression.
80 BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
81 BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
82
83 typedef fusion::vector<
84 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
85 > vector_type;
86
87 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
88 return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
89 xpr, d, pre_delimit, attr);
90 }
91
92 template <typename Expr, typename Delimiter
93 , BOOST_PP_ENUM_PARAMS(N, typename A)>
94 inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
95 , fusion::vector<
96 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
97 > >
98 format_delimited(Expr const& xpr, Delimiter const& d
99 , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
100 {
101 using karma::detail::format_manip;
102
103 // Report invalid expression error as early as possible.
104 // If you got an error_invalid_expression error message here,
105 // then the expression (expr) is not a valid spirit karma expression.
106 BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
107 BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
108
109 typedef fusion::vector<
110 BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
111 > vector_type;
112
113 vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
114 return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
115 xpr, d, delimit_flag::dont_predelimit, attr);
116 }
117}}}
118
119#undef BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE
120#undef N
121
122#endif
123