Example #1
0
bool
Option_Bool::set(const std::string& v) {
    try {
        myValue = StringUtils::toBool(v);
        return markSet();
    } catch (...) {
        throw ProcessError("'" + v + "' is not a valid bool.");
    }
}
Example #2
0
bool
Option_Float::set(const std::string& v) {
    try {
        myValue = StringUtils::toDouble(v);
        return markSet();
    } catch (...) {
        throw ProcessError("'" + v + "' is not a valid float.");
    }
}
Example #3
0
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.");
    }
}
Example #4
0
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);
    }
}
Example #5
0
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);
    }
}
Example #6
0
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);
    }
}
Example #7
0
bool
Option_BoolExtended::set(const std::string& v) {
    try {
        myValue = StringUtils::toBool(v);
        myValueString = "";
    } catch (...) {
        myValue = true;
        myValueString = v;
    }
    return markSet();
}
Example #8
0
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.");
    }
}
Example #9
0
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.");
    }
}
Example #10
0
bool
Option_Bool::set(bool v) throw(InvalidArgument) {
    myValue = v;
    return markSet();
}
Example #11
0
bool
Option_String::set(const std::string &v) throw(InvalidArgument) {
    myValue = v;
    return markSet();
}
Example #12
0
bool
Option_String::set(const std::string& v) {
    myValue = v;
    return markSet();
}