void ClassData::get_class_spec(QString & templates, QString & names, QString & templates_tmplop, QString & names_tmplop) const { if (((BrowserNode *) browser_node->parent())->get_type() == UmlClass) { ((ClassData *) ((BrowserNode *) browser_node->parent())->get_data()) ->get_class_spec(templates, names, templates_tmplop, names_tmplop); names += "::"; } QString t1; QString t2; get_template_prefixes(t1, t2); templates_tmplop = templates + "template<>\n"; templates += t1; names_tmplop = names + true_name(browser_node->get_name(), cpp_decl); names = names_tmplop + t2; }
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(); }