mirror of
https://github.com/boostorg/regex.git
synced 2025-07-19 07:12:07 +02:00
merged changes in regex5 branch
[SVN r26692]
This commit is contained in:
@ -26,16 +26,16 @@ namespace boost{
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
template <class BidiIterator, class Allocator, class charT, class traits, class Allocator2>
|
||||
template <class BidiIterator, class Allocator, class charT, class traits>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
match_results<BidiIterator, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
if(e.flags() & regex_constants::failbit)
|
||||
return false;
|
||||
|
||||
re_detail::perl_matcher<BidiIterator, Allocator, traits, Allocator2> matcher(first, last, m, e, flags);
|
||||
re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags);
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
@ -46,24 +46,24 @@ bool regex_search(BidiIterator first, BidiIterator last,
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
// then it really won't support this either:
|
||||
template <class charT, class Allocator, class traits, class Allocator2>
|
||||
template <class charT, class Allocator, class traits>
|
||||
inline bool regex_search(const charT* str,
|
||||
match_results<const charT*, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + traits::length(str), m, e, flags);
|
||||
}
|
||||
|
||||
template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
|
||||
template <class ST, class SA, class Allocator, class charT, class traits>
|
||||
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
|
||||
match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#else // partial specialisation
|
||||
#else // partial overloads:
|
||||
inline bool regex_search(const char* str,
|
||||
cmatch& m,
|
||||
const regex& e,
|
||||
@ -71,6 +71,14 @@ inline bool regex_search(const char* str,
|
||||
{
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
inline bool regex_search(const char* first, const char* last,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
cmatch m;
|
||||
return regex_search(first, last, m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
@ -79,6 +87,13 @@ inline bool regex_search(const wchar_t* str,
|
||||
{
|
||||
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
inline bool regex_search(const wchar_t* first, const wchar_t* last,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wcmatch m;
|
||||
return regex_search(first, last, m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#endif
|
||||
inline bool regex_search(const std::string& s,
|
||||
smatch& m,
|
||||
@ -99,9 +114,9 @@ inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
|
||||
#endif
|
||||
|
||||
template <class BidiIterator, class charT, class traits, class Allocator2>
|
||||
template <class BidiIterator, class charT, class traits>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
if(e.flags() & regex_constants::failbit)
|
||||
@ -109,51 +124,34 @@ bool regex_search(BidiIterator first, BidiIterator last,
|
||||
|
||||
match_results<BidiIterator> m;
|
||||
typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
|
||||
re_detail::perl_matcher<BidiIterator, match_alloc_type, traits, Allocator2> matcher(first, last, m, e, flags);
|
||||
re_detail::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any);
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template <class charT, class traits, class Allocator2>
|
||||
template <class charT, class traits>
|
||||
inline bool regex_search(const charT* str,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + traits::length(str), e, flags);
|
||||
}
|
||||
|
||||
template <class ST, class SA, class charT, class traits, class Allocator2>
|
||||
template <class ST, class SA, class charT, class traits>
|
||||
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#else // non-template function overloads
|
||||
inline bool regex_search(const char* first, const char* last,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
cmatch m;
|
||||
return regex_search(first, last, m, e, flags);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* first, const wchar_t* last,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wcmatch m;
|
||||
return regex_search(first, last, m, e, flags);
|
||||
}
|
||||
#endif
|
||||
inline bool regex_search(const char* str,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
cmatch m;
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* str,
|
||||
@ -161,7 +159,7 @@ inline bool regex_search(const wchar_t* str,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wcmatch m;
|
||||
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
|
||||
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#endif
|
||||
inline bool regex_search(const std::string& s,
|
||||
@ -169,7 +167,7 @@ inline bool regex_search(const std::string& s,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
smatch m;
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
@ -177,11 +175,12 @@ inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wsmatch m;
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // BOOST_NO_WREGEX
|
||||
|
||||
#endif // partial overload
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
|
Reference in New Issue
Block a user