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); } } }
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); } } }
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 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()); } } }
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 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 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; }
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)); }
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; }
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; }
void Trigger::add(FileIn & in, Token & token, Q3CString & name, Q3CString & idref) { // token is <trigger ...> Q3CString t = token.xmiIdref(); if (! t.isEmpty()) { QMap<Q3CString, Q3CString>::Iterator iter = All.find(t); if (iter == All.end()) { idref = t; name = ""; } else { name = *iter; idref = ""; } } else { name = token.valueOf("name"); idref = ""; All.insert(token.xmiId(), name); } if (! token.closed()) in.finish(token.what()); }
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); } } }
void UmlItem::incoming(FileIn & in, Token & token, UmlItem * where) { Incomings.insert(token.xmiIdref(), where); if (! token.closed()) in.finish(token.what()); }
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 UmlComponent::manageInterface(Token & token, FileIn & in) { QCString idref = token.valueOf("supplier"); QMap<QCString, UmlItem *>::Iterator it = All.find(idref); int c = ((const char *) token.what())[0]; if (it != All.end()) { if ((*it)->kind() == aClass) { if (c == 'i') { // provided QVector<UmlClass> provided = providedClasses(); unsigned sz = provided.size(); provided.resize(sz + 1); provided.insert(sz, (UmlClass *) *it); set_AssociatedClasses(realizingClasses(), provided, requiredClasses()); } else { // realization QVector<UmlClass> realizing = realizingClasses(); unsigned sz = realizing.size(); realizing.resize(sz + 1); realizing.insert(sz, (UmlClass *) *it); set_AssociatedClasses(realizing, providedClasses(), requiredClasses()); } } } else UnresolvedWithContext::add(this, idref, c); if (! token.closed()) in.finish(token.what()); }
void Trigger::importIt(FileIn & in, Token & token, UmlItem *) { All.insert(token.xmiId(), token.valueOf("name")); if (! token.closed()) in.finish(token.what()); }
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); } } }
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 UmlPackage::applyStereotype(FileIn & in, Token & token) { WrapperStr prof_st; Q3ValueList<WrapperStr> base_v; WrapperStr s; if (UmlClass::isAppliedStereotype(token, prof_st, base_v)) { WrapperStr s; Q3ValueList<WrapperStr>::Iterator it_ext; for (it_ext = base_v.begin(); it_ext != base_v.end(); ++it_ext) { WrapperStr s2; if (token.valueOf(*it_ext, s2)) { if (s.isEmpty()) s = s2; else if (s != s2) in.warning("doesn't refer to the same element ('" + s + "' != '" + s2 + "')"); } } if (s.isEmpty()) in.warning("value of 'base_...' is missing"); else { UmlItem * elt = All[s]; if (elt == 0) { if (!FileIn::isBypassedId(s)) in.warning("unknown reference '" + s + "'"); } else { elt->set_Stereotype(prof_st); elt->UmlItem::applyStereotype(); // set properties Q3Dict<WrapperStr> props = elt->properties(); Q3DictIterator<WrapperStr> it(props); while (it.current()) { WrapperStr k = it.currentKey().latin1(); if (token.valueOf(k.mid(k.findRev(':') + 1).lower(), s)) elt->set_PropertyValue(k, s); ++it; } } } if (! token.closed()) in.finish(token.what()); } else in.bypass(token); }
void UmlItem::outgoing(FileIn & in, Token & token, UmlItem * where) { while (where->kind() == aRegion) // up to the state where = where->parent(); Outgoings.insert(token.xmiIdref(), where); if (! token.closed()) in.finish(token.what()); }
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; } } } } }
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); } } }
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 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); } } }
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()); }
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); } }
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 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()); } } }
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()); } } }
void UmlUseCase::importExtensionPoint(FileIn & in, Token & token, UmlItem * where) { if (where->kind() == anUseCase) { Q3CString ep = token.valueOf("name"); if (!ep.isEmpty()) { Q3CString eps = ((UmlUseCase *) where)->extensionPoints(); if (! eps.isEmpty()) eps += "\n" + ep; else eps = ep; ((UmlUseCase *) where)->set_ExtensionPoints(eps); } } if (! token.closed()) in.finish(token.what()); }