/usr/lib/bouml/xmi2import/9217.bodies is in bouml-plugouts-src 4.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | class UmlPackage
!!!188674.cpp!!! import(in path : QString) : void
bool manual = path.isEmpty();
if (manual)
path = QFileDialog::getOpenFileName(QString::null, QString::null, 0, 0, "open xmi/xml file");
if (! path.isEmpty()) {
// note : QTextStream(FILE *) bugged under windows
FILE * fp = fopen(path, "rb");
if (fp == 0)
UmlCom::trace("cannot open " + path);
else {
QString s = "import " + path + "<br>";
UmlCom::trace(s);
FileIn in(path, fp);
getProject()->set_childrenVisible(FALSE);
init();
importHeader(in);
UmlCom::trace(QCString("<br><font face=helvetica>xmi import done<br><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(numberOf() - 1) + QCString(" packages </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlUseCase::numberOf()) + QCString(" use cases </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlClass::numberOf()) + QCString(" classes </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlActivity::numberOf()) + QCString(" activities </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlState::numberOf()) + " states </font><br>" +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlComponent::numberOf()) + QCString(" components </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlArtifact::numberOf()) + QCString(" artifacts </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlNode::numberOf()) + QCString(" deployment nodes </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlPackage::numberOfProfile()) + QCString(" profiles </font><br>") +
QCString("<font face=helvetica> ") +
QCString().setNum(UmlClass::numberOfStereotype()) + QCString(" stereotypes </font><br><br>"));
if (manual)
getProject()->set_childrenVisible(TRUE);
}
}
!!!188930.cpp!!! importHeader(inout in : FileIn) : void
Token & tk = in.read();
if (tk.what() != "xml")
in.error("xml version expected");
if (tk.valueOf("version") != "1.0") {
UmlCom::trace("Only import xml 1.0");
return;
}
in.setEncoding(tk.valueOf("encoding"));
(void) in.read(); // update tk
if (tk.what() == "xmi:xmi") {
QCString ver = tk.valueOf("xmi:version");
if (ver.isEmpty())
UmlCom::trace("warning : unknown xmi version<br><br>");
else if (ver != "2.1")
UmlCom::trace("warning : imported file is not xmi 2.1<br><br>");
FromEclipse =
// for instance RSA Eclipse xmi export
!tk.valueOf("xmlns:ecore").isEmpty();
if (FromEclipse)
UmlCom::trace("xmi file produced under <b>Eclipse</b><br><br>");
// read all before stereotype use
QCString prof_st;
QValueList<QCString> base_v;
while ((void) in.read(), !tk.close("xmi:xmi")) {
if (UmlClass::isAppliedStereotype(tk, prof_st, base_v))
break;
UmlCom::targetItem()->import(in, tk);
}
solveRefs();
if (NumberOfProfile != 0)
// to take into account inheritances
updateProfiles();
// read stereotype use
while (!tk.close("xmi:xmi")) {
applyStereotype(in, tk);
(void) in.read();
}
}
else if ((tk.what() == "uml:model") || (tk.what() == "uml:profile")) {
// Borland Together 2006 for Eclipse
// Visual Paradigm for UML 6.1
// RSA Eclipse (profile)
QCString ver = tk.valueOf("xmi:version");
if (ver.isEmpty())
UmlCom::trace("warning : unknown xmi version<br><br>");
else if (ver != "2.1")
UmlCom::trace("warning : imported file is not xmi 2.1<br><br>");
FromEclipse =
// .uml
!tk.valueOf("xmlns:ecore").isEmpty();
if (FromEclipse)
UmlCom::trace("xmi file produced under <b>Eclipse</b><br><br>");
UmlCom::targetItem()->import(in, tk);
solveRefs();
if (NumberOfProfile != 0)
updateProfiles();
}
else
in.error("uml:model or uml:profile or xmi:xmi expected, nothing imported");
!!!193538.cpp!!! container(in kind : anItemKind, in token : Token, inout in : FileIn) : UmlItem
switch (kind) {
case aClass:
case aClassInstance:
case aState:
case anActivity:
if (_classview == 0)
_classview = UmlClassView::create(this,
(stereotype() == "profile")
? "Stereotype View" : "Class View");
return _classview;
case anUseCase:
if (_usecaseview == 0)
_usecaseview = UmlUseCaseView::create(this, "Use Case View");
return _usecaseview;
case aComponent:
if (_compview == 0)
_compview = UmlComponentView::create(this, "Component View");
return _compview;
case aNode:
case anArtifact:
if (_deplview == 0)
_deplview = UmlDeploymentView::create(this, "Deployment View");
return _deplview;
default:
in.bypass(token);
return 0;
}
!!!189058.cpp!!! importIt(inout in : FileIn, inout token : Token, inout where : UmlItem) : void
while (where->kind() != aPackage)
where = where->parent();
QCString s = token.valueOf("name");
if (s.isEmpty()) {
static unsigned n = 0;
s.sprintf("anonymous %u", ++n);
}
UmlPackage * pack = create((UmlPackage *) where, s);
if (pack == 0)
in.error("cannot create package '" + s + "' in '" + where->name() + "'");
bool profile =
(token.what() == "uml:profile") || (token.xmiType() == "uml:Profile");
if (profile) {
pack->set_Stereotype("profile");
pack->set_PropertyValue("xmiId", token.xmiId());
NumberOf -= 1;
NumberOfProfile += 1;
if (!(s = token.valueOf("metamodelreference")).isEmpty())
pack->set_PropertyValue("metamodelReference", s);
if (!(s = token.valueOf("metaclassreference")).isEmpty())
pack->set_PropertyValue("metaclassReference", s);
}
s = token.xmiId();
if (!s.isEmpty()) {
pack->addItem(s, in);
if (! token.closed()) {
QCString k = token.what();
const char * kstr = k;
if (profile) {
while (in.read(), !token.close(kstr)) {
if ((token.what() == "packagedelement") &&
(token.xmiType() == "uml:Extension")) {
if (! token.closed())
in.finish(token.what());
}
else if (token.what() == "packageimport")
pack->packageImport(in, token);
else
pack->UmlItem::import(in, token);
}
updateProfiles();
}
else
while (in.read(), !token.close(kstr))
pack->UmlItem::import(in, token);
}
}
else if (! token.valueOf("href", s))
in.error("xmi:id is missing"); // doesn't return
else {
in.warning("bypass external package " + s);
if (! token.closed())
in.finish(token.what());
}
pack->unload(TRUE, FALSE);
!!!252674.cpp!!! appliedProfile(inout in : FileIn, inout token : Token, inout where : UmlItem) : void
if (! token.closed()) {
QCString k = token.what();
const char * kstr = k;
while (in.read(), !token.close(kstr)) {
if (token.what() == "appliedprofile") {
QCString s = token.valueOf("href");
importProfile(in, s);
}
if (! token.closed())
in.finish(token.what());
}
}
!!!191746.cpp!!! init() : void
declareFct("uml:model", "uml:Model", &importIt);
declareFct("packagedelement", "uml:Package", &importIt);
declareFct("ownedmember", "uml:Package", &importIt);
declareFct("ownedmember", "uml:Model", &importIt); // magic draw
declareFct("packagedelement", "uml:Profile", &importIt);
declareFct("ownedmember", "uml:Profile", &importIt);
declareFct("uml:package", "", &importIt);
declareFct("uml:model", "", &importIt);
declareFct("uml:profile", "", &importIt);
declareFct("profileapplication", "", &appliedProfile);
declareFct("profileapplication", "uml:ProfileApplication", &appliedProfile);
//
UmlItem::init();
UmlUseCase::init();
UmlClass::init();
UmlState::init();
UmlActivity::init();
UmlComponent::init();
UmlNode::init();
UmlArtifact::init();
!!!253186.cpp!!! applyStereotype(inout in : FileIn, inout token : Token) : void
QCString prof_st;
QValueList<QCString> base_v;
QCString s;
if (UmlClass::isAppliedStereotype(token, prof_st, base_v)) {
QCString s;
QValueList<QCString>::Iterator it_ext;
for (it_ext = base_v.begin(); it_ext != base_v.end(); ++it_ext) {
QCString s2;
if (token.valueOf(*it_ext, s2)) {
if (s.isEmpty())
s = s2;
else if (s != s2)
in.warning("doesn't refer to the same element ('" + s + "' != '" + s2 + "')");
}
}
if (s.isEmpty())
in.warning("value of 'base_...' is missing");
else {
UmlItem * elt = All[s];
if (elt == 0) {
if (!FileIn::isBypassedId(s))
in.warning("unknown reference '" + s + "'");
}
else {
elt->set_Stereotype(prof_st);
elt->UmlItem::applyStereotype(); // set properties
QDict<QCString> props = elt->properties();
QDictIterator<QCString> it(props);
while (it.current()) {
QCString k = it.currentKey().latin1();
if (token.valueOf(k.mid(k.findRev(':') + 1).lower(), s))
elt->set_PropertyValue(k, s);
++it;
}
}
}
if (! token.closed())
in.finish(token.what());
}
else
in.bypass(token);
!!!262018.cpp!!! importProfile(inout in : FileIn, in href : string) : UmlPackage
if (!href.isEmpty() && (href.left(5) != "http:") && (href.left(8) != "pathmap:")) {
int index = href.find('#');
if (index != -1) {
QCString id = href.mid(index + 1);
QMap<QCString, UmlItem *>::Iterator it = All.find(id);
if (it == All.end()) {
UmlPackage * pf = getProject()->findProfile(id);
if (pf == 0) {
QFileInfo fi(in.path());
QDir d(fi.dir(TRUE));
QString fn = d.absFilePath(href.left(index));
if (QFile::exists(fn)) {
QCString cmd = qApp->argv()[0] + QCString(" ") + QCString(fn);
int pid = UmlCom::targetItem()->apply(cmd);
while (isToolRunning(pid)) {
#ifdef WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
UmlCom::targetItem()->unload(FALSE, FALSE); // to reread children
if ((pf = ((UmlPackage *) UmlCom::targetItem())->findProfile(id)) != 0)
// not in Bouml case
pf->loadFromProfile();
}
else
in.warning("can't open " + href.left(index));
}
else
// not in Bouml case
pf->loadFromProfile();
return pf;
}
else if ((*it)->kind() == aPackage)
return (UmlPackage *) *it;
}
}
return 0;
!!!251522.cpp!!! packageImport(inout in : FileIn, inout tk : Token) : void
if (! tk.closed()) {
QCString id = tk.xmiId();
QCString k = tk.what();
const char * kstr = k;
while (in.read(), !tk.close(kstr)) {
if (tk.what() == "importedpackage") {
if (tk.xmiType() == "uml:Model") {
QCString v;
if (propertyValue("metamodelReference", v) && (v == id)) {
QCString href = tk.valueOf("href");
int index = href.find('#');
set_PropertyValue("metamodelReference",
(index == -1)
? href : href.left(index));
}
}
else if (tk.xmiType() == "uml:Profile") {
QCString s = tk.xmiIdref();
UmlPackage * pf = 0;
if (!s.isEmpty()) {
QMap<QCString, UmlItem *>::Iterator it = All.find(s);
if (it == All.end())
UnresolvedRelation::add(4, this->id(), s, "", "");
else if ((*it)->kind() == aPackage)
pf = (UmlPackage *) *it;
}
else
pf = importProfile(in, tk.valueOf("href"));
if (pf != 0) {
UmlNcRelation * ncr = UmlNcRelation::create(aDependency, this, pf);
if (ncr != 0)
ncr->set_Stereotype("import");
}
}
}
else if (tk.what() == "importedelement") {
QCString v;
if (propertyValue("metaclassReference", v) && (v == id)) {
QCString href = tk.valueOf("href");
int index = href.find('#');
set_PropertyValue("metaclassReference",
(index == -1)
? href : href.left(index));
}
}
if (! tk.closed())
in.finish(tk.what());
}
}
!!!252802.cpp!!! solveRefs() : void
UmlCom::trace("<br><font face=helvetica>solve references<br>");
UnresolvedWithContext::solveThem();
UnresolvedRelation::solveThem();
Association::solveThem(); // must be done after UnresolvedRelation::solveThem();
Unresolved::solveThem(); // must be done when all relations are done for activity read/write var=rel
UmlFlow::solveThem();
UmlTransition::solveThem();
Binding::solveThem(); // must be done when all classes and realization or generalization are done
ClassInstance::solveThem(); // must be done when all classes are done
Manifestation::solveThem(); // must be done when all artifact, class, component and node exist
!!!262146.cpp!!! findProfile(in xmiId : string) : UmlPackage
if (stereotype() == "profile") {
QCString id;
if (propertyValue("xmiId", id) && (id == xmiId))
return this;
}
const QVector<UmlItem> ch = children();
unsigned n = ch.size();
UmlPackage * r;
for (unsigned u = 0; u != n; u += 1) {
if ((ch[u]->kind() == aPackage) &&
((r = ((UmlPackage *) ch[u])->findProfile(xmiId)) != 0))
return r;
}
return 0;
|