Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:45

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Hartmut Kaiser
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #ifndef BOOST_SPIRIT_QI_NUMERIC_BOOL_POLICIES_HPP
0008 #define BOOST_SPIRIT_QI_NUMERIC_BOOL_POLICIES_HPP
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/spirit/home/qi/detail/string_parse.hpp>
0015 #include <boost/spirit/home/qi/detail/assign_to.hpp>
0016 
0017 namespace boost { namespace spirit { namespace qi
0018 {
0019     ///////////////////////////////////////////////////////////////////////////
0020     //  Default boolean policies
0021     ///////////////////////////////////////////////////////////////////////////
0022     template <typename T = bool>
0023     struct bool_policies
0024     {
0025         template <typename Iterator, typename Attribute>
0026         static bool
0027         parse_true(Iterator& first, Iterator const& last, Attribute& attr_)
0028         {
0029             if (detail::string_parse("true", first, last, unused))
0030             {
0031                 spirit::traits::assign_to(T(true), attr_);    // result is true
0032                 return true;
0033             }
0034             return false;
0035         }
0036 
0037         template <typename Iterator, typename Attribute>
0038         static bool
0039         parse_false(Iterator& first, Iterator const& last, Attribute& attr_)
0040         {
0041             if (detail::string_parse("false", first, last, unused))
0042             {
0043                 spirit::traits::assign_to(T(false), attr_);   // result is false
0044                 return true;
0045             }
0046             return false;
0047         }
0048     };
0049 
0050     ///////////////////////////////////////////////////////////////////////////
0051     template <typename T = bool>
0052     struct no_case_bool_policies
0053     {
0054         template <typename Iterator, typename Attribute>
0055         static bool
0056         parse_true(Iterator& first, Iterator const& last, Attribute& attr_)
0057         {
0058             if (detail::string_parse("true", "TRUE", first, last, unused))
0059             {
0060                 spirit::traits::assign_to(T(true), attr_);    // result is true
0061                 return true;
0062             }
0063             return false;
0064         }
0065 
0066         template <typename Iterator, typename Attribute>
0067         static bool
0068         parse_false(Iterator& first, Iterator const& last, Attribute& attr_)
0069         {
0070             if (detail::string_parse("false", "FALSE", first, last, unused))
0071             {
0072                 spirit::traits::assign_to(T(false), attr_);   // result is false
0073                 return true;
0074             }
0075             return false;
0076         }
0077     };
0078 
0079 }}}
0080 
0081 #endif