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

Function Utf8ToUtf16

src/OpenColorIO/Platform.cpp:292–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290#endif
291
292std::wstring Utf8ToUtf16(const std::string & str)
293{
294 if (str.empty()) {
295 return std::wstring();
296 }
297
298#ifdef _WIN32
299 int sz = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
300 std::wstring wstr(sz, 0);
301 MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstr[0], sz);
302 return wstr;
303#else
304 throw Exception("Only supported by the Windows platform.");
305#endif
306}
307
308std::string Utf16ToUtf8(const std::wstring & wstr)
309{

Callers 8

GetenvFunction · 0.85
SetenvFunction · 0.85
UnsetenvFunction · 0.85
CreateInputFileStreamFunction · 0.85
OpenInputFileStreamFunction · 0.85
filenameToUTFFunction · 0.85
CreateFileContentHashFunction · 0.85
OCIO_ADD_TESTFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by 1

OCIO_ADD_TESTFunction · 0.68