void UmlNcRelation::write(FileOut & out) { if ((relationKind() == aDependency) && (parent()->kind() == anUseCase) && (target()->kind() == anUseCase)) { const char * t; const char * r; if (stereotype() == "include") { t = "Include"; r = "addition"; } else if (stereotype() == "extend") { t = "Extend"; r = "extendedCase"; } else { write(out, TRUE); return; } out.indent(); out << "<" << stereotype() << " xmi:type=\"uml:" << t << "\""; out.id(this); out.ref(target(), r); out << ">\n"; out.indent(+1); write_description_properties(out); out.indent(-1); out.indent(); out << "</" << stereotype() << ">\n"; } else write(out, TRUE); }
void UmlRegion::write(FileOut & out) { out.indent(); out << "<region xmi:type=\"uml:Region\""; out.id(this); out << " name=\""; out.quote(name()); out << "\">\n"; out.indent(+1); write_description_properties(out); const QVector<UmlItem> ch = children(); unsigned n = ch.size(); unsigned i; for (i = 0; i != n; i += 1) ch[i]->write(out); #if 0 // to bypass Eclipse's bug this is done by the parent state while (! _trans.isEmpty()) _trans.take(0)->write_it(out); #endif out.indent(-1); out.indent(); out << "</region>\n"; unload(); }
void UmlNode::write(FileOut & out) { const char * k = (_uml_20) ? "ownedMember" : "packagedElement"; out.indent(); out << "<" << k << " xmi:type=\"" << ((stereotype() == "device\"") ? "uml:Device" : "uml:Node\""); out.id(this); out << " name=\""; out.quote((const char *)name()); //[jasa] ambiguous call out << "\">\n"; out.indent(+1); write_description_properties(out); const QVector<UmlItem*> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write(out); out.indent(-1); out.indent(); out << "</" << k << ">\n"; unload(); }
void UmlClass::write_formals(FileOut & out) { QValueList<UmlFormalParameter> formal_params = formals(); if (!formal_params.isEmpty()) { out.indent(); out << "<ownedTemplateSignature xmi:type=\"uml:"; if (!_uml_20) out << "Redefinable"; out << "TemplateSignature\""; out.id_prefix(this, "FORMALS_"); out << ">\n"; out.indent(+1); int rank; QValueList<UmlFormalParameter>::ConstIterator iter; for (iter = formal_params.begin(), rank = 0; iter != formal_params.end(); ++iter, rank += 1) (*iter).write(out, this, rank, _uml_20); out.indent(-1); out.indent(); out << "</ownedTemplateSignature>\n"; } }
void UmlOperation::write_uml_params(FileOut & out) { const Q3ValueList<UmlParameter> p = params(); Q3ValueList<UmlParameter>::ConstIterator it; for (it = p.begin(); it != p.end(); ++it) { out.indent(); out << "<ownedParameter xmi:type=\"uml:Parameter\" name=\"" << (*it).name << "\" xmi:id=\"BOUML_op_param_" << ++param_id << "\" direction=\""; if (_pk_prefix) out << "pk_"; switch ((*it).dir) { case InputOutputDirection: out << "inout\">\n"; break; case OutputDirection: out << "out\">\n"; break; default: out << "in\">\n"; } out.indent(+1); UmlItem::write_type(out, (*it).type); out.indent(-1); out.indent(); out << "</ownedParameter>\n"; } }
void UmlRelation::write_relation(FileOut & out) { // note : it is the first side if (_assoc_class != 0) // generated in the association class return; const char * k = (_uml_20) ? "ownedElement" : "packagedElement"; out.indent(); out << '<' << k << " xmi:type=\"uml:Association\""; out.id_prefix(this, "ASSOC_"); Q3CString s = name(); int i1 = s.find("("); int i2 = s.findRev(")"); if ((i1 != -1) && (i2 != -1) && (i2 > i1) && (s[i1+1] != '<') && (s[i2-1] != '>')) { s = s.mid(i1 + 1, i2 - i1 - 1); if (!s.isEmpty()) { out << " name=\""; out.quote((const char*)s);//[jasa] ambiguous call out << '"'; } } write_visibility(out); out << ">\n"; write_ends(out); out.indent(); out << "</" << k << ">\n"; }
void UmlPseudoState::write(FileOut & out) { out.indent(); out << "<subvertex xmi:type=\"uml:Pseudostate\""; out.id(this); if (! name().isEmpty()) { out << " name=\""; out.quote(name()); out << '"'; } out << " kind=\"" << sKind() << "\">\n"; out.indent(+1); write_description_properties(out); while (! _incoming_trans.isEmpty()) _incoming_trans.take(0)->write_in(out); const QVector<UmlItem> ch = children(); unsigned n = ch.size(); unsigned i; for (i = 0; i != n; i += 1) ch[i]->write(out); out.indent(-1); out.indent(); out << "</subvertex>\n"; unload(); }
void UmlRelation::write_extension(FileOut & out) { if ((side(TRUE) == this) && (parent()->stereotype() == "stereotype") && (roleType()->stereotype() == "metaclass")) { const char * k = (_uml_20) ? "ownedMember" : "packagedElement"; out.indent(); out << "<" << k << " xmi:type=\"uml:Extension\" name=\"A_"; out.quote((const char*)roleType()->name());//[jasa] ambiguous call out << '_'; out.quote((const char*)parent()->name());//[jasa] ambiguous call out << '"'; out.id_prefix(this, "EXT_"); out.ref(this, "memberEnd", "BASE_"); out << ">\n"; out.indent(); out << "\t<ownedEnd xmi:type=\"uml:ExtensionEnd\" name=\"extension_"; out.quote((const char*)parent()->name());//[jasa] ambiguous call out << '"'; out.id_prefix(this, "EXTEND_"); out.ref(this, "type"); out << " aggregation=\"composite\"/>\n"; out.indent(); out << "</" << k << ">\n"; } unload(); }
void UmlActivityAction::write_condition(FileOut & out, Q3CString cond, bool pre) { if (! cond.isEmpty()) { const char * k; const char * K; const char * body; if (pre) { k = "pre"; K = "PRE_"; body = "PRE_BODY_"; } else { k = "post"; K = "POST_"; body = "POST_BODY_"; } out.indent(); out << '<' << k << "condition xmi:type=\"uml:Constraint\""; out.id_prefix(this, K); out << ">\n"; out.indent(); out << "\t<specification xmi:type=\"uml:OpaqueExpression\""; out.id_prefix(this, body); out << " body=\""; out.quote(cond); out << "\"/>\n"; out.indent(); out << "</" << k << "condition>\n"; } }
bool UmlComponent::write_if_needed(FileOut & out) { parent()->write(out); out.indent(); out << "<UML:Component name=\""; out.quote(name()); out << '"'; out.id(this); out << " visibility=\"public\" isAbstract=\"false\" isActive=\"false\" >\n"; out.indent(+1); write_stereotype(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</UML:Component>\n"; const Q3PtrVector<UmlItem> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write_if_needed(out); unload(); return TRUE; }
void UmlActivityAction::write_close(FileOut & out) { out.indent(-1); out.indent(); out << ((parent()->kind() == anActivity) ? "</node>\n" : "</containedNode>\n"); unload(); }
void UmlOperation::write_return_type(FileOut & out, QCString decl) { const UmlTypeSpec & t = returnType(); static int return_rank = 0; if ((t.type != 0) || !t.explicit_type.isEmpty()) { out.indent(); out << "<UML:Parameter name=\"return\" xmi.id=\"BOUML_return_" << ++return_rank << "\" kind=\"return\">\n"; out.indent(); out << "\t<UML:Parameter.type>\n"; out.indent(); out << "\t\t<UML:DataType"; switch (_lang) { case Uml: if (t.type != 0) out.idref(t.type); else out.idref_datatype(t.explicit_type); break; case Cpp: write_cpp_returntype(out, decl); break; default: // java write_java_returntype(out, decl); } out << "/>\n"; out.indent(); out << "\t</UML:Parameter.type>\n"; out.indent(); out << "</UML:Parameter>\n"; } }
void UmlActivityPartition::write(FileOut & out) { const char * p = (parent()->kind() == aPartition) ? "subpartition" : "group"; out.indent(); out << "<" << p << " xmi:type=\"uml:ActivityPartition\" name=\""; out.quote((const char*)name());//[jasa] ambiguous call out << '"'; out.id(this); if (isDimension()) out << " isDimension=\"true\""; if (isExternal()) out << " isExternal=\"true\""; if (represents() != 0) out.ref(represents(), "represents"); out << ">\n"; out.indent(+1); write_description_properties(out); const Q3PtrVector<UmlItem> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write(out); out.indent(-1); out.indent(); out << "</" << p << ">\n"; unload(); }
void UmlClassView::write(FileOut & out) { if (_gen_views) { out.indent(); out << ((_uml_20) ? "<ownedMember" : "<packagedElement") << " xmi:type=\"uml:Package\""; out.id(this); out << " name =\"class view "; out.quote(name()); out << "\">\n"; out.indent(+1); write_description_properties(out); } const QVector<UmlItem*> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write(out); if (_gen_views) { while (! _relations.isEmpty()) _relations.takeAt(0)->write(out, FALSE); out.indent(-1); out.indent(); out << ((_uml_20) ? "</ownedMember>\n" : "</packagedElement>\n"); } }
void UmlItem::write_multiplicity(FileOut & out, WrapperStr s, UmlItem * who) { if (!s.isEmpty()) { WrapperStr min; WrapperStr max; int index = s.find(".."); if (index != -1) { min = s.left(index).stripWhiteSpace(); max = s.mid(index + 2).stripWhiteSpace(); } else min = max = s.stripWhiteSpace(); out.indent(); out << "<lowerValue xmi:type=\"uml:LiteralString\""; out.id_prefix(who, "MULTIPLICITY_L_"); out << " value=\"" << min.operator QString() << "\"/>\n"; out.indent(); out << "<upperValue xmi:type=\"uml:LiteralString\""; out.id_prefix(who, "MULTIPLICITY_U_"); out << " value=\"" << max.operator QString() << "\"/>\n"; } }
void UmlClass::write_actor(FileOut & out) { out.indent(); out << "<UML:Actor name=\"" << name() << '"'; out.id(this); out << " visibility=\"public\" isAbstract=\"" << ((isAbstract()) ? "true" : "false") << "\" isActive=\"false\" >\n"; out.indent(+1); if (stereotype() != "actor") write_stereotype(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</UML:Actor>\n"; const QVector<UmlItem*> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) if (ch[i]->kind() == aRelation) ch[i]->write_if_needed(out); }
void UmlOperation::write_cpp_java_params(FileOut & out, QCString decl) { int index1 = decl.find("${(}"); if (index1 == -1) return; int index2 = decl.find("${)}", index1 + 4); if (index2 == -1) return; decl = decl.mid(index1 + 4, index2 - index1 - 4); index1 = 0; const QValueList<UmlParameter> p = params(); QCString sparam; QCString kname; QCString ktype; int rank; if ((name() == "unload") && (parent()->name() == "UmlBasePackage")) rank = 123; while (get_param(decl, index1, sparam, kname, ktype, rank)) { if (rank < (int) p.count()) { const UmlParameter & pa = p[rank]; out.indent(); out << "<UML:Parameter name=\"" << pa.name << "\" xmi.id=\"BOUML_op_param_" << ++param_id << "\" kind =\""; switch (pa.dir) { case InputOutputDirection: out << "inout\">\n"; break; case OutputDirection: out << "out\">\n"; break; default: out << "in\">\n"; } UmlTypeSpec t = pa.type; if ((t.type != 0) || !(t.explicit_type = (_lang == Cpp) ? CppSettings::type(t.explicit_type) : JavaSettings::type(t.explicit_type)).isEmpty()) { out.indent(); out << "\t<UML:Parameter.type>\n"; out.indent(); out << "\t\t<UML:DataType"; write_type(out, t, sparam, kname, ktype); out << "/>\n"; out.indent(); out << "\t</UML:Parameter.type>\n"; } out.indent(); out << "</UML:Parameter>\n"; } } }
void UmlOperation::write_events(FileOut & out) { const char * k = (_uml_20) ? "ownedMember" : "packagedElement"; UmlItem * prj = UmlPackage::getProject(); Q3PtrDictIterator<char> it_oper(SentReceived); while (it_oper.current()) { out.indent(); out << "<" << k << " xmi:type=\"uml:SendOperationEvent\""; out.id_prefix(prj, "SENDOPEREVT", (int)((long) it_oper.current())); out << " name=\""; out.quote((const char *)((UmlOperation *)it_oper.currentKey())->name()); //[jasa] ambiguous call out << '"'; out.ref((UmlOperation *)it_oper.currentKey(), "operation"); out << "/>\n"; out.indent(); out << "<" << k << " xmi:type=\"uml:ReceiveOperationEvent\""; out.id_prefix(prj, "RECOPEREVT", (int)((long) it_oper.current())); out << " name=\""; out.quote((const char *)((UmlOperation *)it_oper.currentKey())->name()); //[jasa] ambiguous call out << '"'; out.ref((UmlOperation *)it_oper.currentKey(), "operation"); out << "/>\n"; ++it_oper; } Q3AsciiDictIterator<char> it_evt(Events); while (it_evt.current()) { out.indent(); if (it_evt.currentKey()[0] == 'D') { out << "<" << k << " xmi:type=\"uml:DestructionEvent\""; out.id_prefix(prj, it_evt.current()); out << "/>\n"; } else { out << "<" << k << " xmi:type=\"uml:ExecutionEvent\""; out.id_prefix(prj, it_evt.current()); if (*it_evt.currentKey() != 0) { out << " name=\""; out.quote(it_evt.currentKey() + 1); out << "\"/>\n"; } else out << "/>\n"; } free(it_evt.current()); ++it_evt; } }
void UmlArtifact::write(FileOut & out) { const char * k = (_uml_20) ? "ownedMember" : "packagedElement"; out.indent(); out << "<" << k << " xmi:type=\"uml:Artifact\""; out.id(this); out << " name=\""; out.quote((const char *)name()); //[jasa] ambiguous call out << "\">\n"; out.indent(+1); write_description_properties(out); const Q3PtrVector<UmlItem> ch = children(); unsigned i; unsigned n = ch.size(); unsigned rank = 0; for (i = 0; i != n; i += 1) { UmlItem * x = ch[i]; if ((x->kind() == aNcRelation) && (x->stereotype() == "manifest") && (((UmlNcRelation *) x)->relationKind() == aDependency)) write_manifest(out, ((UmlNcRelation *) x)->target(), "dependency", ++rank); else ch[i]->write(out); } if (stereotype() == "source") { const Q3PtrVector<UmlClass> & cls = associatedClasses(); n = cls.size(); for (i = 0; i != n; i += 1) write_manifest(out, cls[i], "source", ++rank); } else { const Q3PtrVector<UmlArtifact> & arts = associatedArtifacts(); n = arts.size(); for (i = 0; i != n; i += 1) write_manifest(out, arts[i], 0, ++rank); } out.indent(-1); out.indent(); out << "</" << k << ">\n"; unload(); }
void UmlClass::write(FileOut & out) { if (! _written) { _written = TRUE; // parent already written out.indent(); out << "<UML:Classifier.feature>\n"; out.indent(+1); } }
void UmlRelation::write_ends(FileOut & out) { // note : it is the first side out.indent(); out << "\t<memberEnd"; out.idref(this); out << "/>\n"; UmlRelation * other = side(FALSE); out.indent(); if (other != 0) { out << "\t<memberEnd"; out.idref(other); out << "/>\n"; } else { out << "\t<ownedEnd xmi:type=\"uml:Property\""; out.id_prefix(this, "REVERSE_"); if (_assoc_class != 0) out.ref(_assoc_class, "association"); else out.ref(this, "association", "ASSOC_"); out << " visibility=\"" << ((_vis_prefix) ? "vis_private\"" : "private\""); out.ref(parent(), "type"); out << " aggregation=\""; if (_gen_eclipse) out << "none"; else { switch (relationKind()) { case anAggregation: case aDirectionalAggregation: out << "shared"; break; case anAggregationByValue: case aDirectionalAggregationByValue: out << "composite"; break; default: out << "none"; } } out << "\" isNavigable=\"false\"/>\n"; out.indent(); out << "\t<memberEnd "; out.idref_prefix(this, "REVERSE_"); out << "/>\n"; } }
void UmlActivityObject::write(FileOut & out) { const char * k = (parent()->kind() == anActivity) ? "node" : "containedNode"; out.indent(); out << '<' << k << " xmi:type=\"uml:"; WrapperStr st = stereotype(); if (st == "datastore") out << "DataStoreNode"; else if (st == "centralBuffer") out << "CentralBufferNode"; else out << "ObjectNode"; out << "\" name=\""; out.quote(name()); out << '"'; out.id(this); if (isControlType()) out << " isControlType=\"true\""; write_ordering(out); write_selection(out); write_in_state(out); out << ">\n"; out.indent(+1); write_description_properties(out); write_multiplicity(out, multiplicity(), this); UmlItem::write_type(out, type()); const QVector<UmlItem*> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write(out); write_incoming_flows(out); out.indent(-1); out.indent(); out << "</" << k << ">\n"; unload(); }
void UmlOpaqueAction::write(FileOut & out) { write_begin(out, "OpaqueAction"); write_end(out, TRUE); Q3CString body; switch(_lang) { case Uml: body = behavior(); break; case Cpp: body = cppBehavior(); break; default: // Java body = javaBehavior(); } if (!body.isEmpty()) { out.indent(); out << "<body>"; out.quote(body); out << "</body>\n"; } write_close(out); }
void UmlReplyAction::write(FileOut & out) { write_begin(out, "ReplyAction"); Q3CString trig; switch (_lang) { case Uml: trig = replyToCall(); break; case Cpp: trig = cppReplyToCall(); break; default: // java trig = javaReplyToCall(); } if (! trig.isEmpty()) { out.ref(this, "replyToCall", "TRIGGER_"); write_end(out); out.indent(); out << "<trigger xmi:type=\"uml:Trigger\""; out.id_prefix(this, "TRIGGER_"); out << " name=\""; out.quote(trig); out << "\"/>\n"; } else write_end(out); }
void UmlAcceptEventAction::write(FileOut & out) { write_begin(out, "AcceptEventAction"); if (isUnmarshall()) out << " isUnmarshall=\"true\""; Q3CString trig; switch (_lang) { case Uml: trig = trigger(); break; case Cpp: trig = cppTrigger(); break; default: // java trig = javaTrigger(); } if (! trig.isEmpty()) { out.ref(this, "trigger", "TRIGGER_"); write_end(out); out.indent(); out << "<trigger xmi:type=\"uml:Trigger\""; out.id_prefix(this, "TRIGGER_"); out << " name=\""; out.quote(trig); out << "\"/>\n"; } else write_end(out); }
void UmlRelation::write_dependency(FileOut & out) { const char * k = (_uml_20) ? "ownedElement" : "packagedElement"; out.indent(); out << '<' << k << " xmi:type=\"uml:Dependency\""; out.id(this); out.ref(parent(), "client"); out.ref(roleType(), "supplier"); out << ">\n"; out.indent(+1); write_constraint(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</" << k << ">\n"; }
void UmlRelation::write_generalization(FileOut & out) { out.indent(); out << "<generalization xmi:type=\"uml:Generalization\""; out.id(this); out.ref(roleType(), "general"); if (!constraint().isEmpty()) { out << ">\n"; out.indent(+1); write_constraint(out); out.indent(-1); out.indent(); out << "</generalization>\n"; } else out << "/>\n"; }
void UmlTransition::write_in(FileOut & out) { out.indent(); out << "<incoming"; out.idref(this); out << "/>\n"; }
void UmlItem::write_description_properties(FileOut & out) { if (_taggedvalue_mode != 0) { if (! description().isEmpty()) { out.indent(); out << "<UML:ModelElement.taggedValue>\n"; out.indent(); if (_taggedvalue_mode == 1) { out << "\t<UML:TaggedValue tag=\"documentation\" value=\""; out.quote(description()); out << "\"/>\n"; } else { out << "\t<UML:TaggedValue.tag>documentation</UML:TaggedValue.tag>\n"; out.indent(); out << "\t<UML:TaggedValue.value>"; out.quote(description()); out << "</UML:TaggedValue.value>\n"; } out.indent(); out << "</UML:ModelElement.taggedValue>\n"; } const QHash<QByteArray, QByteArray*> up = properties(); QHashIterator<QByteArray, QByteArray*> it(up); while (it.hasNext()) { it.next(); out.indent(); out << "<UML:ModelElement.taggedValue>\n"; out.indent(); if (_taggedvalue_mode == 1) { out << "\t<UML:TaggedValue tag=\""; out.quote(it.key()); out << "\" value=\""; out.quote(*(it.value())); out << "\"/>\n"; } else { out << "\t<UML:TaggedValue.tag>"; out.quote(it.key()); out << "</UML:TaggedValue.tag>\n"; out.indent(); out << "\t<UML:TaggedValue.value>"; out.quote(*(it.value())); out << "</UML:TaggedValue.value>\n"; } out.indent(); out << "</UML:ModelElement.taggedValue>\n"; // ++it; } } }
void UmlStateAction::write(FileOut & out) { out.indent(); out << "<!-- how to export a state action ? -->\n"; _incoming_trans.clear(); // ! unload(); }