kaetemi 4 years ago
parent 0b191bc6db
commit ac799e444d

@ -44,9 +44,9 @@ int main (int argc, char **argv)
// load the language
CI18N::load(langName);
InfoLog->displayRawNL(CI18N::get("Hi").toString().c_str());
InfoLog->displayRawNL(CI18N::get("PresentI18N").toString().c_str(), "Nevrax");
InfoLog->displayRawNL(CI18N::get("ExitStr").toString().c_str());
InfoLog->displayRawNL(CI18N::get("Hi").c_str());
InfoLog->displayRawNL(CI18N::get("PresentI18N").c_str(), "Nevrax");
InfoLog->displayRawNL(CI18N::get("ExitStr").c_str());
getchar();
return EXIT_SUCCESS;

@ -4731,11 +4731,14 @@ NL_FORCE_INLINE void appendToLowerAsUtf8(std::string &res, const char *str, ptrd
{
char c = str[i];
char d, e;
if (c < 0x80)
{
if (c >= 'A' && c <= 'Z')
{
// 1-byte UTF-8
c += 'a' - 'A';
}
}
else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80)
{
// 2-byte UTF-8
@ -4803,11 +4806,14 @@ NL_FORCE_INLINE void appendToUpperAsUtf8(std::string &res, const char *str, ptrd
{
char c = str[i];
char d, e;
if (c < 0x80)
{
if (c >= 'a' && c <= 'z')
{
// 1-byte UTF-8
c -= 'a' - 'A';
}
}
else if ((c & 0xE0) == 0xC0 && ((d = str[i + 1]) & 0xC0) == 0x80)
{
// 2-byte UTF-8

@ -72,7 +72,7 @@ std::string CUtfStringView::toUtf8(bool reEncode) const
return std::string((const char *)m_Str, (const char *)((ptrdiff_t)m_Str + m_Size));
std::string res;
res.reserve(m_Size);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
{
appendUtf8(res, *it);
}
@ -85,7 +85,7 @@ ucstring CUtfStringView::toUtf16(bool reEncode) const
return ucstring((const ucchar *)m_Str, (const ucchar *)((ptrdiff_t)m_Str + m_Size));
ucstring res;
res.reserve(m_Size << 1);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
{
u32char c = *it;
if (c < 0x10000)
@ -110,7 +110,7 @@ u32string CUtfStringView::toUtf32() const
return u32string((const u32char *)m_Str, (const u32char *)((ptrdiff_t)m_Str + m_Size));
u32string res;
res.reserve(m_Size << 2);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
res += *it;
return res;
}
@ -119,7 +119,7 @@ std::string CUtfStringView::toAscii() const
{
std::string res;
res.reserve(m_Size);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
{
u32char c = *it;
if (c < 0x80)
@ -137,7 +137,7 @@ std::wstring CUtfStringView::toWide() const
return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size));
std::wstring res;
res.reserve(m_Size << 1);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
{
u32char c = *it;
if (c < 0x10000)
@ -157,7 +157,7 @@ std::wstring CUtfStringView::toWide() const
return std::wstring((const wchar_t *)m_Str, (const wchar_t *)((ptrdiff_t)m_Str + m_Size));
std::wstring res;
res.reserve(m_Size << 2);
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
res += *it;
return res;
#endif
@ -166,7 +166,7 @@ std::wstring CUtfStringView::toWide() const
size_t CUtfStringView::count() const
{
size_t res = 0;
for (iterator it(begin()), end(end()); it != end; ++it)
for (iterator it(begin()), end(this->end()); it != end; ++it)
++res;
return res;
}

@ -60,7 +60,7 @@ public:
// Force the cache to be saved
void flushStringCache();
bool getString(uint32 stringId, std::string &result) { ucstring temp; getString(stringId, temp); result = temp.toUtf8(); } // FIXME: UTF-8
bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; } // FIXME: UTF-8
bool getString(uint32 stringId, ucstring &result);
void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result);
void waitString(uint32 stringId, IStringWaitCallback *pcallback);

Loading…
Cancel
Save