blob: 2cfcbf2e93d3bc25ad8548324d84f30b218ea4a3 [file] [log] [blame]
/*
* Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
* Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
*
* Written by Václav Kubernát <kubervac@fit.cvut.cz>
*
*/
#include "schema.hpp"
Schema::~Schema() = default;
bool Schema::isList(const schemaPath_& location, const ModuleNodePair& node) const
{
try {
return nodeType(location, node) == yang::NodeTypes::List;
} catch (InvalidNodeException&) {
return false;
}
}
bool Schema::isPresenceContainer(const schemaPath_& location, const ModuleNodePair& node) const
{
try {
return nodeType(location, node) == yang::NodeTypes::PresenceContainer;
} catch (InvalidNodeException&) {
return false;
}
}
bool Schema::isContainer(const schemaPath_& location, const ModuleNodePair& node) const
{
try {
auto type = nodeType(location, node);
return type == yang::NodeTypes::Container || type == yang::NodeTypes::PresenceContainer;
} catch (InvalidNodeException&) {
return false;
}
}
bool Schema::isLeaf(const schemaPath_& location, const ModuleNodePair& node) const
{
try {
return nodeType(location, node) == yang::NodeTypes::Leaf;
} catch (InvalidNodeException&) {
return false;
}
}