Reimplement Schema::is* methods with Schema::nodeType
Change-Id: I00653c6ff387f7a9b20970afd7ceb9da0fbdb1b5
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 3470865..10565d3 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -93,31 +93,6 @@
return set.find(name) != set.end();
}
-bool YangSchema::isContainer(const schemaPath_& location, const ModuleNodePair& node) const
-{
- const auto schemaNode = getSchemaNode(location, node);
- return schemaNode && schemaNode->nodetype() == LYS_CONTAINER;
-}
-
-bool YangSchema::isLeaf(const schemaPath_& location, const ModuleNodePair& node) const
-{
- const auto schemaNode = getSchemaNode(location, node);
- return schemaNode && schemaNode->nodetype() == LYS_LEAF;
-}
-
-bool YangSchema::isList(const schemaPath_& location, const ModuleNodePair& node) const
-{
- const auto schemaNode = getSchemaNode(location, node);
- return schemaNode && schemaNode->nodetype() == LYS_LIST;
-}
-
-bool YangSchema::isPresenceContainer(const schemaPath_& location, const ModuleNodePair& node) const
-{
- if (!isContainer(location, node))
- return false;
- return libyang::Schema_Node_Container(getSchemaNode(location, node)).presence();
-}
-
bool YangSchema::leafEnumHasValue(const schemaPath_& location, const ModuleNodePair& node, const std::string& value) const
{
auto enums = enumValues(location, node);
@@ -427,7 +402,7 @@
case LYS_LIST:
return yang::NodeTypes::List;
default:
- throw std::runtime_error{"YangSchema::nodeType: unsupported type"};
+ throw InvalidNodeException(); // FIXME: Implement all types.
}
}
}