David Sedlák | 2b626ee | 2019-06-03 16:40:18 +0200 | [diff] [blame] | 1 | |
| 2 | |
| 3 | #ifndef LY_PARSER_YIN_H_ |
| 4 | #define LY_PARSER_YIN_H_ |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include "log.h" |
| 8 | #include "xml.h" |
| 9 | #include "stdlib.h" |
| 10 | |
| 11 | enum YIN_ARGUMENT { |
| 12 | YIN_ARG_UNKNOWN = 0, /**< parsed argument can not be matched with any known yin argument keyword */ |
| 13 | YIN_ARG_NAME, /**< argument name */ |
| 14 | YIN_ARG_TARGET_NODE, /**< argument target-node */ |
| 15 | YIN_ARG_MODULE, /**< argument module */ |
| 16 | YIN_ARG_VALUE, /**< argument value */ |
| 17 | YIN_ARG_TEXT, /**< argument text */ |
| 18 | YIN_ARG_CONDITION, /**< argument condition */ |
| 19 | YIN_ARG_URI, /**< argument uri */ |
| 20 | YIN_ARG_DATE, /**< argument data */ |
| 21 | YIN_ARG_TAG, /**< argument tag */ |
| 22 | YIN_ARG_XMLNS, /**< argument xmlns */ |
David Sedlák | 6882673 | 2019-06-05 10:50:58 +0200 | [diff] [blame^] | 23 | YIN_ARG_NONE, /**< special value to specify no valid argument except xmlns, do not confuse with YIN_ARG_UNKNOWN */ |
David Sedlák | 2b626ee | 2019-06-03 16:40:18 +0200 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | /** |
| 27 | * @brief Match argument name. |
| 28 | * |
| 29 | * @param[in] name String representing name. |
| 30 | * @param[in] len Lenght of the name. |
| 31 | * |
| 32 | * @reurn YIN_ARGUMENT value. |
| 33 | */ |
| 34 | enum YIN_ARGUMENT match_argument_name(const char *name, size_t len); |
| 35 | |
| 36 | /** |
| 37 | * @brief Parse content of whole element as text. |
| 38 | * |
| 39 | * @param[in] xml_ctx Xml context. |
| 40 | * @param[in] data Data to read from. |
| 41 | * @param[out] value Where content of element should be stored. |
| 42 | */ |
| 43 | LY_ERR parse_text_element(struct lyxml_context *xml_ctx, const char **data, const char **value); |
| 44 | |
David Sedlák | d9d3a31 | 2019-06-04 09:47:10 +0200 | [diff] [blame] | 45 | /** |
David Sedlák | da63c08 | 2019-06-04 13:52:23 +0200 | [diff] [blame] | 46 | * @brief Parse import element |
| 47 | * |
| 48 | * @param[in] xml_ctx Xml context. |
| 49 | * @param[in] module_prefix Prefix of the module to check prefix collisions. |
| 50 | * @param[in, out] data Dta to read from. |
| 51 | * |
| 52 | */ |
| 53 | LY_ERR yin_parse_import(struct lyxml_context *xml_ctx, const char *module_prefix, const char **data, struct lysp_import **imports); |
David Sedlák | 2b626ee | 2019-06-03 16:40:18 +0200 | [diff] [blame] | 54 | |
| 55 | #endif /* LY_PARSER_YIN_H_*/ |