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

Method FromWideString

common/src/utils/StringUtils.cpp:143–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143std::string StringUtils::FromWideString(const std::wstring &wide_string) {
144 if(wide_string.empty())
145 return "";
146 const auto size_needed = WideCharToMultiByte(CP_UTF8, 0, &wide_string.at(0), static_cast<int>(wide_string.size()), nullptr, 0, nullptr, nullptr);
147 if(size_needed <= 0)
148 return "";
149 std::string result(size_needed, 0);
150 WideCharToMultiByte(CP_UTF8, 0, &wide_string.at(0), static_cast<int>(wide_string.size()), &result.at(0), size_needed, nullptr, nullptr);
151 return result;
152}
153#endif

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected