libyang 1.0.184
YANG data modeling language library
Loading...
Searching...
No Matches
Context Class Reference

class for wrapping ly_ctx. More...

#include <Libyang.hpp>

Data Structures

struct  mod_missing_cb_return

Public Types

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)>
using mod_missing_deleter_t = std::function<void(void *)>

Public Member Functions

 Context (struct ly_ctx *ctx, S_Deleter deleter)
 Context (const char *search_dir=nullptr, int options=0)
 Context (const char *search_dir, const char *path, LYD_FORMAT format, int options=0)
 Context (const char *search_dir, LYD_FORMAT format, const char *data, int options=0)
 ~Context ()
int set_searchdir (const char *search_dir)
void unset_searchdirs (int idx)
std::vector< std::string > get_searchdirs ()
void set_allimplemented ()
void unset_allimplemented ()
void set_disable_searchdirs ()
void unset_disable_searchdirs ()
void set_disable_searchdir_cwd ()
void unset_disable_searchdir_cwd ()
void set_prefer_searchdirs ()
void unset_prefer_searchdirs ()
S_Data_Node info ()
std::vector< S_Module > get_module_iter ()
std::vector< S_Module > get_disabled_module_iter ()
S_Module get_module (const char *name, const char *revision=nullptr, int implemented=0)
S_Module get_module_older (S_Module module)
S_Module load_module (const char *name, const char *revision=nullptr)
S_Module get_module_by_ns (const char *ns, const char *revision=nullptr, int implemented=0)
S_Submodule get_submodule (const char *module, const char *revision=nullptr, const char *submodule=nullptr, const char *sub_revision=nullptr)
S_Submodule get_submodule2 (S_Module main_module, const char *submodule=nullptr)
S_Schema_Node get_node (S_Schema_Node start, const char *data_path, int output=0)
std::vector< S_Schema_Node > data_instantiables (int options)
S_Set find_path (const char *schema_path)
void clean ()
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)
S_Data_Node parse_data_fd (int fd, LYD_FORMAT format, int options=0)
S_Data_Node parse_data_path (const char *path, LYD_FORMAT format, int options=0)
S_Data_Node parse_data_xml (S_Xml_Elem elem, int options=0)
S_Module parse_module_mem (const char *data, LYS_INFORMAT format)
S_Module parse_module_fd (int fd, LYS_INFORMAT format)
S_Module parse_module_path (const char *path, LYS_INFORMAT format)
struct ly_ctxswig_ctx ()

Static Public Member Functions

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))
static void cpp_mod_missing_deleter (void *data, void *user_data)

Data Fields

friend Data_Node
friend Deleter
friend Error
std::vector< std::pair< mod_missing_cb_t, mod_missing_deleter_t > > mod_missing_cb
std::vector< const mod_missing_deleter_t * > mod_missing_deleter
std::vector< void * > wrap_cb_l

Friends

std::vector< S_Error > get_ly_errors (S_Context context)

Detailed Description

class for wrapping ly_ctx.

Definition at line 43 of file Libyang.hpp.


Data Structure Documentation

◆ libyang::Context::mod_missing_cb_return

struct libyang::Context::mod_missing_cb_return

Definition at line 104 of file Libyang.hpp.

Data Fields
LYS_INFORMAT format
const char * data

Member Typedef Documentation

◆ mod_missing_cb_t

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)>

Definition at line 108 of file Libyang.hpp.

◆ mod_missing_deleter_t

using mod_missing_deleter_t = std::function<void(void *)>

Definition at line 109 of file Libyang.hpp.

Constructor & Destructor Documentation

◆ Context() [1/4]

Context ( struct ly_ctx * ctx,
S_Deleter deleter )

wrapper for struct ly_ctx, for internal use only

Definition at line 35 of file Libyang.cpp.

◆ Context() [2/4]

Context ( const char * search_dir = nullptr,
int options = 0 )
explicit

wrapper for ly_ctx_new

Definition at line 39 of file Libyang.cpp.

◆ Context() [3/4]

Context ( const char * search_dir,
const char * path,
LYD_FORMAT format,
int options = 0 )

