3 * Copyright (c) 1998-2002
6 * Permission to use, copy, modify, distribute and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appear in all copies and
9 * that both that copyright notice and this permission notice appear
10 * in supporting documentation. Dr John Maddock makes no representations
11 * about the suitability of this software for any purpose.
12 * It is provided "as is" without express or implied warranty.
17 * LOCATION: see http://www.boost.org for most recent version.
18 * FILE regex_traits.hpp
19 * VERSION see <boost/version.hpp>
20 * DESCRIPTION: Declares regular expression traits classes.
23 #ifndef BOOST_REGEX_TRAITS_HPP
24 #define BOOST_REGEX_TRAITS_HPP
26 #include <boost/cregex.hpp>
27 #include <boost/static_assert.hpp>
28 #include <boost/regex/detail/regex_cstring.hpp>
33 #pragma option push -a8 -b -Vx -Ve -pc
36 template <class charT>
47 BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
48 BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id);
49 extern BOOST_REGEX_DECL const char *re_default_error_messages[];
51 #ifndef BOOST_NO_WREGEX
52 extern BOOST_REGEX_DECL wchar_t wide_lower_case_map[];
53 extern BOOST_REGEX_DECL unsigned short wide_unicode_classes[];
54 BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(wchar_t c);
58 struct BOOST_REGEX_DECL regex_traits_base
63 syntax_open_bracket = 1, // (
64 syntax_close_bracket = 2, // )
65 syntax_dollar = 3, // $
66 syntax_caret = 4, // ^
70 syntax_question = 8, // ?
71 syntax_open_set = 9, // [
72 syntax_close_set = 10, // ]
75 syntax_hash = 13, // #
76 syntax_dash = 14, // -
77 syntax_open_brace = 15, // {
78 syntax_close_brace = 16, // }
79 syntax_digit = 17, // 0-9
80 syntax_b = 18, // for \b
81 syntax_B = 19, // for \B
82 syntax_left_word = 20, // for \<
83 syntax_right_word = 21, // for \>
84 syntax_w = 22, // for \w
85 syntax_W = 23, // for \W
86 syntax_start_buffer = 24, // for \`
87 syntax_end_buffer = 25, // for \'
88 syntax_newline = 26, // for newline alt
89 syntax_comma = 27, // for {x,y}
91 syntax_a = 28, // for \a
92 syntax_f = 29, // for \f
93 syntax_n = 30, // for \n
94 syntax_r = 31, // for \r
95 syntax_t = 32, // for \t
96 syntax_v = 33, // for \v
97 syntax_x = 34, // for \xdd
98 syntax_c = 35, // for \cx
99 syntax_colon = 36, // for [:...:]
100 syntax_equal = 37, // for [=...=]
103 syntax_e = 38, // for \e
104 syntax_l = 39, // for \l
105 syntax_L = 40, // for \L
106 syntax_u = 41, // for \u
107 syntax_U = 42, // for \U
108 syntax_s = 43, // for \s
109 syntax_S = 44, // for \S
110 syntax_d = 45, // for \d
111 syntax_D = 46, // for \D
112 syntax_E = 47, // for \Q\E
113 syntax_Q = 48, // for \Q\E
114 syntax_X = 49, // for \X
115 syntax_C = 50, // for \C
116 syntax_Z = 51, // for \Z
117 syntax_G = 52, // for \G
120 syntax_not = 53, // for (?!...)
130 struct BOOST_REGEX_DECL c_traits_base : public regex_traits_base
135 char_class_alpha = 0x0001,
136 char_class_cntrl = 0x0002,
137 char_class_digit = 0x0004,
138 char_class_lower = 0x0008,
139 char_class_punct = 0x0010,
140 char_class_space = 0x0020,
141 char_class_upper = 0x0040,
142 char_class_xdigit = 0x0080,
143 char_class_blank = 0x0100,
144 char_class_underscore = 0x4000,
145 char_class_unicode = 0x8000,
147 char_class_alnum = char_class_alpha | char_class_digit,
148 char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
149 char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
150 char_class_word = char_class_alpha | char_class_digit | char_class_underscore
152 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
154 #if defined(__MWERKS__) && __MWERKS__ <= 0x6000
155 friend class c_regex_traits<char>;
156 friend class c_regex_traits<wchar_t>;
159 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
162 map_size = UCHAR_MAX + 1
165 static unsigned char syntax_map[map_size];
166 static unsigned short class_map[map_size];
167 static char lower_case_map[map_size];
169 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
170 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
171 static void BOOST_REGEX_CALL do_update_ctype();
172 static void BOOST_REGEX_CALL do_update_collate();
174 static std::string BOOST_REGEX_CALL error_string(unsigned id);
175 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
178 } // namespace re_detail
182 class BOOST_REGEX_DECL c_regex_traits<char> : public re_detail::c_traits_base
184 typedef re_detail::c_traits_base base_type;
186 typedef char char_type;
187 typedef unsigned char uchar_type;
188 typedef unsigned int size_type;
189 typedef std::string string_type;
190 typedef int locale_type;
192 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
194 return std::strlen(p);
196 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
198 return syntax_map[c];
200 static char BOOST_REGEX_CALL translate(char c, bool icase)
202 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
204 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
206 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
208 static bool BOOST_REGEX_CALL is_separator(char c)
210 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
213 static bool BOOST_REGEX_CALL is_combining(char)
218 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
220 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
223 static int BOOST_REGEX_CALL toi(char c);
224 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
226 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
228 std::string s(first, last);
229 return do_lookup_class(s.c_str());
232 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
234 std::string s(first, last);
235 return do_lookup_collate(buf, s.c_str());
238 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
239 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
251 sentry(const c_regex_traits<char>&)
252 { c_regex_traits<char>::update(); }
253 operator void*() { return this; }
255 static void BOOST_REGEX_CALL update();
257 static void BOOST_REGEX_CALL init();
258 static void BOOST_REGEX_CALL m_free();
259 static c_regex_traits<char> i;
261 static unsigned sort_type;
262 static char sort_delim;
265 #ifndef BOOST_NO_WREGEX
267 class BOOST_REGEX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
269 typedef re_detail::c_traits_base base_type;
271 typedef wchar_t char_type;
272 typedef unsigned short uchar_type;
273 typedef unsigned int size_type;
274 typedef std::basic_string<wchar_t> string_type;
275 typedef int locale_type;
276 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
278 return std::wcslen(p);
280 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
281 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
283 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
286 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
288 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
290 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
292 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
295 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
296 { return re_detail::is_combining(c); }
298 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
300 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
303 static int BOOST_REGEX_CALL toi(wchar_t c);
304 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
306 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
308 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
310 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
311 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
312 c_regex_traits<wchar_t>()
314 ~c_regex_traits<wchar_t>()
318 sentry(const c_regex_traits<wchar_t>&)
319 { c_regex_traits<wchar_t>::update(); }
320 operator void*() { return this; }
322 static void BOOST_REGEX_CALL update();
323 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
324 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
326 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
327 static void BOOST_REGEX_CALL m_free();
328 static void BOOST_REGEX_CALL init();
329 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
330 static c_regex_traits<wchar_t> init_;
332 static unsigned sort_type;
333 static wchar_t sort_delim;
337 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
341 struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
345 char_class_alnum = C1_ALPHA | C1_DIGIT,
346 char_class_alpha = C1_ALPHA,
347 char_class_cntrl = C1_CNTRL,
348 char_class_digit = C1_DIGIT,
349 char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA,
350 char_class_lower = C1_LOWER,
351 char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA,
352 char_class_punct = C1_PUNCT,
353 char_class_space = C1_SPACE,
354 char_class_upper = C1_UPPER,
355 char_class_xdigit = C1_XDIGIT,
356 char_class_blank = C1_BLANK,
357 char_class_underscore = 0x4000,
358 char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
359 char_class_unicode = 0x8000,
360 char_class_win = 0x01FF
365 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
367 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
370 map_size = UCHAR_MAX + 1
373 static unsigned char syntax_map[map_size];
374 static unsigned short class_map[map_size];
375 static char lower_case_map[map_size];
377 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
378 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
379 static void BOOST_REGEX_CALL do_free();
380 static void BOOST_REGEX_CALL do_init();
382 static std::string BOOST_REGEX_CALL error_string(unsigned id);
383 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
387 } // namespace re_detail
389 template<class charT>
390 class w32_regex_traits;
393 class BOOST_REGEX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
395 typedef re_detail::w32_traits_base base_type;
397 typedef char char_type;
398 typedef unsigned char uchar_type;
399 typedef unsigned int size_type;
400 typedef std::string string_type;
401 typedef int locale_type;
403 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
405 return std::strlen(p);
407 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
409 return syntax_map[c];
411 static char BOOST_REGEX_CALL translate(char c, bool icase)
413 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
415 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
417 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
419 static bool BOOST_REGEX_CALL is_separator(char c)
421 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
424 static bool BOOST_REGEX_CALL is_combining(char)
429 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
431 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
434 static int BOOST_REGEX_CALL toi(char c);
435 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
437 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
439 std::string s(first, last);
440 return do_lookup_class(s.c_str());
443 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
445 std::string s(first, last);
446 return do_lookup_collate(buf, s.c_str());
449 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
450 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
454 sentry(const w32_regex_traits<char>&)
455 { w32_regex_traits<char>::update(); }
457 operator void*() { return this; }
459 static void BOOST_REGEX_CALL update();
463 static w32_regex_traits<char> i;
466 #ifndef BOOST_NO_WREGEX
468 class BOOST_REGEX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
470 typedef re_detail::w32_traits_base base_type;
472 typedef wchar_t char_type;
473 typedef unsigned short uchar_type;
474 typedef unsigned int size_type;
475 typedef std::basic_string<wchar_t> string_type;
476 typedef int locale_type;
477 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
479 return std::wcslen(p);
481 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
482 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
484 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
487 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
489 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
491 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
493 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
496 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
497 { return re_detail::is_combining(c); }
499 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
501 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
504 static int BOOST_REGEX_CALL toi(wchar_t c);
505 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
507 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
509 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
511 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
512 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
516 sentry(const w32_regex_traits<wchar_t>&)
517 { w32_regex_traits<wchar_t>::update(); }
519 operator void*() { return this; }
521 static void BOOST_REGEX_CALL update();
524 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
525 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
528 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
529 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
530 static w32_regex_traits<wchar_t> init_;
531 static wchar_t BOOST_REGEX_CALL wtolower(wchar_t c);
532 static unsigned short wide_unicode_classes[];
534 #endif // Wide strings
537 #if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
546 #pragma option push -a4 -b -Ve -pc
554 template <class charT>
558 struct message_data<char>;
561 struct message_data<wchar_t>;
563 struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
568 char_class_alnum = std::ctype_base::alnum,
569 char_class_alpha = std::ctype_base::alpha,
570 char_class_cntrl = std::ctype_base::cntrl,
571 char_class_digit = std::ctype_base::digit,
572 char_class_graph = std::ctype_base::graph,
573 char_class_lower = std::ctype_base::lower,
574 char_class_print = std::ctype_base::print,
575 char_class_punct = std::ctype_base::punct,
576 char_class_space = std::ctype_base::space,
577 char_class_upper = std::ctype_base::upper,
578 char_class_xdigit = std::ctype_base::xdigit,
579 char_class_blank = 1<<12,
580 char_class_underscore = 1<<13,
581 char_class_word = std::ctype_base::alnum | char_class_underscore,
582 char_class_unicode = 1<<14,
583 char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
584 | char_class_digit | char_class_graph | char_class_lower
585 | char_class_print | char_class_punct | char_class_space
586 | char_class_upper | char_class_xdigit
589 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
591 static char regex_message_cat[BOOST_REGEX_MAX_PATH];
594 } // namespace re_detail
596 template <class charT>
597 class cpp_regex_traits;
600 class BOOST_REGEX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
602 typedef re_detail::cpp_regex_traits_base base_type;
604 re_detail::message_data<char>* pmd;
605 const unsigned char* psyntax;
607 const std::ctype<char>* pctype;
608 const std::collate<char>* pcollate;
609 std::locale locale_inst;
613 cpp_regex_traits(const cpp_regex_traits&);
614 cpp_regex_traits& operator=(const cpp_regex_traits&);
617 typedef char char_type;
618 typedef unsigned char uchar_type;
619 typedef unsigned int size_type;
620 typedef std::string string_type;
621 typedef std::locale locale_type;
626 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
628 return std::strlen(p);
630 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
634 char BOOST_REGEX_CALL translate(char c, bool icase)const
636 return icase ? lower_map[(size_type)(uchar_type)c] : c;
638 void BOOST_REGEX_CALL transform(std::string& out, const std::string& in)const
640 out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
643 void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in)const;
645 static bool BOOST_REGEX_CALL is_separator(char c)
647 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
650 static bool BOOST_REGEX_CALL is_combining(char)
655 bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)const
657 if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
659 if((f & char_class_underscore) && (c == '_'))
661 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
666 int BOOST_REGEX_CALL toi(char c)const;
667 int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix)const;
669 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)const;
670 bool BOOST_REGEX_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
672 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
673 locale_type BOOST_REGEX_CALL imbue(locale_type l);
674 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
678 sentry(const cpp_regex_traits<char>&){}
679 operator void*() { return this; }
683 #ifndef BOOST_NO_WREGEX
685 class BOOST_REGEX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
687 typedef re_detail::cpp_regex_traits_base base_type;
689 typedef wchar_t char_type;
690 typedef unsigned short uchar_type;
691 typedef unsigned int size_type;
692 typedef std::basic_string<wchar_t> string_type;
693 typedef std::locale locale_type;
696 re_detail::message_data<wchar_t>* pmd;
697 const unsigned char* psyntax;
699 const std::ctype<wchar_t>* pctype;
700 const std::collate<wchar_t>* pcollate;
701 const std::codecvt<wchar_t, char, std::mbstate_t>* pcdv;
702 std::locale locale_inst;
703 unsigned int BOOST_REGEX_CALL do_syntax_type(size_type c)const;
707 cpp_regex_traits(const cpp_regex_traits&);
708 cpp_regex_traits& operator=(const cpp_regex_traits&);
712 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
714 return std::wcslen(p);
716 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
718 return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
720 wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)const
722 return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
724 void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
726 out = pcollate->transform(in.c_str(), in.c_str() + in.size());
729 void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
731 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
733 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
736 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
737 { return re_detail::is_combining(c); }
739 bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)const
741 if(pctype->is((std::ctype<wchar_t>::mask)(f & char_class_all_base), c))
743 if((f & char_class_underscore) && (c == '_'))
745 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
747 if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
752 int BOOST_REGEX_CALL toi(wchar_t c)const;
753 int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
755 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
756 bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
758 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
761 locale_type BOOST_REGEX_CALL imbue(locale_type l);
762 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
763 std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2)const;
767 sentry(const cpp_regex_traits<wchar_t>&){}
768 operator void*() { return this; }
771 #endif // BOOST_NO_WREGEX
773 #endif // BOOST_NO_STD_LOCALE
775 #ifdef BOOST_REGEX_USE_WIN32_LOCALE
777 template <class charT>
778 class regex_traits : public w32_regex_traits<charT>
782 #elif defined(BOOST_REGEX_USE_C_LOCALE)
784 template <class charT>
785 class regex_traits : public c_regex_traits<charT>
789 #elif defined(BOOST_REGEX_USE_CPP_LOCALE)
791 template <class charT>
792 class regex_traits : public cpp_regex_traits<charT>
797 #error No default localisation model defined