Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 // 
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_KARMA_STRING_COMPARE_AUG_08_2009_0756PM)
0007 #define BOOST_SPIRIT_KARMA_STRING_COMPARE_AUG_08_2009_0756PM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/spirit/home/support/char_class.hpp>
0014 #include <boost/spirit/home/karma/detail/generate_to.hpp>
0015 
0016 namespace boost { namespace spirit { namespace karma { namespace detail
0017 {
0018     template <typename Char>
0019     bool string_compare(Char const* attr, Char const* lit)
0020     {
0021         Char ch_attr = *attr;
0022         Char ch_lit = *lit;
0023 
0024         while (!!ch_lit && !!ch_attr)
0025         {
0026             if (ch_attr != ch_lit)
0027                 return false;
0028 
0029             ch_attr = *++attr;
0030             ch_lit = *++lit;
0031         }
0032 
0033         return !ch_lit && !ch_attr;
0034     }
0035 
0036     template <typename Char>
0037     bool string_compare(Char const* attr, Char const* lit, unused_type, unused_type)
0038     {
0039         return string_compare(attr, lit);
0040     }
0041 
0042     template <typename Char>
0043     bool string_compare(unused_type, Char const*, unused_type, unused_type)
0044     {
0045         return true;
0046     }
0047 
0048     template <typename Char, typename CharEncoding, typename Tag>
0049     bool string_compare(Char const* attr, Char const* lit, CharEncoding, Tag)
0050     {
0051         Char ch_attr = *attr;
0052         Char ch_lit = spirit::char_class::convert<CharEncoding>::to(Tag(), *lit);
0053 
0054         while (!!ch_lit && !!ch_attr)
0055         {
0056             if (ch_attr != ch_lit)
0057                 return false;
0058 
0059             ch_attr = *++attr;
0060             ch_lit = spirit::char_class::convert<CharEncoding>::to(Tag(), *++lit);
0061         }
0062 
0063         return !ch_lit && !ch_attr;
0064     }
0065 
0066     template <typename Char, typename CharEncoding, typename Tag>
0067     bool string_compare(unused_type, Char const*, CharEncoding, Tag)
0068     {
0069         return true;
0070     }
0071 
0072 }}}}
0073 
0074 #endif