Exemplo n.º 1
0
void
vleSmDT::setInitialValue(const QString& varName,
        const vle::value::Value& val)
{
    QDomNode var = nodeVariable(varName);
    if (var.isNull()) {
        return;
    }
    undoStackSm->snapshot(var);
    QDomNodeList initList = var.toElement().elementsByTagName("initial_value");
    if (initList.length() == 0) {
        //TODO see vpz management of vle values
        QDomElement dble = mDocSm->createElement("double");
        dble.appendChild(mDocSm->createTextNode(
                val.writeToString().c_str()));
        QDomElement el = mDocSm->createElement("initial_value");
        el.appendChild(dble);
        var.appendChild(el);
    } else {
        QDomNode init_value = initList.at(0);
        init_value = var.toElement().elementsByTagName("double").at(0);
        if (init_value.nodeName() == "double") {
            QDomText dbleval = init_value.childNodes().item(0).toText();
            dbleval.setData(val.writeToString().c_str());
        }
    }
}
Exemplo n.º 2
0
void
vleSmDT::setPortCondValue(const QString& portName,
                          const vle::value::Value& val)
{
    QDomNode port = nodeCondPort(portName);
    if (port.isNull()) {
        return;
    }

    QDomElement dble = mDocSm->createElement("double");
    dble.appendChild(mDocSm->createTextNode(
                         val.writeToString().c_str()));
    port.appendChild(dble);
}