Beispiel #1
0
double
PlanSimSubpanel::getDouble(const vle::value::Matrix& view,
                              unsigned int col,
                              unsigned int row,
                              bool error_message)
{
    if (not view.get(col, row)) {
        if (error_message) {
            mLog->logExt(QString("output '%1' is null")
                           .arg(view.getString(col, 0).c_str()),
                         true);
        }
        return 0;
    } else if (view.get(col, row)->isInteger()) {
        return (double)view.getInt(col, row);
    } else if (view.get(col, row)->isDouble()) {
        return (double)view.getDouble(col, row);
    } else {
        if (error_message) {
            mLog->logExt(QString("output '%1' is neither an int nor a double")
                           .arg(view.getString(col, 0).c_str()),
                         true);
        }
        return 0;
    }
}
Beispiel #2
0
QString
PlanSimSubpanel::getString(const vle::value::Matrix& view,
                           unsigned int col,
                           unsigned int row,
                           bool error_message)
{
    if (not view.get(col, row)) {
        if (error_message) {
            mLog->logExt(QString("output '%1' is null")
                           .arg(view.getString(col, 0).c_str()),
                         true);
        }
        return 0;
    } else if (view.get(col, row)->isString()) {
        return QString::fromStdString((std::string)view.getString(col, row));
    } else {
        if (error_message) {
            mLog->logExt(QString("output '%1' is not a string")
                           .arg(view.getString(col, 0).c_str()),
                         true);
        }
        return 0;
    }
}