MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / LocalWideFromUtf8

Function LocalWideFromUtf8

plugins/jieba/src/JiebaSegmentation.cpp:66–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65#if defined(_WIN32) || defined(_WIN64)
66std::wstring LocalWideFromUtf8(const std::string& text) {
67 if (text.empty()) {
68 return L"";
69 }
70 const int size = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr,
71 0);
72 if (size <= 1) {
73 return L"";
74 }
75 std::wstring wide(static_cast<size_t>(size), L'\0');
76 MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, &wide[0], size);
77 wide.resize(static_cast<size_t>(size - 1));
78 return wide;
79}
80#endif
81
82std::string ParentDir(const std::string& path) {

Callers 1

IsRegularFileFunction · 0.70

Calls 2

emptyMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected