MCPcopy Create free account
hub / github.com/PDAL/PDAL / toNative

Function toNative

pdal/util/FileUtils.cpp:92–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90{
91#ifdef PDAL_WIN32_STL
92std::wstring toNative(const std::string& in)
93{
94 if (in.empty())
95 return std::wstring();
96
97 // The first call determines the length of the conversion. The second does the
98 // actual conversion.
99 int len = MultiByteToWideChar(CP_UTF8, 0, in.data(), in.length(), nullptr, 0);
100 std::wstring out(len, 0);
101 if (MultiByteToWideChar(CP_UTF8, 0, in.data(), in.length(), out.data(), len) == 0)
102 {
103 char buf[200] {};
104 len = FormatMessageA(0, 0, GetLastError(), 0, buf, 199, 0);
105 throw pdal_error("Can't convert UTF8 to UTF16: " + std::string(buf, len));
106 }
107 return out;
108}
109
110std::string fromNative(const std::wstring& in)
111{

Callers 5

toCanonicalPathFunction · 0.70
toAbsolutePathFunction · 0.70
isAbsolutePathFunction · 0.70
globFunction · 0.70
mapFileFunction · 0.70

Calls 3

emptyMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected