wip: settings in effect

This commit is contained in:
Hane 2024-12-06 17:55:46 +01:00
commit 1ae324b68a
8 changed files with 277 additions and 158 deletions

View file

@ -7,6 +7,42 @@
class EndpointVolumeCallback;
class Session;
std::string getPath(SettingsTargetDirectory target, bool create);
// Convert a wide UTF16LE string to an UTF8 string
static inline std::string utf16ToUtf8(const wchar_t* wstr) {
if(!wstr || wstr[0] == '\0') return std::string();
int size_needed = WideCharToMultiByte(CP_UTF8,
0,
wstr,
-1,
NULL,
0,
NULL,
NULL);
std::string str(size_needed, 0);
WideCharToMultiByte(CP_UTF8,
0,
wstr,
-1,
&str[0],
size_needed,
NULL,
NULL);
return str;
}
// Convert an UTF8 string to a wide UTF16LE String
/*
* std::wstring utf8_decode(const std::string &str)
* {
* if( str.empty() ) return std::wstring();
* int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
* std::wstring wstrTo( size_needed, 0 );
* MultiByteToWideChar (CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
* return wstrTo;
* }
*/
class Endpoint {