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 UmlClass::write(FileOut & out) { QCString st = stereotype(); if (st == "metaclass") return; bool is_actor = (st == "actor"); bool is_enum = (st == "enum"); bool is_stereotype = (st == "stereotype") && (parent()->parent()->kind() == aPackage) && (parent()->parent()->stereotype() == "profile"); if (!is_actor) { switch (_lang) { case Cpp: if (cppDecl().isEmpty()) return; break; case Java: if (javaDecl().isEmpty()) return; default: break; } } const char * k = (parent()->kind() == aClass) ? "nestedClassifier" : ((!_uml_20) ? "packagedElement" : ((is_stereotype) ? "ownedStereotype" : "ownedMember")); bool is_assoc_class = (_assoc != 0); out.indent(); out << "<" << k << " xmi:type=\"uml:" << ((is_actor) ? "Actor" : ((is_assoc_class) ? "AssociationClass" : ((st == "interface") ? "Interface" : ((is_enum) ?"Enumeration" : ((is_stereotype) ? "Stereotype" : "Class"))))) << "\" name=\""; out.quote(name()); out << '"'; out.id(this); write_visibility(out); if (isAbstract()) out << " isAbstract=\"true\""; if (isActive()) out << " isActive=\"true\""; out << ">\n"; if (is_assoc_class) _assoc->write_ends(out); out.indent(+1); write_constraint(out); write_annotation(out); write_description_properties(out); if (_gen_extension && (st == "typedef")) { const UmlTypeSpec & base = baseType(); if ((base.type != 0) || !base.explicit_type.isEmpty()) { out.indent(); out << "<xmi:Extension extender=\"Bouml\">\n"; out.indent(); out << "\t<typedef>\n"; out.indent(+2); UmlItem::write_type(out, base, "base"); out.indent(-2); out.indent(); out << "\t</typedef>\n"; out.indent(); out << "</xmi:Extension>\n"; } } write_formals(out); write_actuals(out); const QVector<UmlItem> ch = children(); unsigned n = ch.size(); unsigned i; for (i = 0; i != n; i += 1) ch[i]->write(out); if (is_stereotype) { QCString path; if (propertyValue("stereotypeIconPath", path) && !path.isEmpty()) { out.indent(); out << "<icon xmi:type=\"uml:Image\""; out.id_prefix(this, "Icon_"); out << " location=\"" << path << "\"/>\n"; } } out.indent(-1); out.indent(); out << "</" << k << ">\n"; if (is_stereotype) for (i = 0; i != n; i += 1) if (ch[i]->kind() == aRelation) ((UmlRelation *) ch[i])->write_extension(out); unload(); }
bool UmlOperation::write_if_needed(FileOut & out) { QCString decl; switch (_lang) { case Uml: parent()->write(out); out.indent(); out << "<UML:Operation name=\""; out.quote(name()); break; case Cpp: decl = cppDecl(); if (decl.isEmpty()) return FALSE; remove_comments(decl); parent()->write(out); out.indent(); out << "<UML:Operation name=\""; out.quote(true_name(cppDecl())); break; default: // Java decl = javaDecl(); if (decl.isEmpty()) return FALSE; remove_comments(decl); parent()->write(out); out.indent(); out << "<UML:Operation name=\""; out.quote(true_name(javaDecl())); break; } out << '"'; out.id(this); switch (_lang) { case Uml: write_visibility(out); break; case Cpp: write_visibility(out, (cppVisibility() == DefaultVisibility) ? visibility() : cppVisibility()); break; default: // Java if (javaDecl().find("${visibility}") != -1) write_visibility(out, visibility()); break; } write_scope(out); out << " isAbstract=\"" << ((isAbstract()) ? "true" : "false") << "\">\n"; out.indent(+1); write_stereotype(out); write_annotation(out); write_description_properties(out); out.indent(); out << "<UML:BehavioralFeature.parameter>\n"; out.indent(+1); write_return_type(out, decl); if (_lang == Uml) write_uml_params(out); else write_cpp_java_params(out, decl); out.indent(-1); out.indent(); out << "</UML:BehavioralFeature.parameter>\n"; out.indent(-1); out.indent(); out << "</UML:Operation>\n"; unload(); return TRUE; }
void UmlRelation::write_relation_as_attribute(FileOut & out) { UmlRelation * first = side(TRUE); Q3CString s; UmlClass * base; if ((first->parent()->stereotype() == "stereotype") && (first->roleType()->stereotype() == "metaclass")) { if (this != first) return; base = first->roleType(); s = "base_" + base->name(); } else { base = 0; switch (_lang) { case Uml: s = roleName(); break; case Cpp: if (cppDecl().isEmpty()) return; s = true_name(roleName(), cppDecl()); break; default: // Java if (javaDecl().isEmpty()) return; s = true_name(roleName(), javaDecl()); } } out.indent(); out << "<ownedAttribute xmi:type=\"uml:Property\" name=\"" << s << '"'; out.id(this); if (base != 0) out.ref(first, "association", "EXT_"); else { write_visibility(out); write_scope(out); if (isReadOnly()) out << " isReadOnly=\"true\""; if (isDerived()) { out << " isDerived=\"true\""; if (isDerivedUnion()) out << " isDerivedUnion=\"true\""; } if (isOrdered()) out << " isOrdered=\"true\""; if (isUnique()) out << " isUnique=\"true\""; if (first->_assoc_class != 0) out.ref(first->_assoc_class, "association"); else out.ref(first, "association", "ASSOC_"); out << " aggregation=\""; if (this == first) { parent()->memo_relation(this); if (_gen_eclipse) { switch (relationKind()) { case anAggregation: case aDirectionalAggregation: out << "shared"; break; case anAggregationByValue: case aDirectionalAggregationByValue: out << "composite"; break; default: out << "none"; } } else out << "none"; } else 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 << '"'; } out << ">\n"; out.indent(+1); out.indent(); out << "<type xmi:type=\"uml:Class\""; if (base != 0) { if (! base->propertyValue("metaclassPath", s)) s = (_uml_20) ? "http://schema.omg.org/spec/UML/2.0/uml.xml" : "http://schema.omg.org/spec/UML/2.1/uml.xml"; out << " href=\"" << s << '#' << base->name() << '"'; } else out.idref(roleType()); out << "/>\n"; write_multiplicity(out, multiplicity(), this); write_default_value(out, defaultValue(), this); write_constraint(out); write_annotation(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</ownedAttribute>\n"; unload(); }
bool UmlAttribute::write_if_needed(FileOut & out) { switch (_lang) { case Uml: parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << name() << '"'; break; case Cpp: if (cppDecl().isEmpty()) return FALSE; parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << true_name(cppDecl()) << '"'; break; default: // Java if (javaDecl().isEmpty()) return FALSE; parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << true_name(javaDecl()) << '"'; break; } out.id(this); switch (_lang) { case Uml: write_visibility(out); break; case Cpp: write_visibility(out, (cppVisibility() == DefaultVisibility) ? visibility() : cppVisibility()); break; default: // Java if (javaDecl().find("${visibility}") != -1) write_visibility(out, visibility()); break; } write_scope(out); out << ">\n"; out.indent(+1); const UmlTypeSpec & t = type(); if ((t.type != 0) || !t.explicit_type.isEmpty()) { out.indent(); out << "<UML:StructuralFeature.type>\n"; out.indent(); out << "\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_type(out); break; default: // java write_java_type(out); } out << "/>\n"; out.indent(); out << "</UML:StructuralFeature.type>\n"; } write_stereotype(out); write_annotation(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</UML:Attribute>\n"; unload(); return TRUE; }
void UmlOperation::write(FileOut & out) { WrapperStr decl; switch (_lang) { case Uml: out.indent(); out << "<ownedOperation xmi:type=\"uml:Operation\" name=\""; out.quote((const char *)name()); //[jasa] ambiguous call break; case Cpp: decl = cppDecl(); if (decl.isEmpty()) return; remove_comments(decl); out.indent(); out << "<ownedOperation xmi:type=\"uml:Operation\" name=\""; out.quote((const char *)true_name(name(), cppDecl())); //[jasa] ambiguous call break; default: // Java decl = javaDecl(); if (decl.isEmpty()) return; remove_comments(decl); out.indent(); out << "<ownedOperation xmi:type=\"uml:Operation\" name=\""; out.quote((const char *)true_name(name(), javaDecl())); //[jasa] ambiguous call break; } out << '"'; out.id(this); write_visibility(out); write_scope(out); if ((_lang == Cpp) && isCppConst()) out << " isQuery=\"true\""; out << " isAbstract=\"" << ((isAbstract()) ? "true" : "false") << "\">\n"; out.indent(+1); write_constraint(out); write_annotation(out); write_description_properties(out); write_exceptions(out); write_return_type(out, decl); if (_lang == Uml) write_uml_params(out); else write_cpp_java_params(out, decl); out.indent(-1); out.indent(); out << "</ownedOperation>\n"; unload(); }