mpqc::detail::SubTreeKeyVal Class Referencefinal
Collaboration diagram for mpqc::detail::SubTreeKeyVal:

Documentation

is a KeyVal that instead of keeping a path to the root of this subtree has actual ptree ref currently only useful for parsing JSON arrays (with their braindead empty element keys), specifically is mandatory for arrays of objects

Public Member Functions

 SubTreeKeyVal (const ptree &tree, const KeyVal &kv)
 
KeyVal keyval (const key_type &path) const override
 construct a KeyVal representing a subtree located at the given path More...
 
- Public Member Functions inherited from mpqc::KeyVal
 KeyVal ()
 creates empty KeyVal More...
 
 KeyVal (const KeyVal &other)=default
 copy ctor More...
 
 KeyVal (KeyVal &&other)=default
 move ctor More...
 
virtual ~KeyVal ()=default
 
KeyValoperator= (const KeyVal &other)=default
 copy assignment More...
 
KeyValoperator= (KeyVal &&other)=default
 move assignment More...
 
KeyVal clone () const
 creates a deep copy of this object More...
 
std::shared_ptr< ptreetop_tree () const
 returns a shared_ptr to the (top) tree More...
 
std::shared_ptr< ptreetree () const
 returns a shared_ptr to this (sub)tree More...
 
template<typename T , typename = std::enable_if_t<Describable<T>::value>>
KeyValset_default_class_key (const std::string &key)
 obtains default class key for class T More...
 
template<typename T >
std::string default_class_key () const
 obtains default class key for class T More...
 
bool exists (const key_type &path) const
 
template<typename Target = const DescribedClass>
bool exists_object (const key_type &path) const noexcept
 
bool exists_class (const key_type &path) const
 
std::optional< size_t > count (const key_type &path) const
 
template<typename T >
std::enable_if_t< not KeyVal::is_sequence_v< T >, KeyVal & > assign (const key_type &path, const T &value) &
 assign simple value at the given path (overwrite, if necessary) More...
 
template<typename T >
std::enable_if_t< not KeyVal::is_sequence_v< T >, KeyValassign (const key_type &path, const T &value) &&
 
template<typename SequenceContainer >
std::enable_if_t< KeyVal::is_sequence_v< SequenceContainer >, KeyVal & > assign (const key_type &path, const SequenceContainer &value, bool json_style=true) &
 Assign a sequence container at the given path (overwrite, if necessary). More...
 
template<typename SequenceContainer >
std::enable_if_t< KeyVal::is_sequence_v< SequenceContainer >, KeyValassign (const key_type &path, const SequenceContainer &value, bool json_style=true) &&
 
template<typename T >
KeyValassign (const key_type &path, std::initializer_list< T > value, bool json_style=true) &
 Assign a sequence container at the given path (overwrite, if necessary). More...
 
template<typename T >
KeyVal assign (const key_type &path, std::initializer_list< T > value, bool json_style=true) &&
 
template<typename T = DescribedClass>
std::enable_if_t< Describable< T >::value, KeyVal & > assign (const key_type &path, const std::shared_ptr< T > &value) &
 
template<typename T = DescribedClass>
std::enable_if_t< Describable< T >::value, KeyValassign (const key_type &path, const std::shared_ptr< T > &value) &&
 
template<typename T = DescribedClass>
std::enable_if_t< Describable< T >::value, const KeyVal & > assign (const key_type &path, const std::shared_ptr< T > &value) const
 
KeyValerase (const key_type &path)
 
const KeyValerase_object (const key_type &path) const
 
const KeyValerase_class (const key_type &path) const
 
template<typename T , typename Validator = dummy_validator_t>
std::enable_if_t< not KeyVal::is_sequence_v< T > &&not utility::meta::can_construct< T, const KeyVal & >::value, T > value (const key_type &path, Validator &&validator=Validator{}, std::enable_if_t< KeyVal::is_valid_validator_v< Validator, T >> *=nullptr) const
 
template<typename T , typename Validator = dummy_validator_t>
std::enable_if_t< not KeyVal::is_sequence_v< T > &&utility::meta::can_construct< T, const KeyVal & >::value, T > value (const key_type &path, Validator &&validator=Validator{}, std::enable_if_t< is_valid_validator_v< Validator, T >> *=nullptr) const
 
