Status parse(const std::string& str, float& result) { if (COLUMN_EMPTY_ERROR == check_not_empty(str)) { return COLUMN_EMPTY_ERROR; } result = atof(str.c_str()); return SUCCESS; }
Status parse(const std::string& str, std::string& result) { if (COLUMN_EMPTY_ERROR == check_not_empty(str)) { return COLUMN_EMPTY_ERROR; } result = str; return SUCCESS; }
Status check_right_vector(const std::string& str, std::vector<std::string>& vec) { if (SUCCESS != check_not_empty(str)) { return COLUMN_VECTOR_ERROR; } size_t colon_idx = str.find_first_of(':'); if (colon_idx == std::string::npos) { return COLUMN_VECTOR_ERROR; } int num = atoi(str.substr(0, colon_idx).c_str()); if (num < 0) { return COLUMN_VECTOR_ERROR; } str_split(str.substr(colon_idx + 1), ",", vec); if (static_cast<int>(vec.size()) != num) { return COLUMN_VECTOR_ERROR; } return SUCCESS; }
// set dont_overwrite setting by file name. if name equal FULL_AP_BIN_PATH,just don't overwrite. void set_dont_overwrite_byname(char *upgradeFile) { UBOOT_TRACE("IN\n"); if(strcmp(upgradeFile,FULL_AP_BIN_PATH)==0) { UBOOT_DEBUG("dont_overwrite force disable"); dont_overwrite_disable(); } else { if(check_not_empty()==0) { UBOOT_DEBUG("dont_overwrite force enable"); dont_overwrite_enable(); } else { UBOOT_DEBUG("dont_overwrite force disable"); dont_overwrite_disable(); } } UBOOT_TRACE("OK\n"); }