Ejemplo n.º 1
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);
        }
    }
}
Ejemplo n.º 2
0
WrapperStr UmlItem::readConstraint(FileIn & in, Token & token)
{
    WrapperStr constraint;

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

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

            if ((s == "specification") && (token.xmiType() == "uml:OpaqueExpression")) {
                constraint = token.valueOf("body");

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

                        if (s == "body")
                            constraint = in.body("body");
                        else if (! token.closed())
                            in.finish(s);
                    }
                }
            }
            else
                in.bypass(token);
        }
    }

    return constraint;
}
Ejemplo n.º 3
0
WrapperStr UmlItem::readComment(FileIn & in, Token & token)
{
    in.bypassedId(token);

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

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

        while (in.read(), !token.close(kstr)) {
            if (token.what() == "body") {
                if (! doc.isEmpty())
                    doc += "\n";

                doc += in.body("body");
            }
            else if (! token.closed())
                in.finish(token.what());
        }
    }

    return doc;

}
void UmlOpaqueAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anOpaqueAction, token, in);

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

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

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

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

            while (in.read(), !token.close(kstr)) {
                if (token.what() == "body")
                    a->set_Behavior(in.body("body"));
                else
                    a->import(in, token);
            }
        }
    }
}
Ejemplo n.º 5
0
void UmlState::importActivity(FileIn & in, Token & token)
{
    WrapperStr k = token.what();
    const char * kstr = k;
    WrapperStr b = token.valueOf("body");

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

                if (s == "body") {
                    b = in.body("body");
                    in.finish(k);
                    break;
                }
                else if ((s == "node") &&
                         (token.xmiType() == "uml:CallOperationAction")) {
                    s = token.valueOf("operation");

                    if (! s.isEmpty()) {
                        if (k == "entry")
                            UnresolvedWithContext::add(this, s, 0);
                        else if (k == "exit")
                            UnresolvedWithContext::add(this, s, 1);
                        else
                            UnresolvedWithContext::add(this, s, 2);
                    }

                    if (! token.closed())
                        in.finish("node");

                    in.finish(k);
                    return;
                }
                else if (! token.closed())
                    in.finish(s);
            }
        }
    }
    else if (! token.closed())
        in.finish(k);

    if (! b.isEmpty()) {
        if (k == "entry")
            set_EntryBehavior(b);
        else if (k == "exit")
            set_ExitBehavior(b);
        else
            set_DoActivity(b);
    }

}
Ejemplo n.º 6
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);
        }
    }
}
Ejemplo n.º 7
0
void UmlFlow::importIt(FileIn & in, Token & token, UmlItem *)
{
  Flow & flow = *(All.append(Flow()));
  QCString s;
  
  flow.id = token.xmiId();
  flow.name = token.valueOf("name");
  flow.interrupt = (token.what() == "interruptingedge");
  flow.source = token.valueOf("source");
  flow.target = token.valueOf("target");
  flow.selection = token.valueOf("selection");
  flow.transformation = token.valueOf("transformation");
  
  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
      
    while (in.read(), !token.close(kstr)) {
      s = token.what();
      
      if (s == "selection") {
	flow.selection = token.valueOf("idref");
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "transformation") {
	flow.transformation = token.valueOf("idref");
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "weight") {
	flow.weight = token.valueOf("value");
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "guard") {
	QCString b = token.valueOf("body");
	
	if (! b.isNull()) {
	  flow.guard = b;
	  if (! token.closed())
	    in.finish(s);
	}
	else if (! token.closed()) {
	  while (in.read(), !token.close("guard")) {
	    b = token.what();
      
	    if (b == "body") {
	      flow.guard = in.body("body");
	      in.finish("guard");
	      break;
	    }
	    else if (! token.closed())
	      in.finish(b);
	  }
	}
      }
      else if (! token.closed())
	in.finish(s);
    }
  }
}