SimpleRelationData * SimpleRelationData::read(char * & st) { SimpleRelationData * result = new SimpleRelationData(relation_type(read_keyword(st), TRUE)); char * k = read_keyword(st); result->BasicData::read(st, k); // updates k if (strcmp(k, "on")) wrong_keyword(k, "on"); k = read_keyword(st); // note : BrowserArtifact::read get Component def on component -> artifact if (((result->end = BrowserArtifact::read(st, k, 0)) == 0) && ((result->end = BrowserComponent::read(st, k, 0)) == 0) && ((result->end = BrowserUseCase::read(st, k, 0)) == 0) && ((result->end = BrowserPackage::read(st, k, 0, FALSE)) == 0) && ((result->end = BrowserDeploymentNode::read(st, k, 0)) == 0) && ((result->end = BrowserActivity::read(st, k, 0)) == 0) && ((result->end = BrowserActivityAction::read(st, k, 0)) == 0) && ((result->end = BrowserActivityObject::read(st, k, 0)) == 0) && ((result->end = BrowserClass::read(st, k, 0)) == 0)) wrong_keyword(k, "a ref to a class, component, usecase, package, deployment node, activity, activity action or activity object"); connect(result->end->get_data(), SIGNAL(deleted()), result, SLOT(end_deleted())); return result; }
void BrowserNode::read_stereotypes(char * & st, QStringList relations_stereotypes[]) { int r; for (r = 0; r != UmlRelations; r += 1) relations_stereotypes[r].clear(); char * k; while (strcmp((k = read_keyword(st)), "end")) { QStringList & list = relations_stereotypes[relation_type(k)]; list.clear(); read_unicode_string_list(list, st); } }
RelationData * RelationData::read(char *& st, char *& k, BrowserRelation *& unconsistent) { unconsistent = 0; RelationData * result; int id; if (!strcmp(k, "relation_ref")) { if ((result = all[id = read_id(st)]) == 0) result = new RelationData(UmlRelations/*!!*/, id); k = read_keyword(st); return result; } else if (!strcmp(k, "relation")) { if ((result = all[id = read_id(st)]) == 0) result = new RelationData(relation_type(read_keyword(st)), id); else if (result->type != UmlRelations) { // shared identifier result->set_unconsistent(); unconsistent = result->start; result = new RelationData(relation_type(read_keyword(st)), id); result->set_unconsistent(); } else { result->type = relation_type(read_keyword(st)); result->name = default_name(result->type); if (result->start != 0) { // Created by RelationData::read_ref() // invalidate start/end to not delete result // when start/end will be deleted result->start->invalidate(); result->end->invalidate(); } } k = read_keyword(st); if (!strcmp(k, "name")) { result->name = read_string(st); k = read_keyword(st); } result->BasicData::read(st, k); // updates k if (in_lib_import()) { result->original_id = id; if (! strcmp(k, "oid")) { // a sub lib is imported as a part of the imported lib (void) read_id(st); k = read_keyword(st); } } else if (! strcmp(k, "oid")) { result->original_id = read_id(st); k = read_keyword(st); } bool assoc = isa_association(result->type); if (strcmp(k, "a")) wrong_keyword(k, "a"); read_role(result->a, assoc, st, k, result); // updates k result->start = BrowserRelation::read_ref(st, k); read_keyword(st, "b"); if (!RelationData::uni_directional(result->type)) { read_role(result->b, assoc, st, k, result); // updates k result->end = BrowserRelation::read_ref(st, k); // 'end' may be read before 'start' : relation's type was unknown result->end->set_name(0); result->end->set_name(result->name); } else { k = read_keyword(st); if (!strcmp(k, "multiplicity")) { result->b.multiplicity = read_string(st); k = read_keyword(st); } else result->b.multiplicity = 0; if (strcmp(k, "parent")) wrong_keyword(k, "parent"); result->end_removed_from = BrowserClass::read_ref(st); result->b.uml_visibility = ((BrowserNode *) result->end_removed_from->parent())->get_visibility(UmlRelations); connect(result->end_removed_from->get_data(), SIGNAL(deleted()), result, SLOT(end_deleted())); result->end = 0; // manage old declarations switch (result->type) { case UmlRealize: case UmlGeneralisation: if (result->a.cpp_decl == "Generated") result->a.cpp_decl = "${type}"; if (result->a.java_decl == "Generated") result->a.java_decl = "${type}"; if (result->a.idl_decl == "Generated") result->a.idl_decl = "${type}"; break; case UmlDependency: if (!result->a.cpp_decl.isEmpty()) { if (result->stereotype == "friend") result->a.cpp_decl = "${type}"; else if ((result->a.cpp_decl == "Generated") || (result->a.cpp_decl == "${type}")) result->a.cpp_decl = "#include in header"; else if ((result->a.cpp_decl == "#include in source") && (read_file_format() < 56)) IncludeToHeaderIfExternal.append(result); } break; default: break; } } k = read_keyword(st); AType t; if (!strcmp(k, "association_type") || !strcmp(k, "association_explicit_type")) { t.read(st, "association_type", "association_explicit_type", k); result->set_association(t); k = read_keyword(st); } return result; } else return 0; }