YANG schema: refactor schema search dirs support
I got very confused, because the code in netconf-cli calls these methods
"addFoo", whereas the libayng-cpp calls them "setFoo", even though all
of them simply extend the "foo" with the provided argument. So, let's
refactor these.
Start by making the interface a bit more type safe with
`std::filesystem::path`, and then change the interface of the `yang-cli`
program so that the `-s` option can be now specified several times.
Change-Id: Iad40696b0e133c60e0c0a1512da851650f6ac8a0
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 26ef38d..3c5456e 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -48,14 +48,14 @@
m_context.parseModule(std::string{schema}, libyang::SchemaFormat::YANG);
}
-void YangSchema::addSchemaDirectory(const char* directoryName)
+void YangSchema::addSchemaDirectory(const std::filesystem::path& directory)
{
- m_context.setSearchDir(directoryName);
+ m_context.setSearchDir(directory);
}
-void YangSchema::addSchemaFile(const char* filename)
+void YangSchema::addSchemaFile(const std::filesystem::path& filename)
{
- m_context.parseModule(std::filesystem::path{filename}, libyang::SchemaFormat::YANG);
+ m_context.parseModule(filename, libyang::SchemaFormat::YANG);
}
bool YangSchema::isModule(const std::string& name) const