Add support for `empty` YANG leaf type
Change-Id: I87eafae9df9accdaa4579ace769996e70da6cb1c
diff --git a/src/sysrepo_access.cpp b/src/sysrepo_access.cpp
index b40b9f1..5b01d3e 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -47,6 +47,8 @@
}
case SR_BINARY_T:
return binary_{value->data()->get_binary()};
+ case SR_LEAF_EMPTY_T:
+ return empty_{};
case SR_DECIMAL64_T:
return value->data()->get_decimal64();
case SR_CONTAINER_T:
@@ -71,6 +73,11 @@
return std::make_shared<sysrepo::Val>(value.m_value.c_str(), SR_BINARY_T);
}
+ sysrepo::S_Val operator()(const empty_) const
+ {
+ return std::make_shared<sysrepo::Val>(nullptr, SR_LEAF_EMPTY_T);
+ }
+
sysrepo::S_Val operator()(const identityRef_& value) const
{
auto res = value.m_prefix ? (value.m_prefix.value().m_name + ":" + value.m_value) : value.m_value;
@@ -113,6 +120,11 @@
v->set(xpath.c_str(), value.m_value.c_str(), SR_BINARY_T);
}
+ void operator()(const empty_) const
+ {
+ v->set(xpath.c_str(), nullptr, SR_LEAF_EMPTY_T);
+ }
+
void operator()(const identityRef_& value) const
{
v->set(xpath.c_str(), (value.m_prefix.value().m_name + ":" + value.m_value).c_str(), SR_IDENTITYREF_T);