Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:39

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 // 
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_PP_IS_ITERATING)
0007 
0008 #if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM)
0009 #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM
0010 
0011 #include <boost/spirit/home/karma/stream/format_manip.hpp>
0012 
0013 #include <boost/mpl/bool.hpp>
0014 #include <boost/fusion/include/vector.hpp>
0015 #include <boost/preprocessor/cat.hpp>
0016 #include <boost/preprocessor/iterate.hpp>
0017 #include <boost/preprocessor/repetition/enum.hpp>
0018 #include <boost/preprocessor/repetition/enum_params.hpp>
0019 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0020 
0021 #define BOOST_PP_FILENAME_1                                                   \
0022     <boost/spirit/home/karma/stream/format_manip_attr.hpp>
0023 #define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
0024 #include BOOST_PP_ITERATE()
0025 
0026 #endif
0027 
0028 ///////////////////////////////////////////////////////////////////////////////
0029 //
0030 //  Preprocessor vertical repetition code
0031 //
0032 ///////////////////////////////////////////////////////////////////////////////
0033 #else // defined(BOOST_PP_IS_ITERATING)
0034 
0035 #define N BOOST_PP_ITERATION()
0036 #define BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE(z, n, A)                       \
0037     BOOST_PP_CAT(A, n) const&
0038 
0039 ///////////////////////////////////////////////////////////////////////////////
0040 namespace boost { namespace spirit { namespace karma 
0041 {
0042     ///////////////////////////////////////////////////////////////////////////
0043     template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
0044     inline detail::format_manip<Expr, mpl::false_, mpl::true_, unused_type
0045       , fusion::vector<
0046             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0047         > > 
0048     format(Expr const& xpr, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
0049     {
0050         using karma::detail::format_manip;
0051 
0052         // Report invalid expression error as early as possible.
0053         // If you got an error_invalid_expression error message here,
0054         // then the expression (expr) is not a valid spirit karma expression.
0055         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
0056 
0057         typedef fusion::vector<
0058             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0059         > vector_type;
0060 
0061         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
0062         return format_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
0063             xpr, unused, attr);
0064     }
0065 
0066     ///////////////////////////////////////////////////////////////////////////
0067     template <typename Expr, typename Delimiter
0068       , BOOST_PP_ENUM_PARAMS(N, typename A)>
0069     inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
0070       , fusion::vector<
0071             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0072         > > 
0073     format_delimited(Expr const& xpr, Delimiter const& d
0074       , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
0075       , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
0076     {
0077         using karma::detail::format_manip;
0078 
0079         // Report invalid expression error as early as possible.
0080         // If you got an error_invalid_expression error message here,
0081         // then the expression (expr) is not a valid spirit karma expression.
0082         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
0083         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
0084 
0085         typedef fusion::vector<
0086             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0087         > vector_type;
0088 
0089         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
0090         return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
0091             xpr, d, pre_delimit, attr);
0092     }
0093 
0094     template <typename Expr, typename Delimiter
0095       , BOOST_PP_ENUM_PARAMS(N, typename A)>
0096     inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
0097       , fusion::vector<
0098             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0099         > > 
0100     format_delimited(Expr const& xpr, Delimiter const& d
0101       , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
0102     {
0103         using karma::detail::format_manip;
0104 
0105         // Report invalid expression error as early as possible.
0106         // If you got an error_invalid_expression error message here,
0107         // then the expression (expr) is not a valid spirit karma expression.
0108         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
0109         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
0110 
0111         typedef fusion::vector<
0112             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
0113         > vector_type;
0114 
0115         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
0116         return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
0117             xpr, d, delimit_flag::dont_predelimit, attr);
0118     }
0119 }}}
0120 
0121 #undef BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE
0122 #undef N
0123 
0124 #endif 
0125