MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / ToWide

Function ToWide

IntelPresentMon/CommonUtilities/str/String.cpp:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 }
32
33 std::wstring ToWide(const std::string& narrow) noexcept
34 {
35 try {
36 if (narrow.empty()) {
37 return {};
38 }
39 std::wstring wide;
40 // TODO: replace with resize_and_overwrite when it becomes widely available
41 wide.resize(narrow.size() + 1);
42 const auto actual = MultiByteToWideChar(CP_UTF8, 0, narrow.data(), (int)narrow.size(), wide.data(), (int)wide.size());
43 if (actual > 0) {
44 wide.resize(actual);
45 return wide;
46 }
47 pmlog_error("failed conversion to wide").hr();
48 }
49 catch (...) {
50 pmlog_error(ReportException());
51 }
52 return {};
53 }
54
55 std::string ToNarrow(const std::wstring& wide) noexcept
56 {

Callers 15

ValueMethod · 0.85
SetMethod · 0.85
AddThread_Method · 0.85
RefreshMethod · 0.85
WinMainFunction · 0.85
MakeOverlaySpecFunction · 0.85
CreateErrorStringFunction · 0.85
OpenMethod · 0.85
MakeFailMessageFunction · 0.85
UpdateTrackingMethod · 0.85
StartTraceSessionMethod · 0.85
StartEtwSessionMethod · 0.85

Calls 3

ReportExceptionFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.45

Tested by 2

MakeOverlaySpecFunction · 0.68
MakeFailMessageFunction · 0.68