1 /** 2 * @file lv_xml_utils.h 3 * 4 */ 5 6 #ifndef LV_XML_UTILS_H 7 #define LV_XML_UTILS_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../../lv_conf_internal.h" 17 #if LV_USE_XML 18 19 #include LV_STDINT_INCLUDE 20 #include "../../misc/lv_color.h" 21 22 /********************** 23 * GLOBAL PROTOTYPES 24 **********************/ 25 const char * lv_xml_get_value_of(const char ** attrs, const char * name); 26 27 int32_t lv_xml_atoi(const char * str); 28 29 30 /** 31 * Convert sections of a string to int. 32 * The end of the string is indicated by the `delimiter`. 33 * @param str pointer to a string, it will point to the character after the delimiter 34 * @param delimiter a character to indicate the end of the int 35 * @return the int before the next delimiter 36 */ 37 int32_t lv_xml_atoi_split(const char ** str, char delimiter); 38 39 lv_color_t lv_xml_to_color(const char * str); 40 41 /** 42 * Concert percentage or integer opacity value from string to integer. 43 * @param str e.g. "70%" or 180 44 * @return 0..255 45 */ 46 lv_opa_t lv_xml_to_opa(const char * str); 47 48 bool lv_xml_to_bool(const char * str); 49 50 int32_t lv_xml_strtol(const char * str, char ** endptr, int32_t base); 51 52 /** 53 * Find a delimiter in a string, terminate the string on the delimiter and 54 * update the source string to the next part 55 * @param src point to a variable containing the input string 56 * @param delimiter a delimiter character, e.g. ':' 57 * @return the beginning of next section in the string closed at the delimiter 58 */ 59 char * lv_xml_split_str(char ** src, char delimiter); 60 61 #endif /* LV_USE_XML */ 62 63 #ifdef __cplusplus 64 } /*extern "C"*/ 65 #endif 66 67 #endif /*LV_XML_UTILS_H*/ 68