| 130 | |
| 131 | #ifdef WINDOWS |
| 132 | std::wstring StringUtils::ToWideString(const std::string &string) { |
| 133 | if(string.empty()) |
| 134 | return L""; |
| 135 | const auto size_needed = MultiByteToWideChar(CP_UTF8, 0, &string.at(0), static_cast<int>(string.size()), nullptr, 0); |
| 136 | if(size_needed <= 0) |
| 137 | return L""; |
| 138 | std::wstring result(size_needed, 0); |
| 139 | MultiByteToWideChar(CP_UTF8, 0, &string.at(0), static_cast<int>(string.size()), &result.at(0), size_needed); |
| 140 | return result; |
| 141 | } |
| 142 | |
| 143 | std::string StringUtils::FromWideString(const std::wstring &wide_string) { |
| 144 | if(wide_string.empty()) |