CESNET / libyang-cpp

C++ bindings for the libyang library
https://gerrit.cesnet.cz/q/project:CzechLight/libyang-cpp
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

lyd_new_term() wrapper #15

Closed zinccyy closed 9 months ago

zinccyy commented 9 months ago

We'd like to convert something along the lines of the following C code into C++ by using libyang-cpp:

ly_err = lyd_new_term(ly_node, ly_uv4mod, "destination-prefix", prefix_buffer, false, NULL);
if (ly_err != LY_SUCCESS) {
  goto error_out;
}

Is there an equivalent function for creating a new term, the same way as in using lyd_new_term() in the C library where a different module can be provided? In this case the data from the main module is augmented in different modules for IPv4 and IPv6 unicast routing.

jktjkt commented 9 months ago

In the C++ wrapper there's no difference between creating terms and non-term nodes; just use newPath for this. Take a look at the test suite, especially the tests/data_node.cpp.

(Please reopen if there's anything missing.)