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[];
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 (?!...)
132 struct BOOST_REGEX_DECL c_traits_base : public regex_traits_base
137 char_class_alpha = 0x0001,
138 char_class_cntrl = 0x0002,
139 char_class_digit = 0x0004,
140 char_class_lower = 0x0008,
141 char_class_punct = 0x0010,
142 char_class_space = 0x0020,
143 char_class_upper = 0x0040,
144 char_class_xdigit = 0x0080,
145 char_class_blank = 0x0100,
146 char_class_underscore = 0x4000,
147 char_class_unicode = 0x8000,
149 char_class_alnum = char_class_alpha | char_class_digit,
150 char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
151 char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
152 char_class_word = char_class_alpha | char_class_digit | char_class_underscore
154 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
156 #if defined(__MWERKS__) && __MWERKS__ <= 0x6000
157 friend class c_regex_traits<char>;
158 friend class c_regex_traits<wchar_t>;
161 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
164 map_size = UCHAR_MAX + 1
167 static unsigned char syntax_map[map_size];
168 static unsigned short class_map[map_size];
169 static char lower_case_map[map_size];
171 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
172 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
173 static void BOOST_REGEX_CALL do_update_ctype();
174 static void BOOST_REGEX_CALL do_update_collate();
176 static std::string BOOST_REGEX_CALL error_string(unsigned id);
177 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
180 } // namespace re_detail
184 class BOOST_REGEX_DECL c_regex_traits<char> : public re_detail::c_traits_base
186 typedef re_detail::c_traits_base base_type;
188 typedef char char_type;
189 typedef unsigned char uchar_type;
190 typedef unsigned int size_type;
191 typedef std::string string_type;
192 typedef int locale_type;
194 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
196 return std::strlen(p);
198 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
200 return syntax_map[c];
202 static char BOOST_REGEX_CALL translate(char c, bool icase)
204 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
206 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
208 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
210 static bool BOOST_REGEX_CALL is_separator(char c)
212 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
215 static bool BOOST_REGEX_CALL is_combining(char)
220 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
222 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
225 static int BOOST_REGEX_CALL toi(char c);
226 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
228 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
230 std::string s(first, last);
231 return do_lookup_class(s.c_str());
234 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
236 std::string s(first, last);
237 return do_lookup_collate(buf, s.c_str());
240 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
241 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
253 sentry(const c_regex_traits<char>&)
254 { c_regex_traits<char>::update(); }
255 operator void*() { return this; }
257 static void BOOST_REGEX_CALL update();
259 static void BOOST_REGEX_CALL init();
260 static void BOOST_REGEX_CALL m_free();
261 static c_regex_traits<char> i;
263 static unsigned sort_type;
264 static char sort_delim;
267 #ifndef BOOST_NO_WREGEX
269 class BOOST_REGEX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
271 typedef re_detail::c_traits_base base_type;
273 typedef wchar_t char_type;
274 typedef unsigned short uchar_type;
275 typedef unsigned int size_type;
276 typedef std::basic_string<wchar_t> string_type;
277 typedef int locale_type;
278 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
280 return std::wcslen(p);
282 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
283 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
285 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
288 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
290 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
292 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
294 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
297 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
298 { return re_detail::is_combining(c); }
300 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
302 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
305 static int BOOST_REGEX_CALL toi(wchar_t c);
306 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
308 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
310 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
312 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
313 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
314 c_regex_traits<wchar_t>()
316 ~c_regex_traits<wchar_t>()
320 sentry(const c_regex_traits<wchar_t>&)
321 { c_regex_traits<wchar_t>::update(); }
322 operator void*() { return this; }
324 static void BOOST_REGEX_CALL update();
325 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
326 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
328 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
329 static void BOOST_REGEX_CALL m_free();
330 static void BOOST_REGEX_CALL init();
331 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
332 static c_regex_traits<wchar_t> init_;
334 static unsigned sort_type;
335 static wchar_t sort_delim;
339 #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
343 struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
347 char_class_alnum = C1_ALPHA | C1_DIGIT,
348 char_class_alpha = C1_ALPHA,
349 char_class_cntrl = C1_CNTRL,
350 char_class_digit = C1_DIGIT,
351 char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA,
352 char_class_lower = C1_LOWER,
353 char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA,
354 char_class_punct = C1_PUNCT,
355 char_class_space = C1_SPACE,
356 char_class_upper = C1_UPPER,
357 char_class_xdigit = C1_XDIGIT,
358 char_class_blank = C1_BLANK,
359 char_class_underscore = 0x4000,
360 char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
361 char_class_unicode = 0x8000,
362 char_class_win = 0x01FF
367 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
369 static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
372 map_size = UCHAR_MAX + 1
375 static unsigned char syntax_map[map_size];
376 static unsigned short class_map[map_size];
377 static char lower_case_map[map_size];
379 static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
380 static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
381 static void BOOST_REGEX_CALL do_free();
382 static void BOOST_REGEX_CALL do_init();
384 static std::string BOOST_REGEX_CALL error_string(unsigned id);
385 static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
389 } // namespace re_detail
391 template<class charT>
392 class w32_regex_traits;
395 class BOOST_REGEX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
397 typedef re_detail::w32_traits_base base_type;
399 typedef char char_type;
400 typedef unsigned char uchar_type;
401 typedef unsigned int size_type;
402 typedef std::string string_type;
403 typedef int locale_type;
405 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
407 return std::strlen(p);
409 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
411 return syntax_map[c];
413 static char BOOST_REGEX_CALL translate(char c, bool icase)
415 return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
417 static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
419 static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
421 static bool BOOST_REGEX_CALL is_separator(char c)
423 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
426 static bool BOOST_REGEX_CALL is_combining(char)
431 static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
433 return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
436 static int BOOST_REGEX_CALL toi(char c);
437 static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
439 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
441 std::string s(first, last);
442 return do_lookup_class(s.c_str());
445 static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
447 std::string s(first, last);
448 return do_lookup_collate(buf, s.c_str());
451 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
452 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
456 sentry(const w32_regex_traits<char>&)
457 { w32_regex_traits<char>::update(); }
459 operator void*() { return this; }
461 static void BOOST_REGEX_CALL update();
465 static w32_regex_traits<char> i;
468 #ifndef BOOST_NO_WREGEX
470 class BOOST_REGEX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
472 typedef re_detail::w32_traits_base base_type;
474 typedef wchar_t char_type;
475 typedef unsigned short uchar_type;
476 typedef unsigned int size_type;
477 typedef std::basic_string<wchar_t> string_type;
478 typedef int locale_type;
479 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
481 return std::wcslen(p);
483 static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
484 static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
486 return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
489 static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
491 static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
493 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
495 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
498 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
499 { return re_detail::is_combining(c); }
501 static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
503 return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
506 static int BOOST_REGEX_CALL toi(wchar_t c);
507 static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
509 static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
511 static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
513 static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
514 locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
518 sentry(const w32_regex_traits<wchar_t>&)
519 { w32_regex_traits<wchar_t>::update(); }
521 operator void*() { return this; }
523 static void BOOST_REGEX_CALL update();
526 static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
527 static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
530 static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
531 static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
532 static w32_regex_traits<wchar_t> init_;
533 static wchar_t BOOST_REGEX_CALL wtolower(wchar_t c);
534 static unsigned short wide_unicode_classes[];
536 #endif // Wide strings
539 #if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
548 #pragma option push -a4 -b -Ve -pc
556 template <class charT>
560 struct message_data<char>;
563 struct message_data<wchar_t>;
565 struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
570 char_class_alnum = std::ctype_base::alnum,
571 char_class_alpha = std::ctype_base::alpha,
572 char_class_cntrl = std::ctype_base::cntrl,
573 char_class_digit = std::ctype_base::digit,
574 char_class_graph = std::ctype_base::graph,
575 char_class_lower = std::ctype_base::lower,
576 char_class_print = std::ctype_base::print,
577 char_class_punct = std::ctype_base::punct,
578 char_class_space = std::ctype_base::space,
579 char_class_upper = std::ctype_base::upper,
580 char_class_xdigit = std::ctype_base::xdigit,
581 char_class_blank = 1<<12,
582 char_class_underscore = 1<<13,
583 char_class_word = std::ctype_base::alnum | char_class_underscore,
584 char_class_unicode = 1<<14,
585 char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
586 | char_class_digit | char_class_graph | char_class_lower
587 | char_class_print | char_class_punct | char_class_space
588 | char_class_upper | char_class_xdigit
591 static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
593 static char regex_message_cat[BOOST_REGEX_MAX_PATH];
596 } // namespace re_detail
598 template <class charT>
599 class cpp_regex_traits;
602 class BOOST_REGEX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
604 typedef re_detail::cpp_regex_traits_base base_type;
606 re_detail::message_data<char>* pmd;
607 const unsigned char* psyntax;
609 const std::ctype<char>* pctype;
610 const std::collate<char>* pcollate;
611 std::locale locale_inst;
615 cpp_regex_traits(const cpp_regex_traits&);
616 cpp_regex_traits& operator=(const cpp_regex_traits&);
619 typedef char char_type;
620 typedef unsigned char uchar_type;
621 typedef unsigned int size_type;
622 typedef std::string string_type;
623 typedef std::locale locale_type;
628 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
630 return std::strlen(p);
632 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
636 char BOOST_REGEX_CALL translate(char c, bool icase)const
638 return icase ? lower_map[(size_type)(uchar_type)c] : c;
640 void BOOST_REGEX_CALL transform(std::string& out, const std::string& in)const
642 out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
645 void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in)const;
647 static bool BOOST_REGEX_CALL is_separator(char c)
649 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
652 static bool BOOST_REGEX_CALL is_combining(char)
657 bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)const
659 if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
661 if((f & char_class_underscore) && (c == '_'))
663 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
668 int BOOST_REGEX_CALL toi(char c)const;
669 int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix)const;
671 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)const;
672 bool BOOST_REGEX_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
674 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
675 locale_type BOOST_REGEX_CALL imbue(locale_type l);
676 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
680 sentry(const cpp_regex_traits<char>&){}
681 operator void*() { return this; }
685 #ifndef BOOST_NO_WREGEX
687 class BOOST_REGEX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
689 typedef re_detail::cpp_regex_traits_base base_type;
691 typedef wchar_t char_type;
692 typedef unsigned short uchar_type;
693 typedef unsigned int size_type;
694 typedef std::basic_string<wchar_t> string_type;
695 typedef std::locale locale_type;
698 re_detail::message_data<wchar_t>* pmd;
699 const unsigned char* psyntax;
701 const std::ctype<wchar_t>* pctype;
702 const std::collate<wchar_t>* pcollate;
703 const std::codecvt<wchar_t, char, std::mbstate_t>* pcdv;
704 std::locale locale_inst;
705 unsigned int BOOST_REGEX_CALL do_syntax_type(size_type c)const;
709 cpp_regex_traits(const cpp_regex_traits&);
710 cpp_regex_traits& operator=(const cpp_regex_traits&);
714 static std::size_t BOOST_REGEX_CALL length(const char_type* p)
716 return std::wcslen(p);
718 unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
720 return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
722 wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)const
724 return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
726 void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
728 out = pcollate->transform(in.c_str(), in.c_str() + in.size());
731 void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
733 static bool BOOST_REGEX_CALL is_separator(wchar_t c)
735 return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
738 static bool BOOST_REGEX_CALL is_combining(wchar_t c)
739 { return re_detail::is_combining(c); }
741 bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)const
743 if(pctype->is((std::ctype<wchar_t>::mask)(f & char_class_all_base), c))
745 if((f & char_class_underscore) && (c == '_'))
747 if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
749 if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
754 int BOOST_REGEX_CALL toi(wchar_t c)const;
755 int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
757 boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
758 bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
760 std::string BOOST_REGEX_CALL error_string(unsigned id)const;
763 locale_type BOOST_REGEX_CALL imbue(locale_type l);
764 locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
765 std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2)const;
769 sentry(const cpp_regex_traits<wchar_t>&){}
770 operator void*() { return this; }
773 #endif // BOOST_NO_WREGEX
775 #endif // BOOST_NO_STD_LOCALE
777 #ifdef BOOST_REGEX_USE_WIN32_LOCALE
779 template <class charT>
780 class regex_traits : public w32_regex_traits<charT>
784 #elif defined(BOOST_REGEX_USE_C_LOCALE)
786 template <class charT>
787 class regex_traits : public c_regex_traits<charT>
791 #elif defined(BOOST_REGEX_USE_CPP_LOCALE)
793 template <class charT>
794 class regex_traits : public cpp_regex_traits<charT>
799 #error No default localisation model defined