|
| iterator | begin () const |
| | catch (...) |
| | catch (...) |
| | catch (...) |
| | catch (...) |
| | catch (...) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN | catch (const dx::exception &__dx_exception) |
| | catch (const std::exception &__std_exception) |
| | catch (const std::exception &__std_exception) |
| | catch (const std::exception &__std_exception) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END bool | container () const |
| iterator | end () const |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_tree & | erase () noexcept |
| key_value_tree & | erase (const std::string &key) |
| | key_value_tree (const key_value_tree &key_value_tree) |
| | key_value_tree (const key_value_tree &key_value_tree, const std::string &key) |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END | operator bool () const noexcept try |
| template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t> && !std::is_same_v<bool, value_t> && !is_initializer_list_v<value_t> && (is_string_container_v<value_t> || key_value_tree_enabled<tree_t, value_t>::value), value_t>::type> |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END | operator value_t () const try |
| template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type> |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END value_t | operator() (value_t dflt) const try |
| key_value_tree & | operator= (const key_value_tree &key_value_tree) try |
| template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type> |
| key_value_tree & | operator= (const value_t &value) try |
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END key_value_tree | operator[] (const char *key) const |
| key_value_tree | operator[] (const std::string &key) const |
| size_t | size () const |
| DX_PRAGMA_IGNORE_RETURN_VALUE_END | ~key_value_tree () |
template<typename tree_t>
class dx::key_value_tree< tree_t >
hierarchical key/value navigation over a flat persistent store
- usage:
[..]
key_value_tree(const key_value_tree &key_value_tree)
Definition dx_key_value_tree.h:154
This is the platform-agnostic shape of dx::registry's old hierarchical access (and macOS' cf::key_value_tree): a parent pointer chain, one node per hierarchy level, each holding only its own bare key name - nothing here is tied to how a level actually persists.
Every node beyond the true root (parent==nullptr) exists purely in memory until a leaf is actually read/written/erased/enumerated - operator[] never touches the underlying store. At that point tree_t decides, in whatever way fits its own backing store, how to realize the operation - macOS recursively fetches/mutates/writes back a natively-nesting property list up to its flat domain; a plain-key-per-value store (dxd/interface/windows/dx_registry.h) instead joins every ancestor's bare name into one path and issues a single real call. Either way the persisted result for a leaf never depends on how many separate key_value_tree nodes were used to reach it.
requires of tree_t (see dx::registry for a concrete implementation):
tree_t(const tree_t& tree_t, const std::string& key);
template<typename value_t, typename self_t> static bool fetch(const self_t& self, value_t&);
template<typename value_t, typename self_t> static void assign(const self_t& self, const value_t&);
template<typename self_t> static void purge(const self_t& self) noexcept;
template<typename self_t> static bool nested(const self_t& self);
template<
typename self_t>
static size_t size(
const self_t& self);
template<typename container_t, typename self_t> static container_t children(const self_t& self);
std::string key;
key_value_tree & operator=(const key_value_tree &key_value_tree) try
Definition dx_key_value_tree.h:164
size_t size() const
Definition dx_key_value_tree.h:232
template<typename tree_t>
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t> && !std::is_same_v<bool, value_t> && !is_initializer_list_v<value_t> && (is_string_container_v<value_t> || key_value_tree_enabled<tree_t, value_t>::value), value_t>::type>
| DX_PRAGMA_IGNORE_RETURN_VALUE_BEGIN DX_PRAGMA_IGNORE_RETURN_VALUE_END dx::key_value_tree< tree_t >::operator value_t |
( |
| ) |
const |
|
inline |
value_t a string container routes to tree_t::children() below, folded into this same operator template (MSVC treats two separately-SFINAE- gated operator T() templates as redeclarations of each other).
template<typename tree_t>
template<typename value_t, typename = typename std::enable_if< !std::is_same_v<key_value_tree, value_t>, value_t>::type>
| DX_PRAGMA_IGNORE_RETURN_VALUE_END value_t dx::key_value_tree< tree_t >::operator() |
( |
value_t | dflt | ) |
const |
|
inline |
always succeeds, falling back to dflt for a genuine fetch<> error too - the try/catch is purely a safety net around that.