• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_UPDATE_C_HPP
2 #define BOOST_METAPARSE_V1_CPP98_IMPL_UPDATE_C_HPP
3 
4 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
5 // Distributed under the Boost Software License, Version 1.0.
6 //    (See accompanying file LICENSE_1_0.txt or copy at
7 //          http://www.boost.org/LICENSE_1_0.txt)
8 
9 #include <boost/metaparse/v1/cpp98/fwd/string.hpp>
10 
11 #include <boost/preprocessor/arithmetic/dec.hpp>
12 #include <boost/preprocessor/arithmetic/inc.hpp>
13 #include <boost/preprocessor/cat.hpp>
14 #include <boost/preprocessor/punctuation/comma_if.hpp>
15 #include <boost/preprocessor/repetition/enum_params.hpp>
16 #include <boost/preprocessor/repetition/repeat.hpp>
17 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
18 
19 namespace boost
20 {
21   namespace metaparse
22   {
23     namespace v1
24     {
25       namespace impl
26       {
27         template <class S, int N, int C>
28         struct update_c;
29 
30         #ifdef BOOST_METAPARSE_ARGN
31         #  error BOOST_METAPARSE_ARGN already defined
32         #endif
33         #define BOOST_METAPARSE_ARGN(z, n, unused) , BOOST_PP_CAT(C, n)
34 
35         #ifdef BOOST_METAPARSE_UPDATE
36         #  error BOOST_METAPARSE_UPDATE already defined
37         #endif
38         #define BOOST_METAPARSE_UPDATE(z, n, unused) \
39           template < \
40             BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C), \
41             int Ch \
42           > \
43           struct update_c< \
44             string<BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C)>,\
45             n, \
46             Ch \
47           > : \
48             string< \
49               BOOST_PP_ENUM_PARAMS(n, C) BOOST_PP_COMMA_IF(n) \
50               Ch \
51               BOOST_PP_REPEAT_FROM_TO( \
52                 BOOST_PP_INC(n), \
53                 BOOST_PP_DEC(BOOST_METAPARSE_LIMIT_STRING_SIZE), \
54                 BOOST_METAPARSE_ARGN, \
55                 ~ \
56               ) \
57             > \
58           {};
59 
60         BOOST_PP_REPEAT(
61           BOOST_METAPARSE_LIMIT_STRING_SIZE,
62           BOOST_METAPARSE_UPDATE,
63           ~
64         )
65 
66         #undef BOOST_METAPARSE_UPDATE
67         #undef BOOST_METAPARSE_ARGN
68       }
69     }
70   }
71 }
72 
73 #endif
74 
75