MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / Utf16ToUtf8

Function Utf16ToUtf8

src/OpenColorIO/Platform.cpp:308–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308std::string Utf16ToUtf8(const std::wstring & wstr)
309{
310 if (wstr.empty()) {
311 return std::string();
312 }
313
314#ifdef _WIN32
315 int sz = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
316 std::string str(sz, 0);
317 WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], sz, NULL, NULL);
318 return str;
319#else
320 throw Exception("Only supported by the Windows platform.");
321#endif
322}
323
324// Here is the explanation of the stat() method:
325// https://pubs.opengroup.org/onlinepubs/009695299/basedefs/sys/stat.h.html

Callers 4

LoadEnvironmentFunction · 0.85
GetenvFunction · 0.85
getAllMonitorsMethod · 0.85
OCIO_ADD_TESTFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by 1

OCIO_ADD_TESTFunction · 0.68