void UmlComponent::solve(int context, QCString idref) { QMap<QCString, UmlItem *>::Iterator it = All.find(idref); if (it != All.end()) { if ((*it)->kind() == aClass) { if (context == '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 if (!FileIn::isBypassedId(idref)) UmlCom::trace("component : unknown reference '" + idref + "'<br>"); }
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 UmlComponent::html(QCString pfix, unsigned int rank, unsigned int level) { UmlCom::message(name()); UmlItem::html("Component", (UmlDiagram *) associatedDiagram()); if (parent()->kind() == aComponent) { fw.write("<p>nested in "); parent()->write(); fw.write("</p>\n"); } const QVector<UmlClass> & provided = providedClasses(); if (provided.size() != 0) { const char * sep = "<p>provided classes : "; for (unsigned i = 0; i != provided.size(); i += 1) { fw.write(sep); sep = ", "; provided[i]->write(); } fw.write("</p>\n"); } const QVector<UmlClass> & required = requiredClasses(); if (required.size() != 0) { const char * sep = "<p>required classes : "; for (unsigned i = 0; i != required.size(); i += 1) { fw.write(sep); sep = ", "; required[i]->write(); } fw.write("</p>\n"); } const QVector<UmlClass> & realizing = realizingClasses(); if (realizing.size() != 0) { const char * sep = "<p>realizing classes : "; for (unsigned i = 0; i != realizing.size(); i += 1) { fw.write(sep); sep = ", "; realizing[i]->write(); } fw.write("</p>\n"); } write_children(pfix, rank, level); unload(FALSE, FALSE); }
void UmlComponent::generalizeDependRealize(UmlItem * target, FileIn & in, int context, QCString label, QCString constraint) { if ((context == 3) && (target->kind() == aClass)) { // usage indicate a required interface QVector<UmlClass> required = requiredClasses(); unsigned sz = required.size(); required.resize(sz + 1); required.insert(sz, (UmlClass *) target); set_AssociatedClasses(realizingClasses(), providedClasses(), required); } else UmlItem::generalizeDependRealize(target, in, context, label, constraint); }
void UmlComponent::solveGeneralizationDependencyRealization(int context, QCString idref, QCString label, QCString constraint) { QMap<QCString, UmlItem *>::Iterator it; if ((context == 3) && ((it = All.find(idref)) != All.end()) && ((*it)->kind() == aClass)) { // usage indicate resuired interface QVector<UmlClass> required = requiredClasses(); unsigned sz = required.size(); required.resize(sz + 1); required.insert(sz, (UmlClass *) *it); set_AssociatedClasses(realizingClasses(), providedClasses(), required); } else UmlItem::solveGeneralizationDependencyRealization(context, idref, label, constraint); }
void UmlComponent::write(FileOut & out) { const char * k = (parent()->kind() == anUseCase) ? "ownedUseCase" : ((_uml_20) ? "ownedMember" : "packagedElement"); out.indent(); out << "<" << k << " xmi:type=\"uml:Component\""; 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(); unsigned index; for (index = 0; index != n; index += 1) ch[index]->write(out); // provided const QVector< UmlClass* > & prov = providedClasses(); n = prov.size(); for (index = 0; index != n; index += 1) { UmlClass * cl = prov[index]; out.indent(); out << "<interfaceRealization xmi:type=\"uml:InterfaceRealization\""; out.id_prefix(this, "PROV_", index); out.ref(cl, "supplier"); out.ref(this, "client"); out.ref(cl, "contract"); out << "/>\n"; } // realizing const QVector< UmlClass* > & rea = realizingClasses(); n = rea.size(); for (index = 0; index != n; index += 1) { UmlClass * cl = rea[index]; out.indent(); out << "<realization xmi:type=\"uml:ComponentRealization\""; out.id_prefix(this, "REA_", index); out.ref(cl, "supplier"); out.ref(this, "client"); out.ref(cl, "realizingClassifier"); out << "/>\n"; } out.indent(-1); out.indent(); out << "</" << k << ">\n"; // required const QVector< UmlClass* > & req = requiredClasses(); n = req.size(); for (index = 0; index != n; index += 1) { UmlClass * cl = req[index]; out.indent(); out << "<" << k << " xmi:type=\"uml:Usage\""; out.id_prefix(this, "REQ_", index); out.ref(cl, "supplier"); out.ref(this, "client"); out << "/>\n"; } unload(); }