Remove more sr_val remainders
setLeaf uses the last sr_val function in this file, but sysrepo doesn't
have similar alternative to sr_set_item, so I'l keep it for now.
Change-Id: I61fb9f4d194799556cd92f21b1870b013fe11416
diff --git a/src/sysrepo_access.cpp b/src/sysrepo_access.cpp
index e9da2ca..6bcb6f0 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -18,63 +18,6 @@
const auto OPERATION_TIMEOUT_MS = 1000;
-leaf_data_ leafValueFromVal(const sysrepo::S_Val& value)
-{
- using namespace std::string_literals;
- switch (value->type()) {
- case SR_INT8_T:
- return value->data()->get_int8();
- case SR_UINT8_T:
- return value->data()->get_uint8();
- case SR_INT16_T:
- return value->data()->get_int16();
- case SR_UINT16_T:
- return value->data()->get_uint16();
- case SR_INT32_T:
- return value->data()->get_int32();
- case SR_UINT32_T:
- return value->data()->get_uint32();
- case SR_INT64_T:
- return value->data()->get_int64();
- case SR_UINT64_T:
- return value->data()->get_uint64();
- case SR_BOOL_T:
- return value->data()->get_bool();
- case SR_STRING_T:
- return std::string(value->data()->get_string());
- case SR_ENUM_T:
- return enum_{std::string(value->data()->get_enum())};
- case SR_IDENTITYREF_T: {
- auto pair = splitModuleNode(value->data()->get_identityref());
- return identityRef_{*pair.first, pair.second};
- }
- 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:
- return special_{SpecialValue::Container};
- case SR_CONTAINER_PRESENCE_T:
- return special_{SpecialValue::PresenceContainer};
- case SR_LIST_T:
- return special_{SpecialValue::List};
- case SR_BITS_T: {
- bits_ res;
- std::istringstream ss(value->data()->get_bits());
- while (!ss.eof()) {
- std::string bit;
- ss >> bit;
- res.m_bits.push_back(bit);
- }
- return res;
- }
- default: // TODO: implement all types
- return value->val_to_string();
- }
-}
-
struct valFromValue : boost::static_visitor<sysrepo::S_Val> {
sysrepo::S_Val operator()(const enum_& value) const
{
@@ -121,68 +64,6 @@
}
};
-struct updateSrValFromValue : boost::static_visitor<void> {
- std::string xpath;
- sysrepo::S_Val v;
- updateSrValFromValue(const std::string& xpath, sysrepo::S_Val v)
- : xpath(xpath)
- , v(v)
- {
- }
-
- void operator()(const enum_& value) const
- {
- v->set(xpath.c_str(), value.m_value.c_str(), SR_ENUM_T);
- }
-
- void operator()(const binary_& value) const
- {
- 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);
- }
-
- void operator()(const special_& value) const
- {
- switch (value.m_value) {
- case SpecialValue::PresenceContainer:
- v->set(xpath.c_str(), nullptr, SR_CONTAINER_PRESENCE_T);
- break;
- case SpecialValue::List:
- v->set(xpath.c_str(), nullptr, SR_LIST_T);
- break;
- default:
- throw std::runtime_error("Tried constructing S_Val from a " + specialValueToString(value));
- }
- }
-
- auto operator()(const bits_& value) const
- {
- std::stringstream ss;
- std::copy(value.m_bits.begin(), value.m_bits.end(), std::experimental::make_ostream_joiner(ss, " "));
- v->set(xpath.c_str(), ss.str().c_str(), SR_BITS_T);
- }
-
- void operator()(const std::string& value) const
- {
- v->set(xpath.c_str(), value.c_str(), SR_STRING_T);
- }
-
- template <typename T>
- void operator()(const T value) const
- {
- v->set(xpath.c_str(), value);
- }
-};
-
SysrepoAccess::~SysrepoAccess() = default;
sr_datastore_t toSrDatastore(Datastore datastore)