Example #1
0
void UmlItem::importDocumentation(FileIn & in, Token & token, UmlItem *)
{
    WrapperStr who = token.valueOf("exporter");

    if (who.isNull())
        who = token.valueOf("xmi:exporter");

    if (! who.isNull()) {
        UmlCom::trace("xmi file produced by <b>" + who + "</b><br><br>");
        FromBouml = (who == "Bouml");
    }

    if (! token.closed())
        in.finish(token.what());
}
Example #2
0
void UmlItem::importOpaqueDef(FileIn & in, Token & token, UmlItem *)
{
    WrapperStr id = token.xmiId();
    QMap<QString, WrapperStr>::ConstIterator iter = OpaqueDefs.find(id);

    if (iter != OpaqueDefs.end())
        in.error("xmi:id '" + id + "' used twice");

    WrapperStr s = token.valueOf("body");

    if (!s.isNull()) {
        OpaqueDefs.insert(id, s);

        if (! token.closed())
            in.finish(token.what());
    }
    else if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "body")
                OpaqueDefs.insert(id, in.body("body"));
            else if (! token.closed())
                in.finish(s);
        }
    }
}
Example #3
0
void UmlActivity::readCondition(FileIn & in, Token & token)
{
    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "specification") {
                WrapperStr v = token.valueOf("body");

                if (v.isNull())
                    v = token.valueOf("value");	// UMODEL

                if (! v.isEmpty()) {
                    if (k[1] == 'r')
                        set_PreCondition(v);
                    else
                        set_PostCondition(v);
                }
            }

            if (! token.closed())
                in.finish(s);
        }
    }
}
Example #4
0
void UmlTransition::solveThem()
{
    Q3ValueList<Transition>::Iterator iter;

    for (iter = All.begin(); iter != All.end(); ++iter) {
        Transition & transition = *iter;

        QMap<WrapperStr, UmlItem *>::Iterator isrc = UmlItem::All.find(transition.source);
        QMap<WrapperStr, UmlItem *>::Iterator itgt = UmlItem::All.find(transition.target);

        if ((isrc == UmlItem::All.end()) /*&&
	((isrc = Outgoings.find(transition.id)) == Outgoings.end())*/) {
            if (!FileIn::isBypassedId(transition.source))
                UmlCom::trace("transition '" + transition.id + "' : unknown source reference '" + transition.source + "'<br>");
        }
        else if ((itgt == UmlItem::All.end()) /*&&
	     ((itgt = Incomings.find(transition.id)) == Incomings.end())*/) {
            if (!FileIn::isBypassedId(transition.target))
                UmlCom::trace("transition '" + transition.id + "' : unknown target reference '" + transition.target + "'<br>");
        }
        else {
            UmlTransition * t = UmlTransition::create(*isrc, *itgt);

            if (t == 0)
                UmlCom::trace("cannot create transition '" + transition.id + "'<br>");
            else {
                UmlItem::All.insert(transition.id, t);

                if (! transition.name.isEmpty())
                    t->set_Name(transition.name);

                if (! transition.effect.isEmpty())
                    t->set_Activity(transition.effect);

                if (! transition.trigger.isEmpty())
                    t->set_Trigger(transition.trigger);
                else if (! transition.triggerRef.isEmpty()) {
                    WrapperStr trig = Trigger::get(transition.triggerRef);

                    if (!trig.isNull())
                        t->set_Trigger(trig);
                    else if (!FileIn::isBypassedId(transition.triggerRef))
                        UmlCom::trace("transition '" + transition.id + "' : unknown trigger reference '" + transition.triggerRef + "'<br>");
                }

                if (! transition.guard.isEmpty())
                    t->set_Guard(transition.guard);

                if (*isrc == *itgt)
                    t->set_IsExternal(transition.kind == "external");

                t->unload(FALSE, FALSE);
            }
        }
    }

    All.clear();
}
Example #5
0
bool neq(const WrapperStr & s1, const WrapperStr & s2)
{
    const char * p1 = (s1.isNull()) ? "" : (const char *) s1;
    const char * p2 = (s2.isNull()) ? "" : (const char *) s2;

    for (;;) {
        while (*p1 == '\r') p1 += 1;

        while (*p2 == '\r') p2 += 1;

        if (*p1 == 0)
            return (*p2 != 0);

        if (*p1 != *p2)
            return true;

        p1 += 1;
        p2 += 1;
    }
}
void UmlReplyAction::solve(WrapperStr idref)
{
    WrapperStr tr = Trigger::get(idref);

    if (tr.isNull()) {
        if (!FileIn::isBypassedId(idref))
            UmlCom::trace("reply activity action : unknown trigger reference '" + idref + "'<br>");
    }
    else
        set_ReplyToCall(tr);
}
void UmlAcceptEventAction::solve(WrapperStr idref)
{
    WrapperStr tr = Trigger::get(idref);

    if (tr.isNull()) {
        if (!FileIn::isBypassedId(idref))
            UmlCom::trace("accept event activity action : unknown trigger reference '" + idref + "'<br>");
    }
    else
        set_Trigger(tr);
}
Example #8
0
void UmlItem::importExtension(FileIn & in, Token & token, UmlItem * where)
{
    if (! token.closed()) {
        WrapperStr s = token.valueOf("extender");

        if (s.isNull())
            s = token.valueOf("xmi:extender");

        if (s == "Bouml") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "taggedvalue")
                    // is closed
                    where->set_PropertyValue(token.valueOf("tag"), token.valueOf("value"));
                else if (s == "stereotype")
                    where->set_Stereotype(token.valueOf("name"));

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else if (s == "Visual Paradigm for UML") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "appliedstereotype") {
                    s = token.valueOf("xmi:value");

                    if (s.right(3) == "_id") {
                        s = s.mid(s.find("_") + 1);
                        s = s.left(s.length() - 3).lower();
                    }

                    where->set_Stereotype(s);
                }

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else
            in.finish(token.what());
    }
}
void UmlAcceptCallAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anAcceptCallAction, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");
        UmlAcceptCallAction * a = create(where, s);

        if (a == 0)
            in.error("cannot create accept call action '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        if (!(s = token.valueOf("trigger")).isEmpty()) {
            WrapperStr tr = Trigger::get(s);

            if (!tr.isNull())
                a->set_Trigger(tr);
            else
                Unresolved::addRef(a, s);
        }

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                if (token.what() == "trigger") {
                    WrapperStr tr_name;
                    WrapperStr tr_ref;

                    Trigger::add(in, token, tr_name, tr_ref);

                    if (!tr_name.isNull())
                        a->set_Trigger(tr_name);
                    else
                        Unresolved::addRef(a, tr_ref);
                }
                else if (token.what() == "isunmarshall") {
                    // not memorized : always true
                    if (! token.closed())
                        in.finish(token.what());
                }
                else
                    a->import(in, token);
            }
        }
    }
}
void UmlActivityObject::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anActivityObject, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");
        UmlActivityObject * a = create(where, s);

        if (a == 0)
            in.error("cannot create activity object '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        WrapperStr ste;

        s = token.xmiType();

        switch (((const char *) s)[0]) {
        case 'D':
            ste = "datastore";
            break;

        case 'C':
            ste = "centralBuffer";
            break;

        default:
            break;
        }

        a->import_it(in, token);

        if (! ste.isNull())
            a->set_Stereotype(ste);
    }

}
Example #11
0
void UmlTransition::importIt(FileIn & in, Token & token, UmlItem *)
{
    Transition & transition = *(All.append(Transition()));
    WrapperStr s;

    transition.id = token.xmiId();
    transition.name = token.valueOf("name");
    transition.source = token.valueOf("source");
    transition.target = token.valueOf("target");
    transition.triggerRef = token.valueOf("trigger");
    transition.kind = token.valueOf("kind");

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "trigger")
                Trigger::add(in, token, transition.trigger, transition.triggerRef);
            else if (s == "guard") {
                if (! token.closed()) {
                    while (in.read(), !token.close("guard")) {
                        WrapperStr s = token.what();

                        if (s == "specification") {
                            transition.guard = token.valueOf("body");

                            if (transition.guard.isNull())
                                transition.guard = token.valueOf("value");	// UMODEL

                            if (! token.closed()) {
                                while (in.read(), !token.close("specification")) {
                                    WrapperStr s = token.what();

                                    if (s == "body")
                                        transition.guard = in.body("body");
                                    else if (! token.closed())
                                        in.finish(s);
                                }
                            }
                        }
                        else if (! token.closed())
                            in.finish(s);
                    }
                }
            }
            else if (s == "effect") {
                WrapperStr b = token.valueOf("body");

                if (! b.isNull()) {
                    transition.effect = b;

                    if (! token.closed())
                        in.finish(s);
                }
                else if (! token.closed()) {
                    while (in.read(), !token.close("effect")) {
                        b = token.what();

                        if (b == "body") {
                            transition.effect = in.body("body");
                            in.finish(s);
                            break;
                        }
                        else if (! token.closed())
                            in.finish(b);
                    }
                }
            }
            else if (! token.closed())
                in.finish(s);
        }
    }
}