Merge Schema::childNodes and Schema::moduleNodes

Change-Id: I30c7120fdba6c0089108599e5ab48d8dcd47f277
diff --git a/src/utils.cpp b/src/utils.cpp
index 9496db3..1ed25c7 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -188,3 +188,25 @@
 {
     return boost::apply_visitor(leafDataToStringVisitor(), value);
 }
+
+struct getSchemaPathVisitor : boost::static_visitor<schemaPath_> {
+    schemaPath_ operator()(const dataPath_& path) const
+    {
+        return dataPathToSchemaPath(path);
+    }
+
+    schemaPath_ operator()(const schemaPath_& path) const
+    {
+        return path;
+    }
+
+    [[noreturn]] schemaPath_ operator()([[maybe_unused]] const module_& path) const
+    {
+        throw std::logic_error("getSchemaPathVisitor: Tried getting a schema path from a module");
+    }
+};
+
+schemaPath_ anyPathToSchemaPath(const boost::variant<dataPath_, schemaPath_, module_>& path)
+{
+    return boost::apply_visitor(getSchemaPathVisitor(), path);
+}