Skip to content

Commit

Permalink
schema tree NEW function for traversing union types
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Sep 21, 2018
1 parent 7688d58 commit b69d243
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/tree_schema.c
Expand Up @@ -123,6 +123,18 @@ lys_is_disabled(const struct lys_node *node, int recursive)
goto check;
}

API const struct lys_type *
lys_getnext_union_type(const struct lys_type *last, const struct lys_type *type)
{
int found = 0;

if (!type || (type->base != LY_TYPE_UNION)) {
retur NULL;
}

return lyp_get_next_union_type(type, last, &found);
}

int
lys_get_sibling(const struct lys_node *siblings, const char *mod_name, int mod_name_len, const char *name,
int nam_len, LYS_NODE type, const struct lys_node **ret)
Expand Down
9 changes: 9 additions & 0 deletions src/tree_schema.h
Expand Up @@ -2290,6 +2290,15 @@ const struct lys_node *lys_getnext(const struct lys_node *last, const struct lys
#define LYS_GETNEXT_NOSTATECHECK 0x100 /**< lys_getnext() option to skip checking module validity (import-only, disabled) and
relevant if-feature conditions state */

/**
* @brief Get next type of a union.
*
* @param[in] last Last returned type. NULL on first call.
* @param[in] type Union type structure.
* @return Next union type in order, NULL if all were returned or on error.
*/
const struct lys_type *lys_getnext_union_type(const struct lys_type *last, const struct lys_type *type);

/**
* @brief Search for schema nodes matching the provided path.
*
Expand Down

0 comments on commit b69d243

Please sign in to comment.