MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / Utf8ToWideString

Method Utf8ToWideString

SubtitleFontAutoLoaderDaemon/Common.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36std::wstring sfh::Utf8ToWideString(const std::string& str)
37{
38 std::wstring ret;
39 const int length = MultiByteToWideChar(
40 CP_UTF8,
41 MB_ERR_INVALID_CHARS,
42 str.c_str(),
43 static_cast<int>(str.size()),
44 nullptr,
45 0);
46 assert(length != 0 && "utf8 conversion to wide char mustn't fail!");
47 ret.resize(length);
48 MultiByteToWideChar(
49 CP_UTF8,
50 MB_ERR_INVALID_CHARS,
51 str.c_str(),
52 static_cast<int>(str.size()),
53 ret.data(),
54 length);
55 return ret;
56}
57
58void sfh::ErrorMessageBox(const std::wstring& text, const std::wstring& caption, long hResult)
59{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected