#include "UmlItem.h"
#include "FileOut.h"
#include "UmlCom.h"
UmlItem::~UmlItem() {
}
void UmlItem::xmi(int, char **) {
UmlCom::trace("Error : must be applied on a package
");
}
bool UmlItem::write_if_needed(FileOut & out) {
const QVector ch = children();
unsigned n = ch.size();
bool used = FALSE;
for (unsigned i = 0; i != n; i += 1)
used |= ch[i]->write_if_needed(out);
return used;
}
void UmlItem::write(FileOut & out) {
if (! _written) {
_written = TRUE;
parent()->write(out);
}
}
void UmlItem::write_stereotype(FileOut & out) {
if (! stereotype().isEmpty()) {
out.indent();
out << "\n";
out.indent();
out << "\t\n";
out.indent();
out << "\n";
switch (_taggedvalue_mode) {
case 1:
out.indent();
out << "\n";
out.indent();
out << "\t\n";
out.indent();
out << "\n";
break;
case 2:
out.indent();
out << "\n";
out.indent();
out << "\tstereotype\n";
out.indent();
out << "\t";
out.quote(stereotype());
out << "\n";
out.indent();
out << "\n";
}
}
}
void UmlItem::write_description_properties(FileOut & out) {
if (_taggedvalue_mode != 0) {
if (! description().isEmpty()) {
out.indent();
out << "\n";
out.indent();
if (_taggedvalue_mode == 1) {
out << "\t\n";
}
else {
out << "\tdocumentation\n";
out.indent();
out << "\t";
out.quote(description());
out << "\n";
}
out.indent();
out << "\n";
}
const QDict up = properties();
QDictIterator it(up);
while (it.current()) {
out.indent();
out << "\n";
out.indent();
if (_taggedvalue_mode == 1) {
out << "\t\n";
}
else {
out << "\t";
out.quote(it.currentKey());
out << "\n";
out.indent();
out << "\t";
out.quote(*(it.current()));
out << "\n";
}
out.indent();
out << "\n";
++it;
}
}
}
void UmlItem::ref(FileOut & out) {
// theorically not called
out << "";
}
bool UmlItem::_gen_views;
Language UmlItem::_lang;
int UmlItem::_taggedvalue_mode;