Warning, file /include/boost/spirit/home/x3/char/literal_char.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_SPIRIT_X3_LITERAL_CHAR_APRIL_16_2006_1051AM)
0008 #define BOOST_SPIRIT_X3_LITERAL_CHAR_APRIL_16_2006_1051AM
0009
0010 #include <boost/spirit/home/x3/char/char_parser.hpp>
0011 #include <boost/spirit/home/x3/support/utility/utf8.hpp>
0012 #include <boost/type_traits/is_same.hpp>
0013
0014 namespace boost { namespace spirit { namespace x3
0015 {
0016 template <typename Encoding, typename Attribute = typename Encoding::char_type>
0017 struct literal_char : char_parser<literal_char<Encoding, Attribute>>
0018 {
0019 typedef typename Encoding::char_type char_type;
0020 typedef Encoding encoding;
0021 typedef Attribute attribute_type;
0022 static bool const has_attribute =
0023 !is_same<unused_type, attribute_type>::value;
0024
0025 template <typename Char>
0026 constexpr literal_char(Char ch)
0027 : ch(static_cast<char_type>(ch)) {}
0028
0029 template <typename Char, typename Context>
0030 bool test(Char ch_, Context const& context) const
0031 {
0032 return get_case_compare<encoding>(context)(ch, char_type(ch_)) == 0;
0033 }
0034
0035 char_type ch;
0036 };
0037
0038 template <typename Encoding, typename Attribute>
0039 struct get_info<literal_char<Encoding, Attribute>>
0040 {
0041 typedef std::string result_type;
0042 std::string operator()(literal_char<Encoding, Attribute> const& p) const
0043 {
0044 return '\'' + to_utf8(Encoding::toucs4(p.ch)) + '\'';
0045 }
0046 };
0047 }}}
0048
0049 #endif