8#include "../macros.hpp"
17hi_export_module(hikogui.win32.winreg);
101 return wname.error();
130 if (
status == win32_error::success) {
158 DWORD result_type = 0;
161 if (
static_cast<bool>(
status)) {
165 return static_cast<uint32_t
>(
result);
191 auto status = win32_error{};
203 case win32_error::success:
205 case win32_error::more_data:
224hi_export [[
nodiscard]]
inline std::expected<std::vector<std::string>, win32_error>
246 case win32_error::success:
249 case win32_error::more_data:
272hi_export
template<
typename T>
273[[
nodiscard]] std::expected<T, win32_error> win32_RegGetValue(
HKEY key, std::string_view path, std::string_view name) =
delete;
276[[
nodiscard]]
inline std::expected<void, win32_error> win32_RegGetValue(
HKEY key, std::string_view path, std::string_view name)
278 return win32_RegGetValue_void(key, path, name);
281hi_export
template<std::
integral T>
285 return static_cast<T
>(*tmp);
292[[
nodiscard]]
inline std::expected<std::string, win32_error> win32_RegGetValue(
HKEY key, std::string_view path, std::string_view name)
294 return win32_RegGetValue_string(key, path, name);
298[[
nodiscard]]
inline std::expected<std::vector<std::string>, win32_error>
Rules for working with win32 headers.
DOXYGEN BUG.
Definition algorithm.hpp:16
hi_export std::expected< void, win32_error > win32_RegGetValue_void(HKEY key, std::string_view path, std::string_view name)
Check if a registry entry exists.
Definition winreg.hpp:117
hi_export std::expected< std::vector< std::string >, win32_error > win32_RegGetValue_multi_string(HKEY key, std::string_view path, std::string_view name) noexcept
Read a list of strings from the registry value.
Definition winreg.hpp:225
hi_export win32_error win32_RegDeleteKeyValue(HKEY key, std::string_view path, std::string_view name) noexcept
Delete a registry value.
Definition winreg.hpp:27
hi_export 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
hi_export std::expected< T, win32_error > win32_RegGetValue(HKEY key, std::string_view path, std::string_view name)=delete
Read from the registry value.
Definition winreg.hpp:282
hi_export std::expected< std::string, win32_error > win32_RegGetValue_string(HKEY key, std::string_view path, std::string_view name) noexcept
Read a strings from the registry value.
Definition winreg.hpp:175
hi_export std::expected< uint32_t, win32_error > win32_RegGetValue_dword(HKEY key, std::string_view path, std::string_view name) noexcept
Read a DWORD registry value.
Definition winreg.hpp:144
hi_export 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
hi_export std::expected< std::string, win32_error > win32_WideCharToMultiByte(std::wstring_view s, unsigned int code_page=CP_UTF8, uint32_t flags=0) noexcept
Convert a win32-API compatible std::wstring to a multi-byte std::string.
Definition base.hpp:73
hi_export std::expected< std::vector< std::string >, win32_error > win32_MultiSZToStringVector(wchar_t const *first, wchar_t const *last) noexcept
Convert a win32 zero terminated list of zero terminated strings.
Definition base.hpp:139
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
hi_export std::expected< std::wstring, win32_error > win32_MultiByteToWideChar(std::string_view s, unsigned int code_page=CP_UTF8, uint32_t flags=0) noexcept
Convert a win32-API compatible std::wstring to a multi-byte std::string.
Definition base.hpp:105