File indexing completed on 2025-01-18 09:53:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
0017 #include <boost/cstdint.hpp> // for BOOST_STATIC_CONSTANT
0018 #include <boost/detail/workaround.hpp>
0019
0020 namespace boost { namespace xpressive { namespace detail
0021 {
0022
0023
0024
0025
0026 template<typename Char, boost::intmax_t Ch, boost::intmax_t Wch>
0027 struct char_literal;
0028
0029 template<typename Char, boost::intmax_t Ch>
0030 struct char_literal<Char, Ch, Ch>
0031 {
0032 BOOST_STATIC_CONSTANT(boost::intmax_t, value = Ch);
0033 };
0034
0035 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
0036 template<typename Char, boost::intmax_t Ch>
0037 boost::intmax_t const char_literal<Char, Ch, Ch>::value;
0038 #endif
0039
0040 template<typename Ch>
0041 struct string_literal;
0042
0043 template<>
0044 struct string_literal<char>
0045 {
0046 static BOOST_CONSTEXPR char const *pick(char const *cstr, wchar_t const *)
0047 {
0048 return cstr;
0049 }
0050
0051 static BOOST_CONSTEXPR char pick(char ch, wchar_t)
0052 {
0053 return ch;
0054 }
0055 };
0056
0057 template<>
0058 struct string_literal<wchar_t>
0059 {
0060 static BOOST_CONSTEXPR wchar_t const *pick(char const *, wchar_t const *cstr)
0061 {
0062 return cstr;
0063 }
0064
0065 static BOOST_CONSTEXPR wchar_t pick(char, wchar_t ch)
0066 {
0067 return ch;
0068 }
0069 };
0070
0071 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
0072
0073 # define BOOST_XPR_CHAR_(Char, ch) ch
0074 # define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal<Char>::pick(st, L##st)
0075
0076 #else
0077
0078 # define BOOST_XPR_CHAR_(Char, ch) boost::xpressive::detail::char_literal<Char, ch, L##ch>::value
0079 # define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal<Char>::pick(st, L##st)
0080
0081 #endif
0082
0083 }}}
0084
0085 #endif