os/ossrv/ossrv_pub/boost_apis/boost/spirit/utility/chset.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/spirit/utility/chset.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,183 @@
     1.4 +/*=============================================================================
     1.5 +    Copyright (c) 2001-2003 Joel de Guzman
     1.6 +    Copyright (c) 2001-2003 Daniel Nuffer
     1.7 +    http://spirit.sourceforge.net/
     1.8 +
     1.9 +    Use, modification and distribution is subject to the Boost Software
    1.10 +    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.11 +    http://www.boost.org/LICENSE_1_0.txt)
    1.12 +=============================================================================*/
    1.13 +#ifndef BOOST_SPIRIT_CHSET_HPP
    1.14 +#define BOOST_SPIRIT_CHSET_HPP
    1.15 +
    1.16 +///////////////////////////////////////////////////////////////////////////////
    1.17 +#include <boost/shared_ptr.hpp>
    1.18 +#include <boost/spirit/core/primitives/primitives.hpp>
    1.19 +#include <boost/spirit/utility/impl/chset/basic_chset.hpp>
    1.20 +
    1.21 +///////////////////////////////////////////////////////////////////////////////
    1.22 +namespace boost { namespace spirit {
    1.23 +
    1.24 +namespace utility { namespace impl {
    1.25 +
    1.26 +    // This is here because some compilers choke on out-of-line member
    1.27 +    // template functions.  And we don't want to put the whole algorithm
    1.28 +    // in the chset constructor in the class definition.
    1.29 +    template <typename CharT, typename CharT2>
    1.30 +    void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr,
    1.31 +            CharT2 const* definition);
    1.32 +
    1.33 +}} // namespace utility::impl
    1.34 +
    1.35 +///////////////////////////////////////////////////////////////////////////////
    1.36 +//
    1.37 +//  chset class
    1.38 +//
    1.39 +///////////////////////////////////////////////////////////////////////////////
    1.40 +template <typename CharT = char>
    1.41 +class chset: public char_parser<chset<CharT> > {
    1.42 +
    1.43 +public:
    1.44 +                    chset();
    1.45 +                    chset(chset const& arg_);
    1.46 +    explicit        chset(CharT arg_);
    1.47 +    explicit        chset(anychar_parser arg_);
    1.48 +    explicit        chset(nothing_parser arg_);
    1.49 +    explicit        chset(chlit<CharT> const& arg_);
    1.50 +    explicit        chset(range<CharT> const& arg_);
    1.51 +    explicit        chset(negated_char_parser<chlit<CharT> > const& arg_);
    1.52 +    explicit        chset(negated_char_parser<range<CharT> > const& arg_);
    1.53 +
    1.54 +                    template <typename CharT2>
    1.55 +    explicit        chset(CharT2 const* definition)
    1.56 +                    : ptr(new basic_chset<CharT>())
    1.57 +                    {
    1.58 +                        utility::impl::construct_chset(ptr, definition);
    1.59 +                    }
    1.60 +                    ~chset();
    1.61 +
    1.62 +    chset&          operator=(chset const& rhs);
    1.63 +    chset&          operator=(CharT rhs);
    1.64 +    chset&          operator=(anychar_parser rhs);
    1.65 +    chset&          operator=(nothing_parser rhs);
    1.66 +    chset&          operator=(chlit<CharT> const& rhs);
    1.67 +    chset&          operator=(range<CharT> const& rhs);
    1.68 +    chset&          operator=(negated_char_parser<chlit<CharT> > const& rhs);
    1.69 +    chset&          operator=(negated_char_parser<range<CharT> > const& rhs);
    1.70 +
    1.71 +    void            set(range<CharT> const& arg_);
    1.72 +    void            set(negated_char_parser<chlit<CharT> > const& arg_);
    1.73 +    void            set(negated_char_parser<range<CharT> > const& arg_);
    1.74 +
    1.75 +    void            clear(range<CharT> const& arg_);
    1.76 +    void            clear(negated_char_parser<range<CharT> > const& arg_);
    1.77 +    bool            test(CharT ch) const;
    1.78 +    chset&          inverse();
    1.79 +    void            swap(chset& x);
    1.80 +
    1.81 +    chset&          operator|=(chset const& x);
    1.82 +    chset&          operator&=(chset const& x);
    1.83 +    chset&          operator-=(chset const& x);
    1.84 +    chset&          operator^=(chset const& x);
    1.85 +
    1.86 +private:
    1.87 +
    1.88 +    boost::shared_ptr<basic_chset<CharT> > ptr;
    1.89 +};
    1.90 +
    1.91 +///////////////////////////////////////////////////////////////////////////////
    1.92 +//
    1.93 +//  Generator functions
    1.94 +//
    1.95 +///////////////////////////////////////////////////////////////////////////////
    1.96 +template <typename CharT>
    1.97 +inline chset<CharT>
    1.98 +chset_p(chlit<CharT> const& arg_)
    1.99 +{ return chset<CharT>(arg_); }
   1.100 +
   1.101 +//////////////////////////////////
   1.102 +template <typename CharT>
   1.103 +inline chset<CharT>
   1.104 +chset_p(range<CharT> const& arg_)
   1.105 +{ return chset<CharT>(arg_); }
   1.106 +
   1.107 +template <typename CharT>
   1.108 +inline chset<CharT>
   1.109 +chset_p(negated_char_parser<chlit<CharT> > const& arg_)
   1.110 +{ return chset<CharT>(arg_); }
   1.111 +
   1.112 +template <typename CharT>
   1.113 +inline chset<CharT>
   1.114 +chset_p(negated_char_parser<range<CharT> > const& arg_)
   1.115 +{ return chset<CharT>(arg_); }
   1.116 +
   1.117 +//////////////////////////////////
   1.118 +inline chset<char>
   1.119 +chset_p(char const* init)
   1.120 +{ return chset<char>(init); }
   1.121 +
   1.122 +//////////////////////////////////
   1.123 +inline chset<wchar_t>
   1.124 +chset_p(wchar_t const* init)
   1.125 +{ return chset<wchar_t>(init); }
   1.126 +
   1.127 +//////////////////////////////////
   1.128 +inline chset<char>
   1.129 +chset_p(char ch)
   1.130 +{ return chset<char>(ch); }
   1.131 +
   1.132 +//////////////////////////////////
   1.133 +inline chset<wchar_t>
   1.134 +chset_p(wchar_t ch)
   1.135 +{ return chset<wchar_t>(ch); }
   1.136 +
   1.137 +//////////////////////////////////
   1.138 +inline chset<int>
   1.139 +chset_p(int ch)
   1.140 +{ return chset<int>(ch); }
   1.141 +
   1.142 +//////////////////////////////////
   1.143 +inline chset<unsigned int>
   1.144 +chset_p(unsigned int ch)
   1.145 +{ return chset<unsigned int>(ch); }
   1.146 +
   1.147 +//////////////////////////////////
   1.148 +inline chset<short>
   1.149 +chset_p(short ch)
   1.150 +{ return chset<short>(ch); }
   1.151 +
   1.152 +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
   1.153 +//////////////////////////////////
   1.154 +inline chset<unsigned short>
   1.155 +chset_p(unsigned short ch)
   1.156 +{ return chset<unsigned short>(ch); }
   1.157 +#endif
   1.158 +//////////////////////////////////
   1.159 +inline chset<long>
   1.160 +chset_p(long ch)
   1.161 +{ return chset<long>(ch); }
   1.162 +
   1.163 +//////////////////////////////////
   1.164 +inline chset<unsigned long>
   1.165 +chset_p(unsigned long ch)
   1.166 +{ return chset<unsigned long>(ch); }
   1.167 +
   1.168 +#ifdef BOOST_HAS_LONG_LONG
   1.169 +//////////////////////////////////
   1.170 +inline chset< ::boost::long_long_type>
   1.171 +chset_p( ::boost::long_long_type ch)
   1.172 +{ return chset< ::boost::long_long_type>(ch); }
   1.173 +
   1.174 +//////////////////////////////////
   1.175 +inline chset< ::boost::ulong_long_type>
   1.176 +chset_p( ::boost::ulong_long_type ch)
   1.177 +{ return chset< ::boost::ulong_long_type>(ch); }
   1.178 +#endif
   1.179 +
   1.180 +///////////////////////////////////////////////////////////////////////////////
   1.181 +}} // namespace boost::spirit
   1.182 +
   1.183 +#endif
   1.184 +
   1.185 +#include <boost/spirit/utility/impl/chset.ipp>
   1.186 +#include <boost/spirit/utility/chset_operators.hpp>