| 63 | |
| 64 | template <typename T> |
| 65 | void 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 |
no test coverage detected