001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019 #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
020 #define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
021
022 #ifdef BOOST_HAS_ABI_HEADERS
023 # include BOOST_ABI_PREFIX
024 #endif
025
026 #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
027 #include <boost/regex/v4/syntax_type.hpp>
028 #endif
029 #ifndef BOOST_REGEX_ERROR_TYPE_HPP
030 #include <boost/regex/v4/error_type.hpp>
031 #endif
032
033 #ifdef BOOST_NO_STDC_NAMESPACE
034 namespace std{
035 using ::strlen;
036 }
037 #endif
038
039 namespace boost{ namespace re_detail{
040
041
042
043
044
045 template <class charT>
046 inline bool is_extended(charT c)
047 { return c > 256; }
048 inline bool is_extended(char)
049 { return false; }
050
051
052 BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n);
053 BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n);
054 BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c);
055 BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c);
056
057
058 BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(uint_least16_t s);
059
060 template <class charT>
061 inline bool is_combining(charT c)
062 {
063 return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c)));
064 }
065 template <>
066 inline bool is_combining<char>(char)
067 {
068 return false;
069 }
070 template <>
071 inline bool is_combining<signed char>(signed char)
072 {
073 return false;
074 }
075 template <>
076 inline bool is_combining<unsigned char>(unsigned char)
077 {
078 return false;
079 }
080 #ifndef __hpux
081 #ifdef _MSC_VER
082 template<>
083 inline bool is_combining<wchar_t>(wchar_t c)
084 {
085 return is_combining_implementation(static_cast<unsigned short>(c));
086 }
087 #elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
088 #if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX)
089 template<>
090 inline bool is_combining<wchar_t>(wchar_t c)
091 {
092 return is_combining_implementation(static_cast<unsigned short>(c));
093 }
094 #else
095 template<>
096 inline bool is_combining<wchar_t>(wchar_t c)
097 {
098 return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c));
099 }
100 #endif
101 #endif
102 #endif
103
104
105
106
107 template <class charT>
108 inline bool is_separator(charT c)
109 {
110 return BOOST_REGEX_MAKE_BOOL(
111 (c == static_cast<charT>('\n'))
112 || (c == static_cast<charT>('\r'))
113 || (c == static_cast<charT>('\f'))
114 || (static_cast<boost::uint16_t>(c) == 0x2028u)
115 || (static_cast<boost::uint16_t>(c) == 0x2029u)
116 || (static_cast<boost::uint16_t>(c) == 0x85u));
117 }
118 template <>
119 inline bool is_separator<char>(char c)
120 {
121 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f'));
122 }
123
124
125
126
127 BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name);
128
129
130
131
132
133 template <class charT>
134 struct character_pointer_range
135 {
136 const charT* p1;
137 const charT* p2;
138
139 bool operator < (const character_pointer_range& r)const
140 {
141 return std::lexicographical_compare(p1, p2, r.p1, r.p2);
142 }
143 bool operator == (const character_pointer_range& r)const
144 {
145
146
147
148
149 return ((p2 - p1) == (r.p2 - r.p1)) && re_detail::equal(p1, p2, r.p1);
150 }
151 };
152 template <class charT>
153 int get_default_class_id(const charT* p1, const charT* p2)
154 {
155 static const charT data[72] = {
156 'a', 'l', 'n', 'u', 'm',
157 'a', 'l', 'p', 'h', 'a',
158 'b', 'l', 'a', 'n', 'k',
159 'c', 'n', 't', 'r', 'l',
160 'd', 'i', 'g', 'i', 't',
161 'g', 'r', 'a', 'p', 'h',
162 'l', 'o', 'w', 'e', 'r',
163 'p', 'r', 'i', 'n', 't',
164 'p', 'u', 'n', 'c', 't',
165 's', 'p', 'a', 'c', 'e',
166 'u', 'n', 'i', 'c', 'o', 'd', 'e',
167 'u', 'p', 'p', 'e', 'r',
168 'w', 'o', 'r', 'd',
169 'x', 'd', 'i', 'g', 'i', 't',
170 };
171
172 static const character_pointer_range<charT> ranges[19] =
173 {
174 {data+0, data+5,},
175 {data+5, data+10,},
176 {data+10, data+15,},
177 {data+15, data+20,},
178 {data+20, data+21,},
179 {data+20, data+25,},
180 {data+25, data+30,},
181 {data+30, data+31,},
182 {data+30, data+35,},
183 {data+35, data+40,},
184 {data+40, data+45,},
185 {data+45, data+46,},
186 {data+45, data+50,},
187 {data+57, data+58,},
188 {data+50, data+57,},
189 {data+57, data+62,},
190 {data+62, data+63,},
191 {data+62, data+66,},
192 {data+66, data+72,},
193 };
194 static const character_pointer_range<charT>* ranges_begin = ranges;
195 static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
196
197 character_pointer_range<charT> t = { p1, p2, };
198 const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
199 if((p != ranges_end) && (t == *p))
200 return static_cast<int>(p - ranges);
201 return -1;
202 }
203
204
205
206
207 template <class charT>
208 std::ptrdiff_t global_length(const charT* p)
209 {
210 std::ptrdiff_t n = 0;
211 while(*p)
212 {
213 ++p;
214 ++n;
215 }
216 return n;
217 }
218 template<>
219 inline std::ptrdiff_t global_length<char>(const char* p)
220 {
221 return (std::strlen)(p);
222 }
223 #ifndef BOOST_NO_WREGEX
224 template<>
225 inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
226 {
227 return (std::wcslen)(p);
228 }
229 #endif
230 template <class charT>
231 inline charT BOOST_REGEX_CALL global_lower(charT c)
232 {
233 return c;
234 }
235 template <class charT>
236 inline charT BOOST_REGEX_CALL global_upper(charT c)
237 {
238 return c;
239 }
240
241 BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c);
242 BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c);
243 #ifndef BOOST_NO_WREGEX
244 BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c);
245 BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c);
246 #endif
247 #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
248 BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c);
249 BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c);
250 #endif
251
252
253
254
255
256
257
258
259
260
261 template<> inline char BOOST_REGEX_CALL global_lower<char>(char c){ return do_global_lower(c); }
262 template<> inline char BOOST_REGEX_CALL global_upper<char>(char c){ return do_global_upper(c); }
263 #ifndef BOOST_NO_WREGEX
264 template<> inline wchar_t BOOST_REGEX_CALL global_lower<wchar_t>(wchar_t c){ return do_global_lower(c); }
265 template<> inline wchar_t BOOST_REGEX_CALL global_upper<wchar_t>(wchar_t c){ return do_global_upper(c); }
266 #endif
267 #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
268 template<> inline unsigned short BOOST_REGEX_CALL global_lower<unsigned short>(unsigned short c){ return do_global_lower(c); }
269 template<> inline unsigned short BOOST_REGEX_CALL global_upper<unsigned short>(unsigned short c){ return do_global_upper(c); }
270 #endif
271
272 template <class charT>
273 int global_value(charT c)
274 {
275 static const charT zero = '0';
276 static const charT nine = '9';
277 static const charT a = 'a';
278 static const charT f = 'f';
279 static const charT A = 'A';
280 static const charT F = 'F';
281
282 if(c > f) return -1;
283 if(c >= a) return 10 + (c - a);
284 if(c > F) return -1;
285 if(c >= A) return 10 + (c - A);
286 if(c > nine) return -1;
287 if(c >= zero) return c - zero;
288 return -1;
289 }
290 template <class charT, class traits>
291 int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
292 {
293 (void)t;
294 int next_value = t.value(*p1, radix);
295 if((p1 == p2) || (next_value < 0) || (next_value >= radix))
296 return -1;
297 int result = 0;
298 while(p1 != p2)
299 {
300 next_value = t.value(*p1, radix);
301 if((next_value < 0) || (next_value >= radix))
302 break;
303 result *= radix;
304 result += next_value;
305 ++p1;
306 }
307 return result;
308 }
309
310 }
311 }
312
313 #ifdef BOOST_HAS_ABI_HEADERS
314 # include BOOST_ABI_SUFFIX
315 #endif
316
317 #endif
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|