Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Validation fixes

  • Loading branch information...
commit 1d2df659efa4ded89c5d24e8876cb6dcf3d9a4ec 1 parent 71aaf01
@saleyn authored
View
3  bin/config_validator_codegen.py
@@ -368,8 +368,7 @@ def run(self):
f.write(" friend class config::validator;\n\n")
f.write(" virtual ~%s() {}\n\n" % name)
f.write(" %s() {\n" % name)
- f.write(' m_root = "%s";\n' % root.attrib['namespace'])
-
+ f.write(' m_root = "%s";\n' % (root.attrib['root'] if root.attrib.get('root') else ""))
self.process_options(f, root)
View
7 include/utxx/variant_tree.hpp
@@ -514,6 +514,13 @@ class basic_variant_tree : public basic_variant_tree_base<Ch>
/// Validate content of this tree against the custom validator
/// @param a_schema if not NULL use this schema validator otherwise
/// use internal validator().
+ void validate(const config::custom_validator& a_custom_validator) const {
+ validate(NULL, a_custom_validator);
+ }
+
+ /// Validate content of this tree against the custom validator
+ /// @param a_schema if not NULL use this schema validator otherwise
+ /// use internal validator().
void validate(
const config::validator* a_schema = NULL,
const config::custom_validator& a_custom_validator = NULL
View
2  src/config_validator.cpp
@@ -145,6 +145,8 @@ strip_root(const tree_path& a_root_path) const throw(variant_tree_error)
if (s.size() < r.size())
throw variant_tree_error(a_root_path, "Path is shorter than root!");
+ if (r.empty())
+ return a_root_path;
if (s.substr(0, r.size()) != r || (s.size() > r.size() && s[r.size()] != sep))
throw variant_tree_error(a_root_path, "Sub-path not found in root path");
Please sign in to comment.
Something went wrong with that request. Please try again.