File indexing completed on 2025-01-18 09:53:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_HPP_EAN_10_04_2005
0011 #define BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_HPP_EAN_10_04_2005
0012
0013
0014 #include <bitset>
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/xpressive/detail/utility/chset/range_run.ipp>
0017
0018 namespace boost { namespace xpressive { namespace detail
0019 {
0020
0021
0022
0023
0024
0025
0026 template<typename Char>
0027 struct basic_chset
0028 {
0029 basic_chset();
0030 basic_chset(basic_chset const &arg);
0031
0032 bool empty() const;
0033 void set(Char from, Char to);
0034 template<typename Traits>
0035 void set(Char from, Char to, Traits const &tr);
0036 void set(Char c);
0037 template<typename Traits>
0038 void set(Char c, Traits const &tr);
0039
0040 void clear(Char from, Char to);
0041 template<typename Traits>
0042 void clear(Char from, Char to, Traits const &tr);
0043 void clear(Char c);
0044 template<typename Traits>
0045 void clear(Char c, Traits const &tr);
0046 void clear();
0047
0048 template<typename Traits>
0049 bool test(Char v, Traits const &tr, mpl::false_) const;
0050 template<typename Traits>
0051 bool test(Char v, Traits const &tr, mpl::true_) const;
0052
0053 void inverse();
0054 void swap(basic_chset& x);
0055
0056 basic_chset &operator |=(basic_chset const &x);
0057 basic_chset &operator &=(basic_chset const &x);
0058 basic_chset &operator -=(basic_chset const &x);
0059 basic_chset &operator ^=(basic_chset const &x);
0060
0061 private:
0062 range_run<Char> rr_;
0063 };
0064
0065 #if(CHAR_BIT == 8)
0066
0067
0068
0069
0070
0071
0072 template<typename Char>
0073 struct basic_chset_8bit
0074 {
0075 basic_chset_8bit();
0076 basic_chset_8bit(basic_chset_8bit const &arg);
0077
0078 bool empty() const;
0079
0080 void set(Char from, Char to);
0081 template<typename Traits>
0082 void set(Char from, Char to, Traits const &tr);
0083 void set(Char c);
0084 template<typename Traits>
0085 void set(Char c, Traits const &tr);
0086
0087 void clear(Char from, Char to);
0088 template<typename Traits>
0089 void clear(Char from, Char to, Traits const &tr);
0090 void clear(Char c);
0091 template<typename Traits>
0092 void clear(Char c, Traits const &tr);
0093 void clear();
0094
0095 template<typename Traits>
0096 bool test(Char v, Traits const &tr, mpl::false_) const;
0097 template<typename Traits>
0098 bool test(Char v, Traits const &tr, mpl::true_) const;
0099
0100 void inverse();
0101 void swap(basic_chset_8bit& x);
0102
0103 basic_chset_8bit &operator |=(basic_chset_8bit const &x);
0104 basic_chset_8bit &operator &=(basic_chset_8bit const &x);
0105 basic_chset_8bit &operator -=(basic_chset_8bit const &x);
0106 basic_chset_8bit &operator ^=(basic_chset_8bit const &x);
0107
0108 std::bitset<256> const &base() const;
0109
0110 private:
0111 std::bitset<256> bset_;
0112 };
0113
0114
0115 template<>
0116 struct basic_chset<char>
0117 : basic_chset_8bit<char>
0118 {
0119 };
0120
0121
0122 template<>
0123 struct basic_chset<signed char>
0124 : basic_chset_8bit<signed char>
0125 {
0126 };
0127
0128
0129 template<>
0130 struct basic_chset<unsigned char>
0131 : basic_chset_8bit<unsigned char>
0132 {
0133 };
0134
0135 #endif
0136
0137
0138
0139 template<typename Char>
0140 struct is_narrow_char
0141 : mpl::false_
0142 {};
0143
0144 template<>
0145 struct is_narrow_char<char>
0146 : mpl::true_
0147 {};
0148
0149 template<>
0150 struct is_narrow_char<signed char>
0151 : mpl::true_
0152 {};
0153
0154 template<>
0155 struct is_narrow_char<unsigned char>
0156 : mpl::true_
0157 {};
0158
0159
0160
0161 template<typename Char, typename Traits>
0162 void set_char(basic_chset<Char> &chset, Char ch, Traits const &tr, bool icase);
0163
0164 template<typename Char, typename Traits>
0165 void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &tr, bool icase);
0166
0167 template<typename Char, typename Traits>
0168 void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr);
0169
0170 }}}
0171
0172 #endif