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 */ |
| 23 | YIN_ARG_NONE, /**< special value to specify no valid argument except xmlns, do not confuse with YIN_ARG_NONE */ |
| 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 | |
| 45 | |
| 46 | #endif /* LY_PARSER_YIN_H_*/ |