umbrello: umbrello/uml1model/association.h Source File

umbrello 2.31.1 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

association.h
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-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef ASSOCIATION_H
12 #define ASSOCIATION_H
13
14 #include "basictypes.h"
15 #include "umlobject.h"
16
17 #include <QDomDocument>
18 #include <QDomElement>
19
20 class UMLRole;
21
32 class UMLAssociation : public UMLObject
33 {
34 Q_OBJECT
35 friend class AssociationWidget;
36
37 public:
38 UMLAssociation(Uml::AssociationType::Enum type, UMLObject *roleA, UMLObject *roleB);
39 explicit UMLAssociation(Uml::AssociationType::Enum type = Uml::AssociationType::Unknown);
40
41 virtual ~UMLAssociation();
42
43 bool operator==(const UMLAssociation &rhs) const;
44
45 QString toString() const;
46
47 UMLRole * getUMLRole(Uml::RoleType::Enum role) const;
48 Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const;
49 Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const;
50
51 void setAssociationType(Uml::AssociationType::Enum assocType);
52 Uml::AssociationType::Enum getAssocType() const;
53
54 void setObject(UMLObject *obj, Uml::RoleType::Enum role);
55 UMLObject* getObject(Uml::RoleType::Enum role) const;
56
57 void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role);
58 Uml::Visibility::Enum visibility(Uml::RoleType::Enum role) const;
59
60 void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role);
61 Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const;
62
63 void setMultiplicity(const QString &multi, Uml::RoleType::Enum role);
64 QString getMultiplicity(Uml::RoleType::Enum role) const;
65
66 void setRoleName(const QString &roleName, Uml::RoleType::Enum role);
67 QString getRoleName(Uml::RoleType::Enum role) const;
68
69 void setRoleDoc(const QString &doc, Uml::RoleType::Enum role);
70 QString getRoleDoc(Uml::RoleType::Enum role) const;
71
72 void setOldLoadMode(bool value = true);
73 bool getOldLoadMode() const;
74
75 virtual UMLObject* clone() const { return 0; }
76
77 virtual bool resolveRef();
78
79 void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
80
81 virtual bool showPropertiesDialog(QWidget *parent = 0);
82
83 protected:
84
85 bool load1(QDomElement& element);
86
87 // keep track of number of parent widgets
88 int nrof_parent_widgets;
89
90 void init(Uml::AssociationType::Enum type, UMLObject *roleAObj, UMLObject *roleBObj);
91
92 UMLRole * m_pRole[2];
93 Uml::AssociationType::Enum m_AssocType;
94 QString m_Name;
95 bool m_bOldLoadMode;
96
97 private:
98
99 bool isRealization(UMLObject* objA, UMLObject* objB) const;
100 };
101
102 #endif
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
umlrole.h
UMLPackage::addAssocToConcepts
void addAssocToConcepts(UMLAssociation *assoc)
Definition: package.cpp:82
UMLObject::asUMLClassifier
UMLClassifier * asUMLClassifier()
Definition: umlobject.cpp:1308
Uml::ModelType::Enum
Enum
Definition: basictypes.h:75
DEBUG_REGISTER
#define DEBUG_REGISTER(src)
Definition: debug_utils.h:131
AssociationWidget
This class represents an association inside a diagram. Bugs and comments to umbrello-devel@kde....
Definition: associationwidget.h:52
UMLAssociation::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: association.cpp:196
UMLAssociation::setAssociationType
void setAssociationType(Uml::AssociationType::Enum assocType)
Definition: association.cpp:611
UMLAssociation::getRoleName
QString getRoleName(Uml::RoleType::Enum role) const
Definition: association.cpp:567
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
Uml::AssociationType::Reserved
@ Reserved
Definition: basictypes.h:146
Uml::AssociationType::toStringI18n
QString toStringI18n(Enum item)
Definition: basictypes.cpp:356
UMLAssociation::resolveRef
virtual bool resolveRef()
Definition: association.cpp:128
UMLObject::ot_Association
@ ot_Association
Definition: umlobject.h:91
Model_Utils::convert_OT_MT
Uml::ModelType::Enum convert_OT_MT(UMLObject::ObjectType ot)
Definition: model_utils.cpp:2107
UMLAssociation::UMLAssociation
UMLAssociation(Uml::AssociationType::Enum type, UMLObject *roleA, UMLObject *roleB)
Definition: association.cpp:44
AssociationWidget::roleName
QString roleName(Uml::RoleType::Enum role) const
Definition: associationwidget.cpp:945
UMLObject::setSecondaryId
void setSecondaryId(const QString &id)
Definition: umlobject.cpp:688
UMLObject::resolveRef
virtual bool resolveRef()
Definition: umlobject.cpp:738
UMLAssociation::m_bOldLoadMode
bool m_bOldLoadMode
Definition: association.h:95
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:370
Uml::RoleType::A
@ A
Definition: basictypes.h:256
UniqueID::init
void init()
Definition: uniqueid.cpp:45
UMLObject::ot_Interface
@ ot_Interface
Definition: umlobject.h:86
UMLRole::setObject
void setObject(UMLObject *obj)
Definition: umlrole.cpp:123
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1280
UMLObject::emitModified
void emitModified()
Definition: umlobject.cpp:385
association.h
Uml::Changeability::fromInt
Enum fromInt(int item)
Definition: basictypes.cpp:728
UMLObject::umlParent
UMLObject * umlParent() const
Definition: umlobject.cpp:670
cmds.h
UMLAssociation::setMultiplicity
void setMultiplicity(const QString &multi, Uml::RoleType::Enum role)
Definition: association.cpp:660
UMLObject::setName
virtual void setName(const QString &strName)
Definition: umlobject.cpp:192
UMLObject::umlPackage
UMLPackage * umlPackage() const
Definition: umlobject.cpp:645
UMLAssociation::setRoleDoc
void setRoleDoc(const QString &doc, Uml::RoleType::Enum role)
Definition: association.cpp:682
UMLRole::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: umlrole.cpp:177
Uml::AssociationType::Category2Parent
@ Category2Parent
Definition: basictypes.h:141
UMLAssociation::getRoleId
Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const
Definition: association.cpp:532
UMLAssociation::getRoleDoc
QString getRoleDoc(Uml::RoleType::Enum role) const
Definition: association.cpp:576
Uml::ID::Type
std::string Type
Definition: basictypes.h:368
UMLAssociation::clone
virtual UMLObject * clone() const
Definition: association.h:75
Uml::AssociationType::UniAssociation
@ UniAssociation
Definition: basictypes.h:136
UMLAssociation::getMultiplicity
QString getMultiplicity(Uml::RoleType::Enum role) const
Definition: association.cpp:558
UMLAssociation::operator==
bool operator==(const UMLAssociation &rhs) const
Definition: association.cpp:89
model_utils.h
ClassPropertiesDialog
Definition: classpropertiesdialog.h:35
UMLAssociation::m_AssocType
Uml::AssociationType::Enum m_AssocType
Definition: association.h:93
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
Uml::RoleType::fromInt
Enum fromInt(int item)
Definition: basictypes.cpp:828
UMLRole
Definition: umlrole.h:25
Uml::AssociationType::Association_Self
@ Association_Self
Definition: basictypes.h:128
UMLRole::setChangeability
void setChangeability(Uml::Changeability::Enum value)
Definition: umlrole.cpp:145
UMLAssociation::getObject
UMLObject * getObject(Uml::RoleType::Enum role) const
Definition: association.cpp:496
UMLObject::baseType
ObjectType baseType() const
Definition: umlobject.cpp:397
Uml::AssociationType::Unknown
@ Unknown
Definition: basictypes.h:147
UMLAssociation::changeability
Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const
Definition: association.cpp:540
Uml::ModelType::toString
QString toString(Enum item)
Definition: basictypes.cpp:81
UMLAssociation::getUMLRole
UMLRole * getUMLRole(Uml::RoleType::Enum role) const
Definition: association.cpp:585
Uml::Changeability::Enum
Enum
Definition: basictypes.h:221
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:276
Uml::AssociationType::Child2Category
@ Child2Category
Definition: basictypes.h:142
Uml::AssociationType::Aggregation
@ Aggregation
Definition: basictypes.h:125
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1285
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Definition: umlobject.cpp:466
uniqueid.h
UMLAssociation::setObject
void setObject(UMLObject *obj, Uml::RoleType::Enum role)
Definition: association.cpp:630
uWarning
#define uWarning()
Definition: debug_utils.h:124
UMLObject::save1
QDomElement save1(const QString &tag, QDomDocument &qDoc)
Definition: umlobject.cpp:844
folder.h
Uml::AssociationType::Association
@ Association
Definition: basictypes.h:127
Model_Utils::isCommonXMI1Attribute
bool isCommonXMI1Attribute(const QString &tag)
Definition: model_utils.cpp:762
UMLAssociation::toString
QString toString() const
Definition: association.cpp:113
basictypes.h
UMLAssociation::getObjectId
Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const
Definition: association.cpp:508
UMLAssociation::setOldLoadMode
void setOldLoadMode(bool value=true)
Definition: association.cpp:594
Uml::RoleType::B
@ B
Definition: basictypes.h:257
UMLObject::modified
void modified()
UMLObject::secondaryId
QString secondaryId() const
Definition: umlobject.cpp:678
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:123
UMLAssociation::nrof_parent_widgets
int nrof_parent_widgets
Definition: association.h:88
Uml::AssociationType::Generalization
@ Generalization
Definition: basictypes.h:124
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:435
UMLAssociation::setChangeability
void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
Definition: association.cpp:650
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
UMLDoc
Definition: umldoc.h:75
Uml::AssociationType::fromInt
Enum fromInt(int item)
Definition: basictypes.cpp:466
Uml
Definition: basictypes.cpp:37
UMLRole::changeability
Uml::Changeability::Enum changeability() const
Definition: umlrole.cpp:103
UniqueID::gen
Uml::ID::Type gen()
Definition: uniqueid.cpp:34
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Definition: umldoc.cpp:3548
UMLAssociation::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: association.cpp:149
Uml::Visibility::Enum
Enum
Definition: basictypes.h:76
UMLObject::setDoc
void setDoc(const QString &d)
Definition: umlobject.cpp:455
UMLPackage::addObject
bool addObject(UMLObject *pObject)
Definition: package.cpp:128
DEBUG
#define DEBUG(src)
Definition: debug_utils.h:129
classifier.h
uError
#define uError()
Definition: debug_utils.h:123
UMLAssociation::isRealization
bool isRealization(UMLObject *objA, UMLObject *objB) const
Definition: association.cpp:694
UMLObject::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &element)
Definition: umlobject.cpp:954
uml.h
UMLObject::setUMLPackage
bool setUMLPackage(UMLPackage *pPkg)
Definition: umlobject.cpp:615
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
UMLCanvasObject::addAssociationEnd
bool addAssociationEnd(UMLAssociation *assoc)
Definition: umlcanvasobject.cpp:80
UMLAssociation
Sets up association information.
Definition: association.h:33
DBG_SRC
#define DBG_SRC
Definition: import_utils.cpp:43
umlobject.h
UMLAssociation::getAssocType
Uml::AssociationType::Enum getAssocType() const
Definition: association.cpp:105
UMLObject::setVisibility
void setVisibility(Uml::Visibility::Enum visibility)
Definition: umlobject.cpp:476
classpropertiesdialog.h
Uml::AssociationType::Composition
@ Composition
Definition: basictypes.h:134
Uml::CmdChangeMultiplicity
Definition: cmdchangemultiplicity.h:23
UMLAssociation::~UMLAssociation
virtual ~UMLAssociation()
Definition: association.cpp:70
UMLObject::init
void init()
Definition: umlobject.cpp:126
UMLRole::object
UMLObject * object() const
Definition: umlrole.cpp:93
Uml::AssociationType::Dependency
@ Dependency
Definition: basictypes.h:126
UMLAssociation::m_pRole
UMLRole * m_pRole[2]
Definition: association.h:92
UMLApp::executeCommand
void executeCommand(QUndoCommand *cmd)
Definition: uml.cpp:3416
UMLRole::multiplicity
QString multiplicity() const
Definition: umlrole.cpp:113
UMLAssociation::setVisibility
void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role)
Definition: association.cpp:640
UMLRole::toString
QString toString() const
Definition: umlrole.cpp:72
UMLAssociation::load1
bool load1(QDomElement &element)
Definition: association.cpp:208
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1055
Uml::AssociationType::Realization
@ Realization
Definition: basictypes.h:135
UMLAssociation::setRoleName
void setRoleName(const QString &roleName, Uml::RoleType::Enum role)
Definition: association.cpp:672
umldoc.h
UMLAssociation::getOldLoadMode
bool getOldLoadMode() const
Definition: association.cpp:602
Uml::RoleType::Enum
Enum
Definition: basictypes.h:255
UMLAssociation::m_Name
QString m_Name
Definition: association.h:94