|
| std::string | canonical (const std::string &name) const try |
| | catch (...) |
| | catch (...) |
| | dx_catchall_rethrow () registry( |
| | dx_catchall_rethrow () registry(const registry ®istry |
| | dx_catchall_rethrow () template< typename self_t > static void purge(const self_t &self) noexcept try |
| | dx_catchall_rethrow () template< typename value_t |
| | dx_catchall_rethrow () ~registry() noexcept |
| registry & | erase (const char *subkey=nullptr) noexcept |
| registry & | initialize (const std::string &key, ::HKEY root=HKEY_CURRENT_USER, ::REGSAM rights=KEY_ALL_ACCESS) try |
| registry & | initialize (const std::string &key, ::REGSAM rights, ::HKEY root, const char *path=nullptr) try |
| registry & | operator= (const registry ®istry) try |
| | registry (::HKEY root, ::REGSAM rights=KEY_ALL_ACCESS) |
| | registry (::REGSAM rights, ::HKEY root=HKEY_CURRENT_USER) |
| | registry (const registry ®istry) |
| | registry (const std::string &key, ::HKEY root, ::REGSAM rights=KEY_ALL_ACCESS, const decltype(listen)&listen={}) |
| | registry (const std::string &key=property::root, ::REGSAM rights=KEY_ALL_ACCESS, ::HKEY root=HKEY_CURRENT_USER) |
| registry & | run () |
| dx_catchall_rethrow() registry &initialize(size_t | size () const noexcept |
|
| static self_t void | assign (const self_t &self, const value_t &value) try |
| template<typename self_t> |
| static registry | at (const self_t &self) |
| template<typename container_t, typename self_t> |
| static container_t | children (const self_t &self) noexcept try |
| template<typename value_t, typename self_t> |
| static bool | fetch (const self_t &self, value_t &value) try |
| template<typename self_t> |
| static bool | nested (const self_t &self) noexcept |
| template<typename self_t> |
| static size_t | size (const self_t &self) noexcept |
flat, non-hierarchical Windows registry access to one real key
- usage:
registry(const std::string &key=property::root, ::REGSAM rights=KEY_ALL_ACCESS, ::HKEY root=HKEY_CURRENT_USER)
Definition dx_registry.h:249
dx::registry itself has no operator[] and never opens more than the one real HKey it was constructed with (a single RegCreateKeyExA/RegOpenKeyExA call, same as today - the given path may itself be a multi-segment string, Windows resolves/creates the whole chain natively in that one call). It's the right tool where code only ever needs that one real key directly - e.g. watching it for change notification (run()/listen), or a single erase(subkey) - never where code indexes into it with []. On copy construction it generates a new HKey for the same root key to circumvent missing reference counting.
- See also
- dx::key_value_tree (dxd/interface/dx_key_value_tree.h - shared, platform- agnostic template, not part of this file), dx::preference for hierarchical registry[key1][key2]..[keyN] navigation.
/////////////////////////////////////////////////////////////////////////////
- design note: registry vs. key_value_tree
registry[k1][k2]..[kN] navigation stays purely in memory until a leaf is actually read/written/erased/enumerated - operator[] never touches the OS. A parent pointer chain holds each level's own bare key name, mirroring cf::key_value_tree's structure (macOS/cf_key_value_tree.h), though not its storage mechanism: Windows has no CFPropertyListRef-like nesting value.
registry's own fetch/assign/purge (below) join the chain's bare names into one "level0\..\levelN" path and issue exactly one real RegCreateKeyExA/ RegOpenKeyExA call, resolving/creating every intermediate real key atomically (capped at Windows' 32-levels-created-per-call limit). purge() walks that same path back up, deleting each now-empty ancestor real key - auto-prune, mirroring cf::key_value_tree's upward erase cascade.
The persisted registry layout for every consumer (COM registration, ASIO enumeration, preference storage, ...) is real, separate, externally-readable subkeys and values. Each node's .key holds its own bare segment name, so code reading .key directly (enumeration, printing, building a further real path from a child's name) works directly. A node's type is decided dynamically at first write, like CFPropertyListRef's own dynamic typing.