MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / GetRegValue

Function GetRegValue

Source/SettingsService.cpp:47–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template <typename T>
47T GetRegValue(LPCWSTR section, LPCWSTR entry, const T &default_value) {
48 if constexpr (std::is_enum_v<T>)
49 return enum_cast<T>(FTEnv.GetMainApp()->GetProfileIntW(section, entry, static_cast<int>(default_value)));
50 else if constexpr (std::is_integral_v<T>)
51 return static_cast<T>(FTEnv.GetMainApp()->GetProfileIntW(section, entry, static_cast<int>(default_value)));
52 else if constexpr (std::is_same_v<T, std::wstring>) {
53 CStringW v = FTEnv.GetMainApp()->GetProfileStringW(section, entry, default_value.data());
54 return std::wstring {(LPCWSTR)v, static_cast<std::size_t>(v.GetLength())};
55 }
56 else if constexpr (std::is_same_v<T, fs::path>) {
57 CStringW v = FTEnv.GetMainApp()->GetProfileStringW(section, entry, default_value.c_str());
58 return fs::path {(LPCWSTR)v, (LPCWSTR)v + v.GetLength()};
59 }
60 else
61 static_assert(!sizeof(T), "Unknown value type");
62}
63
64template <typename T>
65void SetRegValue(LPCWSTR section, LPCWSTR entry, const T &val) {

Callers 1

LoadFromRegistryMethod · 0.85

Calls 3

GetMainAppMethod · 0.80
dataMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected