bool Option_Bool::set(const std::string& v) { try { myValue = StringUtils::toBool(v); return markSet(); } catch (...) { throw ProcessError("'" + v + "' is not a valid bool."); } }
bool Option_Float::set(const std::string& v) { try { myValue = StringUtils::toDouble(v); return markSet(); } catch (...) { throw ProcessError("'" + v + "' is not a valid float."); } }
bool Option_Bool::set(const std::string& v) { try { myValue = TplConvert::_2bool(v.c_str()); return markSet(); } catch (...) { throw ProcessError("'" + v + "' is not a valid bool."); } }
bool Option_Float::set(const std::string &v) throw(InvalidArgument) { try { myValue = TplConvert<char>::_2SUMOReal(v.c_str()); return markSet(); } catch (...) { std::string s = "'" + v + "' is not a valid float (should be)."; throw InvalidArgument(s); } }
bool Option_Integer::set(const std::string& v) { try { myValue = StringUtils::toInt(v); return markSet(); } catch (...) { std::string s = "'" + v + "' is not a valid integer."; throw ProcessError(s); } }
bool Option_Integer::set(const std::string& v) { try { myValue = TplConvert::_2int(v.c_str()); return markSet(); } catch (...) { std::string s = "'" + v + "' is not a valid integer."; throw ProcessError(s); } }
bool Option_BoolExtended::set(const std::string& v) { try { myValue = StringUtils::toBool(v); myValueString = ""; } catch (...) { myValue = true; myValueString = v; } return markSet(); }
bool Option_IntVector::set(const std::string &v) throw(InvalidArgument) { myValue.clear(); try { if (v.find(';')!=std::string::npos) { MsgHandler::getWarningInstance()->inform("Please note that using ';' as list separator is deprecated.\n From 1.0 onwards, only ',' will be accepted."); } StringTokenizer st(v, ";,", true); while (st.hasNext()) { myValue.push_back(TplConvert<char>::_2int(st.next().c_str())); } return markSet(); } catch (EmptyData &) { throw InvalidArgument("Empty element occured in " + v); } catch (...) { throw InvalidArgument("'" + v + "' is not a valid integer vector."); } }
bool Option_FloatVector::set(const std::string& v) { myValue.clear(); try { if (v.find(';') != std::string::npos) { WRITE_WARNING("Please note that using ';' as list separator is deprecated.\n From 1.0 onwards, only ',' will be accepted."); } StringTokenizer st(v, ";,", true); while (st.hasNext()) { myValue.push_back(StringUtils::toDouble(st.next())); } return markSet(); } catch (EmptyData&) { throw ProcessError("Empty element occurred in " + v); } catch (...) { throw ProcessError("'" + v + "' is not a valid float vector."); } }
bool Option_Bool::set(bool v) throw(InvalidArgument) { myValue = v; return markSet(); }
bool Option_String::set(const std::string &v) throw(InvalidArgument) { myValue = v; return markSet(); }
bool Option_String::set(const std::string& v) { myValue = v; return markSet(); }