MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / UTF8Decode

Method UTF8Decode

external/ImGuiFileDialog/ImGuiFileDialog.cpp:954–969  ·  view source on GitHub ↗

Convert an UTF8 string to a wide Unicode String

Source from the content-addressed store, hash-verified

952
953// Convert an UTF8 string to a wide Unicode String
954std::wstring IGFD::Utils::UTF8Decode(const std::string& str) {
955 std::wstring res;
956#ifdef _IGFD_WIN_
957 if (!str.empty()) {
958 int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), nullptr, 0);
959 if (size_needed) {
960 res = std::wstring(size_needed, 0);
961 MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &res[0], size_needed);
962 }
963 }
964#else
965 // Suppress warnings from the compiler.
966 (void)str;
967#endif // _IGFD_WIN_
968 return res;
969}
970
971bool IGFD::Utils::ReplaceString(std::string& str, const ::std::string& oldStr, const ::std::string& newStr, const size_t& vMaxRecursion) {
972 if (!str.empty() && oldStr != newStr) {

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected