forked from boostorg/regex
Added tests for locales.
[SVN r24113]
This commit is contained in:
@@ -47,13 +47,14 @@ namespace boost{
|
||||
|
||||
c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform(const char* p1, const char* p2)
|
||||
{
|
||||
std::size_t s = 10;
|
||||
std::string result(s, ' ');
|
||||
std::string result(10, ' ');
|
||||
std::size_t s = result.size();
|
||||
std::size_t r;
|
||||
std::string src(p1, p2);
|
||||
while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), result.size())))
|
||||
while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), s)))
|
||||
{
|
||||
result.append(r - s + 3, ' ');
|
||||
s = result.size();
|
||||
}
|
||||
result.erase(r);
|
||||
return result;
|
||||
|
||||
@@ -33,6 +33,7 @@ void cpp_regex_traits_char_layer<char>::init()
|
||||
// we need to start by initialising our syntax map so we know which
|
||||
// character is used for which purpose:
|
||||
std::memset(m_char_map, 0, sizeof(m_char_map));
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
#ifndef __IBMCPP__
|
||||
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
|
||||
#else
|
||||
@@ -75,6 +76,7 @@ void cpp_regex_traits_char_layer<char>::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
|
||||
{
|
||||
const char* ptr = get_default_syntax(i);
|
||||
@@ -84,7 +86,9 @@ void cpp_regex_traits_char_layer<char>::init()
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// finish off by calculating our escape types:
|
||||
//
|
||||
|
||||
@@ -43,9 +43,10 @@ c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::t
|
||||
std::size_t s = 10;
|
||||
std::wstring src(p1, p2);
|
||||
std::wstring result(s, L' ');
|
||||
while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), result.size())))
|
||||
while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s)))
|
||||
{
|
||||
result.append(r - s + 3, L' ');
|
||||
s = result.size();
|
||||
}
|
||||
result.erase(r);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user