template<typename SequenceContainer , typename Validator = dummy_validator_t>
std::enable_if_t< KeyVal::is_mutable_sequence_v< SequenceContainer >, SequenceContainer > value (const key_type &path, Validator &&validator=Validator{}, std::enable_if_t< KeyVal::is_valid_validator_v< Validator, std::decay_t< typename SequenceContainer::value_type >>> *=nullptr) const
 
template<typename SequenceContainer , typename Validator = dummy_validator_t>
std::enable_if_t< KeyVal::is_mutable_sequence_v< SequenceContainer >, SequenceContainer > value (const key_type &path, const key_type &deprecated_path, Validator &&validator=Validator{}, std::enable_if_t< KeyVal::is_valid_validator_v< Validator, std::decay_t< typename SequenceContainer::value_type >>> *=nullptr) const
 
template<typename T , typename Validator = dummy_validator_t>
std::enable_if_t< not KeyVal::is_sequence_v< T >, T > value (const key_type &path, const T &default_value, const key_type &deprecated_path, Validator &&validator=Validator{}, std::enable_if_t< KeyVal::is_valid_validator_v< Validator, T >> *=nullptr) const
 
template<typename T , typename Validator = dummy_validator_t>
std::enable_if_t< not KeyVal::is_sequence_v< T >, T > value (const key_type &path, const T &default_value, Validator &&validator=Validator{}, std::enable_if_t< KeyVal::is_valid_validator_v< Validator, T >> *=nullptr) const
 
template<typename T = DescribedClass, typename Enabler = std::enable_if_t<Describable<T>::value>>
std::shared_ptr< T > object (const key_type &path=key_type(), bool bypass_registry=false, bool disable_bad_input=false) const
 return a pointer to an object at the given path More...
 
template<typename T = DescribedClass, typename = std::enable_if_t<Describable<T>::value>>
std::shared_ptr< T > class_ptr (const key_type &path=key_type(), bool bypass_registry=false, bool disable_bad_input=false) const
 
std::vector< key_typedc_registry_paths () const
 dumps paths of all objects in the DescribedClass object registry More...
 
std::string path () const
 
key_type to_absolute_path (const key_type &path) const
 
bool operator== (const KeyVal &other) const
 
void write_xml (std::basic_ostream< typename key_type::value_type > &os) const
 write to stream in XML form More...
 
void read_xml (std::basic_istream< typename key_type::value_type > &is)
 
void write_json (std::basic_ostream< key_type::value_type > &os) const
 write to stream in JSON form More...
 
void read_json (std::basic_istream< key_type::value_type > &is)
 
void write_info (std::basic_ostream< typename key_type::value_type > &os) const
 write to stream in INFO form More...
 
void read_info (std::basic_istream< typename key_type::value_type > &is)
 

Additional Inherited Members

- Public Types inherited from mpqc::KeyVal
enum  InputFormat {
  InputFormat::invalid = -1, InputFormat::json = 0, InputFormat::xml = 1, InputFormat::info = 2,
  InputFormat::first = json, InputFormat::last = info
}
 
using ptree = boost::property_tree::iptree
 data type for representing a property tree More...
 
using key_type = ptree::key_type
 
using value_type = ptree::data_type
 
- Static Public Member Functions inherited from mpqc::KeyVal
static bool throw_if_deprecated_path ()
 
static void set_throw_if_deprecated_path (bool f)
 
static key_type concat_path (const key_type &prefix, const key_type &postfix)
 
- Static Public Attributes inherited from mpqc::KeyVal
constexpr static char separator = ':'
 
static constexpr dummy_validator_t dummy_validator {}
 
static const is_nonnegative_t is_nonnegative {}
 
static const is_positive_t is_positive {}
 

Constructor & Destructor Documentation

◆ SubTreeKeyVal()

mpqc::detail::SubTreeKeyVal::SubTreeKeyVal ( const ptree tree,
const KeyVal kv 
)
inline

Member Function Documentation

◆ keyval()

KeyVal mpqc::detail::SubTreeKeyVal::keyval ( const key_type path) const
inlineoverridevirtual

construct a KeyVal representing a subtree located at the given path

Since this class has reference semantics, the result refers to the same underlying data structures (ptree and class registry).

corresponds to the old MPQC's PrefixKeyVal

Parameters
paththe path to the subtree; absolute (within the top_tree) and relative (with respect to this KeyVal's subtree) paths are allowed.
Returns
the KeyVal object corresponding to path ; if path does not exist, return an empty KeyVal

Reimplemented from mpqc::KeyVal.


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