1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM)
8 #define BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM
14 #include <boost/spirit/home/qi/detail/assign_to.hpp>
16 namespace boost { namespace spirit { namespace qi { namespace detail
18 template <typename Char, typename Iterator, typename Attribute>
19 inline bool string_parse(
21 , Iterator& first, Iterator const& last, Attribute& attr)
28 if (i == last || (ch != *i))
33 spirit::traits::assign_to(first, i, attr);
38 template <typename String, typename Iterator, typename Attribute>
39 inline bool string_parse(
41 , Iterator& first, Iterator const& last, Attribute& attr)
44 typename String::const_iterator stri = str.begin();
45 typename String::const_iterator str_last = str.end();
47 for (; stri != str_last; ++stri, ++i)
48 if (i == last || (*stri != *i))
50 spirit::traits::assign_to(first, i, attr);
55 template <typename Char, typename Iterator, typename Attribute>
56 inline bool string_parse(
57 Char const* uc_i, Char const* lc_i
58 , Iterator& first, Iterator const& last, Attribute& attr)
62 for (; *uc_i && *lc_i; ++uc_i, ++lc_i, ++i)
63 if (i == last || ((*uc_i != *i) && (*lc_i != *i)))
65 spirit::traits::assign_to(first, i, attr);
70 template <typename String, typename Iterator, typename Attribute>
71 inline bool string_parse(
72 String const& ucstr, String const& lcstr
73 , Iterator& first, Iterator const& last, Attribute& attr)
75 typename String::const_iterator uc_i = ucstr.begin();
76 typename String::const_iterator uc_last = ucstr.end();
77 typename String::const_iterator lc_i = lcstr.begin();
80 for (; uc_i != uc_last; ++uc_i, ++lc_i, ++i)
81 if (i == last || ((*uc_i != *i) && (*lc_i != *i)))
83 spirit::traits::assign_to(first, i, attr);