void UmlActivityObject::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(anActivityObject, token, in); if (where != 0) { QCString 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); QCString 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); } }
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 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); } }
void UmlActivity::readParameterNode(FileIn & in, Token & token) { // the parameter node may already exist because of a // ActivityParameter definition, search for it UmlActivityParameter * param = 0; WrapperStr s = token.valueOf("name"); const Q3PtrVector<UmlItem> ch = children(); unsigned int n = ch.size(); int i; for (i = 0; i != (int) n; i += 1) { UmlActivityParameter * p = dynamic_cast<UmlActivityParameter *>(ch[i]); if ((p != 0) && (p->name() == s)) { param = p; break; } } if (param == 0) { param = UmlActivityParameter::create(this, s); if (param == 0) in.error("cannot create activity parameter node '" + s + "' in '" + name() + "'"); param->addItem(token.xmiId(), in); } param->readParameterNode(in, token); }
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 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); } } } }
void UmlItem::addItem(WrapperStr id, FileIn & in) { QMap<QString, UmlItem *>::ConstIterator iter = All.find(id); if (iter != All.end()) in.error("xmi:id '" + id + "' used twice"); All.insert(id, this); _xmi_id = id; }
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 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 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); } } } }
void UmlUnmarshallAction::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(anUnmarshallAction, token, in); if (where != 0) { Q3CString s = token.valueOf("name"); UmlUnmarshallAction * a = create(where, s); if (a == 0) in.error("cannot create unmarshall action '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); a->import_it(in, token); } }
void UmlRemoveVariableValueAction::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aRemoveVariableValueAction, token, in); if (where != 0) { WrapperStr s = token.valueOf("name"); UmlRemoveVariableValueAction * a = create(where, s); if (a == 0) in.error("cannot create remove variable action '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); a->import_it(in, token); } }
void UmlBroadcastSignalAction::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aBroadcastSignalAction, token, in); if (where != 0) { WrapperStr s = token.valueOf("name"); UmlBroadcastSignalAction * a = create(where, s); if (a == 0) in.error("cannot create broadcast signal action '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); a->import_it(in, token); } }
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 UmlActivityPin::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(anActivityPin, token, in); if (where != 0) { Q3CString s = token.valueOf("name"); if (s.isEmpty()) { s = token.what(); if (s == "returninformation") s = "returnInformation"; else if (s == "removeat") s = "removeAt"; else if (s == "insertat") s = "insertAt"; else if (s == "inputvalue") s = "inputValue"; else if (s == "outputvalue") s = "outputValue"; } UmlActivityPin * a = create((UmlActivityAction *) where, s); if (a == 0) in.error("cannot create activity pin '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); a->set_Direction((token.xmiType() == "uml:InputPin") ? InputDirection : OutputDirection); if (token.valueOf("isunique") == "true") a->set_IsUnique(TRUE); if (token.valueOf("isexception") == "true") a->set_IsException(TRUE); if (token.valueOf("isstream") == "true") a->set_IsStream(TRUE); a->import_it(in, token); } }
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); } } }
void UmlDestroyObjectAction::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aDestroyObjectAction, token, in); if (where != 0) { Q3CString s = token.valueOf("name"); UmlDestroyObjectAction * a = create(where, s); if (a == 0) in.error("cannot create destroy object action '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); if (token.valueOf("isdestroylinks") == "true") a->set_isDestroyLinks(TRUE); if (token.valueOf("isdestroyownedobjects") == "true") a->set_isDestroyOwnedObjects(TRUE); a->import_it(in, token); } }
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); }
void UmlValueSpecificationAction::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aValueSpecificationAction, token, in); if (where != 0) { WrapperStr s = token.valueOf("name"); UmlValueSpecificationAction * a = create(where, s); if (a == 0) in.error("cannot create value specification action '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); WrapperStr v = token.valueOf("value"); if (! v.isEmpty()) a->setValue(v); a->import_it(in, token); } }
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); } } }
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); }
void UmlNode::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aNode, token, in); if (where == 0) return; WrapperStr s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf("anonymous_node_%u", ++n); } UmlNode * node = create((UmlDeploymentView *) where, s); if (node == 0) in.error("cannot create node '" + s + "' in '" + where->name() + "'"); node->addItem(token.xmiId(), in); if (token.xmiType() == "uml:Device") node->set_Stereotype("device"); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) node->UmlItem::import(in, token); } node->unload(TRUE, FALSE); }
void UmlRegion::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aRegion, token, in); if (where != 0) { WrapperStr s = token.valueOf("name"); UmlRegion * st = create((UmlState *) where, s); if (st == 0) in.error("cannot create region '" + s + "' in '" + where->name() + "'"); st->addItem(token.xmiId(), in); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) st->UmlItem::import(in, token); } } }
void UmlClass::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aClass, token, in); // can't be null WrapperStr s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf("anonymous_%u", ++n); } else s = legalName(s); UmlClass * cl = create(where, s); Association * assocclass = 0; bool stereotype = FALSE; if (cl == 0) in.error("cannot create classe '" + s + "' in '" + where->name() + "'"); cl->addItem(token.xmiId(), in); do where = where->parent(); while (where->kind() != aPackage); if (where->stereotype() == "profile") cl->set_PropertyValue("xmiId", token.xmiId()); if (token.xmiType() == "uml:Actor") cl->set_Stereotype("actor"); else if (token.xmiType() == "uml:Interface") cl->set_Stereotype("interface"); else if (token.xmiType() == "uml:Enumeration") cl->set_Stereotype("enum"); else if (token.xmiType() == "uml:Stereotype") { cl->set_Stereotype("stereotype"); NumberOf -= 1; NumberOfStereotype += 1; stereotype = TRUE; } else if (token.xmiType() == "uml:AssociationClass") { assocclass = &Association::get(token.xmiId(), token.valueOf("name")); assocclass->set_class_association(); } cl->setVisibility(token.valueOf("visibility")); if (token.valueOf("isabstract") == "true") cl->set_isAbstract(TRUE); if (token.valueOf("isactive") == "true") cl->set_isActive(TRUE); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; WrapperStr assocclass_ref1; WrapperStr assocclass_ref2; while (in.read(), !token.close(kstr)) { s = token.what(); if ((s == "ownedtemplatesignature") && ((token.xmiType() == "uml:TemplateSignature") || (token.xmiType() == "uml:RedefinableTemplateSignature"))) cl->readFormal(in, token); else if ((s == "templatebinding") && (token.xmiType() == "uml:TemplateBinding")) { Binding::import(in, token, cl); } else if ((assocclass != 0) && (s == "memberend")) { if (assocclass_ref1.isEmpty()) assocclass_ref1 = token.xmiIdref(); else assocclass_ref2 = token.xmiIdref(); if (! token.closed()) in.finish(s); } else if ((assocclass != 0) && (s == "ownedend") && (token.xmiType() == "uml:Property")) assocclass->import(in, token); else if (s == "ownedrule") cl->set_Constraint(UmlItem::readConstraint(in, token)); else if (stereotype && (s == "icon") && (token.xmiType() == "uml:Image")) { WrapperStr path = token.valueOf("location"); if (! path.isEmpty()) cl->set_PropertyValue("stereotypeIconPath", path); if (! token.closed()) in.finish(s); } else cl->UmlItem::import(in, token); } } cl->unload(TRUE, FALSE); }
void UmlPackage::importHeader(FileIn & in) { Token & tk = in.read(); if (tk.what() != "xml") in.error("xml version expected"); if (tk.valueOf("version") != "1.0") { UmlCom::trace("Only import xml 1.0"); return; } in.setEncoding(tk.valueOf("encoding")); (void) in.read(); // update tk if (tk.what() == "xmi:xmi") { WrapperStr ver = tk.valueOf("xmi:version"); if (ver.isEmpty()) UmlCom::trace("warning : unknown xmi version<br><br>"); else if (ver != "2.1") UmlCom::trace("warning : imported file is not xmi 2.1<br><br>"); FromEclipse = // for instance RSA Eclipse xmi export !tk.valueOf("xmlns:ecore").isEmpty(); if (FromEclipse) UmlCom::trace("xmi file produced under <b>Eclipse</b><br><br>"); // read all before stereotype use WrapperStr prof_st; Q3ValueList<WrapperStr> base_v; while ((void) in.read(), !tk.close("xmi:xmi")) { if (UmlClass::isAppliedStereotype(tk, prof_st, base_v)) break; UmlCom::targetItem()->import(in, tk); } solveRefs(); if (NumberOfProfile != 0) // to take into account inheritances updateProfiles(); // read stereotype use while (!tk.close("xmi:xmi")) { applyStereotype(in, tk); (void) in.read(); } } else if ((tk.what() == "uml:model") || (tk.what() == "uml:profile")) { // Borland Together 2006 for Eclipse // Visual Paradigm for UML 6.1 // RSA Eclipse (profile) WrapperStr ver = tk.valueOf("xmi:version"); if (ver.isEmpty()) UmlCom::trace("warning : unknown xmi version<br><br>"); else if (ver != "2.1") UmlCom::trace("warning : imported file is not xmi 2.1<br><br>"); FromEclipse = // .uml !tk.valueOf("xmlns:ecore").isEmpty(); if (FromEclipse) UmlCom::trace("xmi file produced under <b>Eclipse</b><br><br>"); UmlCom::targetItem()->import(in, tk); solveRefs(); if (NumberOfProfile != 0) updateProfiles(); } else in.error("uml:model or uml:profile or xmi:xmi expected, nothing imported"); }
void UmlPackage::importIt(FileIn & in, Token & token, UmlItem * where) { while (where->kind() != aPackage) where = where->parent(); WrapperStr s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf("anonymous %u", ++n); } UmlPackage * pack = create((UmlPackage *) where, s); if (pack == 0) in.error("cannot create package '" + s + "' in '" + where->name() + "'"); bool profile = (token.what() == "uml:profile") || (token.xmiType() == "uml:Profile"); if (profile) { pack->set_Stereotype("profile"); pack->set_PropertyValue("xmiId", token.xmiId()); NumberOf -= 1; NumberOfProfile += 1; if (!(s = token.valueOf("metamodelreference")).isEmpty()) pack->set_PropertyValue("metamodelReference", s); if (!(s = token.valueOf("metaclassreference")).isEmpty()) pack->set_PropertyValue("metaclassReference", s); } s = token.xmiId(); if (!s.isEmpty()) { pack->addItem(s, in); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; if (profile) { while (in.read(), !token.close(kstr)) { if ((token.what() == "packagedelement") && (token.xmiType() == "uml:Extension")) { if (! token.closed()) in.finish(token.what()); } else if (token.what() == "packageimport") pack->packageImport(in, token); else pack->UmlItem::import(in, token); } updateProfiles(); } else while (in.read(), !token.close(kstr)) pack->UmlItem::import(in, token); } } else if (! token.valueOf("href", s)) in.error("xmi:id is missing"); // doesn't return else { in.warning("bypass external package " + s); if (! token.closed()) in.finish(token.what()); } pack->unload(TRUE, FALSE); }
void UmlAttribute::importIt(FileIn & in, Token & token, UmlItem * where) { if (!token.valueOf("association").isNull()) UmlRelation::importAsAttribute(in, token, where); else { where = where->container(anAttribute, token, in); if (where != 0) { QCString s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf("anonymous_attribute_%u", ++n); } else s = legalName(s); UmlAttribute * att = create((UmlClass *) where, s); if (att == 0) in.error("cannot create attribute '" + s + "' in '" + where->name() + "'"); att->addItem(token.xmiId(), in); if (token.what() == "ownedliteral") att->set_Visibility(PublicVisibility); else att->setVisibility(token.valueOf("visibility")); if (token.valueOf("isreadonly") == "true") att->set_isReadOnly(TRUE); if (token.valueOf("isderived") == "true") att->set_isDerived(TRUE, (token.valueOf("isderivedunion") == "true")); if (token.valueOf("isordered") == "true") att->set_isOrdered(TRUE); if (token.valueOf("isunique") == "true") att->set_isUnique(TRUE); if (!(s = token.valueOf("type")).isEmpty()) { UmlTypeSpec ts; if (att->setType(s, ts)) att->set_Type(ts); } if (!(s = token.valueOf("defaultvalue")).isEmpty()) att->set_DefaultValue(s); if (token.valueOf("isstatic") == "true") att->set_isClassMember(TRUE); if (! token.closed()) { QCString k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) { s = token.what(); if (s == "type") { UmlTypeSpec ts; if (att->setType(token, ts)) att->set_Type(ts); if (! token.closed()) in.finish(s); } else if (s == "defaultvalue") { att->set_DefaultValue(token.valueOf("value")); if (! token.closed()) in.finish(s); } else if (s == "lowervalue") att->importMultiplicity(in, token, FALSE); else if (s == "uppervalue") att->importMultiplicity(in, token, TRUE); else if (s == "upperbound") { if (! token.closed()) in.finish(s); } else if ((s == "specification") && (k == "ownedliteral")) { if (! token.closed()) in.finish(s); } else if (s == "ownedrule") att->set_Constraint(UmlItem::readConstraint(in, token)); else att->UmlItem::import(in, token); } } } } }
void UmlState::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(aState, token, in); if (where != 0) { bool machine = ((token.xmiType() == "uml:StateMachine") || (token.valueOf("issubmachinestate") == "true") || (token.what() == "ownedstatemachine")); // andromda emf Q3CString s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf((machine) ? "anonymous_state_machine_%u" : "anonymous_state_%u", ++n); } UmlState * st = create(where, s); if (st == 0) in.error((machine) ? "cannot create state machine '" : "cannot create state '" + s + "' in '" + where->name() + "'"); st->addItem(token.xmiId(), in); if (token.valueOf("isactive") == "true") st->set_isActive(TRUE); Q3CString ref = token.valueOf("submachine"); Q3CString spec = token.valueOf("specification"); if (! token.closed()) { Q3CString k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) { s = token.what(); if ((s == "entry") || (s == "doactivity") || (s == "exit")) st->importActivity(in, token); else if (s == "specification") { spec = token.xmiIdref(); if (! token.closed()) in.finish(s); } else st->UmlItem::import(in, token); } } if (machine) st->set_Stereotype("machine"); if (! ref.isEmpty()) { QMap<Q3CString, UmlItem *>::Iterator it = All.find(ref); if (it == All.end()) UnresolvedWithContext::add(st, ref, 4); else if ((*it)->kind() == aState) st->set_Reference((UmlState *) *it); } if (! spec.isEmpty()) { QMap<Q3CString, UmlItem *>::Iterator it = All.find(spec); if (it == All.end()) UnresolvedWithContext::add(st, spec, 3); else if ((*it)->kind() == anOperation) st->set_Specification((UmlOperation *) *it); } st->unload(TRUE, FALSE); } }
void UmlActivity::importIt(FileIn & in, Token & token, UmlItem * where) { where = where->container(anActivity, token, in); if (where != 0) { WrapperStr s = token.valueOf("name"); if (s.isEmpty()) { static unsigned n = 0; s.sprintf("anonymous_activity_%u", ++n); } UmlActivity * a = create((UmlClassView *) where, s); if (a == 0) in.error("cannot create activity '" + s + "' in '" + where->name() + "'"); a->addItem(token.xmiId(), in); if (token.valueOf("isreadonly") == "true") a->set_isReadOnly(TRUE); if (token.valueOf("issingleexecution") == "true") a->set_isSingleExecution(TRUE); if (token.valueOf("isactive") == "true") a->set_isActive(TRUE); WrapperStr spec = token.valueOf("specification"); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) { s = token.what(); if ((s == "precondition") || (s == "postcondition") || (s == "localprecondition") || (s == "localpostcondition")) a->readCondition(in, token); else if (s == "ownedparameter") a->readParameter(in, token); else if ((s == "node") && (token.xmiType() == "uml:ActivityParameterNode")) a->readParameterNode(in, token); else if (s == "specification") { spec = token.xmiIdref(); if (! token.closed()) in.finish(s); } else if (s == "ownedrule") a->set_Constraint(UmlItem::readConstraint(in, token)); else a->UmlItem::import(in, token); } } if (! spec.isEmpty()) { QMap<WrapperStr, UmlItem *>::Iterator it = All.find(spec); if (it == All.end()) Unresolved::addRef(a, spec); else if ((*it)->kind() == anOperation) a->set_Specification((UmlOperation *) *it); } a->unload(TRUE, FALSE); } }