Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/numeric/real.hpp @ 102:f46d142149f5
Whoops, finish that update
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:13:41 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
101:c530137014c0 | 102:f46d142149f5 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2001-2014 Joel de Guzman | |
3 | |
4 Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 ==============================================================================*/ | |
7 #if !defined(BOOST_SPIRIT_X3_REAL_APRIL_18_2006_0850AM) | |
8 #define BOOST_SPIRIT_X3_REAL_APRIL_18_2006_0850AM | |
9 | |
10 #include <boost/spirit/home/x3/core/parser.hpp> | |
11 #include <boost/spirit/home/x3/core/skip_over.hpp> | |
12 #include <boost/spirit/home/x3/numeric/real_policies.hpp> | |
13 #include <boost/spirit/home/x3/support/numeric_utils/extract_real.hpp> | |
14 | |
15 namespace boost { namespace spirit { namespace x3 | |
16 { | |
17 template <typename T, typename RealPolicies = real_policies<T> > | |
18 struct real_parser : parser<real_parser<T, RealPolicies> > | |
19 { | |
20 typedef T attribute_type; | |
21 static bool const has_attribute = true; | |
22 | |
23 real_parser() | |
24 : policies() {} | |
25 | |
26 real_parser(RealPolicies const& policies) | |
27 : policies(policies) {} | |
28 | |
29 template <typename Iterator, typename Context> | |
30 bool parse(Iterator& first, Iterator const& last | |
31 , Context& context, unused_type, T& attr_) const | |
32 { | |
33 x3::skip_over(first, last, context); | |
34 return extract_real<T, RealPolicies>::parse(first, last, attr_, policies); | |
35 } | |
36 | |
37 template <typename Iterator, typename Context, typename Attribute> | |
38 bool parse(Iterator& first, Iterator const& last | |
39 , Context& context, unused_type, Attribute& attr_param) const | |
40 { | |
41 // this case is called when Attribute is not T | |
42 T attr_; | |
43 if (parse(first, last, context, unused, attr_)) | |
44 { | |
45 traits::move_to(attr_, attr_param); | |
46 return true; | |
47 } | |
48 return false; | |
49 } | |
50 | |
51 RealPolicies policies; | |
52 }; | |
53 | |
54 typedef real_parser<float> float_type; | |
55 float_type const float_ = {}; | |
56 | |
57 typedef real_parser<double> double_type; | |
58 double_type const double_ = {}; | |
59 | |
60 }}} | |
61 | |
62 #endif |