File indexing completed on 2025-01-19 09:47:50
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_GET_ENCODING_JANUARY_13_2009_1255PM)
0008 #define BOOST_SPIRIT_GET_ENCODING_JANUARY_13_2009_1255PM
0009
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013
0014 #include <boost/mpl/identity.hpp>
0015 #include <boost/type_traits/is_same.hpp>
0016
0017 namespace boost { namespace spirit { namespace detail
0018 {
0019 template <typename Modifiers, typename Encoding>
0020 struct get_implicit_encoding
0021 {
0022
0023
0024
0025
0026
0027 typedef typename
0028 mpl::find_if<
0029 char_encodings,
0030 has_modifier<Modifiers, tag::char_encoding_base<mpl::_1> >
0031 >::type
0032 iter;
0033
0034 typedef typename
0035 mpl::eval_if<
0036 is_same<iter, typename mpl::end<char_encodings>::type>,
0037 mpl::identity<Encoding>,
0038 mpl::deref<iter>
0039 >::type
0040 type;
0041 };
0042
0043 template <typename Modifiers, typename Encoding>
0044 struct get_encoding
0045 {
0046
0047
0048
0049
0050
0051 typedef typename
0052 mpl::find_if<
0053 char_encodings,
0054 has_modifier<Modifiers, tag::char_code<tag::encoding, mpl::_1> >
0055 >::type
0056 iter;
0057
0058 typedef typename
0059 mpl::eval_if<
0060 is_same<iter, typename mpl::end<char_encodings>::type>,
0061 get_implicit_encoding<Modifiers, Encoding>,
0062 mpl::deref<iter>
0063 >::type
0064 type;
0065 };
0066
0067 template <typename Modifiers, typename Encoding, bool case_modifier = false>
0068 struct get_encoding_with_case : mpl::identity<Encoding> {};
0069
0070 template <typename Modifiers, typename Encoding>
0071 struct get_encoding_with_case<Modifiers, Encoding, true>
0072 : get_encoding<Modifiers, Encoding> {};
0073 }}}
0074
0075 #endif