22template <
typename Iterator>
 
   49    error(
"Key <" + param + 
"> has not been found");
 
 
   54                                 T 
const& default_value)
 const 
 
   66    std::string 
const& param)
 const 
 
   75    std::string 
const& param, T* )
 const 
   79        return p->getValue<T>();
 
 
   87    std::string 
const& param, std::vector<T>* )
 const 
   91        std::string 
const raw = p->getValue<std::string>();
 
   93        std::size_t bad_idx = 0;
 
  101              "' not convertible to a vector of the desired type." 
  102              " Could not convert token no. " +
 
  103              std::to_string(bad_idx) + 
".");
 
 
  112    std::string 
const& param)
 const 
  117    auto p = 
tree_->equal_range(param);
 
 
  127    if (
auto p = 
tree_->get_child_optional(param))
 
  131            return p->get_value<T>();
 
  133        catch (boost::property_tree::ptree_bad_data 
const&)
 
  136                  "' not convertible to the desired type.");
 
  141        error(
"Key <" + param + 
"> has not been found");
 
 
  150        error(
"The data of this subtree has already been read.");
 
  155    if (
auto v = 
tree_->get_value_optional<T>())
 
  160          "' is not convertible to the desired type.");
 
 
  171    error(
"Did not find XML attribute with name '" + attr + 
"'.");
 
 
  176                                 T 
const& default_value)
 const 
  183    return default_value;
 
 
  188    std::string 
const& attr)
 const 
  193    if (
auto attrs = 
tree_->get_child_optional(
"<xmlattr>"))
 
  195        if (
auto a = attrs->get_child_optional(attr))
 
  198            if (
auto v = a->get_value_optional<T>())
 
  200                return std::make_optional(*v);
 
  202            error(
"Value for XML attribute '" + attr + 
"' `" +
 
  204                  "' not convertible to the desired type.");
 
 
  214                                               bool const peek_only)
 const 
  216    auto const type = std::type_index(
typeid(T));
 
  223        auto& v = p.first->second;
 
  233            error(
"There already was an attempt to obtain key <" + key +
 
  234                  "> with type '" + v.type.name() + 
"' (now: '" + type.name() +
 
  239    return p.first->second;
 
 
T peekConfigParameter(std::string const ¶m) const
 
void checkUniqueAttr(std::string const &attr) const
Asserts that the attribute attr has not been read yet.
 
std::map< KeyType, CountType > visited_params_
 
static std::string shortString(std::string const &s)
returns a short string at suitable for error/warning messages
 
void error(std::string const &message) const
 
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
 
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
 
void checkUnique(std::string const &key) const
Asserts that the key has not been read yet.
 
T getConfigParameter(std::string const ¶m) const
 
T getConfigAttribute(std::string const &attr) const
 
Attr
Used to indicate if dealing with XML tags or XML attributes.
 
CountType & markVisited(std::string const &key, Attr const is_attr, bool peek_only) const
 
std::optional< T > getConfigParameterOptionalImpl(std::string const ¶m, T *) const
Default implementation of reading a value of type T.
 
Range< ValueIterator< T > > getConfigParameterList(std::string const ¶m) const
 
std::optional< T > getConfigAttributeOptional(std::string const &attr) const
 
PTree const  * tree_
The wrapped tree.
 
void checkKeyname(std::string const &key) const
Checks if key complies with the rules [a-z0-9_].
 
Wraps a pair of iterators for use as a range in range-based for-loops.
 
Range(Iterator begin, Iterator end)
 
std::optional< std::vector< T > > tryParseVector(std::string const &raw, std::size_t *bad_token_idx)