1 /*=============================================================================
2 Copyright (c) 2009 Hartmut Kaiser
3 Copyright (c) 2014 Joel de Guzman
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
11 #include <boost/spirit/home/x3/string/detail/string_parse.hpp>
12 #include <boost/spirit/home/x3/support/traits/move_to.hpp>
14 namespace boost { namespace spirit { namespace x3
16 ///////////////////////////////////////////////////////////////////////////
17 // Default boolean policies
18 ///////////////////////////////////////////////////////////////////////////
19 template <typename T = bool>
22 template <typename Iterator, typename Attribute, typename CaseCompare>
24 parse_true(Iterator& first, Iterator const& last, Attribute& attr_, CaseCompare const& case_compare)
26 if (detail::string_parse("true", first, last, unused, case_compare))
28 traits::move_to(T(true), attr_); // result is true
34 template <typename Iterator, typename Attribute, typename CaseCompare>
36 parse_false(Iterator& first, Iterator const& last, Attribute& attr_, CaseCompare const& case_compare)
38 if (detail::string_parse("false", first, last, unused, case_compare))
40 traits::move_to(T(false), attr_); // result is false