void UmlClass::import(QTextOStream & f, const QCString & indent) { QCString s; if (!isJavaExternal()) { UmlArtifact * cp = associatedArtifact(); UmlPackage * pack = (UmlPackage *) ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package(); if ((s = pack->javaPackage()).isEmpty()) return; QCString s2 = name(); UmlItem * p = this; while ((p = p->parent())->kind() == aClass) s2 = p->name() + dot + s2; s += dot + s2; } else if ((s = package()->javaPackage()).isEmpty()) return; else s += dot + name(); if (! UmlArtifact::generated_one()->is_imported(s)) { f << indent << "import " << s << ";\n"; UmlArtifact::generated_one()->imported(s); } }
void UmlClass::write(QTextOStream & f) { if (isJavaExternal()) { QCString s = javaDecl().stripWhiteSpace(); int index; if ((index = s.find("${name}")) != -1) s.replace(index, 7, name()); else if ((index = s.find("${Name}")) != -1) s.replace(index, 7, capitalize(name())); else if ((index = s.find("${NAME}")) != -1) s.replace(index, 7, name().upper()); else if ((index = s.find("${nAME}")) != -1) s.replace(index, 7, name().lower()); f << s; } else { UmlClass * toplevel = this; UmlItem * p; QCString s2; while ((p = toplevel->parent())->kind() == aClass) { toplevel = (UmlClass *) p; s2 = dot + p->name() + s2; } UmlArtifact * cp = toplevel->associatedArtifact(); UmlPackage * pack = (UmlPackage *) ((cp != 0) ? (UmlItem *) cp : (UmlItem *) toplevel)->package(); if (pack != UmlArtifact::generation_package()) { QCString s = pack->javaPackage(); if (! s.isEmpty() && (s != "java.lang") && (s.left(10) != "java.lang.")) { s += s2; if (JavaSettings::isForcePackagePrefixGeneration() || !UmlArtifact::generated_one()->is_imported(s, name())) f << s << '.'; } } else if (! s2.isEmpty()) f << s2.mid(1) << '.'; f << name(); } }