Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/classic/utility/chset.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 /////////////////////////////////////////////////////////////////////////////// | |
19 namespace boost { namespace spirit { | |
20 | |
21 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN | |
22 | |
23 namespace 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 /////////////////////////////////////////////////////////////////////////////// | |
39 template <typename CharT = char> | |
40 class chset: public char_parser<chset<CharT> > { | |
41 | |
42 public: | |
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 | |
85 private: | |
86 | |
87 boost::shared_ptr<basic_chset<CharT> > ptr; | |
88 }; | |
89 | |
90 /////////////////////////////////////////////////////////////////////////////// | |
91 // | |
92 // Generator functions | |
93 // | |
94 /////////////////////////////////////////////////////////////////////////////// | |
95 template <typename CharT> | |
96 inline chset<CharT> | |
97 chset_p(chlit<CharT> const& arg_) | |
98 { return chset<CharT>(arg_); } | |
99 | |
100 ////////////////////////////////// | |
101 template <typename CharT> | |
102 inline chset<CharT> | |
103 chset_p(range<CharT> const& arg_) | |
104 { return chset<CharT>(arg_); } | |
105 | |
106 template <typename CharT> | |
107 inline chset<CharT> | |
108 chset_p(negated_char_parser<chlit<CharT> > const& arg_) | |
109 { return chset<CharT>(arg_); } | |
110 | |
111 template <typename CharT> | |
112 inline chset<CharT> | |
113 chset_p(negated_char_parser<range<CharT> > const& arg_) | |
114 { return chset<CharT>(arg_); } | |
115 | |
116 ////////////////////////////////// | |
117 inline chset<char> | |
118 chset_p(char const* init) | |
119 { return chset<char>(init); } | |
120 | |
121 ////////////////////////////////// | |
122 inline chset<wchar_t> | |
123 chset_p(wchar_t const* init) | |
124 { return chset<wchar_t>(init); } | |
125 | |
126 ////////////////////////////////// | |
127 inline chset<char> | |
128 chset_p(char ch) | |
129 { return chset<char>(ch); } | |
130 | |
131 ////////////////////////////////// | |
132 inline chset<wchar_t> | |
133 chset_p(wchar_t ch) | |
134 { return chset<wchar_t>(ch); } | |
135 | |
136 ////////////////////////////////// | |
137 inline chset<int> | |
138 chset_p(int ch) | |
139 { return chset<int>(ch); } | |
140 | |
141 ////////////////////////////////// | |
142 inline chset<unsigned int> | |
143 chset_p(unsigned int ch) | |
144 { return chset<unsigned int>(ch); } | |
145 | |
146 ////////////////////////////////// | |
147 inline chset<short> | |
148 chset_p(short ch) | |
149 { return chset<short>(ch); } | |
150 | |
151 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) | |
152 ////////////////////////////////// | |
153 inline chset<unsigned short> | |
154 chset_p(unsigned short ch) | |
155 { return chset<unsigned short>(ch); } | |
156 #endif | |
157 ////////////////////////////////// | |
158 inline chset<long> | |
159 chset_p(long ch) | |
160 { return chset<long>(ch); } | |
161 | |
162 ////////////////////////////////// | |
163 inline chset<unsigned long> | |
164 chset_p(unsigned long ch) | |
165 { return chset<unsigned long>(ch); } | |
166 | |
167 #ifdef BOOST_HAS_LONG_LONG | |
168 ////////////////////////////////// | |
169 inline chset< ::boost::long_long_type> | |
170 chset_p( ::boost::long_long_type ch) | |
171 { return chset< ::boost::long_long_type>(ch); } | |
172 | |
173 ////////////////////////////////// | |
174 inline chset< ::boost::ulong_long_type> | |
175 chset_p( ::boost::ulong_long_type ch) | |
176 { return chset< ::boost::ulong_long_type>(ch); } | |
177 #endif | |
178 | |
179 /////////////////////////////////////////////////////////////////////////////// | |
180 BOOST_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> |