MCPcopy Create free account
hub / github.com/axmolengine/axmol / wstr_to_utf8

Function wstr_to_utf8

3rdparty/openal/common/strutils.cpp:13–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <windows.h>
12
13std::string wstr_to_utf8(std::wstring_view wstr)
14{
15 std::string ret;
16
17 int len{WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.length()), nullptr,
18 0, nullptr, nullptr)};
19 if(len > 0)
20 {
21 ret.resize(len);
22 WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast<int>(wstr.length()), &ret[0], len,
23 nullptr, nullptr);
24 }
25
26 return ret;
27}
28
29std::wstring utf8_to_wstr(std::string_view str)
30{

Callers 11

helpers.cppFile · 0.85
DirectorySearchFunction · 0.85
SearchDataFilesFunction · 0.85
alc_initconfigFunction · 0.85
ReadALConfigFunction · 0.85
GetDeviceNameAndGuidFunction · 0.85
DeviceHelperMethod · 0.85
DSoundEnumDevicesFunction · 0.85
ProbePlaybackDevicesFunction · 0.85
ProbeCaptureDevicesFunction · 0.85

Calls 3

dataMethod · 0.45
lengthMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected