mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 05:42:15 +02:00
Regex.ICU: use BOOST_REGEX_UCHAR_IS_WCHAR_T in a few other places, and improve concept checks.
This commit is contained in:
@ -158,7 +158,7 @@ inline u32regex_iterator<const wchar_t*> make_u32regex_iterator(const wchar_t* p
|
||||
return u32regex_iterator<const wchar_t*>(p, p+std::wcslen(p), e, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UChar* p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
|
@ -267,7 +267,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m);
|
||||
@ -297,7 +297,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
|
@ -33,7 +33,34 @@
|
||||
#include <boost/regex/concepts.hpp>
|
||||
#endif
|
||||
|
||||
template <class I>
|
||||
void check_token_iterator(I i)
|
||||
{
|
||||
typedef typename I::value_type value_type;
|
||||
typedef typename value_type::value_type char_type;
|
||||
typedef std::basic_string<char_type> string_type;
|
||||
|
||||
I j;
|
||||
|
||||
std::vector<string_type> v;
|
||||
|
||||
while (i != j)
|
||||
{
|
||||
v.push_back(i->str());
|
||||
++i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class I>
|
||||
void check_iterator(I i)
|
||||
{
|
||||
typedef typename I::value_type value_type;
|
||||
|
||||
std::vector <value_type> v(i, I());
|
||||
(void)v;
|
||||
|
||||
}
|
||||
int main()
|
||||
{
|
||||
// VC6 and VC7 can't cope with the iterator architypes,
|
||||
@ -150,6 +177,64 @@ int main()
|
||||
s1 = boost::u32regex_replace(s1, e1, s1);
|
||||
s2 = boost::u32regex_replace(s2, e1, s2);
|
||||
|
||||
std::vector<int> subs1;
|
||||
int subs2[2] = { 1, 2 };
|
||||
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1));
|
||||
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2));
|
||||
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1, boost::regex_constants::match_default));
|
||||
check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1));
|
||||
|
||||
check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1, boost::regex_constants::match_default));
|
||||
check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1));
|
||||
check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1, boost::regex_constants::match_default));
|
||||
check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1));
|
||||
check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1, boost::regex_constants::match_default));
|
||||
check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1));
|
||||
check_iterator(boost::make_u32regex_iterator(s1, e1, boost::regex_constants::match_default));
|
||||
check_iterator(boost::make_u32regex_iterator(s2, e1));
|
||||
check_iterator(boost::make_u32regex_iterator(us, e1));
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user