24 #include "Internal.hpp"
47 Context(
struct ly_ctx *ctx, S_Deleter deleter);
49 explicit Context(
const char *search_dir =
nullptr,
int options = 0);
51 Context(
const char *search_dir,
const char *path,
LYD_FORMAT format,
int options = 0);
53 Context(
const char *search_dir,
LYD_FORMAT format,
const char *data,
int options = 0);
84 S_Module
get_module(
const char *name,
const char *revision =
nullptr,
int implemented = 0);
88 S_Module
load_module(
const char *name,
const char *revision =
nullptr);
90 S_Module
get_module_by_ns(
const char *ns,
const char *revision =
nullptr,
int implemented = 0);
92 S_Submodule
get_submodule(
const char *module,
const char *revision =
nullptr,
const char *submodule =
nullptr,
const char *sub_revision =
nullptr);
94 S_Submodule
get_submodule2(S_Module main_module,
const char *submodule =
nullptr);
96 S_Schema_Node
get_node(S_Schema_Node start,
const char *data_path,
int output = 0);
100 S_Set
find_path(
const char *schema_path);
108 using mod_missing_cb_t = std::function<mod_missing_cb_return(const char *mod_name, const char *mod_rev, const char *submod_name, const char *sub_rev)>;
134 friend std::vector<S_Error>
get_ly_errors(S_Context context);
141 static const char*
cpp_mod_missing_cb(
const char *mod_name,
const char *mod_rev,
const char *submod_name,
const char *sub_rev,
void *user_data,
LYS_INFORMAT *format,
void(**free_module_data)(
void *model_data,
void *user_data));
162 Error(
struct ly_err_item *eitem);
165 LY_ERR
err() throw() {
return eitem->no;};
167 LY_VECODE
vecode() throw() {
return eitem->vecode;};
169 const char *
errmsg()
const throw() {
return eitem->msg ? eitem->msg :
"";};
171 const char *
errpath()
const throw() {
return eitem->path ? eitem->path :
"";};
173 const char *
errapptag()
const throw() {
return eitem->apptag ? eitem->path :
"";};
175 struct ly_err_item *eitem;
190 Set(
struct ly_set *set, S_Deleter);
194 unsigned int size() {
return set->size;};
196 unsigned int number() {
return set->number;};
198 std::vector<S_Data_Node>
data();
200 std::vector<S_Schema_Node>
schema();
206 int add(S_Data_Node node,
int options = 0);
208 int add(S_Schema_Node node,
int options = 0);
216 int rm(S_Data_Node node);
218 int rm(S_Schema_Node node);
std::vector< void * > wrap_cb_l
LY_LOG_LEVEL set_log_verbosity(LY_LOG_LEVEL level)
S_Module get_module_by_ns(const char *ns, const char *revision=nullptr, int implemented=0)
Error(struct ly_err_item *eitem)
std::vector< const mod_missing_deleter_t * > mod_missing_deleter
void unset_disable_searchdir_cwd()
struct ly_ctx * swig_ctx()
S_Module load_module(const char *name, const char *revision=nullptr)
S_Set find_path(const char *schema_path)
const char * errapptag() const
std::vector< S_Module > get_disabled_module_iter()
const char * errmsg() const
std::vector< std::pair< mod_missing_cb_t, mod_missing_deleter_t > > mod_missing_cb
class for wrapping ly_err_item.
S_Data_Node parse_data_xml(S_Xml_Elem elem, int options=0)
void set_disable_searchdir_cwd()
class for wrapping ly_ctx.
S_Data_Node parse_data_path(const char *path, LYD_FORMAT format, int options=0)
static void cpp_mod_missing_deleter(void *data, void *user_data)
S_Data_Node parse_data_fd(int fd, LYD_FORMAT format, int options=0)
S_Module parse_module_path(const char *path, LYS_INFORMAT format)
S_Submodule get_submodule2(S_Module main_module, const char *submodule=nullptr)
void unset_prefer_searchdirs()
friend std::vector< S_Error > get_ly_errors(S_Context context)
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
void add_missing_module_callback(const mod_missing_cb_t &callback, const mod_missing_deleter_t &deleter=mod_missing_deleter_t())
Add a missing include or import module callback.
S_Data_Node parse_data_mem(const char *data, LYD_FORMAT format, int options=0)
std::vector< std::string > get_searchdirs()
const char * errpath() const
S_Module get_module(const char *name, const char *revision=nullptr, int implemented=0)
std::function< mod_missing_cb_return(const char *mod_name, const char *mod_rev, const char *submod_name, const char *sub_rev)> mod_missing_cb_t
int add(S_Data_Node node, int options=0)
std::vector< S_Schema_Node > schema()
std::vector< S_Error > get_ly_errors(S_Context context)
void set_prefer_searchdirs()
int contains(S_Data_Node node)
LYS_INFORMAT
Schema input formats accepted by libyang parser functions.
std::function< void(void *)> mod_missing_deleter_t
void unset_allimplemented()
int set_log_options(int options)
std::vector< S_Schema_Node > data_instantiables(int options)
Context(struct ly_ctx *ctx, S_Deleter deleter)
void set_disable_searchdirs()
void unset_searchdirs(int idx)
S_Module get_module_older(S_Module module)
void unset_disable_searchdirs()
S_Module parse_module_mem(const char *data, LYS_INFORMAT format)
std::vector< S_Data_Node > data()
S_Module parse_module_fd(int fd, LYS_INFORMAT format)
std::vector< S_Module > get_module_iter()
class for wrapping ly_set.
int set_searchdir(const char *search_dir)
S_Schema_Node get_node(S_Schema_Node start, const char *data_path, int output=0)
S_Submodule get_submodule(const char *module, const char *revision=nullptr, const char *submodule=nullptr, const char *sub_revision=nullptr)
void set_allimplemented()
S_Context create_new_Context(struct ly_ctx *ctx)
int rm_index(unsigned int index)
static const char * cpp_mod_missing_cb(const char *mod_name, const char *mod_rev, const char *submod_name, const char *sub_rev, void *user_data, LYS_INFORMAT *format, void(**free_module_data)(void *model_data, void *user_data))