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 -a4 -b -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[];
50 BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
51 //extern BOOST_REGEX_DECL const wchar_t combining_ranges[];
53 #ifndef BOOST_NO_WREGEX
54 extern BOOST_REGEX_DECL wchar_t wide_lower_case_map[];
55 extern BOOST_REGEX_DECL unsigned short wide_unicode_classes[];
56 BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(wchar_t c);
60 struct BOOST_REGEX_DECL regex_traits_base
65 syntax_open_bracket = 1, // (
66 syntax_close_bracket = 2, // )
67 syntax_dollar = 3, // $
68 syntax_caret = 4, // ^
72 syntax_question = 8, // ?
73 syntax_open_set = 9, // [
74 syntax_close_set = 10, // ]
77 syntax_hash = 13, // #
78 syntax_dash = 14, // -
79 syntax_open_brace = 15, // {
80 syntax_close_brace = 16, // }
81 syntax_digit = 17, // 0-9
82 syntax_b = 18, // for \b
83 syntax_B = 19, // for \B
84 syntax_left_word = 20, // for \<
85 syntax_right_word = 21, // for \>
86 syntax_w = 22, // for \w
87 syntax_W = 23, // for \W
88 syntax_start_buffer = 24, // for \`
89 syntax_end_buffer = 25, // for \'
90 syntax_newline = 26, // for newline alt
91 syntax_comma = 27, // for {x,y}
93 syntax_a = 28, // for \a
94 syntax_f = 29, // for \f
95 syntax_n = 30, // for \n
96 syntax_r = 31, // for \r
97 syntax_t = 32, // for \t
98 syntax_v = 33, // for \v
99 syntax_x = 34, // for \xdd
100 syntax_c = 35, // for \cx
101 syntax_colon = 36, // for [:...:]
102 syntax_equal = 37, // for [=...=]
105 syntax_e = 38, // for \e
106 syntax_l = 39, // for \l
107 syntax_L = 40, // for \L
108 syntax_u = 41, // for \u
109 syntax_U = 42, // for \U
110 syntax_s = 43, // for \s
111 syntax_S = 44, // for \S
112 syntax_d = 45, // for \d
113 syntax_D = 46, // for \D
114 syntax_E = 47, // for \Q\E
115 syntax_Q = 48, // for \Q\E
116 syntax_X = 49, // for \X
117 syntax_C = 50, // for \C
118 syntax_Z = 51, // for \Z
119 syntax_G = 52, // for \G
122 syntax_not = 53, // for (?!...)
128 struct BOOST_REGEX_DECL c_traits_base : public regex_traits_base
133 char_class_alpha = 0x0001,
134 char_class_cntrl = 0x0002,
135 char_class_digit = 0x0004,
136 char_class_lower = 0x0008,
137 char_class_punct = 0x0010,
138 char_class_space = 0x0020,
139 char_class_upper = 0x0040,
140 char_class_xdigit = 0x0080,
141 char_class_blank = 0x0100,
142 char_class_underscore = 0x4000,
143 char_class_unicode = 0x8000,
145 char_class_alnum = char_class_alpha | char_class_digit,
146 char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
147 char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
148 char_class_word = char_class_alpha | char_class_digit | char_class_underscore
150 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
152 #if defined(__MWERKS__) && __MWERKS__ <= 0x6000
153 friend class c_regex_traits<char>;
154 friend class c_regex_traits<wchar_t>;
157 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
160 map_size = UCHAR_MAX + 1
163 static unsigned char syntax_map[map_size];
164 static unsigned short class_map[map_size];
165 static char lower_case_map[map_size];
167 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
168 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
169 static void BOOST_REGEX_CALL do_update_ctype();
170 static void BOOST_REGEX_CALL do_update_collate();
172 static std::string BOOST_REGEX_CALL error_string(unsigned id);
173 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
176 } // namespace re_detail
180 class BOOST_REGEX_DECL c_regex_traits<char> : public re_detail::c_traits_base
182 typedef re_detail::c_traits_base base_type;
184 typedef char char_type;
185 typedef unsigned char uchar_type;
186 typedef unsigned int size_type;
187 typedef std::string string_type;
188 typedef int locale_type;
190 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
192 return std::strlen(p);
194 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
196 return syntax_map[c];
198 static char BOOST_REGEX_CALL translate(char c, bool icase)
200 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
202 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
204 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
206 static bool BOOST_REGEX_CALL is_separator(char c)
208 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
211 static bool BOOST_REGEX_CALL is_combining(char)
216 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
218 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
221 static int BOOST_REGEX_CALL toi(char c);
222 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
224 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
226 std::string s(first, last);
227 return do_lookup_class(s.c_str());
230 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
232 std::string s(first, last);
233 return do_lookup_collate(buf, s.c_str());
236 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
237 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
249 sentry(const c_regex_traits<char>&)
250 { c_regex_traits<char>::update(); }
251 operator void*() { return this; }
253 static void BOOST_REGEX_CALL update();
255 static void BOOST_REGEX_CALL init();
256 static void BOOST_REGEX_CALL m_free();
257 static c_regex_traits<char> i;
259 static unsigned sort_type;
260 static char sort_delim;
263 #ifndef BOOST_NO_WREGEX
265 class BOOST_REGEX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
267 typedef re_detail::c_traits_base base_type;
269 typedef wchar_t char_type;
270 typedef unsigned short uchar_type;
271 typedef unsigned int size_type;
272 typedef std::basic_string<wchar_t> string_type;
273 typedef int locale_type;
274 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
276 return std::wcslen(p);
278 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
279 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
281 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
284 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
286 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
288 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
290 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
293 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
294 { return re_detail::is_combining(c); }
296 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
298 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
301 static int BOOST_REGEX_CALL toi(wchar_t c);
302 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
304 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
306 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
308 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
309 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
310 c_regex_traits<wchar_t>()
312 ~c_regex_traits<wchar_t>()
316 sentry(const c_regex_traits<wchar_t>&)
317 { c_regex_traits<wchar_t>::update(); }
318 operator void*() { return this; }
320 static void BOOST_REGEX_CALL update();
321 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
322 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
324 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
325 static void BOOST_REGEX_CALL m_free();
326 static void BOOST_REGEX_CALL init();
327 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
328 static c_regex_traits<wchar_t> init_;
330 static unsigned sort_type;
331 static wchar_t sort_delim;
335 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
339 struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
343 char_class_alnum = C1_ALPHA | C1_DIGIT,
344 char_class_alpha = C1_ALPHA,
345 char_class_cntrl = C1_CNTRL,
346 char_class_digit = C1_DIGIT,
347 char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA,
348 char_class_lower = C1_LOWER,
349 char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA,
350 char_class_punct = C1_PUNCT,
351 char_class_space = C1_SPACE,
352 char_class_upper = C1_UPPER,
353 char_class_xdigit = C1_XDIGIT,
354 char_class_blank = C1_BLANK,
355 char_class_underscore = 0x4000,
356 char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
357 char_class_unicode = 0x8000,
358 char_class_win = 0x01FF
363 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
365 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
368 map_size = UCHAR_MAX + 1
371 static unsigned char syntax_map[map_size];
372 static unsigned short class_map[map_size];
373 static char lower_case_map[map_size];
375 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
376 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
377 static void BOOST_REGEX_CALL do_free();
378 static void BOOST_REGEX_CALL do_init();
380 static std::string BOOST_REGEX_CALL error_string(unsigned id);
381 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
385 } // namespace re_detail
387 template<class charT>
388 class w32_regex_traits;
391 class BOOST_REGEX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
393 typedef re_detail::w32_traits_base base_type;
395 typedef char char_type;
396 typedef unsigned char uchar_type;
397 typedef unsigned int size_type;
398 typedef std::string string_type;
399 typedef int locale_type;
401 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
403 return std::strlen(p);
405 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
407 return syntax_map[c];
409 static char BOOST_REGEX_CALL translate(char c, bool icase)
411 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
413 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
415 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
417 static bool BOOST_REGEX_CALL is_separator(char c)
419 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
422 static bool BOOST_REGEX_CALL is_combining(char)
427 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
429 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
432 static int BOOST_REGEX_CALL toi(char c);
433 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
435 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
437 std::string s(first, last);
438 return do_lookup_class(s.c_str());
441 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
443 std::string s(first, last);
444 return do_lookup_collate(buf, s.c_str());
447 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
448 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
452 sentry(const w32_regex_traits<char>&)
453 { w32_regex_traits<char>::update(); }
455 operator void*() { return this; }
457 static void BOOST_REGEX_CALL update();
461 static w32_regex_traits<char> i;
464 #ifndef BOOST_NO_WREGEX
466 class BOOST_REGEX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
468 typedef re_detail::w32_traits_base base_type;
470 typedef wchar_t char_type;
471 typedef unsigned short uchar_type;
472 typedef unsigned int size_type;
473 typedef std::basic_string<wchar_t> string_type;
474 typedef int locale_type;
475 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
477 return std::wcslen(p);
479 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
480 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
482 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
485 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
487 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
489 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
491 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
494 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
495 { return re_detail::is_combining(c); }
497 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
499 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
502 static int BOOST_REGEX_CALL toi(wchar_t c);
503 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
505 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
507 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
509 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
510 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
514 sentry(const w32_regex_traits<wchar_t>&)
515 { w32_regex_traits<wchar_t>::update(); }
517 operator void*() { return this; }
519 static void BOOST_REGEX_CALL update();
522 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
523 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
526 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
527 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
528 static w32_regex_traits<wchar_t> init_;
529 static wchar_t BOOST_REGEX_CALL wtolower(wchar_t c);
530 static unsigned short wide_unicode_classes[];
532 #endif // Wide strings
535 #ifndef BOOST_NO_STD_LOCALE
544 #pragma option push -a4 -b -Ve -pc
552 template <class charT>
556 struct message_data<char>;
559 struct message_data<wchar_t>;
561 struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
566 char_class_alnum = std::ctype_base::alnum,
567 char_class_alpha = std::ctype_base::alpha,
568 char_class_cntrl = std::ctype_base::cntrl,
569 char_class_digit = std::ctype_base::digit,
570 char_class_graph = std::ctype_base::graph,
571 char_class_lower = std::ctype_base::lower,
572 char_class_print = std::ctype_base::print,
573 char_class_punct = std::ctype_base::punct,
574 char_class_space = std::ctype_base::space,
575 char_class_upper = std::ctype_base::upper,
576 char_class_xdigit = std::ctype_base::xdigit,
577 char_class_blank = 1<<12,
578 char_class_underscore = 1<<13,
579 char_class_word = std::ctype_base::alnum | char_class_underscore,
580 char_class_unicode = 1<<14,
581 char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
582 | char_class_digit | char_class_graph | char_class_lower
583 | char_class_print | char_class_punct | char_class_space
584 | char_class_upper | char_class_xdigit
587 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
589 static char regex_message_cat[BOOST_REGEX_MAX_PATH];
592 } // namespace re_detail
594 template <class charT>
595 class cpp_regex_traits;
598 class BOOST_REGEX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
600 typedef re_detail::cpp_regex_traits_base base_type;
602 re_detail::message_data<char>* pmd;
603 const unsigned char* psyntax;
605 const std::ctype<char>* pctype;
606 const std::collate<char>* pcollate;
607 std::locale locale_inst;
611 cpp_regex_traits(const cpp_regex_traits&);
612 cpp_regex_traits& operator=(const cpp_regex_traits&);
615 typedef char char_type;
616 typedef unsigned char uchar_type;
617 typedef unsigned int size_type;
618 typedef std::string string_type;
619 typedef std::locale locale_type;
624 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
626 return std::strlen(p);
628 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
632 char BOOST_REGEX_CALL translate(char c, bool icase)const
634 return icase ? lower_map[(size_type)(uchar_type)c] : c;
636 void BOOST_REGEX_CALL transform(std::string& out, const std::string& in)const
638 out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
641 void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in)const;
643 static bool BOOST_REGEX_CALL is_separator(char c)
645 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
648 static bool BOOST_REGEX_CALL is_combining(char)
653 bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)const
655 if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
657 if((f & char_class_underscore) && (c == '_'))
659 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
664 int BOOST_REGEX_CALL toi(char c)const;
665 int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix)const;
667 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)const;
668 bool BOOST_REGEX_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
670 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
671 locale_type BOOST_REGEX_CALL imbue(locale_type l);
672 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
676 sentry(const cpp_regex_traits<char>&){}
677 operator void*() { return this; }
681 #ifndef BOOST_NO_WREGEX
683 class BOOST_REGEX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
685 typedef re_detail::cpp_regex_traits_base base_type;
687 typedef wchar_t char_type;
688 typedef unsigned short uchar_type;
689 typedef unsigned int size_type;
690 typedef std::basic_string<wchar_t> string_type;
691 typedef std::locale locale_type;
694 re_detail::message_data<wchar_t>* pmd;
695 const unsigned char* psyntax;
697 const std::ctype<wchar_t>* pctype;
698 const std::collate<wchar_t>* pcollate;
699 const std::codecvt<wchar_t, char, std::mbstate_t>* pcdv;
700 std::locale locale_inst;
701 unsigned int BOOST_REGEX_CALL do_syntax_type(size_type c)const;
705 cpp_regex_traits(const cpp_regex_traits&);
706 cpp_regex_traits& operator=(const cpp_regex_traits&);
710 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
712 return std::wcslen(p);
714 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
716 return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
718 wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)const
720 return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
722 void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
724 out = pcollate->transform(in.c_str(), in.c_str() + in.size());
727 void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
729 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
731 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
734 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
735 { return re_detail::is_combining(c); }
737 bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)const
739 if(pctype->is((std::ctype<wchar_t>::mask)(f & char_class_all_base), c))
741 if((f & char_class_underscore) && (c == '_'))
743 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
745 if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
750 int BOOST_REGEX_CALL toi(wchar_t c)const;
751 int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
753 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
754 bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
756 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
759 locale_type BOOST_REGEX_CALL imbue(locale_type l);
760 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
761 std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2)const;
765 sentry(const cpp_regex_traits<wchar_t>&){}
766 operator void*() { return this; }
769 #endif // BOOST_NO_WREGEX
771 #endif // BOOST_NO_STD_LOCALE
773 #ifdef BOOST_REGEX_USE_WIN32_LOCALE
775 template <class charT>
776 class regex_traits : public w32_regex_traits<charT>
780 #elif defined(BOOST_REGEX_USE_C_LOCALE)
782 template <class charT>
783 class regex_traits : public c_regex_traits<charT>
787 #elif defined(BOOST_REGEX_USE_CPP_LOCALE)
789 template <class charT>
790 class regex_traits : public cpp_regex_traits<charT>
795 #error No default localisation model defined