Reimplement toLower and toUpper as UTF-8, ryzom/ryzomcore#335

develop
kaetemi 4 years ago
parent 54337b757b
commit 2de4907b83

@ -227,8 +227,8 @@ inline double isValidDouble (double v)
* \param str a string to transform to lower case
*/
std::string toLower ( const char *str ); // Ascii only
std::string toLower ( const std::string &str ); // Ascii only
std::string toLower ( const char *str ); // UTF-8
std::string toLower ( const std::string &str ); // UTF-8
void toLower ( char *str ); // Ascii only
char toLower ( const char ch ); // convert only one character
@ -236,8 +236,8 @@ char toLower ( const char ch ); // convert only one character
* \param a string to transform to upper case
*/
// std::string toUpper ( const char *str ); // Ascii only
std::string toUpper ( const std::string &str); // Ascii only
std::string toUpper ( const char *str ); // UTF-8
std::string toUpper ( const std::string &str); // UTF-8
void toUpper ( char *str); // Ascii only

@ -260,12 +260,6 @@ ucstring toUpper(const ucstring &str);
void toUpper(ucchar *str);
ucchar toUpper(ucchar c);
std::string toLowerAsUtf8(const char *str);
std::string toLowerAsUtf8(const std::string &str);
std::string toUpperAsUtf8(const char *str);
std::string toUpperAsUtf8(const std::string &str);
};
#endif // NL_UCSTRING_H

@ -45,7 +45,7 @@ namespace NLGUI
// Compare strings
static inline bool lt_text(const std::pair<int,std::string> &s1, const std::pair<int,std::string> &s2)
{
return toLowerAsUtf8(s1.second) < toLowerAsUtf8(s2.second);
return toLower(s1.second) < toLower(s2.second);
}
std::string CDBGroupComboBox::measureMenu;

@ -148,10 +148,10 @@ namespace NLGUI
switch (mode)
{
case CaseLower:
str = NLMISC::toLowerAsUtf8(str);
str = NLMISC::toLower(str);
break;
case CaseUpper:
str = NLMISC::toUpperAsUtf8(str);
str = NLMISC::toUpper(str);
break;
case CaseFirstStringLetterUp:
{

@ -594,6 +594,8 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea
return true;
}
#if 0
std::string toLower(const char *str)
{
if (!str) return "";
@ -625,6 +627,8 @@ std::string toLower(const std::string &str)
return res;
}
#endif
char toLower(const char ch)
{
if( (ch >= 'A') && (ch <= 'Z') )
@ -652,6 +656,8 @@ void toLower(char *str)
}
}
#if 0
std::string toUpper(const std::string &str)
{
string res;
@ -666,6 +672,8 @@ std::string toUpper(const std::string &str)
return res;
}
#endif
void toUpper(char *str)
{
if (str == 0)

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save