4#include "user_settings_intf.hpp"
5#include "../win32/win32.hpp"
6#include "../path/path.hpp"
7#include "../metadata/metadata.hpp"
8#include "../macros.hpp"
12#include <system_error>
16hi_export_module(hikogui.settings.user_settings : impl);
18hi_export
namespace hi {
inline namespace v1 {
20[[nodiscard]]
inline std::string user_setting_registry_path()
22 return std::format(
"Software\\{}\\{}", get_application_vendor(), get_application_name());
32 if (
auto const value = win32_RegGetValue<std::string>(HKEY_CURRENT_USER, user_setting_registry_path(), name)) {
34 }
else if (value.error() != win32_error::file_not_found) {
40 if (
auto const value = win32_RegGetValue<std::string>(HKEY_LOCAL_MACHINE, user_setting_registry_path(), name)) {
47[[nodiscard]]
inline std::expected<long long, std::error_code> get_user_setting_integral(std::string_view name)
noexcept
50 if (
auto const value = win32_RegGetValue<long long>(HKEY_CURRENT_USER, user_setting_registry_path(), name)) {
52 }
else if (value.error() != win32_error::file_not_found) {
58 if (
auto const value = win32_RegGetValue<long long>(HKEY_LOCAL_MACHINE, user_setting_registry_path(), name)) {
72 return win32_RegSetKeyValue(HKEY_CURRENT_USER, user_setting_registry_path(), name, narrow_cast<uint32_t>(value));
The HikoGUI namespace.
Definition array_generic.hpp:20
win32_error win32_RegSetKeyValue(HKEY key, std::string_view path, std::string_view name, uint32_t value)
Write a DWORD registry value.
Definition winreg.hpp:66
win32_error win32_RegDeleteKeyValue(HKEY key, std::string_view path, std::string_view name) noexcept
Delete a registry value.
Definition winreg.hpp:27
win32_error win32_RegDeleteKey(HKEY key, std::string_view path) noexcept
Delete all registry values and the last part of the subkey.
Definition winreg.hpp:47
std::error_code delete_user_settings() noexcept
Delete all user-setting for the application.
Definition user_settings_win32_impl.hpp:80
std::expected< std::string, std::error_code > get_user_setting_string(std::string_view key) noexcept
Definition user_settings_win32_impl.hpp:29
std::error_code delete_user_setting(std::string_view key) noexcept
Delete a user-setting for the application.
Definition user_settings_win32_impl.hpp:75
std::error_code set_user_setting(std::string_view key, std::string_view value) noexcept
Set a user-setting for the application.
Definition user_settings_win32_impl.hpp:65
DOXYGEN BUG.
Definition algorithm_misc.hpp:20