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 UmlArtifact::gen_app(const Q3CString & path) { Q3CString target; Q3CString pro; propertyValue("genpro target", target); propertyValue("genpro pro", pro); if (target.isEmpty()) { if ((target = name()) == "executable") target = UmlPackage::getProject()->name(); #ifdef WIN32 target += ".exe"; #endif } if (pro.isEmpty()) { pro = target; #ifdef WIN32 if (pro.right(4) == ".exe") pro.resize(pro.length() - 4); #endif QDir d(path); pro = d.absFilePath(pro + ".pro"); } Q3CString tmplt; Q3CString config; Q3CString defines; Q3CString includepath; Q3CString dependpath; Q3CString objectsdir; Q3CString footer; if (!propertyValue("genpro tmplt", tmplt)) tmplt = "app"; if (!propertyValue("genpro config", config)) config = "debug warn_on qt"; if (!propertyValue("genpro defines", defines)) defines = "WITHCPP WITHJAVA WITHPHP WITHPYTHON WITHIDL"; else if (defines.find("WITHPHP") == -1) { int n = 0; if (defines.find("WITHCPP") != -1) n += 1; if (defines.find("WITHJAVA") != -1) n += 1; if (defines.find("WITHIDL") != -1) n += 1; if (n > 1) defines += " WITHPHP WITHPYTHON"; } else if (defines.find("WITHPYTHON") == -1) { int n = 0; if (defines.find("WITHCPP") != -1) n += 1; if (defines.find("WITHJAVA") != -1) n += 1; if (defines.find("WITHIDL") != -1) n += 1; if (defines.find("WITHPHP") != -1) n += 1; if (n > 1) defines += " WITHPYTHON"; } propertyValue("genpro includepath", includepath); propertyValue("genpro dependpath", dependpath); propertyValue("genpro objectsdir", objectsdir); propertyValue("genpro footer", footer); for (;;) { Dialog dialog(this, path, pro, target, tmplt, config, defines, includepath, dependpath, objectsdir, footer); if (dialog.exec() != QDialog::Accepted) return; set_PropertyValue("genpro pro", pro); set_PropertyValue("genpro path", path); set_PropertyValue("genpro target", target); set_PropertyValue("genpro tmplt", tmplt); set_PropertyValue("genpro config", config); set_PropertyValue("genpro defines", defines); set_PropertyValue("genpro includepath", includepath); set_PropertyValue("genpro dependpath", dependpath); set_PropertyValue("genpro objectsdir", objectsdir); set_PropertyValue("genpro footer", footer); QFile f(pro); if (! f.open(QIODevice::WriteOnly)) QMessageBox::critical((QWidget *) 0, "Error", "Cannot open " + QString(pro)); else { Q3TextStream t(&f); QFileInfo tfi(target); QFileInfo pfi(pro); t << "TEMPLATE\t= " << tmplt << '\n'; t << "TARGET\t\t= " << tfi.fileName() << '\n'; if ((target.find('/') != -1) && (pro.find('/') != -1) && (tfi.dirPath(TRUE) != pfi.dirPath(TRUE))) t << "DESTDIR\t\t= " << tfi.dirPath(TRUE) << '\n'; if (! objectsdir.isEmpty()) t << "OBJECTS_DIR\t= " << objectsdir << '\n'; t << "CONFIG\t\t+= " << config << '\n'; if (!includepath.isEmpty()) t << "INCLUDEPATH\t= " << includepath << '\n'; if (!dependpath.isEmpty()) t << "DEPENDPATH\t= " << dependpath << '\n'; if (!defines.isEmpty()) t << "DEFINES\t\t= " << defines << '\n'; QString prodir = pfi.dirPath(TRUE); const Q3PtrVector<UmlArtifact> & arts = associatedArtifacts(); unsigned index; const char * sep; Q3CString ext; ext = CppSettings::headerExtension(); sep = "HEADERS\t\t= "; for (index = 0; index != arts.count(); index += 1) { UmlArtifact * art = arts[index]; if ((art->stereotype() == "source") && !art->cppHeader().isEmpty()) { QString s = art->way(prodir, TRUE); if (! s.isEmpty()) { t << sep << s << art->name() << '.' << ext; sep = " \\\n\t\t "; } } } t << '\n'; ext = CppSettings::sourceExtension(); sep = "SOURCES\t\t= "; for (index = 0; index != arts.count(); index += 1) { UmlArtifact * art = arts[index]; if ((art->stereotype() != "source") || !art->cppSource().isEmpty()) { QString s = art->way(prodir, FALSE); if (! s.isEmpty()) { t << sep << s << art->name(); if (art->stereotype() == "source") t << '.' << ext; sep = " \\\n\t\t "; } } } t << '\n' << footer << '\n'; f.close(); return; } } }