comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/numeric/bool_policies.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) 2009 Hartmut Kaiser
3 Copyright (c) 2014 Joel de Guzman
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM)
9 #define SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM
10
11 #if defined(_MSC_VER)
12 #pragma once
13 #endif
14
15 #include <boost/spirit/home/x3/string/detail/string_parse.hpp>
16 #include <boost/spirit/home/x3/support/traits/move_to.hpp>
17
18 namespace boost { namespace spirit { namespace x3
19 {
20 ///////////////////////////////////////////////////////////////////////////
21 // Default boolean policies
22 ///////////////////////////////////////////////////////////////////////////
23 template <typename T = bool>
24 struct bool_policies
25 {
26 template <typename Iterator, typename Attribute>
27 static bool
28 parse_true(Iterator& first, Iterator const& last, Attribute& attr_)
29 {
30 if (detail::string_parse("true", first, last, unused))
31 {
32 traits::move_to(T(true), attr_); // result is true
33 return true;
34 }
35 return false;
36 }
37
38 template <typename Iterator, typename Attribute>
39 static bool
40 parse_false(Iterator& first, Iterator const& last, Attribute& attr_)
41 {
42 if (detail::string_parse("false", first, last, unused))
43 {
44 traits::move_to(T(false), attr_); // result is false
45 return true;
46 }
47 return false;
48 }
49 };
50 }}}
51
52 #endif