Skip to content
Snippets Groups Projects
Commit 25c12869 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[BL] minor fix

parent 806a1ce0
No related branches found
No related tags found
No related merge requests found
......@@ -144,10 +144,11 @@ ConfigTreeNew::
getConfAttribute(std::string const& attr) const
{
checkUniqueAttr(attr);
markVisited<T>(attr, true);
auto& ct = markVisited<T>(attr, true, true);
if (auto attrs = _tree->get_child_optional("<xmlattr>")) {
if (auto a = attrs->get_child_optional(attr)) {
++ct.count; // count only if attribute has been found
if (auto v = a->get_value_optional<T>()) {
return *v;
} else {
......@@ -156,7 +157,7 @@ getConfAttribute(std::string const& attr) const
+ "' not convertible to the desired type.");
}
} else {
error("No XML attribute named \"" + attr + "\"");
error("Did not find XML attribute with name \"" + attr + "\"");
}
} else {
error("This parameter has no XML attributes");
......
......@@ -85,6 +85,16 @@ getConfParam(std::string const& root) const
return ct;
}
boost::optional<ConfigTreeNew>
ConfigTreeNew::
getConfParamOptional(std::string const& root) const
{
auto ct = getConfSubtreeOptional(root);
if (ct && hasChildren(*ct))
error("Requested parameter <" + root + "> actually is a subtree.");
return ct;
}
ConfigTreeNew
ConfigTreeNew::
getConfSubtree(std::string const& root) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment