MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / to_utf8

Function to_utf8

src/base/string.cpp:62–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60#ifdef _WIN32
61
62std::string to_utf8(const std::wstring& src)
63{
64 int required_size =
65 ::WideCharToMultiByte(CP_UTF8, 0,
66 src.c_str(), (int)src.size(),
67 NULL, 0, NULL, NULL);
68
69 if (required_size == 0)
70 return std::string();
71
72 std::vector<char> buf(++required_size);
73
74 ::WideCharToMultiByte(CP_UTF8, 0,
75 src.c_str(), (int)src.size(),
76 &buf[0], required_size,
77 NULL, NULL);
78
79 return std::string(&buf[0]);
80}
81
82std::wstring from_utf8(const std::string& src)
83{

Callers 15

wndProcMethod · 0.85
get_atom_stringFunction · 0.85
handle_dde_messagesFunction · 0.85
fileNameMethod · 0.85
drawCharMethod · 0.85
charBoundsMethod · 0.85
get_app_pathFunction · 0.85
get_temp_pathFunction · 0.85
get_user_docs_folderFunction · 0.85
get_canonical_pathFunction · 0.85
list_filesFunction · 0.85
get_font_pathsFunction · 0.85

Calls 5

insert_utf8_charFunction · 0.85
reserveMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68