wrapper for ly_ctx_new_ylpath

Definition at line 46 of file Libyang.cpp.

◆ Context() [4/4]

Context ( const char * search_dir,
LYD_FORMAT format,
const char * data,
int options = 0 )

wrapper for ly_ctx_new_ylmem

Definition at line 53 of file Libyang.cpp.

◆ ~Context()

~Context ( )

Definition at line 60 of file Libyang.cpp.

Member Function Documentation

◆ set_searchdir()

int set_searchdir ( const char * search_dir)

wrapper for ly_ctx_set_searchdir

Definition at line 61 of file Libyang.cpp.

◆ unset_searchdirs()

void unset_searchdirs ( int idx)
inline

wrapper for ly_ctx_unset_searchdirs

Definition at line 58 of file Libyang.hpp.

◆ get_searchdirs()

std::vector< std::string > get_searchdirs ( )

wrapper for ly_ctx_get_searchdirs

Definition at line 130 of file Libyang.cpp.

◆ set_allimplemented()

void set_allimplemented ( )
inline

wrapper for ly_ctx_set_allimplemented

Definition at line 62 of file Libyang.hpp.

◆ unset_allimplemented()

void unset_allimplemented ( )
inline

wrapper for ly_ctx_unset_allimplemented

Definition at line 64 of file Libyang.hpp.

◆ set_disable_searchdirs()

void set_disable_searchdirs ( )
inline

wrapper for ly_ctx_set_disable_searchdirs

Definition at line 66 of file Libyang.hpp.

◆ unset_disable_searchdirs()

void unset_disable_searchdirs ( )
inline

wrapper for ly_ctx_unset_disable_searchdirs

Definition at line 68 of file Libyang.hpp.

◆ set_disable_searchdir_cwd()

void set_disable_searchdir_cwd ( )
inline

wrapper for ly_ctx_set_disable_searchdir_cwd

Definition at line 70 of file Libyang.hpp.

◆ unset_disable_searchdir_cwd()

void unset_disable_searchdir_cwd ( )
inline

wrapper for ly_ctx_unset_disable_searchdir_cwd

Definition at line 72 of file Libyang.hpp.

◆ set_prefer_searchdirs()

void set_prefer_searchdirs ( )
inline

wrapper for ly_ctx_set_prefer_searchdirs

Definition at line 74 of file Libyang.hpp.

◆ unset_prefer_searchdirs()

void unset_prefer_searchdirs ( )
inline

wrapper for ly_ctx_unset_prefer_searchdirs

Definition at line 76 of file Libyang.hpp.

◆ info()

S_Data_Node info ( )

wrapper for ly_ctx_info

Definition at line 68 of file Libyang.cpp.

◆ get_module_iter()

std::vector< S_Module > get_module_iter ( )

wrapper for ly_ctx_get_module_iter

Definition at line 97 of file Libyang.cpp.

◆ get_disabled_module_iter()

std::vector< S_Module > get_disabled_module_iter ( )

wrapper for ly_ctx_get_disabled_module_iter

Definition at line 112 of file Libyang.cpp.

◆ get_module()

S_Module get_module ( const char * name,
const char * revision = nullptr,
int implemented = 0 )

wrapper for ly_ctx_get_module

Definition at line 78 of file Libyang.cpp.

◆ get_module_older()

S_Module get_module_older ( S_Module module)

wrapper for ly_ctx_get_module_older

Definition at line 82 of file Libyang.cpp.

◆ load_module()

S_Module load_module ( const char * name,
const char * revision = nullptr )

wrapper for ly_ctx_load_module

Definition at line 86 of file Libyang.cpp.

◆ get_module_by_ns()

S_Module get_module_by_ns ( const char * ns,
const char * revision = nullptr,
int implemented = 0 )

wrapper for ly_ctx_get_module_by_ns

Definition at line 93 of file Libyang.cpp.

◆ get_submodule()

S_Submodule get_submodule ( const char * module,
const char * revision = nullptr,
const char * submodule = nullptr,
const char * sub_revision = nullptr )

wrapper for ly_ctx_get_submodule

