• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Szabolcs Toth (thszabi@gmail.com) 2016.
2 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 #include <boost/metaparse/string.hpp>
8 
9 template <char C>
10 struct to_upper_char;
11 
12 template <> struct to_upper_char<-128> : boost::mpl::char_<95> {};
13 template <> struct to_upper_char<-127> : boost::mpl::char_<96> {};
14 template <> struct to_upper_char<-126> : boost::mpl::char_<97> {};
15 template <> struct to_upper_char<-125> : boost::mpl::char_<98> {};
16 template <> struct to_upper_char<-124> : boost::mpl::char_<99> {};
17 template <> struct to_upper_char<-123> : boost::mpl::char_<100> {};
18 template <> struct to_upper_char<-122> : boost::mpl::char_<101> {};
19 template <> struct to_upper_char<-121> : boost::mpl::char_<102> {};
20 template <> struct to_upper_char<-120> : boost::mpl::char_<103> {};
21 template <> struct to_upper_char<-119> : boost::mpl::char_<104> {};
22 template <> struct to_upper_char<-118> : boost::mpl::char_<105> {};
23 template <> struct to_upper_char<-117> : boost::mpl::char_<106> {};
24 template <> struct to_upper_char<-116> : boost::mpl::char_<107> {};
25 template <> struct to_upper_char<-115> : boost::mpl::char_<108> {};
26 template <> struct to_upper_char<-114> : boost::mpl::char_<109> {};
27 template <> struct to_upper_char<-113> : boost::mpl::char_<110> {};
28 template <> struct to_upper_char<-112> : boost::mpl::char_<111> {};
29 template <> struct to_upper_char<-111> : boost::mpl::char_<112> {};
30 template <> struct to_upper_char<-110> : boost::mpl::char_<113> {};
31 template <> struct to_upper_char<-109> : boost::mpl::char_<114> {};
32 template <> struct to_upper_char<-108> : boost::mpl::char_<115> {};
33 template <> struct to_upper_char<-107> : boost::mpl::char_<116> {};
34 template <> struct to_upper_char<-106> : boost::mpl::char_<117> {};
35 template <> struct to_upper_char<-105> : boost::mpl::char_<118> {};
36 template <> struct to_upper_char<-104> : boost::mpl::char_<119> {};
37 template <> struct to_upper_char<-103> : boost::mpl::char_<120> {};
38 template <> struct to_upper_char<-102> : boost::mpl::char_<121> {};
39 template <> struct to_upper_char<-101> : boost::mpl::char_<122> {};
40 template <> struct to_upper_char<-100> : boost::mpl::char_<123> {};
41 template <> struct to_upper_char<-99> : boost::mpl::char_<124> {};
42 template <> struct to_upper_char<-98> : boost::mpl::char_<125> {};
43 template <> struct to_upper_char<-97> : boost::mpl::char_<126> {};
44 template <> struct to_upper_char<-96> : boost::mpl::char_<127> {};
45 template <> struct to_upper_char<-95> : boost::mpl::char_<-127> {};
46 template <> struct to_upper_char<-94> : boost::mpl::char_<-126> {};
47 template <> struct to_upper_char<-93> : boost::mpl::char_<-125> {};
48 template <> struct to_upper_char<-92> : boost::mpl::char_<-124> {};
49 template <> struct to_upper_char<-91> : boost::mpl::char_<-123> {};
50 template <> struct to_upper_char<-90> : boost::mpl::char_<-122> {};
51 template <> struct to_upper_char<-89> : boost::mpl::char_<-121> {};
52 template <> struct to_upper_char<-88> : boost::mpl::char_<-120> {};
53 template <> struct to_upper_char<-87> : boost::mpl::char_<-119> {};
54 template <> struct to_upper_char<-86> : boost::mpl::char_<-118> {};
55 template <> struct to_upper_char<-85> : boost::mpl::char_<-117> {};
56 template <> struct to_upper_char<-84> : boost::mpl::char_<-116> {};
57 template <> struct to_upper_char<-83> : boost::mpl::char_<-115> {};
58 template <> struct to_upper_char<-82> : boost::mpl::char_<-114> {};
59 template <> struct to_upper_char<-81> : boost::mpl::char_<-113> {};
60 template <> struct to_upper_char<-80> : boost::mpl::char_<-112> {};
61 template <> struct to_upper_char<-79> : boost::mpl::char_<-111> {};
62 template <> struct to_upper_char<-78> : boost::mpl::char_<-110> {};
63 template <> struct to_upper_char<-77> : boost::mpl::char_<-109> {};
64 template <> struct to_upper_char<-76> : boost::mpl::char_<-108> {};
65 template <> struct to_upper_char<-75> : boost::mpl::char_<-107> {};
66 template <> struct to_upper_char<-74> : boost::mpl::char_<-106> {};
67 template <> struct to_upper_char<-73> : boost::mpl::char_<-105> {};
68 template <> struct to_upper_char<-72> : boost::mpl::char_<-104> {};
69 template <> struct to_upper_char<-71> : boost::mpl::char_<-103> {};
70 template <> struct to_upper_char<-70> : boost::mpl::char_<-102> {};
71 template <> struct to_upper_char<-69> : boost::mpl::char_<-101> {};
72 template <> struct to_upper_char<-68> : boost::mpl::char_<-100> {};
73 template <> struct to_upper_char<-67> : boost::mpl::char_<-99> {};
74 template <> struct to_upper_char<-66> : boost::mpl::char_<-98> {};
75 template <> struct to_upper_char<-65> : boost::mpl::char_<-97> {};
76 template <> struct to_upper_char<-64> : boost::mpl::char_<-96> {};
77 template <> struct to_upper_char<-63> : boost::mpl::char_<-95> {};
78 template <> struct to_upper_char<-62> : boost::mpl::char_<-94> {};
79 template <> struct to_upper_char<-61> : boost::mpl::char_<-93> {};
80 template <> struct to_upper_char<-60> : boost::mpl::char_<-92> {};
81 template <> struct to_upper_char<-59> : boost::mpl::char_<-91> {};
82 template <> struct to_upper_char<-58> : boost::mpl::char_<-90> {};
83 template <> struct to_upper_char<-57> : boost::mpl::char_<-89> {};
84 template <> struct to_upper_char<-56> : boost::mpl::char_<-88> {};
85 template <> struct to_upper_char<-55> : boost::mpl::char_<-87> {};
86 template <> struct to_upper_char<-54> : boost::mpl::char_<-86> {};
87 template <> struct to_upper_char<-53> : boost::mpl::char_<-85> {};
88 template <> struct to_upper_char<-52> : boost::mpl::char_<-84> {};
89 template <> struct to_upper_char<-51> : boost::mpl::char_<-83> {};
90 template <> struct to_upper_char<-50> : boost::mpl::char_<-82> {};
91 template <> struct to_upper_char<-49> : boost::mpl::char_<-81> {};
92 template <> struct to_upper_char<-48> : boost::mpl::char_<-80> {};
93 template <> struct to_upper_char<-47> : boost::mpl::char_<-79> {};
94 template <> struct to_upper_char<-46> : boost::mpl::char_<-78> {};
95 template <> struct to_upper_char<-45> : boost::mpl::char_<-77> {};
96 template <> struct to_upper_char<-44> : boost::mpl::char_<-76> {};
97 template <> struct to_upper_char<-43> : boost::mpl::char_<-75> {};
98 template <> struct to_upper_char<-42> : boost::mpl::char_<-74> {};
99 template <> struct to_upper_char<-41> : boost::mpl::char_<-73> {};
100 template <> struct to_upper_char<-40> : boost::mpl::char_<-72> {};
101 template <> struct to_upper_char<-39> : boost::mpl::char_<-71> {};
102 template <> struct to_upper_char<-38> : boost::mpl::char_<-70> {};
103 template <> struct to_upper_char<-37> : boost::mpl::char_<-69> {};
104 template <> struct to_upper_char<-36> : boost::mpl::char_<-68> {};
105 template <> struct to_upper_char<-35> : boost::mpl::char_<-67> {};
106 template <> struct to_upper_char<-34> : boost::mpl::char_<-66> {};
107 template <> struct to_upper_char<-33> : boost::mpl::char_<-65> {};
108 template <> struct to_upper_char<-32> : boost::mpl::char_<-64> {};
109 template <> struct to_upper_char<-31> : boost::mpl::char_<-63> {};
110 template <> struct to_upper_char<-30> : boost::mpl::char_<-62> {};
111 template <> struct to_upper_char<-29> : boost::mpl::char_<-61> {};
112 template <> struct to_upper_char<-28> : boost::mpl::char_<-60> {};
113 template <> struct to_upper_char<-27> : boost::mpl::char_<-59> {};
114 template <> struct to_upper_char<-26> : boost::mpl::char_<-58> {};
115 template <> struct to_upper_char<-25> : boost::mpl::char_<-57> {};
116 template <> struct to_upper_char<-24> : boost::mpl::char_<-56> {};
117 template <> struct to_upper_char<-23> : boost::mpl::char_<-55> {};
118 template <> struct to_upper_char<-22> : boost::mpl::char_<-54> {};
119 template <> struct to_upper_char<-21> : boost::mpl::char_<-53> {};
120 template <> struct to_upper_char<-20> : boost::mpl::char_<-52> {};
121 template <> struct to_upper_char<-19> : boost::mpl::char_<-51> {};
122 template <> struct to_upper_char<-18> : boost::mpl::char_<-50> {};
123 template <> struct to_upper_char<-17> : boost::mpl::char_<-49> {};
124 template <> struct to_upper_char<-16> : boost::mpl::char_<-48> {};
125 template <> struct to_upper_char<-15> : boost::mpl::char_<-47> {};
126 template <> struct to_upper_char<-14> : boost::mpl::char_<-46> {};
127 template <> struct to_upper_char<-13> : boost::mpl::char_<-45> {};
128 template <> struct to_upper_char<-12> : boost::mpl::char_<-44> {};
129 template <> struct to_upper_char<-11> : boost::mpl::char_<-43> {};
130 template <> struct to_upper_char<-10> : boost::mpl::char_<-42> {};
131 template <> struct to_upper_char<-9> : boost::mpl::char_<-41> {};
132 template <> struct to_upper_char<-8> : boost::mpl::char_<-40> {};
133 template <> struct to_upper_char<-7> : boost::mpl::char_<-39> {};
134 template <> struct to_upper_char<-6> : boost::mpl::char_<-38> {};
135 template <> struct to_upper_char<-5> : boost::mpl::char_<-37> {};
136 template <> struct to_upper_char<-4> : boost::mpl::char_<-36> {};
137 template <> struct to_upper_char<-3> : boost::mpl::char_<-35> {};
138 template <> struct to_upper_char<-2> : boost::mpl::char_<-34> {};
139 template <> struct to_upper_char<-1> : boost::mpl::char_<-33> {};
140 template <> struct to_upper_char<0> : boost::mpl::char_<-32> {};
141 template <> struct to_upper_char<1> : boost::mpl::char_<-31> {};
142 template <> struct to_upper_char<2> : boost::mpl::char_<-30> {};
143 template <> struct to_upper_char<3> : boost::mpl::char_<-29> {};
144 template <> struct to_upper_char<4> : boost::mpl::char_<-28> {};
145 template <> struct to_upper_char<5> : boost::mpl::char_<-27> {};
146 template <> struct to_upper_char<6> : boost::mpl::char_<-26> {};
147 template <> struct to_upper_char<7> : boost::mpl::char_<-25> {};
148 template <> struct to_upper_char<8> : boost::mpl::char_<-24> {};
149 template <> struct to_upper_char<9> : boost::mpl::char_<-23> {};
150 template <> struct to_upper_char<10> : boost::mpl::char_<-22> {};
151 template <> struct to_upper_char<11> : boost::mpl::char_<-21> {};
152 template <> struct to_upper_char<12> : boost::mpl::char_<-20> {};
153 template <> struct to_upper_char<13> : boost::mpl::char_<-19> {};
154 template <> struct to_upper_char<14> : boost::mpl::char_<-18> {};
155 template <> struct to_upper_char<15> : boost::mpl::char_<-17> {};
156 template <> struct to_upper_char<16> : boost::mpl::char_<-16> {};
157 template <> struct to_upper_char<17> : boost::mpl::char_<-15> {};
158 template <> struct to_upper_char<18> : boost::mpl::char_<-14> {};
159 template <> struct to_upper_char<19> : boost::mpl::char_<-13> {};
160 template <> struct to_upper_char<20> : boost::mpl::char_<-12> {};
161 template <> struct to_upper_char<21> : boost::mpl::char_<-11> {};
162 template <> struct to_upper_char<22> : boost::mpl::char_<-10> {};
163 template <> struct to_upper_char<23> : boost::mpl::char_<-9> {};
164 template <> struct to_upper_char<24> : boost::mpl::char_<-8> {};
165 template <> struct to_upper_char<25> : boost::mpl::char_<-7> {};
166 template <> struct to_upper_char<26> : boost::mpl::char_<-6> {};
167 template <> struct to_upper_char<27> : boost::mpl::char_<-5> {};
168 template <> struct to_upper_char<28> : boost::mpl::char_<-4> {};
169 template <> struct to_upper_char<29> : boost::mpl::char_<-3> {};
170 template <> struct to_upper_char<30> : boost::mpl::char_<-2> {};
171 template <> struct to_upper_char<31> : boost::mpl::char_<-1> {};
172 template <> struct to_upper_char<32> : boost::mpl::char_<0> {};
173 template <> struct to_upper_char<33> : boost::mpl::char_<1> {};
174 template <> struct to_upper_char<34> : boost::mpl::char_<2> {};
175 template <> struct to_upper_char<35> : boost::mpl::char_<3> {};
176 template <> struct to_upper_char<36> : boost::mpl::char_<4> {};
177 template <> struct to_upper_char<37> : boost::mpl::char_<5> {};
178 template <> struct to_upper_char<38> : boost::mpl::char_<6> {};
179 template <> struct to_upper_char<39> : boost::mpl::char_<7> {};
180 template <> struct to_upper_char<40> : boost::mpl::char_<8> {};
181 template <> struct to_upper_char<41> : boost::mpl::char_<9> {};
182 template <> struct to_upper_char<42> : boost::mpl::char_<10> {};
183 template <> struct to_upper_char<43> : boost::mpl::char_<11> {};
184 template <> struct to_upper_char<44> : boost::mpl::char_<12> {};
185 template <> struct to_upper_char<45> : boost::mpl::char_<13> {};
186 template <> struct to_upper_char<46> : boost::mpl::char_<14> {};
187 template <> struct to_upper_char<47> : boost::mpl::char_<15> {};
188 template <> struct to_upper_char<48> : boost::mpl::char_<16> {};
189 template <> struct to_upper_char<49> : boost::mpl::char_<17> {};
190 template <> struct to_upper_char<50> : boost::mpl::char_<18> {};
191 template <> struct to_upper_char<51> : boost::mpl::char_<19> {};
192 template <> struct to_upper_char<52> : boost::mpl::char_<20> {};
193 template <> struct to_upper_char<53> : boost::mpl::char_<21> {};
194 template <> struct to_upper_char<54> : boost::mpl::char_<22> {};
195 template <> struct to_upper_char<55> : boost::mpl::char_<23> {};
196 template <> struct to_upper_char<56> : boost::mpl::char_<24> {};
197 template <> struct to_upper_char<57> : boost::mpl::char_<25> {};
198 template <> struct to_upper_char<58> : boost::mpl::char_<26> {};
199 template <> struct to_upper_char<59> : boost::mpl::char_<27> {};
200 template <> struct to_upper_char<60> : boost::mpl::char_<28> {};
201 template <> struct to_upper_char<61> : boost::mpl::char_<29> {};
202 template <> struct to_upper_char<62> : boost::mpl::char_<30> {};
203 template <> struct to_upper_char<63> : boost::mpl::char_<31> {};
204 template <> struct to_upper_char<64> : boost::mpl::char_<32> {};
205 template <> struct to_upper_char<65> : boost::mpl::char_<33> {};
206 template <> struct to_upper_char<66> : boost::mpl::char_<34> {};
207 template <> struct to_upper_char<67> : boost::mpl::char_<35> {};
208 template <> struct to_upper_char<68> : boost::mpl::char_<36> {};
209 template <> struct to_upper_char<69> : boost::mpl::char_<37> {};
210 template <> struct to_upper_char<70> : boost::mpl::char_<38> {};
211 template <> struct to_upper_char<71> : boost::mpl::char_<39> {};
212 template <> struct to_upper_char<72> : boost::mpl::char_<40> {};
213 template <> struct to_upper_char<73> : boost::mpl::char_<41> {};
214 template <> struct to_upper_char<74> : boost::mpl::char_<42> {};
215 template <> struct to_upper_char<75> : boost::mpl::char_<43> {};
216 template <> struct to_upper_char<76> : boost::mpl::char_<44> {};
217 template <> struct to_upper_char<77> : boost::mpl::char_<45> {};
218 template <> struct to_upper_char<78> : boost::mpl::char_<46> {};
219 template <> struct to_upper_char<79> : boost::mpl::char_<47> {};
220 template <> struct to_upper_char<80> : boost::mpl::char_<48> {};
221 template <> struct to_upper_char<81> : boost::mpl::char_<49> {};
222 template <> struct to_upper_char<82> : boost::mpl::char_<50> {};
223 template <> struct to_upper_char<83> : boost::mpl::char_<51> {};
224 template <> struct to_upper_char<84> : boost::mpl::char_<52> {};
225 template <> struct to_upper_char<85> : boost::mpl::char_<53> {};
226 template <> struct to_upper_char<86> : boost::mpl::char_<54> {};
227 template <> struct to_upper_char<87> : boost::mpl::char_<55> {};
228 template <> struct to_upper_char<88> : boost::mpl::char_<56> {};
229 template <> struct to_upper_char<89> : boost::mpl::char_<57> {};
230 template <> struct to_upper_char<90> : boost::mpl::char_<58> {};
231 template <> struct to_upper_char<91> : boost::mpl::char_<59> {};
232 template <> struct to_upper_char<92> : boost::mpl::char_<60> {};
233 template <> struct to_upper_char<93> : boost::mpl::char_<61> {};
234 template <> struct to_upper_char<94> : boost::mpl::char_<62> {};
235 template <> struct to_upper_char<95> : boost::mpl::char_<63> {};
236 template <> struct to_upper_char<96> : boost::mpl::char_<64> {};
237 template <> struct to_upper_char<97> : boost::mpl::char_<65> {};
238 template <> struct to_upper_char<98> : boost::mpl::char_<66> {};
239 template <> struct to_upper_char<99> : boost::mpl::char_<67> {};
240 template <> struct to_upper_char<100> : boost::mpl::char_<68> {};
241 template <> struct to_upper_char<101> : boost::mpl::char_<69> {};
242 template <> struct to_upper_char<102> : boost::mpl::char_<70> {};
243 template <> struct to_upper_char<103> : boost::mpl::char_<71> {};
244 template <> struct to_upper_char<104> : boost::mpl::char_<72> {};
245 template <> struct to_upper_char<105> : boost::mpl::char_<73> {};
246 template <> struct to_upper_char<106> : boost::mpl::char_<74> {};
247 template <> struct to_upper_char<107> : boost::mpl::char_<75> {};
248 template <> struct to_upper_char<108> : boost::mpl::char_<76> {};
249 template <> struct to_upper_char<109> : boost::mpl::char_<77> {};
250 template <> struct to_upper_char<110> : boost::mpl::char_<78> {};
251 template <> struct to_upper_char<111> : boost::mpl::char_<79> {};
252 template <> struct to_upper_char<112> : boost::mpl::char_<80> {};
253 template <> struct to_upper_char<113> : boost::mpl::char_<81> {};
254 template <> struct to_upper_char<114> : boost::mpl::char_<82> {};
255 template <> struct to_upper_char<115> : boost::mpl::char_<83> {};
256 template <> struct to_upper_char<116> : boost::mpl::char_<84> {};
257 template <> struct to_upper_char<117> : boost::mpl::char_<85> {};
258 template <> struct to_upper_char<118> : boost::mpl::char_<86> {};
259 template <> struct to_upper_char<119> : boost::mpl::char_<87> {};
260 template <> struct to_upper_char<120> : boost::mpl::char_<88> {};
261 template <> struct to_upper_char<121> : boost::mpl::char_<89> {};
262 template <> struct to_upper_char<122> : boost::mpl::char_<90> {};
263 template <> struct to_upper_char<123> : boost::mpl::char_<91> {};
264 template <> struct to_upper_char<124> : boost::mpl::char_<92> {};
265 template <> struct to_upper_char<125> : boost::mpl::char_<93> {};
266 template <> struct to_upper_char<126> : boost::mpl::char_<94> {};
267 template <> struct to_upper_char<127> : boost::mpl::char_<95> {};
268 
269 template <class S>
270 struct to_upper;
271 
272 template <char... Cs>
273 struct to_upper<boost::metaparse::string<Cs...>> :
274   boost::metaparse::string<to_upper_char<Cs>::value...>
275 {};
276 
277 #define CAT_IMPL(a, b) a ## b
278 #define CAT(a, b) CAT_IMPL(a, b)
279 
280 #define TEST_STRING(...) to_upper< __VA_ARGS__ >::type CAT(v, __LINE__);
281 
282