| Server IP : 217.160.0.212 / Your IP : 216.73.216.60 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/include/boost/spirit/home/qi/numeric/ |
Upload File : |
/*=============================================================================
Copyright (c) 2001-2011 Hartmut Kaiser
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)
==============================================================================*/
#ifndef BOOST_SPIRIT_QI_NUMERIC_BOOL_POLICIES_HPP
#define BOOST_SPIRIT_QI_NUMERIC_BOOL_POLICIES_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/qi/detail/string_parse.hpp>
#include <boost/spirit/home/qi/detail/assign_to.hpp>
namespace boost { namespace spirit { namespace qi
{
///////////////////////////////////////////////////////////////////////////
// Default boolean policies
///////////////////////////////////////////////////////////////////////////
template <typename T = bool>
struct bool_policies
{
template <typename Iterator, typename Attribute>
static bool
parse_true(Iterator& first, Iterator const& last, Attribute& attr_)
{
if (detail::string_parse("true", first, last, unused))
{
spirit::traits::assign_to(T(true), attr_); // result is true
return true;
}
return false;
}
template <typename Iterator, typename Attribute>
static bool
parse_false(Iterator& first, Iterator const& last, Attribute& attr_)
{
if (detail::string_parse("false", first, last, unused))
{
spirit::traits::assign_to(T(false), attr_); // result is false
return true;
}
return false;
}
};
///////////////////////////////////////////////////////////////////////////
template <typename T = bool>
struct no_case_bool_policies
{
template <typename Iterator, typename Attribute>
static bool
parse_true(Iterator& first, Iterator const& last, Attribute& attr_)
{
if (detail::string_parse("true", "TRUE", first, last, unused))
{
spirit::traits::assign_to(T(true), attr_); // result is true
return true;
}
return false;
}
template <typename Iterator, typename Attribute>
static bool
parse_false(Iterator& first, Iterator const& last, Attribute& attr_)
{
if (detail::string_parse("false", "FALSE", first, last, unused))
{
spirit::traits::assign_to(T(false), attr_); // result is false
return true;
}
return false;
}
};
}}}
#endif