Add enum completion
Change-Id: I5ee7d6359812535d0eef9f70e1b66e205d93cf39
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index 9be7751..d80ac7b 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -121,12 +121,8 @@
bool StaticSchema::leafEnumHasValue(const schemaPath_& location, const ModuleNodePair& node, const std::string& value) const
{
- std::string locationString = pathToAbsoluteSchemaString(location);
- assert(isLeaf(location, node));
-
- const auto& child = children(locationString).at(fullNodeName(location, node));
- const auto& list = boost::get<yang::leaf>(child);
- return list.m_enumValues.find(value) != list.m_enumValues.end();
+ auto enums = enumValues(location, node);
+ return enums.find(value) != enums.end();
}
bool StaticSchema::isLeaf(const schemaPath_& location, const ModuleNodePair& node) const
@@ -145,6 +141,16 @@
return boost::get<yang::leaf>(children(locationString).at(fullNodeName(location, node))).m_type;
}
+const std::set<std::string> StaticSchema::enumValues(const schemaPath_& location, const ModuleNodePair& node) const
+{
+ std::string locationString = pathToAbsoluteSchemaString(location);
+ assert(isLeaf(location, node));
+
+ const auto& child = children(locationString).at(fullNodeName(location, node));
+ const auto& leaf = boost::get<yang::leaf>(child);
+ return leaf.m_enumValues;
+}
+
// We do not test StaticSchema, so we don't need to implement recursive childNodes
// for this class.
std::set<std::string> StaticSchema::childNodes(const schemaPath_& path, const Recursion) const