• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

umbrello/umbrello

  • sources
  • kde-4.12
  • kdesdk
  • umbrello
  • umbrello
association.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * This program is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU General Public License as published by *
4  * the Free Software Foundation; either version 2 of the License, or *
5  * (at your option) any later version. *
6  * *
7  * copyright (C) 2003-2013 *
8  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9  ***************************************************************************/
10 
11 // own header
12 #include "association.h"
13 
14 // app includes
15 #include "debug_utils.h"
16 #include "classifier.h"
17 #include "folder.h"
18 #include "uml.h"
19 #include "umldoc.h"
20 #include "umlrole.h"
21 #include "uniqueid.h"
22 #include "model_utils.h"
23 #include "cmds.h"
24 
25 // kde includes
26 #include <klocale.h>
27 
28 // qt includes
29 #include <QRegExp>
30 
31 using namespace Uml;
32 
33 DEBUG_REGISTER(UMLAssociation)
34 
35 
42 UMLAssociation::UMLAssociation(Uml::AssociationType::Enum type,
43  UMLObject * roleA, UMLObject * roleB)
44  : UMLObject("")
45 {
46  init(type, roleA, roleB);
47 
48  m_pRole[RoleType::A]->setID(UniqueID::gen());
49  m_pRole[RoleType::B]->setID(UniqueID::gen());
50 }
51 
59 UMLAssociation::UMLAssociation(Uml::AssociationType::Enum type)
60  : UMLObject("", Uml::ID::Reserved)
61 {
62  init(type, NULL, NULL);
63 }
64 
68 UMLAssociation::~UMLAssociation()
69 {
70  if (m_pRole[RoleType::A] == NULL) {
71  uError() << "UMLAssociation destructor: m_pRole[A] is NULL already";
72  } else {
73  delete m_pRole[RoleType::A];
74  m_pRole[RoleType::A] = NULL;
75  }
76  if (m_pRole[RoleType::B] == NULL) {
77  uError() << "UMLAssociation destructor: m_pRole[B] is NULL already";
78  } else {
79  delete m_pRole[RoleType::B];
80  m_pRole[RoleType::B] = NULL;
81  }
82 }
83 
87 bool UMLAssociation::operator==(const UMLAssociation &rhs) const
88 {
89  if (this == &rhs) {
90  return true;
91  }
92  return (UMLObject::operator== (rhs) &&
93  m_AssocType == rhs.m_AssocType &&
94  m_Name == rhs.m_Name &&
95  m_pRole[RoleType::A] == rhs.m_pRole[RoleType::A] &&
96  m_pRole[RoleType::B] == rhs.m_pRole[RoleType::B]);
97 }
98 
103 Uml::AssociationType::Enum UMLAssociation::getAssocType() const
104 {
105  return m_AssocType;
106 }
107 
111 QString UMLAssociation::toString() const
112 {
113  QString string;
114  if(m_pRole[RoleType::A])
115  {
116  string += m_pRole[RoleType::A]->object()->name();
117  string += ':';
118  string += m_pRole[RoleType::A]->name();
119  }
120  string += ':' + Uml::AssociationType::toStringI18n(m_AssocType) + ':';
121  if(m_pRole[RoleType::B])
122  {
123  string += m_pRole[RoleType::B]->object()->name();
124  string += ':';
125  string += m_pRole[RoleType::B]->name();
126  }
127  return string;
128 }
129 
137 bool UMLAssociation::resolveRef()
138 {
139  bool successA = getUMLRole(RoleType::A)->resolveRef();
140  bool successB = getUMLRole(RoleType::B)->resolveRef();
141  if (successA && successB) {
142  UMLObject *objA = getUMLRole(RoleType::A)->object();
143  UMLObject *objB = getUMLRole(RoleType::B)->object();
144  // Check if need to change the assoc type to Realization
145  if (isRealization(objA, objB)) {
146  m_AssocType = Uml::AssociationType::Realization;
147  }
148  m_pUMLPackage->addAssocToConcepts(this);
149  return true;
150  }
151  return false;
152 }
153 
158 void UMLAssociation::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
159 {
160  if (m_AssocType == Uml::AssociationType::Generalization) {
161  QDomElement assocElement = UMLObject::save("UML:Generalization", qDoc);
162  assocElement.setAttribute("discriminator", "");
163  assocElement.setAttribute("child", Uml::ID::toString(getObjectId(RoleType::A)));
164  assocElement.setAttribute("parent", Uml::ID::toString(getObjectId(RoleType::B)));
165  qElement.appendChild(assocElement);
166  return;
167  }
168  if (m_AssocType == Uml::AssociationType::Realization) {
169  QDomElement assocElement = UMLObject::save("UML:Abstraction", qDoc);
170  assocElement.setAttribute("client", Uml::ID::toString(getObjectId(RoleType::A)));
171  assocElement.setAttribute("supplier", Uml::ID::toString(getObjectId(RoleType::B)));
172  qElement.appendChild(assocElement);
173  return;
174  }
175  if (m_AssocType == Uml::AssociationType::Dependency) {
176  QDomElement assocElement = UMLObject::save("UML:Dependency", qDoc);
177  assocElement.setAttribute("client", Uml::ID::toString(getObjectId(RoleType::A)));
178  assocElement.setAttribute("supplier", Uml::ID::toString(getObjectId(RoleType::B)));
179  qElement.appendChild(assocElement);
180  return;
181  }
182  if (m_AssocType == Uml::AssociationType::Child2Category) {
183  QDomElement assocElement = UMLObject::save("UML:Child2Category", qDoc);
184  assocElement.setAttribute("client", Uml::ID::toString(getObjectId(RoleType::A)));
185  assocElement.setAttribute("supplier", Uml::ID::toString(getObjectId(RoleType::B)));
186  qElement.appendChild(assocElement);
187  return;
188  }
189  if (m_AssocType == Uml::AssociationType::Category2Parent) {
190  QDomElement assocElement = UMLObject::save("UML:Category2Parent", qDoc);
191  assocElement.setAttribute("client", Uml::ID::toString(getObjectId(RoleType::A)));
192  assocElement.setAttribute("supplier", Uml::ID::toString(getObjectId(RoleType::B)));
193  qElement.appendChild(assocElement);
194  return;
195  }
196 
197  QDomElement associationElement = UMLObject::save("UML:Association", qDoc);
198  QDomElement connElement = qDoc.createElement("UML:Association.connection");
199  getUMLRole(RoleType::A)->saveToXMI (qDoc, connElement);
200  getUMLRole(RoleType::B)->saveToXMI (qDoc, connElement);
201  associationElement.appendChild (connElement);
202  qElement.appendChild(associationElement);
203 }
204 
209 bool UMLAssociation::load(QDomElement & element)
210 {
211  if (id() == Uml::ID::None)
212  return false; // old style XMI file. No real info in this association.
213 
214  UMLDoc * doc = UMLApp::app()->document();
215  UMLObject * obj[2] = { NULL, NULL };
216  if (m_AssocType == Uml::AssociationType::Generalization ||
217  m_AssocType == Uml::AssociationType::Realization ||
218  m_AssocType == Uml::AssociationType::Dependency ||
219  m_AssocType == Uml::AssociationType::Child2Category ||
220  m_AssocType == Uml::AssociationType::Category2Parent
221  ) {
222  for (unsigned r = RoleType::A; r <= RoleType::B; ++r) {
223  const QString fetch = (m_AssocType == Uml::AssociationType::Generalization ?
224  r == RoleType::A ? "child" : "parent"
225  : r == RoleType::A ? "client" : "supplier");
226  QString roleIdStr = element.attribute(fetch, "");
227  if (roleIdStr.isEmpty()) {
228  // Might be given as a child node instead - see below.
229  continue;
230  }
231 
232  // set umlobject of role if possible (else defer resolution)
233  obj[r] = doc->findObjectById(Uml::ID::fromString(roleIdStr));
234  Uml::RoleType::Enum role = Uml::RoleType::fromInt(r);
235  if (obj[r] == NULL) {
236  m_pRole[role]->setSecondaryId(roleIdStr); // defer to resolveRef()
237  } else {
238  m_pRole[role]->setObject(obj[r]);
239  if (m_pUMLPackage == NULL) {
240  Uml::ModelType::Enum mt = Model_Utils::convert_OT_MT(obj[r]->baseType());
241  m_pUMLPackage = doc->rootFolder(mt);
242  DEBUG(DBG_SRC) << "assoctype " << m_AssocType
243  << ": setting model type " << Uml::ModelType::toString(mt);
244  }
245  }
246  }
247  if (obj[RoleType::A] == NULL || obj[RoleType::B] == NULL) {
248  for (QDomNode node = element.firstChild(); !node.isNull();
249  node = node.nextSibling()) {
250  if (node.isComment())
251  continue;
252  QDomElement tempElement = node.toElement();
253  QString tag = tempElement.tagName();
254  if (Model_Utils::isCommonXMIAttribute(tag))
255  continue;
256  // Permitted tag names:
257  // roleA: "child" "subtype" "client"
258  // roleB: "parent" "supertype" "supplier"
259  QString idStr = tempElement.attribute("xmi.id", "");
260  if (idStr.isEmpty())
261  idStr = tempElement.attribute("xmi.idref", "");
262  if (idStr.isEmpty()) {
263  QDomNode inner = node.firstChild();
264  QDomElement tmpElem = inner.toElement();
265  idStr = tmpElem.attribute("xmi.id", "");
266  if (idStr.isEmpty())
267  idStr = tmpElem.attribute("xmi.idref", "");
268  }
269  if (idStr.isEmpty()) {
270  uError() << "type " << m_AssocType
271  << ", id " << Uml::ID::toString(id()) << ": "
272  << "xmi id not given for " << tag;
273  continue;
274  }
275  // Since we know for sure that we're dealing with a non
276  // umbrello file, use deferred resolution unconditionally.
277  if (UMLDoc::tagEq(tag, "child") || UMLDoc::tagEq(tag, "subtype") || UMLDoc::tagEq(tag, "client")) {
278  getUMLRole(RoleType::A)->setSecondaryId(idStr);
279  } else {
280  getUMLRole(RoleType::B)->setSecondaryId(idStr);
281  }
282  }
283  }
284 
285  // it is a realization if either endpoint is an interface
286  if (isRealization(obj[RoleType::A], obj[RoleType::B])) {
287  m_AssocType = Uml::AssociationType::Realization;
288  }
289  return true;
290  }
291 
292  for (QDomNode node = element.firstChild(); !node.isNull();
293  node = node.nextSibling()) {
294  // uml13.dtd compliant format (new style)
295  if (node.isComment())
296  continue;
297  QDomElement tempElement = node.toElement();
298  QString tag = tempElement.tagName();
299  if (Model_Utils::isCommonXMIAttribute(tag))
300  continue;
301  if (!UMLDoc::tagEq(tag, "Association.connection") &&
302  !UMLDoc::tagEq(tag, "Namespace.ownedElement") &&
303  !UMLDoc::tagEq(tag, "Namespace.contents")) {
304  uWarning() << "unknown child node " << tag;
305  continue;
306  }
307  // Load role A.
308  QDomNode nodeA = tempElement.firstChild();
309  while (nodeA.isComment())
310  nodeA = nodeA.nextSibling();
311  tempElement = nodeA.toElement();
312  if (tempElement.isNull()) {
313  uWarning() << "UML:Association : element (A) is Null";
314  return false;
315  }
316  tag = tempElement.tagName();
317  if (!UMLDoc::tagEq(tag, "AssociationEndRole") &&
318  !UMLDoc::tagEq(tag, "AssociationEnd")) {
319  uWarning() << "unknown child (A) tag " << tag;
320  return false;
321  }
322  if (! getUMLRole(RoleType::A)->loadFromXMI(tempElement))
323  return false;
324  // Load role B.
325  QDomNode nodeB = nodeA.nextSibling();
326  while (nodeB.isComment())
327  nodeB = nodeB.nextSibling();
328  tempElement = nodeB.toElement();
329  if (tempElement.isNull()) {
330  uWarning() << "UML:Association : element (B) is Null";
331  return false;
332  }
333  tag = tempElement.tagName();
334  if (!UMLDoc::tagEq(tag, "AssociationEndRole") &&
335  !UMLDoc::tagEq(tag, "AssociationEnd")) {
336  uWarning() << "unknown child (B) tag " << tag;
337  return false;
338  }
339  if (! getUMLRole(RoleType::B)->loadFromXMI(tempElement))
340  return false;
341 
342  if (m_pUMLPackage == NULL) {
343  Uml::ModelType::Enum mt = Model_Utils::convert_OT_MT(getObject(RoleType::B)->baseType());
344  m_pUMLPackage = doc->rootFolder(mt);
345  DEBUG(DBG_SRC) << "setting model type " << Uml::ModelType::toString(mt);
346  }
347 
348  // setting the association type:
349  //
350  // In the old days, we could just record this on the association,
351  // and be done with it. But thats not how the UML13.dtd does things.
352  // As a result, we are checking roleA for information about the
353  // parent association (!) which by this point in the parse, should
354  // be set. However, the information that the roles are allowed to have
355  // is not complete, so we need to finish the analysis here.
356 
357  // find self-associations
358  if (m_AssocType == Uml::AssociationType::Association && getObjectId(RoleType::A) == getObjectId(RoleType::B))
359  m_AssocType = Uml::AssociationType::Association_Self;
360 
361  // fall-back default type
362  if (m_AssocType == Uml::AssociationType::Unknown) {
363  m_AssocType = Uml::AssociationType::Association;
364  }
365 
366  return true;
367  }
368 
369  // From here on it's old-style stuff.
370  QString assocTypeStr = element.attribute("assoctype", "-1");
371  Uml::AssociationType::Enum assocType = Uml::AssociationType::Unknown;
372  if (assocTypeStr[0] >= 'a' && assocTypeStr[0] <= 'z') {
373  // In an earlier version, the natural assoctype names were saved.
374  const QString assocTypeString[] = {
375  "generalization", // Uml::AssociationType::Generalization
376  "aggregation", // Uml::AssociationType::Aggregation
377  "dependency", // Uml::AssociationType::Dependency
378  "association", // Uml::AssociationType::Association
379  "associationself", // Uml::AssociationType::Association_Self
380  "collmessage", // Uml::AssociationType::Coll_Message
381  "seqmessage", // Uml::AssociationType::Seq_Message
382  "collmessageself", // Uml::AssociationType::Coll_Message_Self
383  "seqmessageself", // Uml::AssociationType::Seq_Message_Self
384  "implementation", // Uml::AssociationType::Implementation
385  "composition", // Uml::AssociationType::Composition
386  "realization", // Uml::AssociationType::Realization
387  "uniassociation", // Uml::AssociationType::UniAssociation
388  "anchor", // Uml::AssociationType::Anchor
389  "state", // Uml::AssociationType::State
390  "activity", // Uml::AssociationType::Activity
391  "exception", // Uml::AssociationType::Exception
392  "category2parent" // Uml::AssociationType::Category2Parent
393  "child2category" // Uml::AssociationType::Child2Category
394  "relationship" // Uml::AssociationType::Relationship
395  };
396  const int arraySize = sizeof(assocTypeString)/sizeof(QString);
397  DEBUG(DBG_SRC) << "AssociationType string array size = " << arraySize;
398 
399  int index;
400  for (index = 0; index < arraySize; ++index)
401  if (assocTypeStr == assocTypeString[index])
402  break;
403  if (index < arraySize)
404  assocType = Uml::AssociationType::fromInt(index);
405  } else {
406  int assocTypeNum = assocTypeStr.toInt();
407  if (assocTypeNum < (int)Uml::AssociationType::Generalization || // first enum
408  assocTypeNum > (int)Uml::AssociationType::Relationship) { // last enum
409  uWarning() << "bad assoctype of UML:AssociationType::Enum " << Uml::ID::toString(id());
410  return false;
411  }
412  assocType = Uml::AssociationType::fromInt(assocTypeNum);
413  }
414  setAssociationType(assocType);
415 
416  Uml::ID::Type roleAObjID = Uml::ID::fromString(element.attribute("rolea", "-1"));
417  Uml::ID::Type roleBObjID = Uml::ID::fromString(element.attribute("roleb", "-1"));
418  if (assocType == Uml::AssociationType::Aggregation ||
419  assocType == Uml::AssociationType::Composition) {
420  // Flip roles to compensate for changed diamond logic in AssociationLine.
421  // For further explanations see AssociationWidget::loadFromXMI.
422  Uml::ID::Type tmp = roleAObjID;
423  roleAObjID = roleBObjID;
424  roleBObjID = tmp;
425  }
426 
427  UMLObject * objA = doc->findObjectById(roleAObjID);
428  UMLObject * objB = doc->findObjectById(roleBObjID);
429 
430  if(objA)
431  getUMLRole(RoleType::A)->setObject(objA);
432  else
433  return false;
434 
435  if(objB)
436  getUMLRole(RoleType::B)->setObject(objB);
437  else
438  return false;
439 
440  setMultiplicity(element.attribute("multia", ""), RoleType::A);
441  setMultiplicity(element.attribute("multib", ""), RoleType::B);
442 
443  setRoleName(element.attribute("namea", ""), RoleType::A);
444  setRoleName(element.attribute("nameb", ""), RoleType::B);
445 
446  setRoleDoc(element.attribute("doca", ""), RoleType::A);
447  setRoleDoc(element.attribute("docb", ""), RoleType::B);
448 
449  // Visibility defaults to Public if it cant set it here..
450  QString visibilityA = element.attribute("visibilitya", "0");
451  QString visibilityB = element.attribute("visibilityb", "0");
452  int vis = visibilityA.toInt();
453  if (vis >= 200) // bkwd compat.
454  vis -= 200;
455  setVisibility((Uml::Visibility::Enum)vis, RoleType::A);
456  vis = visibilityB.toInt();
457  if (vis >= 200) // bkwd compat.
458  vis -= 200;
459  setVisibility((Uml::Visibility::Enum)vis, RoleType::B);
460 
461  // Changeability defaults to Changeable if it cant set it here..
462  QString changeabilityA = element.attribute("changeabilitya", "0");
463  QString changeabilityB = element.attribute("changeabilityb", "0");
464  if (changeabilityA.toInt() > 0)
465  setChangeability(Uml::Changeability::fromInt(changeabilityA.toInt()), RoleType::A);
466  if (changeabilityB.toInt() > 0)
467  setChangeability(Uml::Changeability::fromInt(changeabilityB.toInt()), RoleType::B);
468 
469  return true;
470 }
471 
476 UMLObject* UMLAssociation::getObject(Uml::RoleType::Enum role) const
477 {
478  if (m_pRole[role] == NULL)
479  return NULL;
480  return m_pRole[role]->object();
481 }
482 
488 Uml::ID::Type UMLAssociation::getObjectId(Uml::RoleType::Enum role) const
489 {
490  UMLRole *roleObj = m_pRole[role];
491  UMLObject *o = roleObj->object();
492  if (o == NULL) {
493  QString auxID = roleObj->secondaryId();
494  if (auxID.isEmpty()) {
495  uError() << "role " << role << ": getObject returns NULL";
496  return Uml::ID::None;
497  } else {
498  DEBUG(DBG_SRC) << "role " << role << ": using secondary ID " << auxID;
499  return Uml::ID::fromString(auxID);
500  }
501  }
502  return o->id();
503 }
504 
510 Uml::ID::Type UMLAssociation::getRoleId(RoleType::Enum role) const
511 {
512  return m_pRole[role]->id();
513 }
514 
518 Uml::Changeability::Enum UMLAssociation::changeability(Uml::RoleType::Enum role) const
519 {
520  return m_pRole[role]->changeability();
521 }
522 
527 Uml::Visibility::Enum UMLAssociation::visibility(Uml::RoleType::Enum role) const
528 {
529  return m_pRole[role]->visibility();
530 }
531 
536 QString UMLAssociation::getMultiplicity(Uml::RoleType::Enum role) const
537 {
538  return m_pRole[role]->multiplicity();
539 }
540 
545 QString UMLAssociation::getRoleName(Uml::RoleType::Enum role) const
546 {
547  return m_pRole[role]->name();
548 }
549 
554 QString UMLAssociation::getRoleDoc(Uml::RoleType::Enum role) const
555 {
556  return m_pRole[role]->doc();
557 }
558 
563 UMLRole * UMLAssociation::getUMLRole(Uml::RoleType::Enum role) const
564 {
565  return m_pRole[role];
566 }
567 
572 void UMLAssociation::setOldLoadMode(bool value /* = true */)
573 {
574  m_bOldLoadMode = value;
575 }
576 
580 bool UMLAssociation::getOldLoadMode() const
581 {
582  return m_bOldLoadMode;
583 }
584 
589 void UMLAssociation::setAssociationType(Uml::AssociationType::Enum assocType)
590 {
591  m_AssocType = assocType;
592  if (m_AssocType == Uml::AssociationType::UniAssociation)
593  {
594  // In this case we need to auto-set the multiplicity/rolenames
595  // of the roles
596 #ifdef VERBOSE_DEBUGGING
597  DEBUG(DBG_SRC) << " A new uni-association has been created.";
598 #endif
599  }
600  UMLObject::emitModified();
601 }
602 
608 void UMLAssociation::setObject(UMLObject *obj, Uml::RoleType::Enum role)
609 {
610  m_pRole[role]->setObject(obj);
611 }
612 
618 void UMLAssociation::setVisibility(Visibility::Enum value, Uml::RoleType::Enum role)
619 {
620  m_pRole[role]->setVisibility(value);
621 }
622 
628 void UMLAssociation::setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
629 {
630  m_pRole[role]->setChangeability(value);
631 }
632 
638 void UMLAssociation::setMultiplicity(const QString &multi, Uml::RoleType::Enum role)
639 {
640  UMLApp::app()->executeCommand(new CmdChangeMultiplicity(m_pRole[role], multi));
641  //m_pRole[role]->setMultiplicity(multi);
642 }
643 
649 void UMLAssociation::setRoleName(const QString &roleName, Uml::RoleType::Enum role)
650 {
651  m_pRole[role]->setName(roleName);
652 }
653 
659 void UMLAssociation::setRoleDoc(const QString &doc, Uml::RoleType::Enum role)
660 {
661  m_pRole[role]->setDoc(doc);
662 }
663 
671 bool UMLAssociation::isRealization(UMLObject* objA, UMLObject* objB) const
672 {
673  bool aIsInterface = false;
674  if (objA && (objA->baseType() == UMLObject::ot_Interface)) {
675  aIsInterface = true;
676  }
677  bool bIsInterface = false;
678  if (objB && (objB->baseType() == UMLObject::ot_Interface)) {
679  bIsInterface = true;
680  }
681  return (m_AssocType == Uml::AssociationType::Generalization) &&
682  (aIsInterface || bIsInterface);
683 }
684 
691 void UMLAssociation::init(Uml::AssociationType::Enum type, UMLObject *roleAObj, UMLObject *roleBObj)
692 {
693  m_AssocType = type;
694  m_BaseType = ot_Association;
695  m_Name = "";
696  m_bOldLoadMode = false;
697  nrof_parent_widgets = -1;
698  if (!UMLApp::app()->document()->loading()) {
699  m_pUMLPackage = UMLApp::app()->document()->currentRoot();
700  }
701  m_pRole[RoleType::A] = new UMLRole (this, roleAObj, RoleType::A);
702  m_pRole[RoleType::B] = new UMLRole (this, roleBObj, RoleType::B);
703 }
704 
705 #include "association.moc"
Uml::AssociationType::Aggregation
Definition: basictypes.h:101
UMLAssociation::getOldLoadMode
bool getOldLoadMode() const
Return the backward compatibility flag for loading files.
Definition: association.cpp:580
UMLAssociation::getObject
UMLObject * getObject(Uml::RoleType::Enum role) const
Returns the UMLObject assigned to the given role.
Definition: association.cpp:476
UMLAssociation::m_pRole
UMLRole * m_pRole[2]
Definition: association.h:90
UMLObject::setName
virtual void setName(const QString &strName)
Set the UMLObject's name.
Definition: umlobject.cpp:168
UMLAssociation::toString
QString toString() const
Returns a String representation of this UMLAssociation.
Definition: association.cpp:111
UMLAssociation::getRoleId
Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const
Returns the ID of the UMLObject assigned to the given role.
Definition: association.cpp:510
UniqueID::init
void init()
Reinitialize the unique ID counter.
Definition: uniqueid.cpp:37
UMLAssociation::m_bOldLoadMode
bool m_bOldLoadMode
Definition: association.h:93
Uml::AssociationType::Generalization
Definition: basictypes.h:100
UniqueID::gen
Uml::ID::Type gen()
MAIN FUNCTION: Return a new unique ID.
Definition: uniqueid.cpp:26
UMLRole::multiplicity
QString multiplicity() const
Returns the multiplicity assigned to the role.
Definition: umlrole.cpp:96
UMLObject::loadFromXMI
virtual bool loadFromXMI(QDomElement &element)
This method loads the generic parts of the XMI common to most model classes.
Definition: umlobject.cpp:914
association.h
UMLAssociation::setAssociationType
void setAssociationType(Uml::AssociationType::Enum assocType)
Sets the assocType of the UMLAssociation.
Definition: association.cpp:589
Uml::RoleType::A
Definition: basictypes.h:209
Uml::Visibility::Enum
Enum
Definition: basictypes.h:56
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Returns the visibility of the object.
Definition: umlobject.cpp:435
Uml::AssociationType::UniAssociation
Definition: basictypes.h:112
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Function for comparing tags in XMI files.
Definition: umldoc.cpp:3030
UMLAssociation::setRoleDoc
void setRoleDoc(const QString &doc, Uml::RoleType::Enum role)
Sets the documentation on the given role in the association.
Definition: association.cpp:659
umlrole.h
UMLObject::setVisibility
void setVisibility(Uml::Visibility::Enum visibility)
Sets the visibility of the object.
Definition: umlobject.cpp:445
UMLRole::setObject
void setObject(UMLObject *obj)
Sets the UMLObject playing the role in the association.
Definition: umlrole.cpp:106
Uml::AssociationType::Child2Category
Definition: basictypes.h:118
Uml::RoleType::B
Definition: basictypes.h:210
UMLApp::app
static UMLApp * app()
Get the last created instance of this class.
Definition: uml.cpp:206
UMLObject::init
void init()
Initializes key variables of the class.
Definition: umlobject.cpp:96
Uml::AssociationType::toStringI18n
QString toStringI18n(Enum item)
Converts a AssociationType to its string representation.
Definition: basictypes.cpp:323
uWarning
#define uWarning()
Definition: debug_utils.h:97
Uml::ProgrammingLanguage::Reserved
Definition: basictypes.h:262
classifier.h
UMLApp::document
UMLDoc * document() const
Returns a pointer to the current document connected to the KMainWindow instance.
Definition: uml.cpp:872
UMLAssociation::setChangeability
void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
Sets the changeability of the given role of the UMLAssociation.
Definition: association.cpp:628
Model_Utils::convert_OT_MT
Uml::ModelType::Enum convert_OT_MT(UMLObject::ObjectType ot)
Return the Model_Type which corresponds to the given ObjectType.
Definition: model_utils.cpp:1602
model_utils.h
debug_utils.h
UMLAssociation::setMultiplicity
void setMultiplicity(const QString &multi, Uml::RoleType::Enum role)
Sets the multiplicity of the given role of the UMLAssociation.
Definition: association.cpp:638
Uml::AssociationType::Dependency
Definition: basictypes.h:102
UMLAssociation::resolveRef
virtual bool resolveRef()
Resolve types.
Definition: association.cpp:137
UMLObject
This class is the non-graphical version of UMLWidget.
Definition: umlobject.h:41
UMLAssociation
This class contains the non-graphic representation of an association.
Definition: association.h:32
UMLRole::setChangeability
void setChangeability(Uml::Changeability::Enum value)
Sets the changeability of the role.
Definition: umlrole.cpp:128
UMLAssociation::setObject
void setObject(UMLObject *obj, Uml::RoleType::Enum role)
Sets the UMLObject playing the given role in the association.
Definition: association.cpp:608
UMLObject::resolveRef
virtual bool resolveRef()
Resolve referenced objects (if any.) Needs to be called after all UML objects are loaded from file...
Definition: umlobject.cpp:709
UMLAssociation::UMLAssociation
UMLAssociation(Uml::AssociationType::Enum type, UMLObject *roleA, UMLObject *roleB)
Sets up an association.
Definition: association.cpp:42
Uml::RoleType::Enum
Enum
Definition: basictypes.h:208
Uml::Changeability::fromInt
Enum fromInt(int item)
Convert a integer item into Changeability representation.
Definition: basictypes.cpp:639
UMLApp::executeCommand
void executeCommand(QUndoCommand *cmd)
Execute a command and pushit in the stack.
Definition: uml.cpp:3077
UMLAssociation::getAssocType
Uml::AssociationType::Enum getAssocType() const
Returns the AssociationType::Enum of the UMLAssociation.
Definition: association.cpp:103
UMLObject::setDoc
void setDoc(const QString &d)
Sets the documentation for the object.
Definition: umlobject.cpp:424
UMLAssociation::changeability
Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const
Returns the changeability.
Definition: association.cpp:518
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:99
Uml::AssociationType::Association
Definition: basictypes.h:103
DEBUG
#define DEBUG(src)
Definition: debug_utils.h:101
UMLAssociation::setOldLoadMode
void setOldLoadMode(bool value=true)
Set the attribute m_bOldLoadMode.
Definition: association.cpp:572
UMLAssociation::m_AssocType
Uml::AssociationType::Enum m_AssocType
Definition: association.h:91
Uml::AssociationType::Realization
Definition: basictypes.h:111
Uml::AssociationType::fromInt
Enum fromInt(int item)
Convert a integer item into ProgrammingLanguage representation.
Definition: basictypes.cpp:429
UMLRole::object
UMLObject * object() const
Returns the UMLObject assigned to the role.
Definition: umlrole.cpp:76
UMLObject::emitModified
void emitModified()
Forces the emission of the modified signal.
Definition: umlobject.cpp:354
UMLAssociation::getUMLRole
UMLRole * getUMLRole(Uml::RoleType::Enum role) const
Get the underlying UMLRole object for the given role.
Definition: association.cpp:563
UMLAssociation::~UMLAssociation
virtual ~UMLAssociation()
Standard destructor.
Definition: association.cpp:68
Uml::AssociationType::Composition
Definition: basictypes.h:110
Uml::ID::Type
std::string Type
Definition: basictypes.h:317
Model_Utils::isCommonXMIAttribute
bool isCommonXMIAttribute(const QString &tag)
Return true if the given tag is a one of the common XMI attributes, such as: "name" | "visibility" | ...
Definition: model_utils.cpp:503
Uml::CmdChangeMultiplicity
Definition: cmd_changeMultiplicity.h:22
folder.h
UMLObject::baseType
ObjectType baseType() const
Returns the type of the object.
Definition: umlobject.cpp:366
UMLAssociation::nrof_parent_widgets
int nrof_parent_widgets
Definition: association.h:86
Uml::Changeability::Enum
Enum
Definition: basictypes.h:175
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:176
UMLAssociation::load
bool load(QDomElement &element)
Creates the or XMI element including its role objects...
Definition: association.cpp:209
UMLObject::ot_Interface
Definition: umlobject.h:53
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1048
UMLDoc::findObjectById
UMLObject * findObjectById(Uml::ID::Type id)
Used to find a reference to a UMLObject by its ID.
Definition: umldoc.cpp:766
UMLObject::ot_Association
Definition: umlobject.h:57
UMLObject::m_pUMLPackage
UMLPackage * m_pUMLPackage
package the object belongs to if applicable
Definition: umlobject.h:173
UMLObject::save
QDomElement save(const QString &tag, QDomDocument &qDoc)
Auxiliary to saveToXMI.
Definition: umlobject.cpp:808
cmds.h
UMLAssociation::saveToXMI
void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
Creates the or XMI element including its role objects...
Definition: association.cpp:158
umldoc.h
Uml::ModelType::toString
QString toString(Enum item)
Convert ModelType item into QString representation.
Definition: basictypes.cpp:39
UMLRole
This class contains the non-graphic representation of an association role.
Definition: umlrole.h:24
Uml::AssociationType::Unknown
Definition: basictypes.h:120
UMLObject::secondaryId
QString secondaryId() const
Return secondary ID.
Definition: umlobject.cpp:649
UMLAssociation::operator==
bool operator==(const UMLAssociation &rhs) const
Overloaded '==' operator.
Definition: association.cpp:87
Uml::AssociationType::Category2Parent
Definition: basictypes.h:117
uError
#define uError()
Definition: debug_utils.h:96
UMLRole::changeability
Uml::Changeability::Enum changeability() const
Returns the Changeablity of the role.
Definition: umlrole.cpp:86
UMLAssociation::setVisibility
void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role)
Sets the visibility of the given role of the UMLAssociation.
Definition: association.cpp:618
DEBUG_REGISTER
#define DEBUG_REGISTER(src)
Definition: debug_utils.h:102
Uml::AssociationType::Relationship
Definition: basictypes.h:119
UMLAssociation::getRoleDoc
QString getRoleDoc(Uml::RoleType::Enum role) const
Returns the documentation assigned to the given role.
Definition: association.cpp:554
UMLAssociation::getRoleName
QString getRoleName(Uml::RoleType::Enum role) const
Returns the name assigned to the role A.
Definition: association.cpp:545
UMLObject::name
QString name() const
Returns a copy of m_name.
Definition: umlobject.cpp:185
UMLObject::setSecondaryId
void setSecondaryId(const QString &id)
Set the secondary ID.
Definition: umlobject.cpp:659
uniqueid.h
UMLAssociation::getObjectId
Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const
Returns the ID of the UMLObject assigned to the given role.
Definition: association.cpp:488
UMLRole::saveToXMI
void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
Creates the XMI element.
Definition: umlrole.cpp:160
UMLAssociation::m_Name
QString m_Name
Definition: association.h:92
Uml::ModelType::Enum
Enum
Definition: basictypes.h:38
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1053
UMLAssociation::setRoleName
void setRoleName(const QString &roleName, Uml::RoleType::Enum role)
Sets the name of the given role of the UMLAssociation.
Definition: association.cpp:649
UMLAssociation::getMultiplicity
QString getMultiplicity(Uml::RoleType::Enum role) const
Returns the multiplicity assigned to the given role.
Definition: association.cpp:536
Uml::AssociationType::Association_Self
Definition: basictypes.h:104
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:319
UMLDoc::currentRoot
UMLFolder * currentRoot()
Return the currently selected root folder.
Definition: umldoc.cpp:1491
UMLPackage::addAssocToConcepts
void addAssocToConcepts(UMLAssociation *assoc)
Adds an existing association to the matching concept in the list of concepts.
Definition: package.cpp:80
uml.h
UMLDoc::rootFolder
UMLFolder * rootFolder(Uml::ModelType::Enum mt)
Return the predefined root folder of the given type.
Definition: umldoc.cpp:2676
DBG_SRC
#define DBG_SRC
Definition: import_utils.cpp:42
UMLObject::doc
QString doc() const
Returns the documentation for the object.
Definition: umlobject.cpp:404
UMLDoc
UMLDoc provides a document object for a document-view model.
Definition: umldoc.h:63
Uml::RoleType::fromInt
Enum fromInt(int item)
Convert a integer item into RoleType representation.
Definition: basictypes.cpp:739
UMLObject::id
virtual Uml::ID::Type id() const
Returns the ID of the object.
Definition: umlobject.cpp:394
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:05:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal