mirror of
https://github.com/boostorg/regex.git
synced 2025-07-15 05:16:37 +02:00
Ported ICU integration code to VC6/7.
Added some needed std lib #includes. Reworked gcc separate file template instantiation code. [SVN r30791]
This commit is contained in:
@ -35,8 +35,8 @@
|
|||||||
Moved declarations class-inline in static_mutex.hpp so that SGI Irix compiler
|
Moved declarations class-inline in static_mutex.hpp so that SGI Irix compiler
|
||||||
can cope.
|
can cope.
|
||||||
<LI>
|
<LI>
|
||||||
Added missing #includes to fileiter.hpp and cpp_regex_traits.hpp, this is
|
Added needed standard library #includes to fileiter.hpp, regex_workaround.hpp
|
||||||
probably an SGI Irix specific fix.
|
and cpp_regex_traits.hpp.
|
||||||
<LI>
|
<LI>
|
||||||
Fixed a bug where non-greedy repeats could in certain strange curcumstances
|
Fixed a bug where non-greedy repeats could in certain strange curcumstances
|
||||||
repeat more times than their maximum value.
|
repeat more times than their maximum value.
|
||||||
@ -50,11 +50,14 @@
|
|||||||
Disabled external templates for Intel C++ 8.0 and earlier - otherwise
|
Disabled external templates for Intel C++ 8.0 and earlier - otherwise
|
||||||
unresolved references can occur.
|
unresolved references can occur.
|
||||||
<LI>
|
<LI>
|
||||||
|
Rewritten extern template code for gcc so that only specific member functions
|
||||||
|
are exported: otherwise strange unresolved references can occur when linking
|
||||||
|
and mixing debug and non-debug code.
|
||||||
|
<LI>
|
||||||
Initialise all the data members of the unicode_iterators: this keeps gcc from
|
Initialise all the data members of the unicode_iterators: this keeps gcc from
|
||||||
issuing needless warnings.
|
issuing needless warnings.
|
||||||
<LI>
|
<LI>
|
||||||
Added needed header include to regex_workaround.hpp: appears to be an
|
Ported the ICU integration code to VC6 and VC7.</LI></UL>
|
||||||
MSVC+STLport 5 specific problem.</LI></UL>
|
|
||||||
<P>Boost 1.33.0.</P>
|
<P>Boost 1.33.0.</P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>
|
<LI>
|
||||||
@ -136,7 +139,7 @@
|
|||||||
<HR>
|
<HR>
|
||||||
<P></P>
|
<P></P>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
28 June 2004
|
28 June 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
Moved declarations class-inline in static_mutex.hpp so that SGI Irix compiler
|
Moved declarations class-inline in static_mutex.hpp so that SGI Irix compiler
|
||||||
can cope.
|
can cope.
|
||||||
<LI>
|
<LI>
|
||||||
Added missing #includes to fileiter.hpp and cpp_regex_traits.hpp, this is
|
Added needed standard library #includes to fileiter.hpp, regex_workaround.hpp
|
||||||
probably an SGI Irix specific fix.
|
and cpp_regex_traits.hpp.
|
||||||
<LI>
|
<LI>
|
||||||
Fixed a bug where non-greedy repeats could in certain strange curcumstances
|
Fixed a bug where non-greedy repeats could in certain strange curcumstances
|
||||||
repeat more times than their maximum value.
|
repeat more times than their maximum value.
|
||||||
@ -50,11 +50,14 @@
|
|||||||
Disabled external templates for Intel C++ 8.0 and earlier - otherwise
|
Disabled external templates for Intel C++ 8.0 and earlier - otherwise
|
||||||
unresolved references can occur.
|
unresolved references can occur.
|
||||||
<LI>
|
<LI>
|
||||||
|
Rewritten extern template code for gcc so that only specific member functions
|
||||||
|
are exported: otherwise strange unresolved references can occur when linking
|
||||||
|
and mixing debug and non-debug code.
|
||||||
|
<LI>
|
||||||
Initialise all the data members of the unicode_iterators: this keeps gcc from
|
Initialise all the data members of the unicode_iterators: this keeps gcc from
|
||||||
issuing needless warnings.
|
issuing needless warnings.
|
||||||
<LI>
|
<LI>
|
||||||
Added needed header include to regex_workaround.hpp: appears to be an
|
Ported the ICU integration code to VC6 and VC7.</LI></UL>
|
||||||
MSVC+STLport 5 specific problem.</LI></UL>
|
|
||||||
<P>Boost 1.33.0.</P>
|
<P>Boost 1.33.0.</P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>
|
<LI>
|
||||||
@ -136,7 +139,7 @@
|
|||||||
<HR>
|
<HR>
|
||||||
<P></P>
|
<P></P>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
28 June 2004
|
28 June 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
|
@ -49,7 +49,7 @@ rule regex-test-run ( sources + : input * : requirements * )
|
|||||||
run
|
run
|
||||||
# sources
|
# sources
|
||||||
$(sources)
|
$(sources)
|
||||||
<template>../build/regex-options
|
<template>../build/regex-test-options
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
<lib>../build/boost_regex
|
<lib>../build/boost_regex
|
||||||
|
@ -40,28 +40,28 @@ class BOOST_REGEX_DECL icu_regex_traits_implementation
|
|||||||
typedef UChar32 char_type;
|
typedef UChar32 char_type;
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
typedef std::vector<char_type> string_type;
|
typedef std::vector<char_type> string_type;
|
||||||
typedef ::Locale locale_type;
|
typedef U_NAMESPACE_QUALIFIER Locale locale_type;
|
||||||
typedef boost::uint_least32_t char_class_type;
|
typedef boost::uint_least32_t char_class_type;
|
||||||
public:
|
public:
|
||||||
icu_regex_traits_implementation(const ::Locale& l)
|
icu_regex_traits_implementation(const U_NAMESPACE_QUALIFIER Locale& l)
|
||||||
: m_locale(l)
|
: m_locale(l)
|
||||||
{
|
{
|
||||||
UErrorCode success = U_ZERO_ERROR;
|
UErrorCode success = U_ZERO_ERROR;
|
||||||
m_collator.reset( ::Collator::createInstance(l, success));
|
m_collator.reset(U_NAMESPACE_QUALIFIER Collator::createInstance(l, success));
|
||||||
if(U_SUCCESS(success) == 0)
|
if(U_SUCCESS(success) == 0)
|
||||||
init_error();
|
init_error();
|
||||||
m_collator->setStrength(::Collator::IDENTICAL);
|
m_collator->setStrength(U_NAMESPACE_QUALIFIER Collator::IDENTICAL);
|
||||||
success = U_ZERO_ERROR;
|
success = U_ZERO_ERROR;
|
||||||
m_primary_collator.reset( ::Collator::createInstance(l, success));
|
m_primary_collator.reset(U_NAMESPACE_QUALIFIER Collator::createInstance(l, success));
|
||||||
if(U_SUCCESS(success) == 0)
|
if(U_SUCCESS(success) == 0)
|
||||||
init_error();
|
init_error();
|
||||||
m_primary_collator->setStrength(::Collator::PRIMARY);
|
m_primary_collator->setStrength(U_NAMESPACE_QUALIFIER Collator::PRIMARY);
|
||||||
}
|
}
|
||||||
::Locale getloc()const
|
U_NAMESPACE_QUALIFIER Locale getloc()const
|
||||||
{
|
{
|
||||||
return m_locale;
|
return m_locale;
|
||||||
}
|
}
|
||||||
string_type do_transform(const char_type* p1, const char_type* p2, const ::Collator* pcoll) const;
|
string_type do_transform(const char_type* p1, const char_type* p2, const U_NAMESPACE_QUALIFIER Collator* pcoll) const;
|
||||||
string_type transform(const char_type* p1, const char_type* p2) const
|
string_type transform(const char_type* p1, const char_type* p2) const
|
||||||
{
|
{
|
||||||
return do_transform(p1, p2, m_collator.get());
|
return do_transform(p1, p2, m_collator.get());
|
||||||
@ -76,12 +76,12 @@ private:
|
|||||||
std::runtime_error e("Could not initialize ICU resources");
|
std::runtime_error e("Could not initialize ICU resources");
|
||||||
boost::throw_exception(e);
|
boost::throw_exception(e);
|
||||||
}
|
}
|
||||||
::Locale m_locale; // The ICU locale that we're using
|
U_NAMESPACE_QUALIFIER Locale m_locale; // The ICU locale that we're using
|
||||||
boost::scoped_ptr< ::Collator> m_collator; // The full collation object
|
boost::scoped_ptr< U_NAMESPACE_QUALIFIER Collator> m_collator; // The full collation object
|
||||||
boost::scoped_ptr< ::Collator> m_primary_collator; // The primary collation object
|
boost::scoped_ptr< U_NAMESPACE_QUALIFIER Collator> m_primary_collator; // The primary collation object
|
||||||
};
|
};
|
||||||
|
|
||||||
inline boost::shared_ptr<icu_regex_traits_implementation> get_icu_regex_traits_implementation(const ::Locale& loc)
|
inline boost::shared_ptr<icu_regex_traits_implementation> get_icu_regex_traits_implementation(const U_NAMESPACE_QUALIFIER Locale& loc)
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<icu_regex_traits_implementation>(new icu_regex_traits_implementation(loc));
|
return boost::shared_ptr<icu_regex_traits_implementation>(new icu_regex_traits_implementation(loc));
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
typedef UChar32 char_type;
|
typedef UChar32 char_type;
|
||||||
typedef std::size_t size_type;
|
typedef std::size_t size_type;
|
||||||
typedef std::vector<char_type> string_type;
|
typedef std::vector<char_type> string_type;
|
||||||
typedef ::Locale locale_type;
|
typedef U_NAMESPACE_QUALIFIER Locale locale_type;
|
||||||
#ifdef BOOST_NO_INT64_T
|
#ifdef BOOST_NO_INT64_T
|
||||||
typedef std::bitset<64> char_class_type;
|
typedef std::bitset<64> char_class_type;
|
||||||
#else
|
#else
|
||||||
@ -104,7 +104,7 @@ public:
|
|||||||
struct boost_extensions_tag{};
|
struct boost_extensions_tag{};
|
||||||
|
|
||||||
icu_regex_traits()
|
icu_regex_traits()
|
||||||
: m_pimpl(re_detail::get_icu_regex_traits_implementation(::Locale()))
|
: m_pimpl(re_detail::get_icu_regex_traits_implementation(U_NAMESPACE_QUALIFIER Locale()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static size_type length(const char_type* p);
|
static size_type length(const char_type* p);
|
||||||
@ -213,6 +213,7 @@ typedef match_results<const ::UChar*> u16match;
|
|||||||
//
|
//
|
||||||
namespace re_detail{
|
namespace re_detail{
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
inline u32regex do_make_u32regex(InputIterator i,
|
inline u32regex do_make_u32regex(InputIterator i,
|
||||||
InputIterator j,
|
InputIterator j,
|
||||||
@ -241,7 +242,59 @@ inline u32regex do_make_u32regex(InputIterator i,
|
|||||||
{
|
{
|
||||||
return u32regex(i, j, opt);
|
return u32regex(i, j, opt);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
template <class InputIterator>
|
||||||
|
inline u32regex do_make_u32regex(InputIterator i,
|
||||||
|
InputIterator j,
|
||||||
|
boost::regex_constants::syntax_option_type opt,
|
||||||
|
const boost::mpl::int_<1>*)
|
||||||
|
{
|
||||||
|
typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type;
|
||||||
|
typedef std::vector<UChar32> vector_type;
|
||||||
|
vector_type v;
|
||||||
|
conv_type a(i), b(j);
|
||||||
|
while(a != b)
|
||||||
|
{
|
||||||
|
v.push_back(*a);
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
return u32regex(&*v.begin(), v.size(), opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class InputIterator>
|
||||||
|
inline u32regex do_make_u32regex(InputIterator i,
|
||||||
|
InputIterator j,
|
||||||
|
boost::regex_constants::syntax_option_type opt,
|
||||||
|
const boost::mpl::int_<2>*)
|
||||||
|
{
|
||||||
|
typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type;
|
||||||
|
typedef std::vector<UChar32> vector_type;
|
||||||
|
vector_type v;
|
||||||
|
conv_type a(i), b(j);
|
||||||
|
while(a != b)
|
||||||
|
{
|
||||||
|
v.push_back(*a);
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
return u32regex(&*v.begin(), v.size(), opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class InputIterator>
|
||||||
|
inline u32regex do_make_u32regex(InputIterator i,
|
||||||
|
InputIterator j,
|
||||||
|
boost::regex_constants::syntax_option_type opt,
|
||||||
|
const boost::mpl::int_<4>*)
|
||||||
|
{
|
||||||
|
typedef std::vector<UCHAR32> vector_type;
|
||||||
|
vector_type v;
|
||||||
|
while(i != j)
|
||||||
|
{
|
||||||
|
v.push_back((UCHAR32)(*i));
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
return u32regex(&*v.begin(), v.size(), opt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -721,7 +774,14 @@ OutputIterator do_regex_replace(OutputIterator out,
|
|||||||
{
|
{
|
||||||
// unfortunately we have to copy the format string in order to pass in onward:
|
// unfortunately we have to copy the format string in order to pass in onward:
|
||||||
std::vector<UChar32> f;
|
std::vector<UChar32> f;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
f.assign(fmt.first, fmt.second);
|
f.assign(fmt.first, fmt.second);
|
||||||
|
#else
|
||||||
|
f.clear();
|
||||||
|
I2 pos = fmt.first;
|
||||||
|
while(pos != fmt.second)
|
||||||
|
f.push_back(*pos++);
|
||||||
|
#endif
|
||||||
|
|
||||||
regex_iterator<I1, UChar32, icu_regex_traits> i(in.first, in.second, e, flags);
|
regex_iterator<I1, UChar32, icu_regex_traits> i(in.first, in.second, e, flags);
|
||||||
regex_iterator<I1, UChar32, icu_regex_traits> j;
|
regex_iterator<I1, UChar32, icu_regex_traits> j;
|
||||||
@ -773,7 +833,11 @@ inline OutputIterator u32regex_replace(OutputIterator out,
|
|||||||
const charT* fmt,
|
const charT* fmt,
|
||||||
match_flag_type flags = match_default)
|
match_flag_type flags = match_default)
|
||||||
{
|
{
|
||||||
return re_detail::extract_output_base(
|
return re_detail::extract_output_base
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
|
<OutputIterator>
|
||||||
|
#endif
|
||||||
|
(
|
||||||
re_detail::do_regex_replace(
|
re_detail::do_regex_replace(
|
||||||
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
@ -791,7 +855,11 @@ inline OutputIterator u32regex_replace(OutputIterator out,
|
|||||||
const std::basic_string<charT>& fmt,
|
const std::basic_string<charT>& fmt,
|
||||||
match_flag_type flags = match_default)
|
match_flag_type flags = match_default)
|
||||||
{
|
{
|
||||||
return re_detail::extract_output_base(
|
return re_detail::extract_output_base
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
|
<OutputIterator>
|
||||||
|
#endif
|
||||||
|
(
|
||||||
re_detail::do_regex_replace(
|
re_detail::do_regex_replace(
|
||||||
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
@ -809,7 +877,11 @@ inline OutputIterator u32regex_replace(OutputIterator out,
|
|||||||
const UnicodeString& fmt,
|
const UnicodeString& fmt,
|
||||||
match_flag_type flags = match_default)
|
match_flag_type flags = match_default)
|
||||||
{
|
{
|
||||||
return re_detail::extract_output_base(
|
return re_detail::extract_output_base
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
|
<OutputIterator>
|
||||||
|
#endif
|
||||||
|
(
|
||||||
re_detail::do_regex_replace(
|
re_detail::do_regex_replace(
|
||||||
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
|
||||||
|
@ -242,10 +242,17 @@ public:
|
|||||||
{
|
{
|
||||||
return assign(p, p + len, f);
|
return assign(p, p + len, f);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
basic_regex& do_assign(const charT* p1,
|
||||||
|
const charT* p2,
|
||||||
|
flag_type f);
|
||||||
|
public:
|
||||||
basic_regex& assign(const charT* p1,
|
basic_regex& assign(const charT* p1,
|
||||||
const charT* p2,
|
const charT* p2,
|
||||||
flag_type f = regex_constants::normal);
|
flag_type f = regex_constants::normal)
|
||||||
|
{
|
||||||
|
return do_assign(p1, p2, f);
|
||||||
|
}
|
||||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
|
|
||||||
template <class ST, class SA>
|
template <class ST, class SA>
|
||||||
@ -493,7 +500,7 @@ private:
|
|||||||
// (in the event of a throw, the state of the object remains unchanged).
|
// (in the event of a throw, the state of the object remains unchanged).
|
||||||
//
|
//
|
||||||
template <class charT, class traits>
|
template <class charT, class traits>
|
||||||
basic_regex<charT, traits>& basic_regex<charT, traits>::assign(const charT* p1,
|
basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p1,
|
||||||
const charT* p2,
|
const charT* p2,
|
||||||
flag_type f)
|
flag_type f)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
#include <ios>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
|
@ -57,7 +57,7 @@ template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T >;
|
|||||||
# include BOOST_ABI_SUFFIX
|
# include BOOST_ABI_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(BOOST_MSVC) || defined(BOOST_INTEL) || (defined(__GNUC__) && (__GNUC__ >= 3))
|
#elif defined(BOOST_MSVC) || defined(__ICL)
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
# ifndef BOOST_REGEX_INSTANTIATE
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
@ -99,6 +99,53 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher< std::basic_str
|
|||||||
# undef template
|
# undef template
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#elif (defined(__GNUC__) && (__GNUC__ >= 3))
|
||||||
|
|
||||||
|
# ifndef BOOST_REGEX_INSTANTIATE
|
||||||
|
# define template __extension__ extern template
|
||||||
|
# endif
|
||||||
|
|
||||||
|
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T>&
|
||||||
|
basic_regex<BOOST_REGEX_CHAR_T>::do_assign(
|
||||||
|
const BOOST_REGEX_CHAR_T* p1,
|
||||||
|
const BOOST_REGEX_CHAR_T* p2,
|
||||||
|
flag_type f);
|
||||||
|
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T>::locale_type BOOST_REGEX_CALL
|
||||||
|
basic_regex<BOOST_REGEX_CHAR_T>::imbue(locale_type l);
|
||||||
|
|
||||||
|
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
||||||
|
match_results<const BOOST_REGEX_CHAR_T*>::maybe_assign(
|
||||||
|
const match_results<const BOOST_REGEX_CHAR_T*>& m);
|
||||||
|
|
||||||
|
|
||||||
|
template BOOST_REGEX_DECL void ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::construct_init(
|
||||||
|
BOOST_REGEX_CHAR_T const * first, BOOST_REGEX_CHAR_T const * end,
|
||||||
|
match_results<BOOST_REGEX_CHAR_T const *>& what,
|
||||||
|
const basic_regex<BOOST_REGEX_CHAR_T>& e,
|
||||||
|
match_flag_type f);
|
||||||
|
template BOOST_REGEX_DECL bool ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::match();
|
||||||
|
template BOOST_REGEX_DECL bool ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::find();
|
||||||
|
|
||||||
|
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||||
|
// std:basic_string<>::const_iterator instances as well:
|
||||||
|
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
||||||
|
match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::maybe_assign(
|
||||||
|
const match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>& m);
|
||||||
|
|
||||||
|
template BOOST_REGEX_DECL void ::boost::re_detail::perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::construct_init(
|
||||||
|
std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator first, std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator end,
|
||||||
|
match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>& what,
|
||||||
|
const basic_regex<BOOST_REGEX_CHAR_T>& e,
|
||||||
|
match_flag_type f);
|
||||||
|
template BOOST_REGEX_DECL bool ::boost::re_detail::perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::match();
|
||||||
|
template BOOST_REGEX_DECL bool ::boost::re_detail::perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::find();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# ifdef template
|
||||||
|
# undef template
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
@ -71,6 +71,17 @@ template<>
|
|||||||
struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
|
struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
|
||||||
template<>
|
template<>
|
||||||
struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
|
struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
|
||||||
|
//
|
||||||
|
// the follwoing are needed for ICU support:
|
||||||
|
//
|
||||||
|
template<>
|
||||||
|
struct regex_iterator_traits<unsigned char*> : pointer_iterator_traits<char>{};
|
||||||
|
template<>
|
||||||
|
struct regex_iterator_traits<const unsigned char*> : const_pointer_iterator_traits<char>{};
|
||||||
|
template<>
|
||||||
|
struct regex_iterator_traits<int*> : pointer_iterator_traits<int>{};
|
||||||
|
template<>
|
||||||
|
struct regex_iterator_traits<const int*> : const_pointer_iterator_traits<int>{};
|
||||||
|
|
||||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
|
@ -68,6 +68,7 @@ inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
|
|||||||
// which succeeds when it should not.
|
// which succeeds when it should not.
|
||||||
//
|
//
|
||||||
#ifndef _RWSTD_VER
|
#ifndef _RWSTD_VER
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
|
||||||
template <class C, class T, class A>
|
template <class C, class T, class A>
|
||||||
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
||||||
{
|
{
|
||||||
@ -78,7 +79,9 @@ inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
|||||||
}
|
}
|
||||||
return s.compare(p);
|
return s.compare(p);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
|
||||||
template <class C, class T, class A>
|
template <class C, class T, class A>
|
||||||
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
||||||
{
|
{
|
||||||
@ -89,6 +92,7 @@ inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
|||||||
}
|
}
|
||||||
return s.compare(p);
|
return s.compare(p);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
inline int string_compare(const std::string& s, const char* p)
|
inline int string_compare(const std::string& s, const char* p)
|
||||||
{ return std::strcmp(s.c_str(), p); }
|
{ return std::strcmp(s.c_str(), p); }
|
||||||
# ifndef BOOST_NO_WREGEX
|
# ifndef BOOST_NO_WREGEX
|
||||||
@ -96,7 +100,6 @@ inline int string_compare(const std::wstring& s, const wchar_t* p)
|
|||||||
{ return std::wcscmp(s.c_str(), p); }
|
{ return std::wcscmp(s.c_str(), p); }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
|
|
||||||
template <class Seq, class C>
|
template <class Seq, class C>
|
||||||
inline int string_compare(const Seq& s, const C* p)
|
inline int string_compare(const Seq& s, const C* p)
|
||||||
{
|
{
|
||||||
@ -107,7 +110,6 @@ inline int string_compare(const Seq& s, const C* p)
|
|||||||
}
|
}
|
||||||
return (i == s.size()) ? -p[i] : s[i] - p[i];
|
return (i == s.size()) ? -p[i] : s[i] - p[i];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
# define STR_COMP(s,p) string_compare(s,p)
|
# define STR_COMP(s,p) string_compare(s,p)
|
||||||
|
|
||||||
template<class charT>
|
template<class charT>
|
||||||
@ -325,13 +327,7 @@ public:
|
|||||||
match_flag_type f);
|
match_flag_type f);
|
||||||
|
|
||||||
bool match();
|
bool match();
|
||||||
bool match_imp();
|
|
||||||
bool find();
|
bool find();
|
||||||
bool find_imp();
|
|
||||||
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
|
||||||
typedef bool (perl_matcher::*protected_proc_type)();
|
|
||||||
bool protected_call(protected_proc_type);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void setf(match_flag_type f)
|
void setf(match_flag_type f)
|
||||||
{ m_match_flags |= f; }
|
{ m_match_flags |= f; }
|
||||||
@ -339,6 +335,16 @@ public:
|
|||||||
{ m_match_flags &= ~f; }
|
{ m_match_flags &= ~f; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void construct_init(BidiIterator first, BidiIterator end,
|
||||||
|
match_results<BidiIterator, Allocator>& what,
|
||||||
|
const basic_regex<char_type, traits>& e,
|
||||||
|
match_flag_type f);
|
||||||
|
bool find_imp();
|
||||||
|
bool match_imp();
|
||||||
|
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||||
|
typedef bool (perl_matcher::*protected_proc_type)();
|
||||||
|
bool protected_call(protected_proc_type);
|
||||||
|
#endif
|
||||||
void estimate_max_state_count(std::random_access_iterator_tag*);
|
void estimate_max_state_count(std::random_access_iterator_tag*);
|
||||||
void estimate_max_state_count(void*);
|
void estimate_max_state_count(void*);
|
||||||
bool match_prefix();
|
bool match_prefix();
|
||||||
|
@ -39,6 +39,15 @@ perl_matcher<BidiIterator, Allocator, traits>::perl_matcher(BidiIterator first,
|
|||||||
: m_result(what), base(first), last(end),
|
: m_result(what), base(first), last(end),
|
||||||
position(first), re(e), traits_inst(e.get_traits()),
|
position(first), re(e), traits_inst(e.get_traits()),
|
||||||
m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
|
m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
|
||||||
|
{
|
||||||
|
construct_init(first, last, what, e, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class BidiIterator, class Allocator, class traits>
|
||||||
|
void perl_matcher<BidiIterator, Allocator, traits>::construct_init(BidiIterator first, BidiIterator end,
|
||||||
|
match_results<BidiIterator, Allocator>& what,
|
||||||
|
const basic_regex<char_type, traits>& e,
|
||||||
|
match_flag_type f)
|
||||||
{
|
{
|
||||||
typedef typename regex_iterator_traits<BidiIterator>::iterator_category category;
|
typedef typename regex_iterator_traits<BidiIterator>::iterator_category category;
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
namespace re_detail{
|
namespace re_detail{
|
||||||
|
@ -175,7 +175,8 @@ inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UChar* p, co
|
|||||||
template <class charT, class Traits, class Alloc>
|
template <class charT, class Traits, class Alloc>
|
||||||
inline u32regex_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
|
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||||
|
return u32regex_iterator<iter_type>(p.begin(), p.end(), e, m);
|
||||||
}
|
}
|
||||||
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,9 @@ public:
|
|||||||
: end(last), re(*p), flags(f){ subs.push_back(sub); }
|
: end(last), re(*p), flags(f){ subs.push_back(sub); }
|
||||||
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
||||||
: end(last), re(*p), flags(f), subs(v){}
|
: end(last), re(*p), flags(f), subs(v){}
|
||||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
// can't reliably get this to work....
|
||||||
|
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||||
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
@ -190,7 +192,9 @@ public:
|
|||||||
if(!pdata->init(a))
|
if(!pdata->init(a))
|
||||||
pdata.reset();
|
pdata.reset();
|
||||||
}
|
}
|
||||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
// can't reliably get this to work....
|
||||||
|
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||||
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
@ -284,13 +288,15 @@ inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const
|
|||||||
template <class charT, class Traits, class Alloc>
|
template <class charT, class Traits, class Alloc>
|
||||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
|
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||||
|
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
|
||||||
}
|
}
|
||||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
// construction from a reference to an array:
|
// construction from a reference to an array:
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
@ -314,13 +320,15 @@ inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const
|
|||||||
template <class charT, class Traits, class Alloc, std::size_t N>
|
template <class charT, class Traits, class Alloc, std::size_t N>
|
||||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
|
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||||
|
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
|
||||||
}
|
}
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
|
||||||
}
|
}
|
||||||
|
#endif // BOOST_MSVC < 1300
|
||||||
|
|
||||||
// construction from a vector of sub_match id's:
|
// construction from a vector of sub_match id's:
|
||||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
@ -342,7 +350,8 @@ inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const
|
|||||||
template <class charT, class Traits, class Alloc>
|
template <class charT, class Traits, class Alloc>
|
||||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
|
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||||
|
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
|
||||||
}
|
}
|
||||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
|
42
src/icu.cpp
42
src/icu.cpp
@ -25,12 +25,18 @@ namespace boost{
|
|||||||
|
|
||||||
namespace re_detail{
|
namespace re_detail{
|
||||||
|
|
||||||
icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do_transform(const char_type* p1, const char_type* p2, const ::Collator* pcoll) const
|
icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do_transform(const char_type* p1, const char_type* p2, const U_NAMESPACE_QUALIFIER Collator* pcoll) const
|
||||||
{
|
{
|
||||||
// TODO make thread safe!!!! :
|
// TODO make thread safe!!!! :
|
||||||
typedef u32_to_u16_iterator<const char_type*, ::UChar> itt;
|
typedef u32_to_u16_iterator<const char_type*, ::UChar> itt;
|
||||||
itt i(p1), j(p2);
|
itt i(p1), j(p2);
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
std::vector< ::UChar> t(i, j);
|
std::vector< ::UChar> t(i, j);
|
||||||
|
#else
|
||||||
|
std::vector< ::UChar> t;
|
||||||
|
while(i != j)
|
||||||
|
t.push_back(*i++);
|
||||||
|
#endif
|
||||||
::uint8_t result[100];
|
::uint8_t result[100];
|
||||||
::int32_t len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result));
|
::int32_t len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result));
|
||||||
if(std::size_t(len) > sizeof(result))
|
if(std::size_t(len) > sizeof(result))
|
||||||
@ -39,11 +45,29 @@ icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do
|
|||||||
len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1);
|
len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1);
|
||||||
if((0 == presult[len-1]) && (len > 1))
|
if((0 == presult[len-1]) && (len > 1))
|
||||||
--len;
|
--len;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
return string_type(presult.get(), presult.get()+len);
|
return string_type(presult.get(), presult.get()+len);
|
||||||
|
#else
|
||||||
|
string_type sresult;
|
||||||
|
::uint8_t const* ia = presult.get();
|
||||||
|
::uint8_t const* ib = presult.get()+len;
|
||||||
|
while(ia != ib)
|
||||||
|
sresult.push_back(*ia++);
|
||||||
|
return sresult;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if((0 == result[len-1]) && (len > 1))
|
if((0 == result[len-1]) && (len > 1))
|
||||||
--len;
|
--len;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
return string_type(result, result+len);
|
return string_type(result, result+len);
|
||||||
|
#else
|
||||||
|
string_type sresult;
|
||||||
|
::uint8_t const* ia = result;
|
||||||
|
::uint8_t const* ib = result+len;
|
||||||
|
while(ia != ib)
|
||||||
|
sresult.push_back(*ia++);
|
||||||
|
return sresult;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -390,7 +414,14 @@ icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_ty
|
|||||||
string_type result;
|
string_type result;
|
||||||
if(std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2)
|
if(std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2)
|
||||||
{
|
{
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
std::string s(p1, p2);
|
std::string s(p1, p2);
|
||||||
|
#else
|
||||||
|
std::string s;
|
||||||
|
const char_type* p3 = p1;
|
||||||
|
while(p3 != p2)
|
||||||
|
s.append(1, *p3++);
|
||||||
|
#endif
|
||||||
// Try Unicode name:
|
// Try Unicode name:
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, s.c_str(), &err);
|
UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, s.c_str(), &err);
|
||||||
@ -409,7 +440,16 @@ icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_ty
|
|||||||
}
|
}
|
||||||
// try POSIX name:
|
// try POSIX name:
|
||||||
s = ::boost::re_detail::lookup_default_collate_name(s);
|
s = ::boost::re_detail::lookup_default_collate_name(s);
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
result.assign(s.begin(), s.end());
|
result.assign(s.begin(), s.end());
|
||||||
|
#else
|
||||||
|
result.clear();
|
||||||
|
std::string::const_iterator si, sj;
|
||||||
|
si = s.begin();
|
||||||
|
sj = s.end();
|
||||||
|
while(si != sj)
|
||||||
|
result.push_back(*si++);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if(result.empty() && (p2-p1 == 1))
|
if(result.empty() && (p2-p1 == 1))
|
||||||
result.push_back(*p1);
|
result.push_back(*p1);
|
||||||
|
@ -25,6 +25,44 @@
|
|||||||
#include <boost/regex/icu.hpp>
|
#include <boost/regex/icu.hpp>
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
|
||||||
|
namespace unnecessary_fix{
|
||||||
|
//
|
||||||
|
// Some outrageously broken std lib's don't have a conforming
|
||||||
|
// back_insert_iterator, which means we can't use the std version
|
||||||
|
// as an argument to regex_replace, sigh... use our own:
|
||||||
|
//
|
||||||
|
template <class Seq>
|
||||||
|
class back_insert_iterator
|
||||||
|
#ifndef BOOST_NO_STD_ITERATOR
|
||||||
|
: public std::iterator<std::output_iterator_tag,void,void,void,void>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Seq* container;
|
||||||
|
typedef const typename Seq::value_type value_type;
|
||||||
|
public:
|
||||||
|
typedef Seq container_type;
|
||||||
|
typedef std::output_iterator_tag iterator_category;
|
||||||
|
|
||||||
|
explicit back_insert_iterator(Seq& x) : container(&x) {}
|
||||||
|
back_insert_iterator& operator=(const value_type& val)
|
||||||
|
{
|
||||||
|
container->push_back(val);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
back_insert_iterator& operator*() { return *this; }
|
||||||
|
back_insert_iterator& operator++() { return *this; }
|
||||||
|
back_insert_iterator operator++(int) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Seq>
|
||||||
|
inline back_insert_iterator<Seq> back_inserter(Seq& x)
|
||||||
|
{
|
||||||
|
return back_insert_iterator<Seq>(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// compare two match_results struct's for equality,
|
// compare two match_results struct's for equality,
|
||||||
// converting the iterator as needed:
|
// converting the iterator as needed:
|
||||||
@ -32,7 +70,9 @@
|
|||||||
template <class MR1, class MR2>
|
template <class MR1, class MR2>
|
||||||
void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
||||||
{
|
{
|
||||||
typedef boost::u16_to_u32_iterator<typename MR2::value_type::const_iterator> iterator_type;
|
typedef typename MR2::value_type MR2_value_type;
|
||||||
|
typedef typename MR2_value_type::const_iterator MR2_iterator_type;
|
||||||
|
typedef boost::u16_to_u32_iterator<MR2_iterator_type> iterator_type;
|
||||||
typedef typename MR1::size_type size_type;
|
typedef typename MR1::size_type size_type;
|
||||||
if(w1.size() != w2.size())
|
if(w1.size() != w2.size())
|
||||||
{
|
{
|
||||||
@ -60,7 +100,9 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
|||||||
template <class MR1, class MR2>
|
template <class MR1, class MR2>
|
||||||
void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<1> const*)
|
void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<1> const*)
|
||||||
{
|
{
|
||||||
typedef boost::u8_to_u32_iterator<typename MR2::value_type::const_iterator> iterator_type;
|
typedef typename MR2::value_type MR2_value_type;
|
||||||
|
typedef typename MR2_value_type::const_iterator MR2_iterator_type;
|
||||||
|
typedef boost::u8_to_u32_iterator<MR2_iterator_type> iterator_type;
|
||||||
typedef typename MR1::size_type size_type;
|
typedef typename MR1::size_type size_type;
|
||||||
if(w1.size() != w2.size())
|
if(w1.size() != w2.size())
|
||||||
{
|
{
|
||||||
@ -150,23 +192,35 @@ void test_icu(const wchar_t&, const test_regex_search_tag& )
|
|||||||
boost::u32regex r;
|
boost::u32regex r;
|
||||||
if(*test_locale::c_str())
|
if(*test_locale::c_str())
|
||||||
{
|
{
|
||||||
::Locale l(test_locale::c_str());
|
U_NAMESPACE_QUALIFIER Locale l(test_locale::c_str());
|
||||||
if(l.isBogus())
|
if(l.isBogus())
|
||||||
return;
|
return;
|
||||||
r.imbue(l);
|
r.imbue(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< ::UChar32> expression;
|
std::vector< ::UChar32> expression;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
||||||
|
#else
|
||||||
|
std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
|
||||||
|
#endif
|
||||||
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
||||||
try{
|
try{
|
||||||
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
r.assign(expression.begin(), expression.end(), syntax_options);
|
r.assign(expression.begin(), expression.end(), syntax_options);
|
||||||
|
#else
|
||||||
|
r.assign(&*expression.begin(), expression.size(), syntax_options);
|
||||||
|
#endif
|
||||||
if(r.status())
|
if(r.status())
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
||||||
}
|
}
|
||||||
std::vector< ::UChar32> search_text;
|
std::vector< ::UChar32> search_text;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
search_text.assign(test_info<wchar_t>::search_text().begin(), test_info<wchar_t>::search_text().end());
|
search_text.assign(test_info<wchar_t>::search_text().begin(), test_info<wchar_t>::search_text().end());
|
||||||
|
#else
|
||||||
|
std::copy(test_info<wchar_t>::search_text().begin(), test_info<wchar_t>::search_text().end(), std::back_inserter(search_text));
|
||||||
|
#endif
|
||||||
boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
|
boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
|
||||||
const int* answer_table = test_info<wchar_t>::answer_table();
|
const int* answer_table = test_info<wchar_t>::answer_table();
|
||||||
boost::match_results<std::vector< ::UChar32>::const_iterator> what;
|
boost::match_results<std::vector< ::UChar32>::const_iterator> what;
|
||||||
@ -194,8 +248,15 @@ void test_icu(const wchar_t&, const test_regex_search_tag& )
|
|||||||
std::vector<UChar> expression16, text16;
|
std::vector<UChar> expression16, text16;
|
||||||
boost::match_results<std::vector<UChar>::const_iterator> what16;
|
boost::match_results<std::vector<UChar>::const_iterator> what16;
|
||||||
boost::match_results<const UChar*> what16c;
|
boost::match_results<const UChar*> what16c;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
||||||
text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
|
text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
|
||||||
|
#else
|
||||||
|
expression16.clear();
|
||||||
|
std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
|
||||||
|
text16.clear();
|
||||||
|
std::copy(u16_conv(search_text.begin()), u16_conv(search_text.end()), std::back_inserter(text16));
|
||||||
|
#endif
|
||||||
r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
|
r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
|
||||||
if(boost::u32regex_search(const_cast<const std::vector<UChar>&>(text16).begin(), const_cast<const std::vector<UChar>&>(text16).end(), what16, r, opts))
|
if(boost::u32regex_search(const_cast<const std::vector<UChar>&>(text16).begin(), const_cast<const std::vector<UChar>&>(text16).end(), what16, r, opts))
|
||||||
{
|
{
|
||||||
@ -231,8 +292,15 @@ void test_icu(const wchar_t&, const test_regex_search_tag& )
|
|||||||
std::vector<unsigned char> expression8, text8;
|
std::vector<unsigned char> expression8, text8;
|
||||||
boost::match_results<std::vector<unsigned char>::const_iterator> what8;
|
boost::match_results<std::vector<unsigned char>::const_iterator> what8;
|
||||||
boost::match_results<const unsigned char*> what8c;
|
boost::match_results<const unsigned char*> what8c;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
||||||
text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
|
text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
|
||||||
|
#else
|
||||||
|
expression8.clear();
|
||||||
|
std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
|
||||||
|
text8.clear();
|
||||||
|
std::copy(u8_conv(search_text.begin()), u8_conv(search_text.end()), std::back_inserter(text8));
|
||||||
|
#endif
|
||||||
r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
|
r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
|
||||||
if(boost::u32regex_search(const_cast<const std::vector<unsigned char>&>(text8).begin(), const_cast<const std::vector<unsigned char>&>(text8).end(), what8, r, opts))
|
if(boost::u32regex_search(const_cast<const std::vector<unsigned char>&>(text8).begin(), const_cast<const std::vector<unsigned char>&>(text8).end(), what8, r, opts))
|
||||||
{
|
{
|
||||||
@ -289,12 +357,16 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
{
|
{
|
||||||
typedef boost::u16_to_u32_iterator<std::wstring::const_iterator, ::UChar32> conv_iterator;
|
typedef boost::u16_to_u32_iterator<std::wstring::const_iterator, ::UChar32> conv_iterator;
|
||||||
std::vector< ::UChar32> expression;
|
std::vector< ::UChar32> expression;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
||||||
|
#else
|
||||||
|
std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
|
||||||
|
#endif
|
||||||
boost::regex_constants::syntax_option_type syntax_options = test_info<wchar_t>::syntax_options();
|
boost::regex_constants::syntax_option_type syntax_options = test_info<wchar_t>::syntax_options();
|
||||||
boost::u32regex r;
|
boost::u32regex r;
|
||||||
if(*test_locale::c_str())
|
if(*test_locale::c_str())
|
||||||
{
|
{
|
||||||
::Locale l(test_locale::c_str());
|
U_NAMESPACE_QUALIFIER Locale l(test_locale::c_str());
|
||||||
if(l.isBogus())
|
if(l.isBogus())
|
||||||
return;
|
return;
|
||||||
r.imbue(l);
|
r.imbue(l);
|
||||||
@ -304,7 +376,11 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
if(0 == r.assign(expression.begin(), expression.end(), syntax_options | boost::regex_constants::no_except).status())
|
if(0 == r.assign(expression.begin(), expression.end(), syntax_options | boost::regex_constants::no_except).status())
|
||||||
|
#else
|
||||||
|
if(0 == r.assign(&*expression.begin(), expression.size(), syntax_options | boost::regex_constants::no_except).status())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
||||||
}
|
}
|
||||||
@ -318,7 +394,11 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
//
|
//
|
||||||
bool have_catch = false;
|
bool have_catch = false;
|
||||||
try{
|
try{
|
||||||
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
r.assign(expression.begin(), expression.end(), syntax_options);
|
r.assign(expression.begin(), expression.end(), syntax_options);
|
||||||
|
#else
|
||||||
|
r.assign(&*expression.begin(), expression.size(), syntax_options);
|
||||||
|
#endif
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
if(r.status())
|
if(r.status())
|
||||||
have_catch = true;
|
have_catch = true;
|
||||||
@ -356,7 +436,11 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
//
|
//
|
||||||
typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
|
typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
|
||||||
std::vector<UChar> expression16;
|
std::vector<UChar> expression16;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
||||||
|
#else
|
||||||
|
std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
|
||||||
|
#endif
|
||||||
if(0 == boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options | boost::regex_constants::no_except).status())
|
if(0 == boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options | boost::regex_constants::no_except).status())
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
||||||
@ -374,7 +458,11 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
//
|
//
|
||||||
typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator> u8_conv;
|
typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator> u8_conv;
|
||||||
std::vector<unsigned char> expression8;
|
std::vector<unsigned char> expression8;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
||||||
|
#else
|
||||||
|
std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
|
||||||
|
#endif
|
||||||
if(0 == boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options | boost::regex_constants::no_except).status())
|
if(0 == boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options | boost::regex_constants::no_except).status())
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
||||||
@ -393,27 +481,42 @@ void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
|||||||
void test_icu(const wchar_t&, const test_regex_replace_tag&)
|
void test_icu(const wchar_t&, const test_regex_replace_tag&)
|
||||||
{
|
{
|
||||||
std::vector< ::UChar32> expression;
|
std::vector< ::UChar32> expression;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
|
||||||
|
#else
|
||||||
|
std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
|
||||||
|
#endif
|
||||||
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
||||||
boost::u32regex r;
|
boost::u32regex r;
|
||||||
try{
|
try{
|
||||||
|
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||||
r.assign(expression.begin(), expression.end(), syntax_options);
|
r.assign(expression.begin(), expression.end(), syntax_options);
|
||||||
|
#else
|
||||||
|
r.assign(&*expression.begin(), expression.size(), syntax_options);
|
||||||
|
#endif
|
||||||
if(r.status())
|
if(r.status())
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
||||||
}
|
}
|
||||||
typedef std::vector<UChar32> string_type;
|
typedef std::vector<UChar32> string_type;
|
||||||
string_type search_text;
|
string_type search_text;
|
||||||
search_text.assign(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end());
|
|
||||||
boost::regex_constants::match_flag_type opts = test_info<UChar32>::match_options();
|
boost::regex_constants::match_flag_type opts = test_info<UChar32>::match_options();
|
||||||
string_type format_string;
|
string_type format_string;
|
||||||
|
string_type result_string;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
|
search_text.assign(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end());
|
||||||
format_string.assign(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end());
|
format_string.assign(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end());
|
||||||
format_string.push_back(0);
|
format_string.push_back(0);
|
||||||
string_type result_string;
|
|
||||||
result_string.assign(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end());
|
result_string.assign(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end());
|
||||||
|
#else
|
||||||
|
std::copy(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end(), std::back_inserter(search_text));
|
||||||
|
std::copy(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end(), std::back_inserter(format_string));
|
||||||
|
format_string.push_back(0);
|
||||||
|
std::copy(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end(), std::back_inserter(result_string));
|
||||||
|
#endif
|
||||||
string_type result;
|
string_type result;
|
||||||
|
|
||||||
boost::u32regex_replace(std::back_inserter(result), search_text.begin(), search_text.end(), r, &*format_string.begin(), opts);
|
boost::u32regex_replace(unnecessary_fix::back_inserter(result), search_text.begin(), search_text.end(), r, &*format_string.begin(), opts);
|
||||||
if(result != result_string)
|
if(result != result_string)
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", UChar32);
|
BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", UChar32);
|
||||||
@ -428,12 +531,19 @@ void test_icu(const wchar_t&, const test_regex_replace_tag&)
|
|||||||
//
|
//
|
||||||
typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
|
typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
|
||||||
std::vector<UChar> expression16, text16, format16, result16, found16;
|
std::vector<UChar> expression16, text16, format16, result16, found16;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
|
||||||
text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
|
text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
|
||||||
format16.assign(u16_conv(format_string.begin()), u16_conv(format_string.end()));
|
format16.assign(u16_conv(format_string.begin()), u16_conv(format_string.end()));
|
||||||
result16.assign(u16_conv(result_string.begin()), u16_conv(result_string.end()));
|
result16.assign(u16_conv(result_string.begin()), u16_conv(result_string.end()));
|
||||||
|
#else
|
||||||
|
std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
|
||||||
|
std::copy(u16_conv(search_text.begin()), u16_conv(search_text.end()), std::back_inserter(text16));
|
||||||
|
std::copy(u16_conv(format_string.begin()), u16_conv(format_string.end()), std::back_inserter(format16));
|
||||||
|
std::copy(u16_conv(result_string.begin()), u16_conv(result_string.end()), std::back_inserter(result16));
|
||||||
|
#endif
|
||||||
r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
|
r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
|
||||||
boost::u32regex_replace(std::back_inserter(found16), text16.begin(), text16.end(), r, &*format16.begin(), opts);
|
boost::u32regex_replace(unnecessary_fix::back_inserter(found16), text16.begin(), text16.end(), r, &*format16.begin(), opts);
|
||||||
if(result16 != found16)
|
if(result16 != found16)
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-16 string returned incorrect result", UChar32);
|
BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-16 string returned incorrect result", UChar32);
|
||||||
@ -458,12 +568,19 @@ void test_icu(const wchar_t&, const test_regex_replace_tag&)
|
|||||||
//
|
//
|
||||||
typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator, unsigned char> u8_conv;
|
typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator, unsigned char> u8_conv;
|
||||||
std::vector<char> expression8, text8, format8, result8, found8;
|
std::vector<char> expression8, text8, format8, result8, found8;
|
||||||
|
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||||
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
|
||||||
text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
|
text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
|
||||||
format8.assign(u8_conv(format_string.begin()), u8_conv(format_string.end()));
|
format8.assign(u8_conv(format_string.begin()), u8_conv(format_string.end()));
|
||||||
result8.assign(u8_conv(result_string.begin()), u8_conv(result_string.end()));
|
result8.assign(u8_conv(result_string.begin()), u8_conv(result_string.end()));
|
||||||
|
#else
|
||||||
|
std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
|
||||||
|
std::copy(u8_conv(search_text.begin()), u8_conv(search_text.end()), std::back_inserter(text8));
|
||||||
|
std::copy(u8_conv(format_string.begin()), u8_conv(format_string.end()), std::back_inserter(format8));
|
||||||
|
std::copy(u8_conv(result_string.begin()), u8_conv(result_string.end()), std::back_inserter(result8));
|
||||||
|
#endif
|
||||||
r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
|
r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
|
||||||
boost::u32regex_replace(std::back_inserter(found8), text8.begin(), text8.end(), r, &*format8.begin(), opts);
|
boost::u32regex_replace(unnecessary_fix::back_inserter(found8), text8.begin(), text8.end(), r, &*format8.begin(), opts);
|
||||||
if(result8 != found8)
|
if(result8 != found8)
|
||||||
{
|
{
|
||||||
BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-8 string returned incorrect result", UChar32);
|
BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-8 string returned incorrect result", UChar32);
|
||||||
|
@ -122,10 +122,14 @@ void test_unicode()
|
|||||||
TEST_REGEX_CLASS_U(Line Separator, 2028);
|
TEST_REGEX_CLASS_U(Line Separator, 2028);
|
||||||
TEST_REGEX_CLASS_U(Zp, 2029);
|
TEST_REGEX_CLASS_U(Zp, 2029);
|
||||||
TEST_REGEX_CLASS_U(Paragraph Separator, 2029);
|
TEST_REGEX_CLASS_U(Paragraph Separator, 2029);
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
// Some tests have to be disabled for VC6 because the compiler
|
||||||
|
// mangles the string literals...
|
||||||
TEST_REGEX_CLASS_U(C*, 009F);
|
TEST_REGEX_CLASS_U(C*, 009F);
|
||||||
TEST_REGEX_CLASS_U(Other, 009F);
|
TEST_REGEX_CLASS_U(Other, 009F);
|
||||||
TEST_REGEX_CLASS_U(Cc, 009F);
|
TEST_REGEX_CLASS_U(Cc, 009F);
|
||||||
TEST_REGEX_CLASS_U(Control, 009F);
|
TEST_REGEX_CLASS_U(Control, 009F);
|
||||||
|
#endif
|
||||||
TEST_REGEX_CLASS_U(Cf, FFFB);
|
TEST_REGEX_CLASS_U(Cf, FFFB);
|
||||||
TEST_REGEX_CLASS_U(Format, FFFB);
|
TEST_REGEX_CLASS_U(Format, FFFB);
|
||||||
//TEST_REGEX_CLASS_U(Cs, DC00);
|
//TEST_REGEX_CLASS_U(Cs, DC00);
|
||||||
@ -147,14 +151,18 @@ void test_unicode()
|
|||||||
TEST_REGEX_SEARCH_U(L"[\\N{MODIFIER LETTER LOW ACUTE ACCENT}]", perl, L"\x02CF", match_default, make_array(0, 1, -2, -2));
|
TEST_REGEX_SEARCH_U(L"[\\N{MODIFIER LETTER LOW ACUTE ACCENT}]", perl, L"\x02CF", match_default, make_array(0, 1, -2, -2));
|
||||||
TEST_REGEX_SEARCH_U(L"[\\N{SUPERSCRIPT ONE}]", perl, L"\x00B9", match_default, make_array(0, 1, -2, -2));
|
TEST_REGEX_SEARCH_U(L"[\\N{SUPERSCRIPT ONE}]", perl, L"\x00B9", match_default, make_array(0, 1, -2, -2));
|
||||||
TEST_REGEX_SEARCH_U(L"\\N{CJK UNIFIED IDEOGRAPH-7FED}", perl, L"\x7FED", match_default, make_array(0, 1, -2, -2));
|
TEST_REGEX_SEARCH_U(L"\\N{CJK UNIFIED IDEOGRAPH-7FED}", perl, L"\x7FED", match_default, make_array(0, 1, -2, -2));
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
// Some tests have to be disabled for VC6 because the compiler
|
||||||
|
// mangles the string literals...
|
||||||
TEST_REGEX_SEARCH_U(L"\\w+", perl, L" e\x301" L"coute ", match_default, make_array(1, 8, -2, -2));
|
TEST_REGEX_SEARCH_U(L"\\w+", perl, L" e\x301" L"coute ", match_default, make_array(1, 8, -2, -2));
|
||||||
|
|
||||||
TEST_REGEX_SEARCH_U(L"^", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
|
TEST_REGEX_SEARCH_U(L"^", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
|
||||||
match_default | match_not_bol, make_array(2, 2, -2, 4, 4, -2, 7, 7, -2, 9, 9, -2, 11, 11, -2, 13, 13, -2, 15, 15, -2, -2));
|
match_default | match_not_bol, make_array(2, 2, -2, 4, 4, -2, 7, 7, -2, 9, 9, -2, 11, 11, -2, 13, 13, -2, 15, 15, -2, -2));
|
||||||
TEST_REGEX_SEARCH_U(L"$", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
|
TEST_REGEX_SEARCH_U(L"$", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
|
||||||
match_default | match_not_eol, make_array(1, 1, -2, 3, 3, -2, 5, 5, -2, 8, 8, -2, 10, 10, -2, 12, 12, -2, 14, 14, -2, -2));
|
match_default | match_not_eol, make_array(1, 1, -2, 3, 3, -2, 5, 5, -2, 8, 8, -2, 10, 10, -2, 12, 12, -2, 14, 14, -2, -2));
|
||||||
TEST_REGEX_SEARCH_U(L".", perl, L" \x2028\x2029\x000D\x000A\x000A\x000C\x000D\x0085 ",
|
TEST_REGEX_SEARCH_U(L".", perl, L" \x2028\x2029\x000D\x000A\x000A\x000C\x000D\x0085 ",
|
||||||
match_default | match_not_dot_newline, make_array(0, 1, -2, 9, 10, -2, -2));
|
match_default | match_not_dot_newline, make_array(0, 1, -2, 9, 10, -2, -2));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user