void UmlBaseCollaborationDiagramDefinition::read_() { Q3PtrDict<UmlClassInstanceReference> instances; unsigned n; unsigned rank; n = UmlCom::read_unsigned(); _instances.resize(n); for (rank = 0; rank != n; rank += 1) { UmlClassInstanceReference * i = new UmlClassInstanceReference(); _instances.insert(rank, i); instances.insert((void *) UmlCom::read_unsigned(), i); i->read_(); } _instances.setAutoDelete(TRUE); n = UmlCom::read_unsigned(); _messages.resize(n); for (rank = 0; rank != n; rank += 1) { UmlCollaborationMessage * m = new UmlCollaborationMessage(); _messages.insert(rank, m); m->read_(instances); } _messages.setAutoDelete(TRUE); }
void UmlBaseSequenceDiagramDefinition::read_() { QHash<void*,UmlClassInstanceReference*> instances; unsigned n; unsigned rank; n = UmlCom::read_unsigned(); _fragments.resize(n); for (rank = 0; rank != n; rank += 1) { UmlFragment * f = new UmlFragment(); _fragments.insert(rank, f); f->read_(); } //_fragments.setAutoDelete(TRUE); UmlBaseFragment::compute_container_(_fragments); n = UmlCom::read_unsigned(); _instances.resize(n); for (rank = 0; rank != n; rank += 1) { UmlClassInstanceReference * i = new UmlClassInstanceReference(); _instances.insert(rank, i); instances.insert((void *) UmlCom::read_unsigned(), i); i->read_(); } //_instances.setAutoDelete(TRUE); n = UmlCom::read_unsigned(); _messages.resize(n); if (n != 0) { for (rank = 0; rank != n; rank += 1) { UmlSequenceMessage * m = new UmlSequenceMessage(); _messages.insert(rank, m); m->read_(instances, _fragments); } ::qsort(_messages.data(), 0, n - 1); //_messages.setAutoDelete(TRUE); } n = _fragments.count(); for (rank = 0; rank != n; rank += 1) _fragments.at(rank)->read_covered_(instances); while (UmlCom::read_bool()) { WrapperStr s = UmlCom::read_string(); int x = (int) UmlCom::read_unsigned(); int y = (int) UmlCom::read_unsigned(); int w = (int) UmlCom::read_unsigned(); int h = (int) UmlCom::read_unsigned(); UmlFragmentCompartment * cp = UmlBaseFragment::get_container_(x, y, w, h, _fragments); if (cp != 0) cp->add_text_(s); } while (UmlCom::read_bool()) { WrapperStr s = UmlCom::read_string(); int x = (int) UmlCom::read_unsigned(); int y = (int) UmlCom::read_unsigned(); int w = (int) UmlCom::read_unsigned(); int h = (int) UmlCom::read_unsigned(); UmlFragmentCompartment * cp = UmlBaseFragment::get_container_(x, y, w, h, _fragments); if (cp != 0) cp->add_cont_(s, y + h / 2); } }
void UmlFragment::write(FileOut & out, UmlItem * diagram, Q3PtrList<UmlSequenceMessage> & msgs) { WrapperStr oper = name(); if (oper == "ref") write_ref(out, diagram, msgs); else { if ((oper != "alt") && (oper != "opt") && (oper != "loop") && (oper != "break") && (oper != "par") && (oper != "seq") && (oper != "strict") && (oper != "neg") && (oper != "critical") && (oper != "assert") && (oper != "ignore") && (oper != "consider")) oper = ""; else { static int rank = 0; out.indent(); out << "<fragment xmi:type=\"uml:CombinedFragment\""; out.id_prefix(diagram, "COMBINEDFRAGMENT", ++rank); if (! covered.isEmpty()) { out << " covered=\""; UmlClassInstanceReference * lifeline = covered.first(); for (;;) { out.ref_only(diagram, lifeline->lifeline()); lifeline = covered.next(); if (lifeline == 0) break; out << " "; } out << '"'; } out << " interactionOperator=\"" << oper.operator QString() << "\">\n"; out.indent(+1); } const Q3PtrVector<UmlFragmentCompartment> & subs = compartments(); unsigned n = subs.size(); for (unsigned i = 0; i != n; i += 1) subs.at(i)->write(out, diagram, msgs, oper); if (!oper.isEmpty()) { out.indent(-1); out.indent(); out << "</fragment>\n"; } } }