Definition at line 148 of file Libyang.cpp.

◆ get_submodule2()

S_Submodule get_submodule2 ( S_Module main_module,
const char * submodule = nullptr )

wrapper for ly_ctx_get_submodule2

Definition at line 155 of file Libyang.cpp.

◆ get_node()

S_Schema_Node get_node ( S_Schema_Node start,
const char * data_path,
int output = 0 )

wrapper for ly_ctx_get_node

Definition at line 162 of file Libyang.cpp.

◆ data_instantiables()

std::vector< S_Schema_Node > data_instantiables ( int options)

wrapper for lys_getnext

Definition at line 178 of file Libyang.cpp.

◆ find_path()

S_Set find_path ( const char * schema_path)

wrapper for ly_ctx_find_path

Definition at line 169 of file Libyang.cpp.

◆ clean()

void clean ( )

wrapper for ly_ctx_clean

Definition at line 127 of file Libyang.cpp.

◆ add_missing_module_callback()

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.

When libyang hits a missing module, the

  • callback will be called. If it can accommodate this request, it should return an appropriate mod_missing_cb_return struct. If it is needed to free the actual module "source code", then
  • deleter should be provided; it is then responsible for deallocation of the resulting mod_missing_cb_return::data.

Definition at line 281 of file Libyang.cpp.

◆ parse_data_mem()

S_Data_Node parse_data_mem ( const char * data,
LYD_FORMAT format,
int options = 0 )

wrapper for lyd_parse_mem

Definition at line 191 of file Libyang.cpp.

◆ parse_data_fd()

S_Data_Node parse_data_fd ( int fd,
LYD_FORMAT format,
int options = 0 )

wrapper for lyd_parse_fd

Definition at line 203 of file Libyang.cpp.

◆ parse_data_path()

S_Data_Node parse_data_path ( const char * path,
LYD_FORMAT format,
int options = 0 )

wrapper for lyd_parse_path

Definition at line 252 of file Libyang.cpp.

◆ parse_data_xml()

S_Data_Node parse_data_xml ( S_Xml_Elem elem,
int options = 0 )

wrapper for lyd_parse_xml

Definition at line 264 of file Libyang.cpp.

◆ parse_module_mem()

S_Module parse_module_mem ( const char * data,
LYS_INFORMAT format )

wrapper for lys_parse_mem

Definition at line 216 of file Libyang.cpp.

◆ parse_module_fd()

S_Module parse_module_fd ( int fd,
LYS_INFORMAT format )

wrapper for lys_parse_fd

Definition at line 228 of file Libyang.cpp.

◆ parse_module_path()

S_Module parse_module_path ( const char * path,
LYS_INFORMAT format )

wrapper for lys_parse_path

Definition at line 240 of file Libyang.cpp.

◆ cpp_mod_missing_cb()

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) )
static

Definition at line 289 of file Libyang.cpp.

◆ cpp_mod_missing_deleter()

void cpp_mod_missing_deleter ( void * data,
void * user_data )
static

Definition at line 311 of file Libyang.cpp.

◆ swig_ctx()

struct ly_ctx * swig_ctx ( )
inline

Definition at line 145 of file Libyang.hpp.

◆ get_ly_errors

std::vector< S_Error > get_ly_errors ( S_Context context)
friend

Definition at line 323 of file Libyang.cpp.

Field Documentation

◆ Data_Node

friend Data_Node

Definition at line 135 of file Libyang.hpp.

◆ Deleter

friend Deleter

Definition at line 136 of file Libyang.hpp.

◆ Error

friend Error

Definition at line 137 of file Libyang.hpp.

◆ mod_missing_cb

std::vector<std::pair<mod_missing_cb_t, mod_missing_deleter_t> > mod_missing_cb

Definition at line 139 of file Libyang.hpp.

◆ mod_missing_deleter

std::vector<const mod_missing_deleter_t *> mod_missing_deleter

Definition at line 140 of file Libyang.hpp.

◆ wrap_cb_l

std::vector<void*> wrap_cb_l

Definition at line 146 of file Libyang.hpp.


The documentation for this class was generated from the following files: