/*============================================================================= Copyright (c) 2001-2003 Joel de Guzman Copyright (c) 2001-2003 Daniel Nuffer http://spirit.sourceforge.net/ Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef BOOST_SPIRIT_BASIC_CHSET_HPP #define BOOST_SPIRIT_BASIC_CHSET_HPP /////////////////////////////////////////////////////////////////////////////// #include #include namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // // basic_chset: basic character set implementation using range_run // /////////////////////////////////////////////////////////////////////////// template class basic_chset { public: basic_chset(); basic_chset(basic_chset const& arg_); bool test(CharT v) const; void set(CharT from, CharT to); void set(CharT c); void clear(CharT from, CharT to); void clear(CharT c); void clear(); void inverse(); void swap(basic_chset& x); basic_chset& operator|=(basic_chset const& x); basic_chset& operator&=(basic_chset const& x); basic_chset& operator-=(basic_chset const& x); basic_chset& operator^=(basic_chset const& x); private: utility::impl::range_run rr; }; #if (CHAR_BIT == 8) /////////////////////////////////////////////////////////////////////////// // // basic_chset: specializations for 8 bit chars using std::bitset // /////////////////////////////////////////////////////////////////////////// template class basic_chset_8bit { public: basic_chset_8bit(); basic_chset_8bit(basic_chset_8bit const& arg_); bool test(CharT v) const; void set(CharT from, CharT to); void set(CharT c); void clear(CharT from, CharT to); void clear(CharT c); void clear(); void inverse(); void swap(basic_chset_8bit& x); basic_chset_8bit& operator|=(basic_chset_8bit const& x); basic_chset_8bit& operator&=(basic_chset_8bit const& x); basic_chset_8bit& operator-=(basic_chset_8bit const& x); basic_chset_8bit& operator^=(basic_chset_8bit const& x); private: std::bitset<256> bset; }; ///////////////////////////////// template <> class basic_chset : public basic_chset_8bit {}; ///////////////////////////////// template <> class basic_chset : public basic_chset_8bit {}; ///////////////////////////////// template <> class basic_chset : public basic_chset_8bit {}; #endif }} // namespace boost::spirit #endif #include