Platform: Improve Windows wstring support

This commit is contained in:
David Rebbe
2025-02-06 18:43:51 +00:00
committed by Kyle Schwarz
parent c5ba2d8d32
commit f04cd16bee
7 changed files with 85 additions and 14 deletions
+4 -5
View File
@@ -1,4 +1,5 @@
#include "icsneo/platform/windows/registry.h"
#include "icsneo/platform/windows/strings.h"
#include "icsneo/platform/windows.h"
#include <codecvt>
#include <vector>
@@ -6,8 +7,6 @@
using namespace icsneo;
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
class Key {
public:
Key(std::wstring path, bool readwrite = false);
@@ -95,8 +94,8 @@ bool Registry::Get(std::wstring path, std::wstring key, std::wstring& value) {
bool Registry::Get(std::string path, std::string key, std::string& value) {
std::wstring wvalue;
bool ret = Get(converter.from_bytes(path), converter.from_bytes(key), wvalue);
value = converter.to_bytes(wvalue);
bool ret = Get(convertStringToWide(path), convertStringToWide(key), wvalue);
value = convertWideString(wvalue);
return ret;
}
@@ -116,5 +115,5 @@ bool Registry::Get(std::wstring path, std::wstring key, uint32_t& value) {
}
bool Registry::Get(std::string path, std::string key, uint32_t& value) {
return Get(converter.from_bytes(path), converter.from_bytes(key), value);
return Get(convertStringToWide(path), convertStringToWide(key), value);
}