]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/include/boost/spirit/home/classic/utility/chset.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / classic / utility / chset.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2001-2003 Joel de Guzman
3 Copyright (c) 2001-2003 Daniel Nuffer
4 http://spirit.sourceforge.net/
5
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8=============================================================================*/
9#ifndef BOOST_SPIRIT_CHSET_HPP
10#define BOOST_SPIRIT_CHSET_HPP
11
12///////////////////////////////////////////////////////////////////////////////
13#include <boost/shared_ptr.hpp>
14#include <boost/spirit/home/classic/namespace.hpp>
15#include <boost/spirit/home/classic/core/primitives/primitives.hpp>
16#include <boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp>
17
18///////////////////////////////////////////////////////////////////////////////
19namespace boost { namespace spirit {
20
21BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
22
23namespace utility { namespace impl {
24
25 // This is here because some compilers choke on out-of-line member
26 // template functions. And we don't want to put the whole algorithm
27 // in the chset constructor in the class definition.
28 template <typename CharT, typename CharT2>
29 void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr,
30 CharT2 const* definition);
31
32}} // namespace utility::impl
33
34///////////////////////////////////////////////////////////////////////////////
35//
36// chset class
37//
38///////////////////////////////////////////////////////////////////////////////
39template <typename CharT = char>
40class chset: public char_parser<chset<CharT> > {
41
42public:
43 chset();
44 chset(chset const& arg_);
45 explicit chset(CharT arg_);
46 explicit chset(anychar_parser arg_);
47 explicit chset(nothing_parser arg_);
48 explicit chset(chlit<CharT> const& arg_);
49 explicit chset(range<CharT> const& arg_);
50 explicit chset(negated_char_parser<chlit<CharT> > const& arg_);
51 explicit chset(negated_char_parser<range<CharT> > const& arg_);
52
53 template <typename CharT2>
54 explicit chset(CharT2 const* definition)
55 : ptr(new basic_chset<CharT>())
56 {
57 utility::impl::construct_chset(ptr, definition);
58 }
59 ~chset();
60
61 chset& operator=(chset const& rhs);
62 chset& operator=(CharT rhs);
63 chset& operator=(anychar_parser rhs);
64 chset& operator=(nothing_parser rhs);
65 chset& operator=(chlit<CharT> const& rhs);
66 chset& operator=(range<CharT> const& rhs);
67 chset& operator=(negated_char_parser<chlit<CharT> > const& rhs);
68 chset& operator=(negated_char_parser<range<CharT> > const& rhs);
69
70 void set(range<CharT> const& arg_);
71 void set(negated_char_parser<chlit<CharT> > const& arg_);
72 void set(negated_char_parser<range<CharT> > const& arg_);
73
74 void clear(range<CharT> const& arg_);
75 void clear(negated_char_parser<range<CharT> > const& arg_);
76 bool test(CharT ch) const;
77 chset& inverse();
78 void swap(chset& x);
79
80 chset& operator|=(chset const& x);
81 chset& operator&=(chset const& x);
82 chset& operator-=(chset const& x);
83 chset& operator^=(chset const& x);
84
85private:
86
87 boost::shared_ptr<basic_chset<CharT> > ptr;
88};
89
90///////////////////////////////////////////////////////////////////////////////
91//
92// Generator functions
93//
94///////////////////////////////////////////////////////////////////////////////
95template <typename CharT>
96inline chset<CharT>
97chset_p(chlit<CharT> const& arg_)
98{ return chset<CharT>(arg_); }
99
100//////////////////////////////////
101template <typename CharT>
102inline chset<CharT>
103chset_p(range<CharT> const& arg_)
104{ return chset<CharT>(arg_); }
105
106template <typename CharT>
107inline chset<CharT>
108chset_p(negated_char_parser<chlit<CharT> > const& arg_)
109{ return chset<CharT>(arg_); }
110
111template <typename CharT>
112inline chset<CharT>
113chset_p(negated_char_parser<range<CharT> > const& arg_)
114{ return chset<CharT>(arg_); }
115
116//////////////////////////////////
117inline chset<char>
118chset_p(char const* init)
119{ return chset<char>(init); }
120
121//////////////////////////////////
122inline chset<wchar_t>
123chset_p(wchar_t const* init)
124{ return chset<wchar_t>(init); }
125
126//////////////////////////////////
127inline chset<char>
128chset_p(char ch)
129{ return chset<char>(ch); }
130
131//////////////////////////////////
132inline chset<wchar_t>
133chset_p(wchar_t ch)
134{ return chset<wchar_t>(ch); }
135
136//////////////////////////////////
137inline chset<int>
138chset_p(int ch)
139{ return chset<int>(ch); }
140
141//////////////////////////////////
142inline chset<unsigned int>
143chset_p(unsigned int ch)
144{ return chset<unsigned int>(ch); }
145
146//////////////////////////////////
147inline chset<short>
148chset_p(short ch)
149{ return chset<short>(ch); }
150
151#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
152//////////////////////////////////
153inline chset<unsigned short>
154chset_p(unsigned short ch)
155{ return chset<unsigned short>(ch); }
156#endif
157//////////////////////////////////
158inline chset<long>
159chset_p(long ch)
160{ return chset<long>(ch); }
161
162//////////////////////////////////
163inline chset<unsigned long>
164chset_p(unsigned long ch)
165{ return chset<unsigned long>(ch); }
166
167#ifdef BOOST_HAS_LONG_LONG
168//////////////////////////////////
169inline chset< ::boost::long_long_type>
170chset_p( ::boost::long_long_type ch)
171{ return chset< ::boost::long_long_type>(ch); }
172
173//////////////////////////////////
174inline chset< ::boost::ulong_long_type>
175chset_p( ::boost::ulong_long_type ch)
176{ return chset< ::boost::ulong_long_type>(ch); }
177#endif
178
179///////////////////////////////////////////////////////////////////////////////
180BOOST_SPIRIT_CLASSIC_NAMESPACE_END
181
182}} // namespace BOOST_SPIRIT_CLASSIC_NS
183
184#endif
185
186#include <boost/spirit/home/classic/utility/impl/chset.ipp>
187#include <boost/spirit/home/classic/utility/chset_operators.hpp>