forked from organicmaps/organicmaps
Renamed methods.
This commit is contained in:
parent
2b6dd058f2
commit
8c8dddf571
7 changed files with 20 additions and 20 deletions
|
@ -101,15 +101,15 @@ UNIT_TEST(MakeLowerCase)
|
|||
string s;
|
||||
|
||||
s = "THIS_IS_UPPER";
|
||||
strings::MakeLowerCase(s);
|
||||
strings::MakeLowerCaseInplace(s);
|
||||
TEST_EQUAL(s, "this_is_upper", ());
|
||||
|
||||
s = "THIS_iS_MiXed";
|
||||
strings::MakeLowerCase(s);
|
||||
strings::MakeLowerCaseInplace(s);
|
||||
TEST_EQUAL(s, "this_is_mixed", ());
|
||||
|
||||
s = "this_is_lower";
|
||||
strings::MakeLowerCase(s);
|
||||
strings::MakeLowerCaseInplace(s);
|
||||
TEST_EQUAL(s, "this_is_lower", ());
|
||||
|
||||
string const utf8("Hola! 99-\xD0\xA3\xD0\x9F\xD0\xAF\xD0\xA7\xD0\x9A\xD0\x90");
|
||||
|
@ -117,7 +117,7 @@ UNIT_TEST(MakeLowerCase)
|
|||
"hola! 99-\xD1\x83\xD0\xBF\xD1\x8F\xD1\x87\xD0\xBA\xD0\xB0", ());
|
||||
|
||||
s = "\xc3\x9f"; // es-cet
|
||||
strings::MakeLowerCase(s);
|
||||
strings::MakeLowerCaseInplace(s);
|
||||
TEST_EQUAL(s, "ss", ());
|
||||
|
||||
strings::UniChar const arr[] = {0x397, 0x10B4, 'Z'};
|
||||
|
@ -378,7 +378,7 @@ UNIT_TEST(Normalize)
|
|||
strings::UniChar const r[] = { 0x30, 0x2c, 'H', 0x649, 0x631, 0x6cc, 0x627, 0x644,
|
||||
0x31, 0x2044, 0x37 };
|
||||
strings::UniString result(&r[0], &r[0] + ARRAY_SIZE(r));
|
||||
strings::Normalize(us);
|
||||
strings::NormalizeInplace(us);
|
||||
TEST_EQUAL(us, result, ());
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static size_t w(UniChar c, UniChar * buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void MakeLowerCase(UniString & s)
|
||||
void MakeLowerCaseInplace(UniString & s)
|
||||
{
|
||||
size_t const size = s.size();
|
||||
|
||||
|
@ -211,8 +211,8 @@ size_t CountNormLowerSymbols(UniString const & s, UniString const & lowStr)
|
|||
|
||||
UniString strCharNorm;
|
||||
strCharNorm.push_back(s[sIdx++]);
|
||||
MakeLowerCase(strCharNorm);
|
||||
Normalize(strCharNorm);
|
||||
MakeLowerCaseInplace(strCharNorm);
|
||||
NormalizeInplace(strCharNorm);
|
||||
|
||||
for (size_t i = 0; i < strCharNorm.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ static void w(strings::UniString & r, uint16_t startIndex, int count)
|
|||
r.push_back(normSymbols[startIndex + i]);
|
||||
}
|
||||
|
||||
void Normalize(strings::UniString & s)
|
||||
void NormalizeInplace(strings::UniString & s)
|
||||
{
|
||||
size_t const size = s.size();
|
||||
|
||||
|
|
|
@ -87,15 +87,15 @@ bool to_double(char const * s, double & d)
|
|||
UniString MakeLowerCase(UniString const & s)
|
||||
{
|
||||
UniString result(s);
|
||||
MakeLowerCase(result);
|
||||
MakeLowerCaseInplace(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void MakeLowerCase(string & s)
|
||||
void MakeLowerCaseInplace(string & s)
|
||||
{
|
||||
UniString uniStr;
|
||||
utf8::unchecked::utf8to32(s.begin(), s.end(), back_inserter(uniStr));
|
||||
MakeLowerCase(uniStr);
|
||||
MakeLowerCaseInplace(uniStr);
|
||||
s.clear();
|
||||
utf8::unchecked::utf32to8(uniStr.begin(), uniStr.end(), back_inserter(s));
|
||||
}
|
||||
|
@ -103,14 +103,14 @@ void MakeLowerCase(string & s)
|
|||
string MakeLowerCase(string const & s)
|
||||
{
|
||||
string result(s);
|
||||
MakeLowerCase(result);
|
||||
MakeLowerCaseInplace(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
UniString Normalize(UniString const & s)
|
||||
{
|
||||
UniString result(s);
|
||||
Normalize(result);
|
||||
NormalizeInplace(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ public:
|
|||
/// Performs full case folding for string to make it search-compatible according
|
||||
/// to rules in ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt
|
||||
/// For implementation @see base/lower_case.cpp
|
||||
void MakeLowerCase(UniString & s);
|
||||
void MakeLowerCaseInplace(UniString & s);
|
||||
UniString MakeLowerCase(UniString const & s);
|
||||
|
||||
/// Performs NFKD - Compatibility decomposition for Unicode according
|
||||
/// to rules in ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
|
||||
/// For implementation @see base/normilize_unicode.cpp
|
||||
void Normalize(UniString & s);
|
||||
void NormalizeInplace(UniString & s);
|
||||
UniString Normalize(UniString const & s);
|
||||
|
||||
/// Counts number of start symbols in string s (that is not lower and not normalized) that maches
|
||||
|
@ -50,7 +50,7 @@ size_t CountNormLowerSymbols(UniString const & s, UniString const & lowStr);
|
|||
void AsciiToLower(string & s);
|
||||
void Trim(string & s);
|
||||
|
||||
void MakeLowerCase(string & s);
|
||||
void MakeLowerCaseInplace(string & s);
|
||||
string MakeLowerCase(string const & s);
|
||||
bool EqualNoCase(string const & s1, string const & s2);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ inline strings::UniString NormalizeAndSimplifyString(string const & s)
|
|||
break;
|
||||
}
|
||||
}
|
||||
MakeLowerCase(uniString);
|
||||
MakeLowerCaseInplace(uniString);
|
||||
// Just after lower casing is a correct place to avoid normalization for specific chars.
|
||||
static auto const isSpecificChar = [](UniChar c) -> bool
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ inline strings::UniString NormalizeAndSimplifyString(string const & s)
|
|||
auto j = find_if(i, end, isSpecificChar);
|
||||
// We don't check if (j != i) because UniString and Normalize handle it correctly.
|
||||
UniString normString(i, j);
|
||||
Normalize(normString);
|
||||
NormalizeInplace(normString);
|
||||
result.insert(result.end(), normString.begin(), normString.end());
|
||||
if (j == end)
|
||||
break;
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
ParsedNumber::ParsedNumber(string const & number, bool american)
|
||||
: m_fullN(number)
|
||||
{
|
||||
strings::MakeLowerCase(m_fullN);
|
||||
strings::MakeLowerCaseInplace(m_fullN);
|
||||
|
||||
char * curr;
|
||||
m_startN = strtol(number.c_str(), &curr, 10);
|
||||
|
|
Loading…
Add table
Reference in a new issue