summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Fusik <piotr@fusion-lang.org>2024-02-22 17:40:00 +0100
committerPiotr Fusik <piotr@fusion-lang.org>2024-02-22 17:40:00 +0100
commit9646487c12c1c15a6b653883e6332186b3efa7a6 (patch)
tree2822f2522da76bc689738bc52e21f40dac82f293
parentc9fd2268a6cc7b31ee3c4c25506b0000d2368aa7 (diff)
[cpp] Less copies for string.ToLower/ToUpper on Windows.
#147
-rw-r--r--GenCpp.fu65
-rw-r--r--libfut.cpp65
-rw-r--r--libfut.cs65
-rw-r--r--libfut.js65
4 files changed, 80 insertions, 180 deletions
diff --git a/GenCpp.fu b/GenCpp.fu
index c854929..06dc5f6 100644
--- a/GenCpp.fu
+++ b/GenCpp.fu
@@ -1998,60 +1998,35 @@ public class GenCpp : GenCCpp
}
if (this.StringToLower || this.StringToUpper) {
WriteNewLine();
- WriteLine("#if defined(_WIN32)");
+ WriteLine("#ifdef _WIN32");
WriteNewLine();
WriteLine("#include <Windows.h>");
WriteNewLine();
- WriteLine("inline std::string FuString_WideToUtf8(std::wstring const& wstr)");
+ WriteLine("static std::string FuString_Win32LCMap(std::string_view s, DWORD flags)");
OpenBlock();
- WriteLine("int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);");
- WriteLine("std::string strTo(sizeNeeded, 0);");
- WriteLine("WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], sizeNeeded, NULL, NULL);");
- WriteLine("return strTo;");
- CloseBlock();
- WriteNewLine();
- WriteLine("inline std::wstring FuString_Utf8ToWide(std::string const& str)");
- OpenBlock();
- WriteLine("int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);");
- WriteLine("std::wstring strTo(sizeNeeded, 0);");
- WriteLine("MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &strTo[0], sizeNeeded);");
- WriteLine("return strTo;");
- CloseBlock();
- WriteNewLine();
- WriteLine("static std::string FuString_Win32LCMap(std::string str, DWORD flags)");
- OpenBlock();
- WriteLine("std::wstring wide = FuString_Utf8ToWide(str);");
- WriteLine("int sizeNeeded = LCMapStringEx(");
- WriteLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- WriteLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- WriteLine("\twide.c_str(), // lpSrcStr");
- WriteLine("\twide.length(), // cchSrc");
- WriteLine("\t0, // lpDestStr");
- WriteLine("\t0, // cchDest");
- WriteLine("\tNULL, NULL, 0);");
- WriteLine("std::wstring strTo(sizeNeeded, 0);");
- WriteLine("LCMapStringEx(");
- WriteLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- WriteLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- WriteLine("\twide.c_str(), // lpSrcStr");
- WriteLine("\twide.length(), // cchSrc");
- WriteLine("\t&strTo[0], // lpDestStr");
- WriteLine("\tsizeNeeded, // cchDest");
- WriteLine("\tNULL, NULL, 0);");
- WriteLine("return FuString_WideToUtf8(strTo);");
+ WriteLine("int size = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), nullptr, 0);");
+ WriteLine("std::wstring wide(size, 0);");
+ WriteLine("MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), wide.data(), size);");
+ WriteLine("size = LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), size, nullptr, 0, nullptr, nullptr, 0);");
+ WriteLine("std::wstring wideResult(size, 0);");
+ WriteLine("LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), wide.size(), wideResult.data(), size, nullptr, nullptr, 0);");
+ WriteLine("int resultSize = WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, nullptr, 0, nullptr, nullptr);");
+ WriteLine("std::string result(resultSize, 0);");
+ WriteLine("WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, result.data(), resultSize, nullptr, nullptr);");
+ WriteLine("return result;");
CloseBlock();
if (this.StringToLower) {
WriteNewLine();
- WriteLine("static std::string FuString_ToLower(std::string_view str)");
+ WriteLine("static std::string FuString_ToLower(std::string_view s)");
OpenBlock();
- WriteLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_LOWERCASE);");
+ WriteLine("return FuString_Win32LCMap(s, LCMAP_LOWERCASE);");
CloseBlock();
}
if (this.StringToUpper) {
WriteNewLine();
- WriteLine("static std::string FuString_ToUpper(std::string_view str)");
+ WriteLine("static std::string FuString_ToUpper(std::string_view s)");
OpenBlock();
- WriteLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_UPPERCASE);");
+ WriteLine("return FuString_Win32LCMap(s, LCMAP_UPPERCASE);");
CloseBlock();
}
WriteNewLine();
@@ -2062,16 +2037,16 @@ public class GenCpp : GenCCpp
WriteNewLine();
WriteLine("static std::string FuString_ToLower(std::string_view str)");
OpenBlock();
- WriteLine("\tstd::string result;");
- WriteLine("\treturn icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
+ WriteLine("std::string result;");
+ WriteLine("return icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
CloseBlock();
}
if (this.StringToUpper) {
WriteNewLine();
WriteLine("static std::string FuString_ToUpper(std::string_view str)");
OpenBlock();
- WriteLine("\tstd::string result;");
- WriteLine("\treturn icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
+ WriteLine("std::string result;");
+ WriteLine("return icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
CloseBlock();
}
WriteNewLine();
diff --git a/libfut.cpp b/libfut.cpp
index f6f9fb2..c1917bc 100644
--- a/libfut.cpp
+++ b/libfut.cpp
@@ -14949,60 +14949,35 @@ void GenCpp::writeProgram(const FuProgram * program)
}
if (this->stringToLower || this->stringToUpper) {
writeNewLine();
- writeLine("#if defined(_WIN32)");
+ writeLine("#ifdef _WIN32");
writeNewLine();
writeLine("#include <Windows.h>");
writeNewLine();
- writeLine("inline std::string FuString_WideToUtf8(std::wstring const& wstr)");
+ writeLine("static std::string FuString_Win32LCMap(std::string_view s, DWORD flags)");
openBlock();
- writeLine("int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);");
- writeLine("std::string strTo(sizeNeeded, 0);");
- writeLine("WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], sizeNeeded, NULL, NULL);");
- writeLine("return strTo;");
- closeBlock();
- writeNewLine();
- writeLine("inline std::wstring FuString_Utf8ToWide(std::string const& str)");
- openBlock();
- writeLine("int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);");
- writeLine("std::wstring strTo(sizeNeeded, 0);");
- writeLine("MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &strTo[0], sizeNeeded);");
- writeLine("return strTo;");
- closeBlock();
- writeNewLine();
- writeLine("static std::string FuString_Win32LCMap(std::string str, DWORD flags)");
- openBlock();
- writeLine("std::wstring wide = FuString_Utf8ToWide(str);");
- writeLine("int sizeNeeded = LCMapStringEx(");
- writeLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- writeLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- writeLine("\twide.c_str(), // lpSrcStr");
- writeLine("\twide.length(), // cchSrc");
- writeLine("\t0, // lpDestStr");
- writeLine("\t0, // cchDest");
- writeLine("\tNULL, NULL, 0);");
- writeLine("std::wstring strTo(sizeNeeded, 0);");
- writeLine("LCMapStringEx(");
- writeLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- writeLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- writeLine("\twide.c_str(), // lpSrcStr");
- writeLine("\twide.length(), // cchSrc");
- writeLine("\t&strTo[0], // lpDestStr");
- writeLine("\tsizeNeeded, // cchDest");
- writeLine("\tNULL, NULL, 0);");
- writeLine("return FuString_WideToUtf8(strTo);");
+ writeLine("int size = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), nullptr, 0);");
+ writeLine("std::wstring wide(size, 0);");
+ writeLine("MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), wide.data(), size);");
+ writeLine("size = LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), size, nullptr, 0, nullptr, nullptr, 0);");
+ writeLine("std::wstring wideResult(size, 0);");
+ writeLine("LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), wide.size(), wideResult.data(), size, nullptr, nullptr, 0);");
+ writeLine("int resultSize = WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, nullptr, 0, nullptr, nullptr);");
+ writeLine("std::string result(resultSize, 0);");
+ writeLine("WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, result.data(), resultSize, nullptr, nullptr);");
+ writeLine("return result;");
closeBlock();
if (this->stringToLower) {
writeNewLine();
- writeLine("static std::string FuString_ToLower(std::string_view str)");
+ writeLine("static std::string FuString_ToLower(std::string_view s)");
openBlock();
- writeLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_LOWERCASE);");
+ writeLine("return FuString_Win32LCMap(s, LCMAP_LOWERCASE);");
closeBlock();
}
if (this->stringToUpper) {
writeNewLine();
- writeLine("static std::string FuString_ToUpper(std::string_view str)");
+ writeLine("static std::string FuString_ToUpper(std::string_view s)");
openBlock();
- writeLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_UPPERCASE);");
+ writeLine("return FuString_Win32LCMap(s, LCMAP_UPPERCASE);");
closeBlock();
}
writeNewLine();
@@ -15013,16 +14988,16 @@ void GenCpp::writeProgram(const FuProgram * program)
writeNewLine();
writeLine("static std::string FuString_ToLower(std::string_view str)");
openBlock();
- writeLine("\tstd::string result;");
- writeLine("\treturn icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
+ writeLine("std::string result;");
+ writeLine("return icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
closeBlock();
}
if (this->stringToUpper) {
writeNewLine();
writeLine("static std::string FuString_ToUpper(std::string_view str)");
openBlock();
- writeLine("\tstd::string result;");
- writeLine("\treturn icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
+ writeLine("std::string result;");
+ writeLine("return icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
closeBlock();
}
writeNewLine();
diff --git a/libfut.cs b/libfut.cs
index 6bae0ef..d174c61 100644
--- a/libfut.cs
+++ b/libfut.cs
@@ -15303,60 +15303,35 @@ namespace Fusion
}
if (this.StringToLower || this.StringToUpper) {
WriteNewLine();
- WriteLine("#if defined(_WIN32)");
+ WriteLine("#ifdef _WIN32");
WriteNewLine();
WriteLine("#include <Windows.h>");
WriteNewLine();
- WriteLine("inline std::string FuString_WideToUtf8(std::wstring const& wstr)");
+ WriteLine("static std::string FuString_Win32LCMap(std::string_view s, DWORD flags)");
OpenBlock();
- WriteLine("int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);");
- WriteLine("std::string strTo(sizeNeeded, 0);");
- WriteLine("WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], sizeNeeded, NULL, NULL);");
- WriteLine("return strTo;");
- CloseBlock();
- WriteNewLine();
- WriteLine("inline std::wstring FuString_Utf8ToWide(std::string const& str)");
- OpenBlock();
- WriteLine("int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);");
- WriteLine("std::wstring strTo(sizeNeeded, 0);");
- WriteLine("MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &strTo[0], sizeNeeded);");
- WriteLine("return strTo;");
- CloseBlock();
- WriteNewLine();
- WriteLine("static std::string FuString_Win32LCMap(std::string str, DWORD flags)");
- OpenBlock();
- WriteLine("std::wstring wide = FuString_Utf8ToWide(str);");
- WriteLine("int sizeNeeded = LCMapStringEx(");
- WriteLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- WriteLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- WriteLine("\twide.c_str(), // lpSrcStr");
- WriteLine("\twide.length(), // cchSrc");
- WriteLine("\t0, // lpDestStr");
- WriteLine("\t0, // cchDest");
- WriteLine("\tNULL, NULL, 0);");
- WriteLine("std::wstring strTo(sizeNeeded, 0);");
- WriteLine("LCMapStringEx(");
- WriteLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- WriteLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- WriteLine("\twide.c_str(), // lpSrcStr");
- WriteLine("\twide.length(), // cchSrc");
- WriteLine("\t&strTo[0], // lpDestStr");
- WriteLine("\tsizeNeeded, // cchDest");
- WriteLine("\tNULL, NULL, 0);");
- WriteLine("return FuString_WideToUtf8(strTo);");
+ WriteLine("int size = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), nullptr, 0);");
+ WriteLine("std::wstring wide(size, 0);");
+ WriteLine("MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), wide.data(), size);");
+ WriteLine("size = LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), size, nullptr, 0, nullptr, nullptr, 0);");
+ WriteLine("std::wstring wideResult(size, 0);");
+ WriteLine("LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), wide.size(), wideResult.data(), size, nullptr, nullptr, 0);");
+ WriteLine("int resultSize = WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, nullptr, 0, nullptr, nullptr);");
+ WriteLine("std::string result(resultSize, 0);");
+ WriteLine("WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, result.data(), resultSize, nullptr, nullptr);");
+ WriteLine("return result;");
CloseBlock();
if (this.StringToLower) {
WriteNewLine();
- WriteLine("static std::string FuString_ToLower(std::string_view str)");
+ WriteLine("static std::string FuString_ToLower(std::string_view s)");
OpenBlock();
- WriteLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_LOWERCASE);");
+ WriteLine("return FuString_Win32LCMap(s, LCMAP_LOWERCASE);");
CloseBlock();
}
if (this.StringToUpper) {
WriteNewLine();
- WriteLine("static std::string FuString_ToUpper(std::string_view str)");
+ WriteLine("static std::string FuString_ToUpper(std::string_view s)");
OpenBlock();
- WriteLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_UPPERCASE);");
+ WriteLine("return FuString_Win32LCMap(s, LCMAP_UPPERCASE);");
CloseBlock();
}
WriteNewLine();
@@ -15367,16 +15342,16 @@ namespace Fusion
WriteNewLine();
WriteLine("static std::string FuString_ToLower(std::string_view str)");
OpenBlock();
- WriteLine("\tstd::string result;");
- WriteLine("\treturn icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
+ WriteLine("std::string result;");
+ WriteLine("return icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
CloseBlock();
}
if (this.StringToUpper) {
WriteNewLine();
WriteLine("static std::string FuString_ToUpper(std::string_view str)");
OpenBlock();
- WriteLine("\tstd::string result;");
- WriteLine("\treturn icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
+ WriteLine("std::string result;");
+ WriteLine("return icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
CloseBlock();
}
WriteNewLine();
diff --git a/libfut.js b/libfut.js
index c03ce3a..f995845 100644
--- a/libfut.js
+++ b/libfut.js
@@ -15748,60 +15748,35 @@ export class GenCpp extends GenCCpp
}
if (this.#stringToLower || this.#stringToUpper) {
this.writeNewLine();
- this.writeLine("#if defined(_WIN32)");
+ this.writeLine("#ifdef _WIN32");
this.writeNewLine();
this.writeLine("#include <Windows.h>");
this.writeNewLine();
- this.writeLine("inline std::string FuString_WideToUtf8(std::wstring const& wstr)");
+ this.writeLine("static std::string FuString_Win32LCMap(std::string_view s, DWORD flags)");
this.openBlock();
- this.writeLine("int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);");
- this.writeLine("std::string strTo(sizeNeeded, 0);");
- this.writeLine("WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], sizeNeeded, NULL, NULL);");
- this.writeLine("return strTo;");
- this.closeBlock();
- this.writeNewLine();
- this.writeLine("inline std::wstring FuString_Utf8ToWide(std::string const& str)");
- this.openBlock();
- this.writeLine("int sizeNeeded = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);");
- this.writeLine("std::wstring strTo(sizeNeeded, 0);");
- this.writeLine("MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &strTo[0], sizeNeeded);");
- this.writeLine("return strTo;");
- this.closeBlock();
- this.writeNewLine();
- this.writeLine("static std::string FuString_Win32LCMap(std::string str, DWORD flags)");
- this.openBlock();
- this.writeLine("std::wstring wide = FuString_Utf8ToWide(str);");
- this.writeLine("int sizeNeeded = LCMapStringEx(");
- this.writeLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- this.writeLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- this.writeLine("\twide.c_str(), // lpSrcStr");
- this.writeLine("\twide.length(), // cchSrc");
- this.writeLine("\t0, // lpDestStr");
- this.writeLine("\t0, // cchDest");
- this.writeLine("\tNULL, NULL, 0);");
- this.writeLine("std::wstring strTo(sizeNeeded, 0);");
- this.writeLine("LCMapStringEx(");
- this.writeLine("\tLOCALE_NAME_SYSTEM_DEFAULT, // lpLocaleName");
- this.writeLine("\tLCMAP_LINGUISTIC_CASING | flags, // dwMapFlags");
- this.writeLine("\twide.c_str(), // lpSrcStr");
- this.writeLine("\twide.length(), // cchSrc");
- this.writeLine("\t&strTo[0], // lpDestStr");
- this.writeLine("\tsizeNeeded, // cchDest");
- this.writeLine("\tNULL, NULL, 0);");
- this.writeLine("return FuString_WideToUtf8(strTo);");
+ this.writeLine("int size = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), nullptr, 0);");
+ this.writeLine("std::wstring wide(size, 0);");
+ this.writeLine("MultiByteToWideChar(CP_UTF8, 0, s.data(), (int) s.size(), wide.data(), size);");
+ this.writeLine("size = LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), size, nullptr, 0, nullptr, nullptr, 0);");
+ this.writeLine("std::wstring wideResult(size, 0);");
+ this.writeLine("LCMapStringEx(LOCALE_NAME_SYSTEM_DEFAULT, LCMAP_LINGUISTIC_CASING | flags, wide.data(), wide.size(), wideResult.data(), size, nullptr, nullptr, 0);");
+ this.writeLine("int resultSize = WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, nullptr, 0, nullptr, nullptr);");
+ this.writeLine("std::string result(resultSize, 0);");
+ this.writeLine("WideCharToMultiByte(CP_UTF8, 0, wideResult.data(), size, result.data(), resultSize, nullptr, nullptr);");
+ this.writeLine("return result;");
this.closeBlock();
if (this.#stringToLower) {
this.writeNewLine();
- this.writeLine("static std::string FuString_ToLower(std::string_view str)");
+ this.writeLine("static std::string FuString_ToLower(std::string_view s)");
this.openBlock();
- this.writeLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_LOWERCASE);");
+ this.writeLine("return FuString_Win32LCMap(s, LCMAP_LOWERCASE);");
this.closeBlock();
}
if (this.#stringToUpper) {
this.writeNewLine();
- this.writeLine("static std::string FuString_ToUpper(std::string_view str)");
+ this.writeLine("static std::string FuString_ToUpper(std::string_view s)");
this.openBlock();
- this.writeLine("\treturn FuString_Win32LCMap(std::string{ str }, LCMAP_UPPERCASE);");
+ this.writeLine("return FuString_Win32LCMap(s, LCMAP_UPPERCASE);");
this.closeBlock();
}
this.writeNewLine();
@@ -15812,16 +15787,16 @@ export class GenCpp extends GenCCpp
this.writeNewLine();
this.writeLine("static std::string FuString_ToLower(std::string_view str)");
this.openBlock();
- this.writeLine("\tstd::string result;");
- this.writeLine("\treturn icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
+ this.writeLine("std::string result;");
+ this.writeLine("return icu::UnicodeString::fromUTF8(s).toLower().toUTF8String(result);");
this.closeBlock();
}
if (this.#stringToUpper) {
this.writeNewLine();
this.writeLine("static std::string FuString_ToUpper(std::string_view str)");
this.openBlock();
- this.writeLine("\tstd::string result;");
- this.writeLine("\treturn icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
+ this.writeLine("std::string result;");
+ this.writeLine("return icu::UnicodeString::fromUTF8(s).toUpper().toUTF8String(result);");
this.closeBlock();
}
this.writeNewLine();