From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/spirit/test/qi/bool.hpp | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/boost/libs/spirit/test/qi/bool.hpp (limited to 'src/boost/libs/spirit/test/qi/bool.hpp') diff --git a/src/boost/libs/spirit/test/qi/bool.hpp b/src/boost/libs/spirit/test/qi/bool.hpp new file mode 100644 index 00000000..571e41c3 --- /dev/null +++ b/src/boost/libs/spirit/test/qi/bool.hpp @@ -0,0 +1,47 @@ +/*============================================================================= + Copyright (c) 2001-2011 Hartmut Kaiser + Copyright (c) 2011 Bryce Lelbach + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_SPIRIT_TEST_QI_BOOL) +#define BOOST_SPIRIT_TEST_QI_BOOL + +#include + +#include +#include +#include +#include +#include +#include "test.hpp" + +/////////////////////////////////////////////////////////////////////////////// +struct backwards_bool_policies : boost::spirit::qi::bool_policies<> +{ + // we want to interpret a 'true' spelled backwards as 'false' + template + static bool + parse_false(Iterator& first, Iterator const& last, Attribute& attr) + { + namespace spirit = boost::spirit; + namespace qi = boost::spirit::qi; + if (qi::detail::string_parse("eurt", first, last, qi::unused)) + { + spirit::traits::assign_to(false, attr); // result is false + return true; + } + return false; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +struct test_bool_type +{ + test_bool_type(bool b) : b(b) {} // provide conversion + bool b; +}; + +#endif + -- cgit v1.2.3