MCPcopy Create free account
hub / github.com/MeisApps/pcbu-desktop / ToWideString

Method ToWideString

common/src/utils/StringUtils.cpp:132–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131#ifdef WINDOWS
132std::wstring StringUtils::ToWideString(const std::string &string) {
133 if(string.empty())
134 return L"";
135 const auto size_needed = MultiByteToWideChar(CP_UTF8, 0, &string.at(0), static_cast<int>(string.size()), nullptr, 0);
136 if(size_needed <= 0)
137 return L"";
138 std::wstring result(size_needed, 0);
139 MultiByteToWideChar(CP_UTF8, 0, &string.at(0), static_cast<int>(string.size()), &result.at(0), size_needed);
140 return result;
141}
142
143std::string StringUtils::FromWideString(const std::wstring &wide_string) {
144 if(wide_string.empty())

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected