Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it
This commit is contained in:
parent
366fda30f5
commit
b4d15b9545
159 changed files with 623 additions and 930 deletions
|
|
@ -7,6 +7,8 @@
|
|||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include "StringUtils.h"
|
||||
|
||||
|
|
@ -48,6 +50,13 @@ const char* StringUtils::wchar_to_char(const wchar_t* pwchar)
|
|||
return filePathC;
|
||||
}
|
||||
|
||||
std::string StringUtils::wstring_to_string(const std::wstring wstring)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
|
||||
|
||||
return(converter.to_bytes(wstring));
|
||||
}
|
||||
|
||||
const std::string StringUtils::remove_null_terminating_chars(std::string input)
|
||||
{
|
||||
while (!input.empty() && input.back() == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue