forked from boostorg/regex
Instantiate more bcc32 v5.1 workarounds.
Fix for Chinese Win32 locales. Don't test c_regex_traits if it's not present. [SVN r31768]
This commit is contained in:
@ -24,13 +24,8 @@
|
|||||||
#if !defined(BOOST_NO_STD_STRING)
|
#if !defined(BOOST_NO_STD_STRING)
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#ifdef BOOST_REGEX_V3
|
|
||||||
#include <boost/regex/v3/fileiter.hpp>
|
|
||||||
typedef unsigned match_flag_type;
|
|
||||||
#else
|
|
||||||
#include <boost/regex/v4/fileiter.hpp>
|
#include <boost/regex/v4/fileiter.hpp>
|
||||||
typedef boost::match_flag_type match_flag_type;
|
typedef boost::match_flag_type match_flag_type;
|
||||||
#endif
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
@ -584,7 +579,7 @@ const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL);
|
|||||||
//
|
//
|
||||||
namespace std{
|
namespace std{
|
||||||
template<> template<>
|
template<> template<>
|
||||||
basic_string<char>&
|
basic_string<char>& BOOST_REGEX_DECL
|
||||||
basic_string<char>::replace<const char*>(char* f1, char* f2, const char* i1, const char* i2)
|
basic_string<char>::replace<const char*>(char* f1, char* f2, const char* i1, const char* i2)
|
||||||
{
|
{
|
||||||
unsigned insert_pos = f1 - begin();
|
unsigned insert_pos = f1 - begin();
|
||||||
@ -605,7 +600,29 @@ basic_string<char>::replace<const char*>(char* f1, char* f2, const char* i1, con
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
template<> template<>
|
||||||
|
basic_string<wchar_t>& BOOST_REGEX_DECL
|
||||||
|
basic_string<wchar_t>::replace<const wchar_t*>(wchar_t* f1, wchar_t* f2, const wchar_t* i1, const wchar_t* i2)
|
||||||
|
{
|
||||||
|
unsigned insert_pos = f1 - begin();
|
||||||
|
unsigned remove_len = f2 - f1;
|
||||||
|
unsigned insert_len = i2 - i1;
|
||||||
|
unsigned org_size = size();
|
||||||
|
if(insert_len > remove_len)
|
||||||
|
{
|
||||||
|
append(insert_len-remove_len, ' ');
|
||||||
|
std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end());
|
||||||
|
std::copy(i1, i2, begin() + insert_pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len);
|
||||||
|
std::copy(i1, i2, begin() + insert_pos);
|
||||||
|
erase(size() + insert_len - remove_len);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
} // namespace std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,7 +105,14 @@ void w32_regex_traits_char_layer<char>::init()
|
|||||||
for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
|
for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
|
||||||
char_map[ii] = static_cast<char>(ii);
|
char_map[ii] = static_cast<char>(ii);
|
||||||
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
||||||
BOOST_ASSERT(r == 1 << CHAR_BIT);
|
BOOST_ASSERT(r != 0);
|
||||||
|
if(r < (1 << CHAR_BIT))
|
||||||
|
{
|
||||||
|
// if we have multibyte characters then not all may have been given
|
||||||
|
// a lower case mapping:
|
||||||
|
for(int jj = r; jj < (1 << CHAR_BIT); ++jj)
|
||||||
|
this->m_lower_map[jj] = static_cast<char>(jj);
|
||||||
|
}
|
||||||
r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
|
r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||||
BOOST_ASSERT(0 != r);
|
BOOST_ASSERT(0 != r);
|
||||||
}
|
}
|
||||||
|
@ -223,12 +223,14 @@ int cpp_main(int /*argc*/, char * /*argv*/[])
|
|||||||
print_cpp_info(wchar_t(0), "wchar_t");
|
print_cpp_info(wchar_t(0), "wchar_t");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
|
||||||
boost::c_regex_traits<char> a;
|
boost::c_regex_traits<char> a;
|
||||||
print_sort_syntax(a, "boost::c_regex_traits<char>");
|
print_sort_syntax(a, "boost::c_regex_traits<char>");
|
||||||
#ifndef BOOST_NO_WREGEX
|
#ifndef BOOST_NO_WREGEX
|
||||||
boost::c_regex_traits<wchar_t> b;
|
boost::c_regex_traits<wchar_t> b;
|
||||||
print_sort_syntax(b, "boost::c_regex_traits<wchar_t>");
|
print_sort_syntax(b, "boost::c_regex_traits<wchar_t>");
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifndef BOOST_NO_STD_LOCALE
|
#ifndef BOOST_NO_STD_LOCALE
|
||||||
boost::cpp_regex_traits<char> c;
|
boost::cpp_regex_traits<char> c;
|
||||||
print_sort_syntax(c, "boost::cpp_regex_traits<char>");
|
print_sort_syntax(c, "boost::cpp_regex_traits<char>");
|
||||||
|
Reference in New Issue
Block a user