Пример #1
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;
}
Пример #2
0
void UmlClass::importPrimitiveType(FileIn & in, Token & token, UmlItem *)
{
    WrapperStr id = token.xmiId();
    UmlTypeSpec t;

    t.explicit_type = token.valueOf("name");

    if (FromBouml) {
        if (! token.closed()) {
            BooL dummy;

            in.read(); 	// <xmi:Extension extender="Bouml">
            in.readWord(FALSE, dummy);	// <
            in.readWord(FALSE, dummy);	// basedOn
            t.type = dynamic_cast<UmlClass *>(All[in.readWord(FALSE, dummy)]);

            if (t.type != 0)
                // forget modifiers
                t.explicit_type = "";

            in.readWord(FALSE, dummy);	// /
            in.readWord(FALSE, dummy);	// >
            in.read(); 	// </xmi:Extension>
            in.read();	// end of token
        }
    }
    else if (! token.closed())
        in.finish(token.what());

    if (!id.isEmpty())
        PrimitiveTypes[id] = t;
}
Пример #3
0
void UmlClass::readFormal(FileIn & in, Token & token)
{
    if (! token.closed()) {
        signatures[token.xmiId()] = this;

        WrapperStr k = token.what();
        const char * kstr = k;
        unsigned int rank = 0;

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

            if (s == "parameter") {
                // useless
                if (! token.closed())
                    in.finish(token.what());
            }
            else if ((s == "ownedparameter") &&
                     (token.xmiType() == "uml:ClassifierTemplateParameter")) {
                WrapperStr idparam = token.xmiId();
                WrapperStr pname = token.valueOf("name");	// at least for VP
                WrapperStr value;

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

                        if ((s == "ownedparameteredelement") ||
                            (s == "ownedelement")) {
                            s = token.valueOf("name");

                            if (! s.isEmpty())
                                pname = s;
                        }
                        else if (s == "defaultvalue")
                            value = token.valueOf("value");

                        if (! token.closed())
                            in.finish(token.what());
                    }
                }

                if (! pname.isEmpty()) {
                    UmlFormalParameter f(pname, value);

                    addFormal(rank++, f);
                    formalsId.append(idparam);
                }
            }
            else if (! token.closed())
                in.finish(token.what());
        }
    }
}
Пример #4
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());
    }
}
Пример #5
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);
        }
    }
}
Пример #6
0
void UmlUseCase::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anUseCase, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    
    if (s.isEmpty()) {
      static unsigned n = 0;
      
      s.sprintf("anonymous_usecase_%u", ++n);
    }
    
    UmlUseCase * uc = create(where, s);
    
    if (uc == 0)
      in.error("cannot create use case '" + s +
	       "' in '" + where->name() + "'");
    
    uc->addItem(token.xmiId(), in);
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr))
	uc->UmlItem::import(in, token);
    }

    uc->unload(TRUE, FALSE);
  }
}
Пример #7
0
void UmlCallBehaviorAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aCallBehaviorAction, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlCallBehaviorAction * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create call behavior action '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    if (!(s=token.valueOf("behavior")).isEmpty())
      a->setBehavior(s);
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	s = token.what();
	
	if (s == "behavior") {
	  a->setBehavior(token.xmiIdref());
	  if (! token.closed())
	    in.finish("behavior");
	}
	else
	  a->import(in, token);
      }
    }
  }
}
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);
            }
        }
    }
}
Пример #9
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;

}
Пример #10
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);
        }
    }
}
Пример #11
0
void Manifestation::import(FileIn & in, Token & token, UmlArtifact * artifact)
{
    WrapperStr s;
    WrapperStr name;
    WrapperStr utilized;

    name = token.valueOf("name");

    if (!(s = token.valueOf("utilizedelement")).isEmpty())
        utilized = s;
    else if (!(s = token.valueOf("client")).isEmpty())
        utilized = s;

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

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

            if (s == "utilizedelement")
                utilized = token.xmiIdref();
            else if ((s == "client") && s.isEmpty())
                utilized = token.xmiIdref();

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

    if (utilized.isEmpty())
        in.warning("'utilizedElement' and 'client' missing in Manifestation");
    else
        All.append(Manifestation(name, artifact, utilized));
}
Пример #12
0
void ClassInstance::Slot::importIt(FileIn & in, Token & token) {
  featureId = token.valueOf("definingfeature");
  valueId = token.valueOf("value");
    
  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr)) {
      QCString s = token.what();
      
      if (s == "featureid")
	featureId = token.xmiIdref();
      else if (s == "value") {
	value = token.valueOf("value");
	if (value.isEmpty())
	  value = token.valueOf("body");
      }
      
      if (! token.closed())
	in.finish(s);
    }
  }

  if (featureId.isEmpty())
    in.warning("'definingFeature' is missing");

}
void UmlAccessVariableValueAction::import_it(FileIn & in, Token & token)
{
    WrapperStr s = token.valueOf("variable");

    if (! s.isEmpty())
        setVariable(s);

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

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

            if (s == "variable") {
                setVariable(token.xmiIdref());

                if (! token.closed())
                    in.finish("variable");
            }
            else
                import(in, token);
        }
    }
}
Пример #14
0
void UmlActivityObject::import_it(FileIn & in, Token & token)
{
    if (token.valueOf("iscontroltype") == "true")
        set_IsControlType(TRUE);

    WrapperStr s;

    if (!(s = token.valueOf("ordering")).isEmpty())
        setOrdering(s, in);

    if (!(s = token.valueOf("selection")).isEmpty())
        setSelection(s);

    if (!(s = token.valueOf("instate")).isEmpty())
        setInState(s);

    if (!(s = token.valueOf("type")).isEmpty())
        setType(s);

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

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

            if (s == "selection") {
                setSelection(token.xmiIdref());

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "instate") {
                setInState(token.xmiIdref());

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "type") {
                setType(token);

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "lowervalue")
                importMultiplicity(in, token, FALSE);
            else if (s == "uppervalue")
                importMultiplicity(in, token, TRUE);
            else if (s == "upperbound") {
                if (! token.closed())
                    in.finish(s);
            }
            else
                UmlItem::import(in, token);
        }
    }
}
Пример #15
0
void UmlActivityParameter::readParameter(FileIn & in, Token & token) {
  QCString s;

  s = token.valueOf("direction");
  if ((s == "in") || (s == "pk_in"))
    set_Direction(InputDirection);
  else if ((s == "out") || (s == "pk_out"))
    set_Direction(OutputDirection);
  else if ((s == "inout") || (s == "pk_inout"))
    set_Direction(InputOutputDirection);
  else if ((s == "return") || (s == "pk_return"))
    set_Direction(ReturnDirection);
  else if (! s.isEmpty())
    in.warning("wrong direction");

  if (!(s = token.valueOf("effect")).isEmpty())
    setEffect(s, in);
  if (token.valueOf("isunique") == "true")
    set_IsUnique(TRUE);
  if (token.valueOf("isexception") == "true")
    set_IsException(TRUE);
  if (token.valueOf("isstream") == "true")
    set_IsStream(TRUE);
  if (!(s = token.valueOf("type")).isEmpty())
    setType(s);

  if (!token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
      
    while (in.read(), !token.close(kstr)) {
      s = token.what();
	
      if (s == "type") {
	setType(token);
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "lowervalue")
	importMultiplicity(in, token, FALSE);
      else if (s == "uppervalue")
	importMultiplicity(in, token, TRUE);
      else if (s == "defaultvalue") {
	set_DefaultValue(token.valueOf("value"));
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "upperbound") {
	if (! token.closed())
	  in.finish(s);
      }
      else
	UmlItem::import(in, token);
    }
  }
}
void UmlReduceAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aReduceAction, token, in);

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

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

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

        if (token.valueOf("isordered") == "true")
            a->set_isOrdered(TRUE);

        s = token.valueOf("reducer");

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

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

                    if (! token.closed())
                        in.finish(token.what());
                }
                else
                    a->import(in, token);
            }
        }

        if (!s.isEmpty()) {
            QMap<QString, UmlItem *>::Iterator it = All.find(s);

            if (it == All.end())
                Unresolved::addRef(a, s);
            else {
                switch ((*it)->kind()) {
                case anActivity:
                case aState:
                    a->set_Reducer(*it);
                    break;

                default:
                    break;
                }
            }
        }
    }
}
Пример #17
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);
    }

}
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);
            }
        }
    }
}
Пример #19
0
void UmlActivityPartition::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aPartition, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlActivityPartition * r = create(where, s);
    
    if (r == 0)
      in.error("cannot create activity partition '"
	       + s + "' in '" + where->name() + "'");
    
    r->addItem(token.xmiId(), in);
    
    if (token.valueOf("isdimension") == "true")
      r->set_isDimension(TRUE);
    
    if (token.valueOf("isexternal") == "true")
      r->set_isExternal(TRUE);
    
    Q3CString idref = token.valueOf("represents");
  
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	s = token.what();
	
	if (s == "variable") {
	  idref = token.xmiIdref();
	  if (! token.closed())
	    in.finish("variable");
	}
	else
	  r->UmlItem::import(in, token);
      }
    }
    
    if (! idref.isEmpty()) {
      QMap<Q3CString, UmlItem *>::Iterator it = All.find(idref);
      
      if (it == All.end())
	Unresolved::addRef(r, idref);
      else
	r->set_Represents(*it);
    }
  }
}
Пример #20
0
void UmlAcceptEventAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anAcceptEventAction, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlAcceptEventAction * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create accept event action '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    if (token.valueOf("isunmarshall") == "true")
      a->set_isUnmarshall(TRUE);
    
    if (!(s = token.valueOf("trigger")).isEmpty()) {
      Q3CString tr = Trigger::get(s);
      
      if (!tr.isNull())
	a->set_Trigger(tr);
      else
	Unresolved::addRef(a, s);
    }
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	if (token.what() == "trigger") {
	  Q3CString tr_name;
	  Q3CString 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
	  a->import(in, token);
      }
    }
  }
}
Пример #21
0
void UmlItem::importDependency(FileIn & in, Token & token, UmlItem * where)
{
    WrapperStr client = token.valueOf("client");
    WrapperStr supplier = token.valueOf("supplier");
    WrapperStr label = token.valueOf("name");
    WrapperStr constraint;
    int kind = (token.xmiType() == "uml:Usage") ? 3 : 1;

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

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

            if (s == "client")
                client = token.xmiIdref();
            else if (s == "supplier")
                supplier = token.xmiIdref();
            else if (s == "ownedrule") {
                constraint = UmlItem::readConstraint(in, token);
                continue;
            }

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

    if (client.isEmpty())
        in.warning("'client' is missing");
    else {
        if (supplier.isEmpty())
            // Borland Together 2006 for Eclipse
            supplier = where->id();

        QMap<QString, UmlItem *>::ConstIterator from = All.find(client);
        QMap<QString, UmlItem *>::ConstIterator to = All.find(supplier);

        if ((from != All.end()) && (to != All.end()))
            (*from)->generalizeDependRealize(*to, in, kind, label, constraint);
        else
            UnresolvedRelation::add(kind, client, supplier, label, constraint);
    }
}
Пример #22
0
void UmlPackage::appliedProfile(FileIn & in, Token & token, UmlItem *)
{
    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            if (token.what() == "appliedprofile") {
                WrapperStr s = token.valueOf("href");

                importProfile(in, s);
            }

            if (! token.closed())
                in.finish(token.what());
        }
    }

}
Пример #23
0
void UmlItem::importGeneralization(FileIn & in, Token & token, UmlItem * where)
{
    WrapperStr id = token.valueOf("general");
    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 == "general") {
                id = token.xmiIdref();

                if (id.isEmpty() && !(id = token.valueOf("href")).isEmpty()) {
                    int index = id.find('#');

                    if (index != -1)
                        id = id.mid(index + 1);
                }
            }
            else if (s == "ownedrule") {
                constraint = UmlItem::readConstraint(in, token);
                continue;
            }

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

    if (!id.isEmpty()) {
        QMap<QString, UmlItem *>::ConstIterator iter = All.find(id);

        if (iter != All.end())
            where->generalizeDependRealize(*iter, in, 0, "", constraint);
        else
            Unresolved::addGeneralization(where, id, constraint);
    }
    else
        in.warning("'general' is missing");
}
void UmlCreateObjectAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aCreateObjectAction, token, in);

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

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

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

        s = token.valueOf("classifier");

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

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

                    if (! token.closed())
                        in.finish(token.what());
                }
                else
                    a->import(in, token);
            }
        }

        if (!s.isEmpty()) {
            QMap<QString, UmlItem *>::Iterator it = All.find(s);

            if (it == All.end())
                Unresolved::addRef(a, s);
            else
                a->set_Classifier((*it)->name());
        }
    }
}
Пример #25
0
void UmlActivityParameter::readParameterNode(FileIn & in, Token & token) {
  QCString s;

  if (token.valueOf("iscontroltype") == "true")
    set_IsControlType(TRUE);
  if (!(s = token.valueOf("ordering")).isEmpty())
    setOrdering(s, in);
  if (!(s = token.valueOf("instate")).isEmpty())
    setInState(s);
  if (!(s = token.valueOf("selection")).isEmpty())
    setSelection(s);
  if (!(s = token.valueOf("type")).isEmpty())
    setType(s);
    
  if (!token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
      
    while (in.read(), !token.close(kstr)) {
      s = token.what();
      
      if (s == "selection") {
	setSelection(token.xmiIdref());
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "instate") {
	setInState(token.xmiIdref());
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "type") {
	setType(token);
	if (! token.closed())
	  in.finish(s);
      }
      else
	UmlItem::import(in, token);
    }
  }
}
Пример #26
0
void UmlFinalState::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aFinalState, token, in);
    
  if (where != 0) {
    UmlFinalState * fs = UmlFinalState::create(where);
    
    if (fs == 0)
      in.error("cannot create final state in '" + where->name() + "'");

    fs->addItem(token.xmiId(), in);
    
    if (! token.closed()) {
      QCString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr))
	fs->UmlItem::import(in, token);
    }
  }
}
Пример #27
0
void UmlComponent::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aComponent, token, in);
  
  if (where == 0)
    return;
    
  QCString s = token.valueOf("name");
  
  if (s.isEmpty()) {
    static unsigned n = 0;
    
    s.sprintf("anonymous_component_%u", ++n);
  }
    
  UmlComponent * component = create((UmlComponentView *) where, s);
  
  if (component == 0)
    in.error("cannot create component '" + s +
	     "' in '" + where->name() + "'");
  
  component->addItem(token.xmiId(), in);

  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr)) {
      QCString ks = token.what();
      
      if ((ks == "interfacerealization") || (ks == "realization"))
	component->manageInterface(token, in);
      else
	component->UmlItem::import(in, token);
    }
  }

  component->unload(TRUE, FALSE);
}
Пример #28
0
void ClassInstance::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aClassInstance, token, in);	// can't be null
  
  ClassInstance * cli = new ClassInstance;

  cli->id = token.xmiId();
  cli->name = token.valueOf("name");
  cli->classifierId = token.valueOf("classifier");
  cli->where = where;
    
  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr)) {
      QCString s = token.what();
      
      if (s == "classifier")
	cli->classifierId = token.xmiIdref();
      else if (s == "slot") {
	cli->bindings.append(Slot());
	
	cli->bindings.last().importIt(in, token);
      }
      else if (! token.closed())
	in.finish(s);
    }
  }

  if (cli->classifierId.isEmpty()) {
    in.warning("classifier missing for class instance '" + cli->id + "', bypass it");
    delete cli;
  }
  else
    All.append(cli);

}
Пример #29
0
void UmlInterruptibleActivityRegion::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anInterruptibleActivityRegion, token, in);
    
  if (where != 0) {
    QCString s = token.valueOf("name");
    UmlInterruptibleActivityRegion * r = create(where, s);
    
    if (r == 0)
      in.error("cannot create interruptible region '"
	       + s + "' in '" + where->name() + "'");
    
    r->addItem(token.xmiId(), in);
    
    if (! token.closed()) {
      QCString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr))
	r->UmlItem::import(in, token);
    }
  }
}
Пример #30
0
void UmlArtifact::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anArtifact, token, in);

    if (where == 0)
        return;

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

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous_artifact_%u", ++n);
    }

    UmlArtifact * artifact = create((UmlDeploymentView *) where, s);

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

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

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

        while (in.read(), !token.close(kstr)) {
            if (token.what() == "manifestation")
                Manifestation::import(in, token, artifact);
            else
                artifact->UmlItem::import(in, token);
        }
    }

    artifact->unload(TRUE, FALSE);
}