Make splitModuleNode reusable

It will become handy when parsing identityref as returned from sysrepo.
The code still assumes that it will never get a module-unqualified name.

Change-Id: I8014a5442c69a2098f8d1425233011fad47bf42e
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index d554cb9..2395aa0 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -135,15 +135,6 @@
     return boost::get<yang::leaf>(children(locationString).at(node)).m_type;
 }
 
-ModuleNodePair splitModuleNode(const std::string& input)
-{
-    auto colonLocation = input.find_first_of(':');
-    if (colonLocation != std::string::npos) {
-        return ModuleNodePair{input.substr(0, colonLocation), input.substr(colonLocation + 1)};
-    }
-    throw std::logic_error("Tried to split a string without a colon (StaticSchema node names should always be stored with prefixes)");
-}
-
 std::set<ModuleNodePair> StaticSchema::availableNodes(const boost::variant<dataPath_, schemaPath_, module_>& path, const Recursion recursion) const
 {
     if (recursion == Recursion::Recursive) {
diff --git a/src/utils.cpp b/src/utils.cpp
index 1ed25c7..dbfc647 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -53,6 +53,15 @@
     return schemaPath_{path.m_scope, decltype(schemaPath_::m_nodes)(path.m_nodes.begin(), path.m_nodes.end() - 1)};
 }
 
+ModuleNodePair splitModuleNode(const std::string& input)
+{
+    auto colonLocation = input.find_first_of(':');
+    if (colonLocation != std::string::npos) {
+        return ModuleNodePair{input.substr(0, colonLocation), input.substr(colonLocation + 1)};
+    }
+    throw std::logic_error("Internal error: got module-unqualified node name");
+}
+
 struct impl_leafDataTypeToString {
     std::string operator()(const yang::String)
     {
diff --git a/src/utils.hpp b/src/utils.hpp
index 7e62ae5..781170d 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -19,6 +19,7 @@
 std::string stripLastNodeFromPath(const std::string& path);
 schemaPath_ pathWithoutLastNode(const schemaPath_& path);
 dataPath_ pathWithoutLastNode(const dataPath_& path);
+ModuleNodePair splitModuleNode(const std::string& input);
 std::string leafDataTypeToString(const yang::LeafDataType& type);
 std::string fullNodeName(const schemaPath_& location, const ModuleNodePair& pair);
 std::string fullNodeName(const dataPath_& location, const ModuleNodePair& pair);