1#ifndef LIBFILEZILLA_GLUE_REGISTRY_HEADER
2#define LIBFILEZILLA_GLUE_REGISTRY_HEADER
25class FZ_PUBLIC_SYMBOL regkey final
39 explicit regkey(HKEY
const root, std::wstring
const& subkey,
bool readonly, regview v = regview_native);
41 regkey(regkey
const&) =
delete;
42 regkey& operator=(regkey
const&) =
delete;
51 bool open(HKEY
const root, std::wstring
const& subkey,
bool readonly, regview v = regview_native);
53 bool has_value(std::wstring
const& name)
const;
56 std::wstring
value(std::wstring
const& name)
const;
61 bool set_value(std::wstring
const& name, std::wstring
const&
value);
62 bool set_value(std::wstring
const& name, uint64_t
value);
64 explicit operator bool()
const {
65 return key_.has_value();
68 bool delete_value(std::wstring
const& name);
80 iterator &operator++()
82 if (key_ && key_->key_) {
86 DWORD res = RegEnumValueW(*key_->key_, ++index_, v_.name.data(), &len,
nullptr, &v_.type,
nullptr,
nullptr);
87 if (res != ERROR_SUCCESS || !len) {
99 return index_ == op.index_;
102 bool operator!=(iterator
const& op)
const
104 return !(*
this == op);
107 value const& operator*()
const
112 value const* operator->()
const
120 iterator(regkey
const* key)
126 regkey
const* key_{};
127 DWORD index_{DWORD(-1)};
130 using const_iterator = iterator;
132 iterator begin()
const
142 const_iterator cbegin()
const
147 const_iterator cend()
const
153 mutable std::optional<HKEY> key_;
158#error This file is for Windows only
regkey(HKEY const root, std::wstring const &subkey, bool readonly, regview v=regview_native)
See.
uint64_t int_value(std::wstring const &name) const
Gets the value with the given name as integer, converting if necessary.
bool open(HKEY const root, std::wstring const &subkey, bool readonly, regview v=regview_native)
Opens the specified registry key.
std::wstring value(std::wstring const &name) const
Gets the value with the given name as wstring, converting if necessary.
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition apply.hpp:17
bool operator==(symmetric_key const &lhs, symmetric_key const &rhs)
Side-channel safe comparison.
Definition registry.hpp:73
@ value
Definition xml.hpp:36