File indexing completed on 2025-02-27 09:55:13
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_SPIRIT_CHSET_HPP
0010 #define BOOST_SPIRIT_CHSET_HPP
0011
0012
0013 #include <boost/shared_ptr.hpp>
0014 #include <boost/spirit/home/classic/namespace.hpp>
0015 #include <boost/spirit/home/classic/core/primitives/primitives.hpp>
0016 #include <boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp>
0017
0018
0019 namespace boost { namespace spirit {
0020
0021 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0022
0023 namespace utility { namespace impl {
0024
0025
0026
0027
0028 template <typename CharT, typename CharT2>
0029 void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr,
0030 CharT2 const* definition);
0031
0032 }}
0033
0034
0035
0036
0037
0038
0039 template <typename CharT = char>
0040 class chset: public char_parser<chset<CharT> > {
0041
0042 public:
0043 chset();
0044 chset(chset const& arg_);
0045 explicit chset(CharT arg_);
0046 explicit chset(anychar_parser arg_);
0047 explicit chset(nothing_parser arg_);
0048 explicit chset(chlit<CharT> const& arg_);
0049 explicit chset(range<CharT> const& arg_);
0050 explicit chset(negated_char_parser<chlit<CharT> > const& arg_);
0051 explicit chset(negated_char_parser<range<CharT> > const& arg_);
0052
0053 template <typename CharT2>
0054 explicit chset(CharT2 const* definition)
0055 : ptr(new basic_chset<CharT>())
0056 {
0057 utility::impl::construct_chset(ptr, definition);
0058 }
0059 ~chset();
0060
0061 chset& operator=(chset const& rhs);
0062 chset& operator=(CharT rhs);
0063 chset& operator=(anychar_parser rhs);
0064 chset& operator=(nothing_parser rhs);
0065 chset& operator=(chlit<CharT> const& rhs);
0066 chset& operator=(range<CharT> const& rhs);
0067 chset& operator=(negated_char_parser<chlit<CharT> > const& rhs);
0068 chset& operator=(negated_char_parser<range<CharT> > const& rhs);
0069
0070 void set(range<CharT> const& arg_);
0071 void set(negated_char_parser<chlit<CharT> > const& arg_);
0072 void set(negated_char_parser<range<CharT> > const& arg_);
0073
0074 void clear(range<CharT> const& arg_);
0075 void clear(negated_char_parser<range<CharT> > const& arg_);
0076 bool test(CharT ch) const;
0077 chset& inverse();
0078 void swap(chset& x);
0079
0080 chset& operator|=(chset const& x);
0081 chset& operator&=(chset const& x);
0082 chset& operator-=(chset const& x);
0083 chset& operator^=(chset const& x);
0084
0085 private:
0086
0087 boost::shared_ptr<basic_chset<CharT> > ptr;
0088 };
0089
0090
0091
0092
0093
0094
0095 template <typename CharT>
0096 inline chset<CharT>
0097 chset_p(chlit<CharT> const& arg_)
0098 { return chset<CharT>(arg_); }
0099
0100
0101 template <typename CharT>
0102 inline chset<CharT>
0103 chset_p(range<CharT> const& arg_)
0104 { return chset<CharT>(arg_); }
0105
0106 template <typename CharT>
0107 inline chset<CharT>
0108 chset_p(negated_char_parser<chlit<CharT> > const& arg_)
0109 { return chset<CharT>(arg_); }
0110
0111 template <typename CharT>
0112 inline chset<CharT>
0113 chset_p(negated_char_parser<range<CharT> > const& arg_)
0114 { return chset<CharT>(arg_); }
0115
0116
0117 inline chset<char>
0118 chset_p(char const* init)
0119 { return chset<char>(init); }
0120
0121
0122 inline chset<wchar_t>
0123 chset_p(wchar_t const* init)
0124 { return chset<wchar_t>(init); }
0125
0126
0127 inline chset<char>
0128 chset_p(char ch)
0129 { return chset<char>(ch); }
0130
0131
0132 inline chset<wchar_t>
0133 chset_p(wchar_t ch)
0134 { return chset<wchar_t>(ch); }
0135
0136
0137 inline chset<int>
0138 chset_p(int ch)
0139 { return chset<int>(ch); }
0140
0141
0142 inline chset<unsigned int>
0143 chset_p(unsigned int ch)
0144 { return chset<unsigned int>(ch); }
0145
0146
0147 inline chset<short>
0148 chset_p(short ch)
0149 { return chset<short>(ch); }
0150
0151 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
0152
0153 inline chset<unsigned short>
0154 chset_p(unsigned short ch)
0155 { return chset<unsigned short>(ch); }
0156 #endif
0157
0158 inline chset<long>
0159 chset_p(long ch)
0160 { return chset<long>(ch); }
0161
0162
0163 inline chset<unsigned long>
0164 chset_p(unsigned long ch)
0165 { return chset<unsigned long>(ch); }
0166
0167 #ifdef BOOST_HAS_LONG_LONG
0168
0169 inline chset< ::boost::long_long_type>
0170 chset_p( ::boost::long_long_type ch)
0171 { return chset< ::boost::long_long_type>(ch); }
0172
0173
0174 inline chset< ::boost::ulong_long_type>
0175 chset_p( ::boost::ulong_long_type ch)
0176 { return chset< ::boost::ulong_long_type>(ch); }
0177 #endif
0178
0179
0180 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0181
0182 }}
0183
0184 #endif
0185
0186 #include <boost/spirit/home/classic/utility/impl/chset.ipp>
0187 #include <boost/spirit/home/classic/utility/chset_operators.hpp>