Rework Schema::units into Schema::leafType
Change-Id: I9c1f039e7e054f84559a3d57812d0254db183a99
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index 3eb42f6..6815015 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -86,7 +86,7 @@
void StaticSchema::addLeaf(const std::string& location, const std::string& name, const yang::LeafDataType& type)
{
- m_nodes.at(location).emplace(name, yang::leaf{type});
+ m_nodes.at(location).emplace(name, yang::leaf{yang::TypeInfo{type, std::nullopt}});
std::string key = joinPaths(location, name);
m_nodes.emplace(key, std::unordered_map<std::string, NodeType>());
}
@@ -122,13 +122,13 @@
return res;
}
-yang::LeafDataType StaticSchema::leafType(const schemaPath_& location, const ModuleNodePair& node) const
+yang::TypeInfo StaticSchema::leafType(const schemaPath_& location, const ModuleNodePair& node) const
{
std::string locationString = pathToSchemaString(location, Prefixes::Always);
return boost::get<yang::leaf>(children(locationString).at(fullNodeName(location, node))).m_type;
}
-yang::LeafDataType StaticSchema::leafType(const std::string& path) const
+yang::TypeInfo StaticSchema::leafType(const std::string& path) const
{
auto locationString = stripLastNodeFromPath(path);
auto node = lastNodeOfSchemaPath(path);
@@ -197,11 +197,6 @@
throw std::runtime_error{"StaticSchema::description not implemented"};
}
-std::optional<std::string> StaticSchema::units([[maybe_unused]] const std::string& path) const
-{
- throw std::runtime_error{"StaticSchema::units not implemented"};
-}
-
yang::NodeTypes StaticSchema::nodeType([[maybe_unused]] const std::string& path) const
{
throw std::runtime_error{"Internal error: StaticSchema::nodeType(std::string) not implemented. The tests should not have called this overload."};