Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*=============================================================================
0002     Copyright (c) 2001-2003 Joel de Guzman
0003     Copyright (c) 2001-2003 Daniel Nuffer
0004     http://spirit.sourceforge.net/
0005 
0006   Distributed under the Boost Software License, Version 1.0. (See accompanying
0007   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #ifndef BOOST_SPIRIT_BASIC_CHSET_HPP
0010 #define BOOST_SPIRIT_BASIC_CHSET_HPP
0011 
0012 ///////////////////////////////////////////////////////////////////////////////
0013 #include <bitset>
0014 #include <climits>
0015 #include <boost/spirit/home/classic/utility/impl/chset/range_run.hpp>
0016 #include <boost/spirit/home/classic/namespace.hpp>
0017 
0018 namespace boost { namespace spirit {
0019 
0020 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0021 
0022     ///////////////////////////////////////////////////////////////////////////
0023     //
0024     //  basic_chset: basic character set implementation using range_run
0025     //
0026     ///////////////////////////////////////////////////////////////////////////
0027     template <typename CharT>
0028     class basic_chset
0029     {
0030     public:
0031                             basic_chset();
0032                             basic_chset(basic_chset const& arg_);
0033 
0034         bool                test(CharT v) const;
0035         void                set(CharT from, CharT to);
0036         void                set(CharT c);
0037         void                clear(CharT from, CharT to);
0038         void                clear(CharT c);
0039         void                clear();
0040 
0041         void                inverse();
0042         void                swap(basic_chset& x);
0043 
0044         basic_chset&        operator|=(basic_chset const& x);
0045         basic_chset&        operator&=(basic_chset const& x);
0046         basic_chset&        operator-=(basic_chset const& x);
0047         basic_chset&        operator^=(basic_chset const& x);
0048 
0049         private: utility::impl::range_run<CharT> rr;
0050     };
0051 
0052     #if (CHAR_BIT == 8)
0053 
0054     ///////////////////////////////////////////////////////////////////////////
0055     //
0056     //  basic_chset: specializations for 8 bit chars using std::bitset
0057     //
0058     ///////////////////////////////////////////////////////////////////////////
0059     template <typename CharT>
0060     class basic_chset_8bit {
0061 
0062     public:
0063                             basic_chset_8bit();
0064                             basic_chset_8bit(basic_chset_8bit const& arg_);
0065 
0066         bool                test(CharT v) const;
0067         void                set(CharT from, CharT to);
0068         void                set(CharT c);
0069         void                clear(CharT from, CharT to);
0070         void                clear(CharT c);
0071         void                clear();
0072 
0073         void                inverse();
0074         void                swap(basic_chset_8bit& x);
0075 
0076         basic_chset_8bit&   operator|=(basic_chset_8bit const& x);
0077         basic_chset_8bit&   operator&=(basic_chset_8bit const& x);
0078         basic_chset_8bit&   operator-=(basic_chset_8bit const& x);
0079         basic_chset_8bit&   operator^=(basic_chset_8bit const& x);
0080 
0081         private: std::bitset<256> bset;
0082     };
0083 
0084     /////////////////////////////////
0085     template <>
0086     class basic_chset<char>
0087     : public basic_chset_8bit<char> {};
0088 
0089     /////////////////////////////////
0090     template <>
0091     class basic_chset<signed char>
0092     : public basic_chset_8bit<signed char> {};
0093 
0094     /////////////////////////////////
0095     template <>
0096     class basic_chset<unsigned char>
0097     : public basic_chset_8bit<unsigned char> {};
0098 
0099 #endif
0100 
0101 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0102 
0103 }} // namespace BOOST_SPIRIT_CLASSIC_NS
0104 
0105 #endif
0106 
0107 #include <boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp>