Added BOOST_REGEX_V3 compatibilty workarounds.

[SVN r21288]
This commit is contained in:
John Maddock
2003-12-16 13:06:01 +00:00
parent 2c3ff62e1b
commit b84b17b3c4
6 changed files with 22 additions and 2 deletions

View File

@ -29,6 +29,11 @@
using namespace boost;
#ifdef BOOST_REGEX_V3
#define regex_constants regbase
#endif
//
// start by defining all our flag types:
@ -63,9 +68,9 @@ flag_info flag_data[] = {
{ BOOST_RE_STR("bk_vbar"), 7, regex_constants::bk_vbar, 2 },
{ BOOST_RE_STR("use_except"), 10, regex_constants::use_except, 2 },
{ BOOST_RE_STR("literal"), 7, regex_constants::literal, 2 },
#ifndef BOOST_REGEX_V3
{ BOOST_RE_STR("nosubs"), 6, regex_constants::nosubs, 2 },
{ BOOST_RE_STR("optimize"), 8, regex_constants::optimize, 2 },
#ifndef BOOST_REGEX_V3
{ BOOST_RE_STR("perlex"), 6, regex_constants::perlex, 2 },
#endif
{ BOOST_RE_STR("normal"), 6, regex_constants::normal, 2 },
@ -87,9 +92,10 @@ flag_info flag_data[] = {
{ BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 },
{ BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 },
{ BOOST_RE_STR("match_partial"), 13, match_partial, 3 },
#ifndef BOOST_REGEX_V3
{ BOOST_RE_STR("match_nosubs"), 12, match_nosubs, 3 },
{ BOOST_RE_STR("match_single_line"), 17, match_single_line, 3 },
#endif
{ BOOST_RE_STR("format_all"), 10, format_all, 3 },
{ BOOST_RE_STR("format_sed"), 10, format_sed, 3 },
{ BOOST_RE_STR("format_perl"), 11, format_perl, 3 },

View File

@ -434,12 +434,14 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
begin_error();
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const basic_regex&, int)" << endl;
}
#ifndef BOOST_REGEX_V3
if(!regex_search(s2, e, static_cast<boost::match_flag_type>(flags[3]))
|| !regex_search(s2.begin(), s2.end(), e, static_cast<boost::match_flag_type>(flags[3])))
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const std::string&, const basic_regex&, int)" << endl;
}
#endif
//
// partial match should give same result as full match
// provided a full match is expected:
@ -476,11 +478,13 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
begin_error();
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const basic_regex&, int)" << endl;
}
#ifndef BOOST_REGEX_V3
if(!regex_search(search_text.c_str(), e, static_cast<boost::match_flag_type>(flags[3])))
{
begin_error();
cout << "regex++ API result mismatch in regex_search(const char_t*, const basic_regex&, int)" << endl;
}
#endif
}
}
if((false == recurse) && (matches[0] == 0) && (matches[1] == static_cast<int>(search_text.size())))