1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
#include "UmlClass.h"
#include "UmlCom.h"
#include "JavaSettings.h"
#include "CppSettings.h"
#include "IdlSettings.h"
#include "PhpSettings.h"
#include "UmlClassView.h"
#include "UmlDeploymentView.h"
#include "UmlArtifact.h"
void UmlClass::uml2cpp(bool rec) {
if (isCppExternal())
set_CppDecl(CppSettings::externalClassDecl());
else {
QCString st = CppSettings::classStereotype(stereotype());
if (st == "enum")
set_CppDecl(CppSettings::enumDecl());
else if (st == "union")
set_CppDecl(CppSettings::unionDecl());
else if (st == "struct")
set_CppDecl(CppSettings::structDecl());
else if (st == "typedef")
set_CppDecl(CppSettings::typedefDecl());
else if (st == "ignored") {
set_CppDecl("");
return;
}
else
set_CppDecl(CppSettings::classDecl());
if (rec) {
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2cpp(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_CppSource(CppSettings::sourceContent());
}
}
void UmlClass::uml2java(bool rec) {
if (isJavaExternal())
set_JavaDecl(JavaSettings::externalClassDecl());
else {
QCString st = JavaSettings::classStereotype(stereotype());
if (st == "enum_pattern")
set_JavaDecl(JavaSettings::enumPatternDecl());
else if (st == "enum")
set_JavaDecl(JavaSettings::enumDecl());
else if (st == "interface")
set_JavaDecl(JavaSettings::interfaceDecl());
else if (st == "@interface") {
QCString s = JavaSettings::interfaceDecl();
int index = s.find("interface");
if (index != -1)
s.insert(index, '@');
set_JavaDecl(s);
}
else if (st == "ignored") {
set_JavaDecl("");
return;
}
else
set_JavaDecl(JavaSettings::classDecl());
if (rec) {
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2java(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_JavaSource(JavaSettings::sourceContent());
}
}
void UmlClass::uml2idl(bool rec) {
if (isIdlExternal())
set_IdlDecl(IdlSettings::externalClassDecl());
else {
QCString st = IdlSettings::classStereotype(stereotype());
if (st == "struct")
set_IdlDecl(IdlSettings::structDecl());
else if (st == "union")
set_IdlDecl(IdlSettings::unionDecl());
else if (st == "enum")
set_IdlDecl(IdlSettings::enumDecl());
else if (st == "exception")
set_IdlDecl(IdlSettings::exceptionDecl());
else if (st == "typedef")
set_IdlDecl(IdlSettings::typedefDecl());
else if (st == "interface")
set_IdlDecl(IdlSettings::interfaceDecl());
else if (st == "ignored") {
set_IdlDecl("");
return;
}
else
set_IdlDecl(IdlSettings::valuetypeDecl());
if (rec) {
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2idl(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_IdlSource(IdlSettings::sourceContent());
}
}
void UmlClass::uml2php(bool rec) {
if (isPhpExternal())
set_PhpDecl(PhpSettings::externalClassDecl());
else {
QCString st = PhpSettings::classStereotype(stereotype());
if (st == "enum")
set_PhpDecl(PhpSettings::enumDecl());
else if (st == "interface")
set_PhpDecl(PhpSettings::interfaceDecl());
else if (st == "ignored") {
set_PhpDecl("");
return;
}
else
set_PhpDecl(PhpSettings::classDecl());
if (rec) {
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
for (unsigned i = 0; i != n; i += 1)
ch[i]->uml2php(rec);
}
if (parent()->kind() == aClassView)
// not nested
artifact()->set_PhpSource(PhpSettings::sourceContent());
}
}
UmlArtifact * UmlClass::artifact() {
// note : class is not nested
UmlArtifact * art = associatedArtifact();
if (art == 0) {
UmlDeploymentView * depl = ((UmlClassView *) parent())->deploymentView();
art = UmlArtifact::create(depl, name());
if (art == 0) {
UmlCom::trace("<b>cannot create artifact '" +
name() + "' in deployment view '" + depl->name() + "'</b><br>");
throw 0;
}
art->set_Stereotype("source");
art->addAssociatedClass(this);
}
return art;
}
|