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

Function SetRegValue

Source/SettingsService.cpp:65–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64template <typename T>
65void SetRegValue(LPCWSTR section, LPCWSTR entry, const T &val) {
66 if constexpr (std::is_enum_v<T>)
67 FTEnv.GetMainApp()->WriteProfileInt(section, entry, static_cast<int>(val));
68 else if constexpr (std::is_integral_v<T>)
69 FTEnv.GetMainApp()->WriteProfileInt(section, entry, static_cast<int>(val));
70 else if constexpr (std::is_same_v<T, std::wstring>)
71 FTEnv.GetMainApp()->WriteProfileStringW(section, entry, CStringW {val.data(), static_cast<int>(val.size())});
72 else if constexpr (std::is_same_v<T, fs::path>) {
73 auto wstr = val.wstring();
74 FTEnv.GetMainApp()->WriteProfileStringW(section, entry, CStringW {wstr.data(), static_cast<int>(wstr.size())});
75 }
76 else
77 static_assert(!sizeof(T), "Unknown value type");
78}
79
80} // namespace
81

Callers 1

SaveToRegistryMethod · 0.85

Calls 3

GetMainAppMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected