Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3 Copyright (c) 2011 Bryce Lelbach
|
Chris@16
|
4 Copyright (c) 2011 Jan Frederick Eick
|
Chris@16
|
5
|
Chris@16
|
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 ==============================================================================*/
|
Chris@16
|
9 #if !defined(SPIRIT_UINT_APR_17_2006_0901AM)
|
Chris@16
|
10 #define SPIRIT_UINT_APR_17_2006_0901AM
|
Chris@16
|
11
|
Chris@16
|
12 #if defined(_MSC_VER)
|
Chris@16
|
13 #pragma once
|
Chris@16
|
14 #endif
|
Chris@16
|
15
|
Chris@16
|
16 #include <boost/spirit/home/qi/skip_over.hpp>
|
Chris@16
|
17 #include <boost/spirit/home/qi/detail/enable_lit.hpp>
|
Chris@16
|
18 #include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
|
Chris@16
|
19 #include <boost/spirit/home/qi/meta_compiler.hpp>
|
Chris@16
|
20 #include <boost/spirit/home/qi/parser.hpp>
|
Chris@16
|
21 #include <boost/spirit/home/support/common_terminals.hpp>
|
Chris@16
|
22 #include <boost/spirit/home/support/info.hpp>
|
Chris@16
|
23 #include <boost/spirit/home/support/detail/is_spirit_tag.hpp>
|
Chris@16
|
24 #include <boost/mpl/assert.hpp>
|
Chris@16
|
25 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost { namespace spirit
|
Chris@16
|
28 {
|
Chris@16
|
29 namespace tag
|
Chris@16
|
30 {
|
Chris@16
|
31 template <typename T, unsigned Radix, unsigned MinDigits
|
Chris@16
|
32 , int MaxDigits>
|
Chris@16
|
33 struct uint_parser
|
Chris@16
|
34 {
|
Chris@16
|
35 BOOST_SPIRIT_IS_TAG()
|
Chris@16
|
36 };
|
Chris@16
|
37 }
|
Chris@16
|
38
|
Chris@16
|
39 namespace qi
|
Chris@16
|
40 {
|
Chris@16
|
41 ///////////////////////////////////////////////////////////////////////
|
Chris@16
|
42 // This one is the class that the user can instantiate directly in
|
Chris@16
|
43 // order to create a customized int parser
|
Chris@16
|
44 template <typename T = int, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
45 , int MaxDigits = -1>
|
Chris@16
|
46 struct uint_parser
|
Chris@16
|
47 : spirit::terminal<tag::uint_parser<T, Radix, MinDigits, MaxDigits> >
|
Chris@16
|
48 {};
|
Chris@16
|
49 }
|
Chris@16
|
50
|
Chris@16
|
51 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
52 // Enablers
|
Chris@16
|
53 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
54 template <> // enables ushort_
|
Chris@16
|
55 struct use_terminal<qi::domain, tag::ushort_> : mpl::true_ {};
|
Chris@16
|
56
|
Chris@16
|
57 template <typename A0> // enables lit(n)
|
Chris@16
|
58 struct use_terminal<qi::domain
|
Chris@16
|
59 , terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
60 , typename enable_if<is_same<A0, unsigned short> >::type>
|
Chris@16
|
61 : mpl::true_ {};
|
Chris@16
|
62
|
Chris@16
|
63 template <typename A0> // enables ushort_(n)
|
Chris@16
|
64 struct use_terminal<qi::domain
|
Chris@16
|
65 , terminal_ex<tag::ushort_, fusion::vector1<A0> > >
|
Chris@16
|
66 : is_arithmetic<A0> {};
|
Chris@16
|
67
|
Chris@16
|
68 template <> // enables *lazy* ushort_(n)
|
Chris@16
|
69 struct use_lazy_terminal<qi::domain, tag::ushort_, 1> : mpl::true_ {};
|
Chris@16
|
70
|
Chris@16
|
71 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
72 template <> // enables uint_
|
Chris@16
|
73 struct use_terminal<qi::domain, tag::uint_> : mpl::true_ {};
|
Chris@16
|
74
|
Chris@16
|
75 template <typename A0> // enables lit(n)
|
Chris@16
|
76 struct use_terminal<qi::domain
|
Chris@16
|
77 , terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
78 , typename enable_if<is_same<A0, unsigned> >::type>
|
Chris@16
|
79 : mpl::true_ {};
|
Chris@16
|
80
|
Chris@16
|
81 template <typename A0> // enables uint_(n)
|
Chris@16
|
82 struct use_terminal<qi::domain
|
Chris@16
|
83 , terminal_ex<tag::uint_, fusion::vector1<A0> > >
|
Chris@16
|
84 : is_arithmetic<A0> {};
|
Chris@16
|
85
|
Chris@16
|
86 template <> // enables *lazy* uint_(n)
|
Chris@16
|
87 struct use_lazy_terminal<qi::domain, tag::uint_, 1> : mpl::true_ {};
|
Chris@16
|
88
|
Chris@16
|
89 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
90 template <> // enables ulong_
|
Chris@16
|
91 struct use_terminal<qi::domain, tag::ulong_> : mpl::true_ {};
|
Chris@16
|
92
|
Chris@16
|
93 template <typename A0> // enables lit(n)
|
Chris@16
|
94 struct use_terminal<qi::domain
|
Chris@16
|
95 , terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
96 , typename enable_if<is_same<A0, unsigned long> >::type>
|
Chris@16
|
97 : mpl::true_ {};
|
Chris@16
|
98
|
Chris@16
|
99 template <typename A0> // enables ulong_(n)
|
Chris@16
|
100 struct use_terminal<qi::domain
|
Chris@16
|
101 , terminal_ex<tag::ulong_, fusion::vector1<A0> > >
|
Chris@16
|
102 : is_arithmetic<A0> {};
|
Chris@16
|
103
|
Chris@16
|
104 template <> // enables *lazy* ulong_(n)
|
Chris@16
|
105 struct use_lazy_terminal<qi::domain, tag::ulong_, 1> : mpl::true_ {};
|
Chris@16
|
106
|
Chris@16
|
107 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
108 #ifdef BOOST_HAS_LONG_LONG
|
Chris@16
|
109 template <> // enables ulong_long
|
Chris@16
|
110 struct use_terminal<qi::domain, tag::ulong_long> : mpl::true_ {};
|
Chris@16
|
111
|
Chris@16
|
112 template <typename A0> // enables lit(n)
|
Chris@16
|
113 struct use_terminal<qi::domain
|
Chris@16
|
114 , terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
115 , typename enable_if<is_same<A0, boost::ulong_long_type> >::type>
|
Chris@16
|
116 : mpl::true_ {};
|
Chris@16
|
117
|
Chris@16
|
118 template <typename A0> // enables ulong_long(n)
|
Chris@16
|
119 struct use_terminal<qi::domain
|
Chris@16
|
120 , terminal_ex<tag::ulong_long, fusion::vector1<A0> > >
|
Chris@16
|
121 : is_arithmetic<A0> {};
|
Chris@16
|
122
|
Chris@16
|
123 template <> // enables *lazy* ulong_long(n)
|
Chris@16
|
124 struct use_lazy_terminal<qi::domain, tag::ulong_long, 1> : mpl::true_ {};
|
Chris@16
|
125 #endif
|
Chris@16
|
126
|
Chris@16
|
127 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
128 template <> // enables bin
|
Chris@16
|
129 struct use_terminal<qi::domain, tag::bin> : mpl::true_ {};
|
Chris@16
|
130
|
Chris@16
|
131 template <typename A0> // enables bin(n)
|
Chris@16
|
132 struct use_terminal<qi::domain
|
Chris@16
|
133 , terminal_ex<tag::bin, fusion::vector1<A0> > >
|
Chris@16
|
134 : is_arithmetic<A0> {};
|
Chris@16
|
135
|
Chris@16
|
136 template <> // enables *lazy* bin(n)
|
Chris@16
|
137 struct use_lazy_terminal<qi::domain, tag::bin, 1> : mpl::true_ {};
|
Chris@16
|
138
|
Chris@16
|
139 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
140 template <> // enables oct
|
Chris@16
|
141 struct use_terminal<qi::domain, tag::oct> : mpl::true_ {};
|
Chris@16
|
142
|
Chris@16
|
143 template <typename A0> // enables oct(n)
|
Chris@16
|
144 struct use_terminal<qi::domain
|
Chris@16
|
145 , terminal_ex<tag::oct, fusion::vector1<A0> > >
|
Chris@16
|
146 : is_arithmetic<A0> {};
|
Chris@16
|
147
|
Chris@16
|
148 template <> // enables *lazy* oct(n)
|
Chris@16
|
149 struct use_lazy_terminal<qi::domain, tag::oct, 1> : mpl::true_ {};
|
Chris@16
|
150
|
Chris@16
|
151 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
152 template <> // enables hex
|
Chris@16
|
153 struct use_terminal<qi::domain, tag::hex> : mpl::true_ {};
|
Chris@16
|
154
|
Chris@16
|
155 template <typename A0> // enables hex(n)
|
Chris@16
|
156 struct use_terminal<qi::domain
|
Chris@16
|
157 , terminal_ex<tag::hex, fusion::vector1<A0> > >
|
Chris@16
|
158 : is_arithmetic<A0> {};
|
Chris@16
|
159
|
Chris@16
|
160 template <> // enables *lazy* hex(n)
|
Chris@16
|
161 struct use_lazy_terminal<qi::domain, tag::hex, 1> : mpl::true_ {};
|
Chris@16
|
162
|
Chris@16
|
163 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
164 // enables any custom uint_parser
|
Chris@16
|
165 template <typename T, unsigned Radix, unsigned MinDigits
|
Chris@16
|
166 , int MaxDigits>
|
Chris@16
|
167 struct use_terminal<qi::domain
|
Chris@16
|
168 , tag::uint_parser<T, Radix, MinDigits, MaxDigits> >
|
Chris@16
|
169 : mpl::true_ {};
|
Chris@16
|
170
|
Chris@16
|
171 // enables any custom uint_parser(n)
|
Chris@16
|
172 template <typename T, unsigned Radix, unsigned MinDigits
|
Chris@16
|
173 , int MaxDigits, typename A0>
|
Chris@16
|
174 struct use_terminal<qi::domain
|
Chris@16
|
175 , terminal_ex<tag::uint_parser<T, Radix, MinDigits, MaxDigits>
|
Chris@16
|
176 , fusion::vector1<A0> >
|
Chris@16
|
177 > : mpl::true_ {};
|
Chris@16
|
178
|
Chris@16
|
179 // enables *lazy* custom uint_parser(n)
|
Chris@16
|
180 template <typename T, unsigned Radix, unsigned MinDigits
|
Chris@16
|
181 , int MaxDigits>
|
Chris@16
|
182 struct use_lazy_terminal<qi::domain
|
Chris@16
|
183 , tag::uint_parser<T, Radix, MinDigits, MaxDigits>, 1
|
Chris@16
|
184 > : mpl::true_ {};
|
Chris@16
|
185 }}
|
Chris@16
|
186
|
Chris@16
|
187 namespace boost { namespace spirit { namespace qi
|
Chris@16
|
188 {
|
Chris@16
|
189 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
Chris@16
|
190 using spirit::bin;
|
Chris@16
|
191 using spirit::oct;
|
Chris@16
|
192 using spirit::hex;
|
Chris@16
|
193
|
Chris@16
|
194 using spirit::ushort_;
|
Chris@16
|
195 using spirit::uint_;
|
Chris@16
|
196 using spirit::ulong_;
|
Chris@16
|
197 #ifdef BOOST_HAS_LONG_LONG
|
Chris@16
|
198 using spirit::ulong_long;
|
Chris@16
|
199 #endif
|
Chris@16
|
200 using spirit::lit; // lit(1) is equivalent to 1
|
Chris@16
|
201 #endif
|
Chris@16
|
202
|
Chris@16
|
203 using spirit::bin_type;
|
Chris@16
|
204 using spirit::oct_type;
|
Chris@16
|
205 using spirit::hex_type;
|
Chris@16
|
206
|
Chris@16
|
207 using spirit::ushort_type;
|
Chris@16
|
208 using spirit::uint_type;
|
Chris@16
|
209 using spirit::ulong_type;
|
Chris@16
|
210 #ifdef BOOST_HAS_LONG_LONG
|
Chris@16
|
211 using spirit::ulong_long_type;
|
Chris@16
|
212 #endif
|
Chris@16
|
213 using spirit::lit_type;
|
Chris@16
|
214
|
Chris@16
|
215 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
216 // This is the actual uint parser
|
Chris@16
|
217 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
218 template <typename T, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
219 , int MaxDigits = -1>
|
Chris@16
|
220 struct any_uint_parser
|
Chris@16
|
221 : primitive_parser<any_uint_parser<T, Radix, MinDigits, MaxDigits> >
|
Chris@16
|
222 {
|
Chris@16
|
223 // check template parameter 'Radix' for validity
|
Chris@16
|
224 BOOST_SPIRIT_ASSERT_MSG(
|
Chris@16
|
225 Radix >= 2 && Radix <= 36,
|
Chris@16
|
226 not_supported_radix, ());
|
Chris@16
|
227
|
Chris@16
|
228 template <typename Context, typename Iterator>
|
Chris@16
|
229 struct attribute
|
Chris@16
|
230 {
|
Chris@16
|
231 typedef T type;
|
Chris@16
|
232 };
|
Chris@16
|
233
|
Chris@16
|
234 template <typename Iterator, typename Context
|
Chris@16
|
235 , typename Skipper, typename Attribute>
|
Chris@16
|
236 bool parse(Iterator& first, Iterator const& last
|
Chris@16
|
237 , Context& /*context*/, Skipper const& skipper
|
Chris@16
|
238 , Attribute& attr_) const
|
Chris@16
|
239 {
|
Chris@16
|
240 typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract;
|
Chris@16
|
241 qi::skip_over(first, last, skipper);
|
Chris@16
|
242 return extract::call(first, last, attr_);
|
Chris@16
|
243 }
|
Chris@16
|
244
|
Chris@16
|
245 template <typename Context>
|
Chris@16
|
246 info what(Context& /*context*/) const
|
Chris@16
|
247 {
|
Chris@16
|
248 return info("unsigned-integer");
|
Chris@16
|
249 }
|
Chris@16
|
250 };
|
Chris@16
|
251 //]
|
Chris@16
|
252
|
Chris@16
|
253 template <typename T, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
254 , int MaxDigits = -1, bool no_attribute = true>
|
Chris@16
|
255 struct literal_uint_parser
|
Chris@16
|
256 : primitive_parser<literal_uint_parser<T, Radix, MinDigits, MaxDigits
|
Chris@16
|
257 , no_attribute> >
|
Chris@16
|
258 {
|
Chris@16
|
259 // check template parameter 'Radix' for validity
|
Chris@16
|
260 BOOST_SPIRIT_ASSERT_MSG(
|
Chris@16
|
261 Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
|
Chris@16
|
262 not_supported_radix, ());
|
Chris@16
|
263
|
Chris@16
|
264 template <typename Value>
|
Chris@16
|
265 literal_uint_parser(Value const& n) : n_(n) {}
|
Chris@16
|
266
|
Chris@16
|
267 template <typename Context, typename Iterator>
|
Chris@16
|
268 struct attribute
|
Chris@16
|
269 : mpl::if_c<no_attribute, unused_type, T>
|
Chris@16
|
270 {};
|
Chris@16
|
271
|
Chris@16
|
272 template <typename Iterator, typename Context
|
Chris@16
|
273 , typename Skipper, typename Attribute>
|
Chris@16
|
274 bool parse(Iterator& first, Iterator const& last
|
Chris@16
|
275 , Context& /*context*/, Skipper const& skipper
|
Chris@16
|
276 , Attribute& attr_param) const
|
Chris@16
|
277 {
|
Chris@16
|
278 typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract;
|
Chris@16
|
279 qi::skip_over(first, last, skipper);
|
Chris@16
|
280
|
Chris@16
|
281 Iterator save = first;
|
Chris@16
|
282 T attr_;
|
Chris@16
|
283
|
Chris@16
|
284 if (extract::call(first, last, attr_) && (attr_ == n_))
|
Chris@16
|
285 {
|
Chris@16
|
286 traits::assign_to(attr_, attr_param);
|
Chris@16
|
287 return true;
|
Chris@16
|
288 }
|
Chris@16
|
289
|
Chris@16
|
290 first = save;
|
Chris@16
|
291 return false;
|
Chris@16
|
292 }
|
Chris@16
|
293
|
Chris@16
|
294 template <typename Context>
|
Chris@16
|
295 info what(Context& /*context*/) const
|
Chris@16
|
296 {
|
Chris@16
|
297 return info("unsigned-integer");
|
Chris@16
|
298 }
|
Chris@16
|
299
|
Chris@16
|
300 T n_;
|
Chris@16
|
301 };
|
Chris@16
|
302
|
Chris@16
|
303 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
304 // Parser generators: make_xxx function (objects)
|
Chris@16
|
305 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
306 template <typename T, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
307 , int MaxDigits = -1>
|
Chris@16
|
308 struct make_uint
|
Chris@16
|
309 {
|
Chris@16
|
310 typedef any_uint_parser<T, Radix, MinDigits, MaxDigits> result_type;
|
Chris@16
|
311 result_type operator()(unused_type, unused_type) const
|
Chris@16
|
312 {
|
Chris@16
|
313 return result_type();
|
Chris@16
|
314 }
|
Chris@16
|
315 };
|
Chris@16
|
316
|
Chris@16
|
317 template <typename T, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
318 , int MaxDigits = -1>
|
Chris@16
|
319 struct make_direct_uint
|
Chris@16
|
320 {
|
Chris@16
|
321 typedef literal_uint_parser<T, Radix, MinDigits, MaxDigits, false>
|
Chris@16
|
322 result_type;
|
Chris@16
|
323 template <typename Terminal>
|
Chris@16
|
324 result_type operator()(Terminal const& term, unused_type) const
|
Chris@16
|
325 {
|
Chris@16
|
326 return result_type(fusion::at_c<0>(term.args));
|
Chris@16
|
327 }
|
Chris@16
|
328 };
|
Chris@16
|
329
|
Chris@16
|
330 template <typename T, unsigned Radix = 10, unsigned MinDigits = 1
|
Chris@16
|
331 , int MaxDigits = -1>
|
Chris@16
|
332 struct make_literal_uint
|
Chris@16
|
333 {
|
Chris@16
|
334 typedef literal_uint_parser<T, Radix, MinDigits, MaxDigits> result_type;
|
Chris@16
|
335 template <typename Terminal>
|
Chris@16
|
336 result_type operator()(Terminal const& term, unused_type) const
|
Chris@16
|
337 {
|
Chris@16
|
338 return result_type(fusion::at_c<0>(term.args));
|
Chris@16
|
339 }
|
Chris@16
|
340 };
|
Chris@16
|
341
|
Chris@16
|
342 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
343 template <typename Modifiers, typename A0>
|
Chris@16
|
344 struct make_primitive<
|
Chris@16
|
345 terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
346 , Modifiers, typename enable_if<is_same<A0, unsigned short> >::type>
|
Chris@16
|
347 : make_literal_uint<unsigned short> {};
|
Chris@16
|
348
|
Chris@16
|
349 template <typename Modifiers, typename A0>
|
Chris@16
|
350 struct make_primitive<
|
Chris@16
|
351 terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
352 , Modifiers, typename enable_if<is_same<A0, unsigned> >::type>
|
Chris@16
|
353 : make_literal_uint<unsigned> {};
|
Chris@16
|
354
|
Chris@16
|
355 template <typename Modifiers, typename A0>
|
Chris@16
|
356 struct make_primitive<
|
Chris@16
|
357 terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
358 , Modifiers, typename enable_if<is_same<A0, unsigned long> >::type>
|
Chris@16
|
359 : make_literal_uint<unsigned long> {};
|
Chris@16
|
360
|
Chris@16
|
361 #ifdef BOOST_HAS_LONG_LONG
|
Chris@16
|
362 template <typename Modifiers, typename A0>
|
Chris@16
|
363 struct make_primitive<
|
Chris@16
|
364 terminal_ex<tag::lit, fusion::vector1<A0> >
|
Chris@16
|
365 , Modifiers, typename enable_if<is_same<A0, boost::ulong_long_type> >::type>
|
Chris@16
|
366 : make_literal_uint<boost::ulong_long_type> {};
|
Chris@16
|
367 #endif
|
Chris@16
|
368
|
Chris@16
|
369 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
370 template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits
|
Chris@16
|
371 , typename Modifiers>
|
Chris@16
|
372 struct make_primitive<
|
Chris@16
|
373 tag::uint_parser<T, Radix, MinDigits, MaxDigits>
|
Chris@16
|
374 , Modifiers>
|
Chris@16
|
375 : make_uint<T, Radix, MinDigits, MaxDigits> {};
|
Chris@16
|
376
|
Chris@16
|
377 template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits
|
Chris@16
|
378 , typename A0, typename Modifiers>
|
Chris@16
|
379 struct make_primitive<
|
Chris@16
|
380 terminal_ex<tag::uint_parser<T, Radix, MinDigits, MaxDigits>
|
Chris@16
|
381 , fusion::vector1<A0> >, Modifiers>
|
Chris@16
|
382 : make_direct_uint<T, Radix, MinDigits, MaxDigits> {};
|
Chris@16
|
383
|
Chris@16
|
384 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
385 template <typename Modifiers>
|
Chris@16
|
386 struct make_primitive<tag::bin, Modifiers>
|
Chris@16
|
387 : make_uint<unsigned, 2> {};
|
Chris@16
|
388
|
Chris@16
|
389 template <typename Modifiers, typename A0>
|
Chris@16
|
390 struct make_primitive<
|
Chris@16
|
391 terminal_ex<tag::bin
|
Chris@16
|
392 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
393 : make_direct_uint<unsigned, 2> {};
|
Chris@16
|
394
|
Chris@16
|
395 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
396 template <typename Modifiers>
|
Chris@16
|
397 struct make_primitive<tag::oct, Modifiers>
|
Chris@16
|
398 : make_uint<unsigned, 8> {};
|
Chris@16
|
399
|
Chris@16
|
400 template <typename Modifiers, typename A0>
|
Chris@16
|
401 struct make_primitive<
|
Chris@16
|
402 terminal_ex<tag::oct
|
Chris@16
|
403 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
404 : make_direct_uint<unsigned, 8> {};
|
Chris@16
|
405
|
Chris@16
|
406 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
407 template <typename Modifiers>
|
Chris@16
|
408 struct make_primitive<tag::hex, Modifiers>
|
Chris@16
|
409 : make_uint<unsigned, 16> {};
|
Chris@16
|
410
|
Chris@16
|
411 template <typename Modifiers, typename A0>
|
Chris@16
|
412 struct make_primitive<
|
Chris@16
|
413 terminal_ex<tag::hex
|
Chris@16
|
414 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
415 : make_direct_uint<unsigned, 16> {};
|
Chris@16
|
416
|
Chris@16
|
417 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
418 template <typename Modifiers>
|
Chris@16
|
419 struct make_primitive<tag::ushort_, Modifiers>
|
Chris@16
|
420 : make_uint<unsigned short> {};
|
Chris@16
|
421
|
Chris@16
|
422 template <typename Modifiers, typename A0>
|
Chris@16
|
423 struct make_primitive<
|
Chris@16
|
424 terminal_ex<tag::ushort_
|
Chris@16
|
425 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
426 : make_direct_uint<unsigned short> {};
|
Chris@16
|
427
|
Chris@16
|
428 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
429 template <typename Modifiers>
|
Chris@16
|
430 struct make_primitive<tag::uint_, Modifiers>
|
Chris@16
|
431 : make_uint<unsigned> {};
|
Chris@16
|
432
|
Chris@16
|
433 template <typename Modifiers, typename A0>
|
Chris@16
|
434 struct make_primitive<
|
Chris@16
|
435 terminal_ex<tag::uint_
|
Chris@16
|
436 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
437 : make_direct_uint<unsigned> {};
|
Chris@16
|
438
|
Chris@16
|
439 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
440 template <typename Modifiers>
|
Chris@16
|
441 struct make_primitive<tag::ulong_, Modifiers>
|
Chris@16
|
442 : make_uint<unsigned long> {};
|
Chris@16
|
443
|
Chris@16
|
444 template <typename Modifiers, typename A0>
|
Chris@16
|
445 struct make_primitive<
|
Chris@16
|
446 terminal_ex<tag::ulong_
|
Chris@16
|
447 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
448 : make_direct_uint<unsigned long> {};
|
Chris@16
|
449
|
Chris@16
|
450 ///////////////////////////////////////////////////////////////////////////
|
Chris@16
|
451 #ifdef BOOST_HAS_LONG_LONG
|
Chris@16
|
452 template <typename Modifiers>
|
Chris@16
|
453 struct make_primitive<tag::ulong_long, Modifiers>
|
Chris@16
|
454 : make_uint<boost::ulong_long_type> {};
|
Chris@16
|
455
|
Chris@16
|
456 template <typename Modifiers, typename A0>
|
Chris@16
|
457 struct make_primitive<
|
Chris@16
|
458 terminal_ex<tag::ulong_long
|
Chris@16
|
459 , fusion::vector1<A0> > , Modifiers>
|
Chris@16
|
460 : make_direct_uint<boost::ulong_long_type> {};
|
Chris@16
|
461 #endif
|
Chris@16
|
462 }}}
|
Chris@16
|
463
|
Chris@16
|
464 #endif
|