Change CViewText to UTF-8, ryzom/ryzomcore#335

develop
kaetemi 4 years ago
parent c3ef0fc91c
commit 506f9f26bd

@ -227,8 +227,8 @@ inline double isValidDouble (double v)
* \param str a string to transform to lower case
*/
std::string toLower ( const char *str ); // UTF-8
std::string toLower ( const std::string &str ); // UTF-8
std::string toLower ( const char *str ); // Ascii only
std::string toLower ( const std::string &str ); // Ascii only
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 ); // UTF-8
std::string toUpper ( const std::string &str); // UTF-8
// std::string toUpper ( const char *str ); // Ascii only
std::string toUpper ( const std::string &str); // Ascii only
void toUpper ( char *str); // Ascii only

@ -260,6 +260,12 @@ 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

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

@ -594,7 +594,6 @@ NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human rea
return true;
}
/*
std::string toLower(const char *str)
{
if (!str) return "";
@ -625,7 +624,6 @@ std::string toLower(const std::string &str)
}
return res;
}
*/
char toLower(const char ch)
{
@ -654,7 +652,6 @@ void toLower(char *str)
}
}
/*
std::string toUpper(const std::string &str)
{
string res;
@ -668,7 +665,6 @@ std::string toUpper(const std::string &str)
}
return res;
}
*/
void toUpper(char *str)
{

@ -1950,7 +1950,7 @@ ucchar toLower (ucchar c)
// ***************************************************************************
static std::string toLower(CUtfStringView sv)
static std::string toLowerAsUtf8(CUtfStringView sv)
{
std::string res;
res.reserve(sv.largestSize());
@ -1962,23 +1962,23 @@ static std::string toLower(CUtfStringView sv)
ucchar uc = c;
ucchar *result = toLowerUpperSearch(&uc, UnicodeUpperToLower);
if (result)
c = uc;
c = result[1];
}
CUtfStringView::append(res, c);
}
return res;
}
std::string toLower(const char *str)
std::string toLowerAsUtf8(const char *str)
{
return toLower(CUtfStringView(str));
return toLowerAsUtf8(CUtfStringView(str));
}
// ***************************************************************************
std::string toLower(const std::string &str)
std::string toLowerAsUtf8(const std::string &str)
{
return toLower(CUtfStringView(str));
return toLowerAsUtf8(CUtfStringView(str));
}
// ***************************************************************************
@ -2025,7 +2025,7 @@ ucchar toUpper (ucchar c)
// ***************************************************************************
static std::string toUpper(CUtfStringView sv)
static std::string toUpperAsUtf8(CUtfStringView sv)
{
std::string res;
res.reserve(sv.largestSize());
@ -2037,23 +2037,23 @@ static std::string toUpper(CUtfStringView sv)
ucchar uc = c;
ucchar *result = toLowerUpperSearch(&uc, UnicodeLowerToUpper);
if (result)
c = uc;
c = result[1];
}
CUtfStringView::append(res, c);
}
return res;
}
std::string toUpper(const char *str)
std::string toUpperAsUtf8(const char *str)
{
return toUpper(CUtfStringView(str));
return toUpperAsUtf8(CUtfStringView(str));
}
// ***************************************************************************
std::string toUpper(const std::string &str)
std::string toUpperAsUtf8(const std::string &str)
{
return toUpper(CUtfStringView(str));
return toUpperAsUtf8(CUtfStringView(str));
}
// ***************************************************************************

Loading…
Cancel
Save