dxd - dynax driver framework 2.7.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
cf::tree< derived_t > Class Template Reference

dx::key_value_tree<derived_t> contract (dxd/interface/dx_key_value_tree.h), implemented once for every CF-backed preference store (cf::_preference, sc::_preference, dx::coreaudio::server::_preference) - inherit from this (CRTP: class _preference: public cf::tree<_preference>) instead of reimplementing it. More...

#include <cf_tree.h>

Public Member Functions

 catch (...)
 dx_catchall_rethrow () template< typename container_t
 dx_catchall_rethrow () template< typename self_t > static size_t size(const self_t &self) try
 dx_catchall_rethrow () template< typename self_t > static void assign_property(const self_t &self
 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 () template< typename value_t
 dx_catchall_rethrow () template< typename value_t > static const expr bool enabled()

Static Public Member Functions

static self_t void assign (const self_t &self, const value_t &value) try
static self_t container_t children (const self_t &self) try
static self_t bool fetch (const self_t &self, value_t &value) try
template<typename self_t>
static bool nested (const self_t &self) try
template<typename self_t>
static ::CFPropertyListRef property_list (const self_t &self) try

Public Attributes

::CFPropertyListRef value try

Detailed Description

template<typename derived_t>
class cf::tree< derived_t >

dx::key_value_tree<derived_t> contract (dxd/interface/dx_key_value_tree.h), implemented once for every CF-backed preference store (cf::_preference, sc::_preference, dx::coreaudio::server::_preference) - inherit from this (CRTP: class _preference: public cf::tree<_preference>) instead of reimplementing it.

derived_t only ever has to provide the 10 position-only primitives below - operating on self's own key alone (empty meaning the whole domain, or, for a derived_t that documents no root support, throwing), never the parent chain:

operator ::CFPropertyListRef() const; // +1, throws if absent
::CFPropertyListRef operator ()(::CFPropertyListRef dflt) const; // +1, dflt (retained) if absent, never throws
operator ::CFArrayRef() const; // +1: this key's own child names
operator array<>::dx_container() const; // same, as the friendlier vector-of-cf::type<>
template<typename container_t> operator container_t() const; // same, as any string container (set<string>, vector<string>, ...)
bool container() const; // true if this key's value is a dictionary
size_t size() const; // this key's own immediate child count
operator bool() const; // true if this key exists
void operator =(::CFPropertyListRef value); // write-through
void erase(); // remove
Definition cf_array.h:38
super & operator=(::BOOL value)
Definition dx_pipe.h:149

Everything else - resolving self's whole parent chain into the entire nested CFPropertyListRef subtree rooted at self - is identical for every CF-backed store and lives here, once (property_list()/assign_property(), plus size()/children() below). These reach derived_t's own, non-recursive primitives via self.derived_t::operator X(), never plain self.operator X(): dx::key_value_tree<derived_t> redeclares operator bool()/operator=/ operator value_t()/erase()/container()/size() itself (folding in this same parent-chain resolution), hiding those names inherited from derived_t - a plain unqualified access would otherwise recurse into the wrong (derived, chain-resolving) version instead of derived_t's own.

Member Function Documentation

◆ assign()

template<typename derived_t>
self_t void cf::tree< derived_t >::assign ( const self_t & self,
const value_t & value )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ catch()

template<typename derived_t>
cf::tree< derived_t >::catch ( ...)
inline

◆ children()

template<typename derived_t>
self_t container_t cf::tree< derived_t >::children ( const self_t & self)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dx_catchall_rethrow() [1/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( )

◆ dx_catchall_rethrow() [2/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( ) const &
inline

◆ dx_catchall_rethrow() [3/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( ) const &

downward write-back mirroring property_list()'s upward read, creating ancestor dictionaries as needed.

◆ dx_catchall_rethrow() [4/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( ) const &
inlinenoexcept

◆ dx_catchall_rethrow() [5/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( )

◆ dx_catchall_rethrow() [6/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( )

value_t is a cf POD/bridging type (see enabled() below) or a foreign type convertible from a CF pointer (e.g. cf::dictionary<>, routed via the third branch below); returns false for an absent self, throwing only for a genuinely malformed stored value.

◆ dx_catchall_rethrow() [7/7]

template<typename derived_t>
cf::tree< derived_t >::dx_catchall_rethrow ( ) const
inline

mirrors fetch<>'s supported value_t set, for key_value_tree_enabled's SFINAE (dx_key_value_tree.h) - cf's own POD/bridging or CFPropertyListRef-constructible types only.

◆ fetch()

template<typename derived_t>
self_t bool cf::tree< derived_t >::fetch ( const self_t & self,
value_t & value )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nested()

template<typename derived_t>
template<typename self_t>
bool cf::tree< derived_t >::nested ( const self_t & self)
inlinestatic
Here is the call graph for this function:

◆ property_list()

template<typename derived_t>
template<typename self_t>
::CFPropertyListRef cf::tree< derived_t >::property_list ( const self_t & self)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ try

template<typename derived_t>
::CFPropertyListRef value cf::tree< derived_t >::try
Initial value:
{
if(self.parent){
dx_pass(self.key.length()? dx::ok: dx::invalid);
if(reference<::CFPropertyListRef> parent{property_list(*self.parent), false})
if(::CFGetTypeID(parent)==::CFDictionaryGetTypeID()){
assign_property(*self.parent, dictionary<>{parent}.set(string{self.key}, value));
return;
}
assign_property(*self.parent, dictionary<>{}.set(string{self.key}, value).retain());
}else
const_cast<self_t&>(self).derived_t::operator =(value)
key value pair store
Definition cf_dictionary.h:50
Definition cf_reference.h:48
static ::CFPropertyListRef property_list(const self_t &self) try
Definition cf_tree.h:70
#define dx_pass(test,...)
Definition dx_exception.h:55
@ ok
Definition macOS/dx_platform.h:181
@ invalid
Definition macOS/dx_platform.h:184

The documentation for this class was generated from the following file:

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.