Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
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 #if !defined(BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM)
0008 #define BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/spirit/home/qi/detail/assign_to.hpp>
0015 
0016 namespace boost { namespace spirit { namespace qi { namespace detail
0017 {
0018     template <typename Char, typename Iterator, typename Attribute>
0019     inline bool string_parse(
0020         Char const* str
0021       , Iterator& first, Iterator const& last, Attribute& attr)
0022     {
0023         Iterator i = first;
0024         Char ch = *str;
0025 
0026         for (; !!ch; ++i)
0027         {
0028             if (i == last || (ch != *i))
0029                 return false;
0030             ch = *++str;
0031         }
0032 
0033         spirit::traits::assign_to(first, i, attr);
0034         first = i;
0035         return true;
0036     }
0037 
0038     template <typename String, typename Iterator, typename Attribute>
0039     inline bool string_parse(
0040         String const& str
0041       , Iterator& first, Iterator const& last, Attribute& attr)
0042     {
0043         Iterator i = first;
0044         typename String::const_iterator stri = str.begin();
0045         typename String::const_iterator str_last = str.end();
0046 
0047         for (; stri != str_last; ++stri, ++i)
0048             if (i == last || (*stri != *i))
0049                 return false;
0050         spirit::traits::assign_to(first, i, attr);
0051         first = i;
0052         return true;
0053     }
0054 
0055     template <typename Char, typename Iterator, typename Attribute>
0056     inline bool string_parse(
0057         Char const* uc_i, Char const* lc_i
0058       , Iterator& first, Iterator const& last, Attribute& attr)
0059     {
0060         Iterator i = first;
0061 
0062         for (; *uc_i && *lc_i; ++uc_i, ++lc_i, ++i)
0063             if (i == last || ((*uc_i != *i) && (*lc_i != *i)))
0064                 return false;
0065         spirit::traits::assign_to(first, i, attr);
0066         first = i;
0067         return true;
0068     }
0069 
0070     template <typename String, typename Iterator, typename Attribute>
0071     inline bool string_parse(
0072         String const& ucstr, String const& lcstr
0073       , Iterator& first, Iterator const& last, Attribute& attr)
0074     {
0075         typename String::const_iterator uc_i = ucstr.begin();
0076         typename String::const_iterator uc_last = ucstr.end();
0077         typename String::const_iterator lc_i = lcstr.begin();
0078         Iterator i = first;
0079 
0080         for (; uc_i != uc_last; ++uc_i, ++lc_i, ++i)
0081             if (i == last || ((*uc_i != *i) && (*lc_i != *i)))
0082                 return false;
0083         spirit::traits::assign_to(first, i, attr);
0084         first = i;
0085         return true;
0086     }
0087 }}}}
0088 
0089 #endif