umbrello: umbrello/umlmodel/association.h Source File

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

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

association.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2003-2022 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef ASSOCIATION_H
7#define ASSOCIATION_H
8
9#include "basictypes.h"
10#include "umlobject.h"
11
12#include <QDomDocument>
13#include <QDomElement>
14#include <QXmlStreamWriter>
15
16class UMLRole;
17
28 class UMLAssociation : public UMLObject
29{
30 Q_OBJECT
31 friend class AssociationWidget;
32
33public:
34 UMLAssociation(Uml::AssociationType::Enum type, UMLObject *roleA, UMLObject *roleB);
35 explicit UMLAssociation(Uml::AssociationType::Enum type = Uml::AssociationType::Unknown);
36
37 virtual ~UMLAssociation();
38
39 bool operator==(const UMLAssociation &rhs) const;
40
41 QString toString() const;
42
43 UMLRole * getUMLRole(Uml::RoleType::Enum role) const;
44 Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const;
45 Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const;
46
47 void setAssociationType(Uml::AssociationType::Enum assocType);
48 Uml::AssociationType::Enum getAssocType() const;
49
50 void setObject(UMLObject *obj, Uml::RoleType::Enum role);
51 UMLObject* getObject(Uml::RoleType::Enum role) const;
52
53 void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role);
54 Uml::Visibility::Enum visibility(Uml::RoleType::Enum role) const;
55
56 void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role);
57 Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const;
58
59 void setMultiplicity(const QString &multi, Uml::RoleType::Enum role);
60 QString getMultiplicity(Uml::RoleType::Enum role) const;
61
62 void setRoleName(const QString &roleName, Uml::RoleType::Enum role);
63 QString getRoleName(Uml::RoleType::Enum role) const;
64
65 void setRoleDoc(const QString &doc, Uml::RoleType::Enum role);
66 QString getRoleDoc(Uml::RoleType::Enum role) const;
67
68 void setOldLoadMode(bool value = true);
69 bool getOldLoadMode() const;
70
71 virtual UMLObject* clone() const { return 0; }
72
73 virtual bool resolveRef();
74
75 void saveToXMI(QXmlStreamWriter& writer);
76
77 virtual bool showPropertiesDialog(QWidget *parent = 0);
78
79protected:
80
81 bool load1(QDomElement& element);
82
83 // keep track of number of parent widgets
84 // @todo The UMLAssocation should continue to exist when no AssociationWidget exists.
85 // We do not yet have the means to delete the UMLAssocation because it is not
86 // represented in the list view. For the time being it is deleted when the last
87 // AssociationWidget representing it is deleted.
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
97private:
98
99 bool isRealization(UMLObject* objA, UMLObject* objB) const;
100};
101
102#endif
basictypes.h
AssociationWidget
This class represents an association inside a diagram. Bugs and comments to umbrello-devel@kde....
Definition: associationwidget.h:47
UMLAssociation
Sets up association information.
Definition: association.h:29
UMLAssociation::clone
virtual UMLObject * clone() const
Definition: association.h:71
UMLAssociation::~UMLAssociation
virtual ~UMLAssociation()
Definition: association.cpp:66
UMLAssociation::setOldLoadMode
void setOldLoadMode(bool value=true)
Definition: association.cpp:604
UMLAssociation::getMultiplicity
QString getMultiplicity(Uml::RoleType::Enum role) const
Definition: association.cpp:568
UMLAssociation::m_Name
QString m_Name
Definition: association.h:94
UMLAssociation::resolveRef
virtual bool resolveRef()
Definition: association.cpp:124
UMLAssociation::m_bOldLoadMode
bool m_bOldLoadMode
Definition: association.h:95
UMLAssociation::getOldLoadMode
bool getOldLoadMode() const
Definition: association.cpp:612
UMLAssociation::setRoleDoc
void setRoleDoc(const QString &doc, Uml::RoleType::Enum role)
Definition: association.cpp:692
UMLAssociation::operator==
bool operator==(const UMLAssociation &rhs) const
Definition: association.cpp:85
UMLAssociation::setVisibility
void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role)
Definition: association.cpp:650
UMLAssociation::isRealization
bool isRealization(UMLObject *objA, UMLObject *objB) const
Definition: association.cpp:704
UMLAssociation::setAssociationType
void setAssociationType(Uml::AssociationType::Enum assocType)
Definition: association.cpp:621
UMLAssociation::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: association.cpp:204
UMLAssociation::load1
bool load1(QDomElement &element)
Definition: association.cpp:216
UMLAssociation::getRoleName
QString getRoleName(Uml::RoleType::Enum role) const
Definition: association.cpp:577
UMLAssociation::getRoleId
Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const
Definition: association.cpp:542
UMLAssociation::setObject
void setObject(UMLObject *obj, Uml::RoleType::Enum role)
Definition: association.cpp:640
UMLAssociation::getObject
UMLObject * getObject(Uml::RoleType::Enum role) const
Definition: association.cpp:505
UMLAssociation::changeability
Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const
Definition: association.cpp:550
UMLAssociation::getAssocType
Uml::AssociationType::Enum getAssocType() const
Definition: association.cpp:101
UMLAssociation::toString
QString toString() const
Definition: association.cpp:109
UMLAssociation::m_AssocType
Uml::AssociationType::Enum m_AssocType
Definition: association.h:93
UMLAssociation::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: association.cpp:145
UMLAssociation::getObjectId
Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const
Definition: association.cpp:517
UMLAssociation::m_pRole
UMLRole * m_pRole[2]
Definition: association.h:92
UMLAssociation::setMultiplicity
void setMultiplicity(const QString &multi, Uml::RoleType::Enum role)
Definition: association.cpp:670
UMLAssociation::nrof_parent_widgets
int nrof_parent_widgets
Definition: association.h:88
UMLAssociation::setChangeability
void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
Definition: association.cpp:660
UMLAssociation::setRoleName
void setRoleName(const QString &roleName, Uml::RoleType::Enum role)
Definition: association.cpp:682
UMLAssociation::getUMLRole
UMLRole * getUMLRole(Uml::RoleType::Enum role) const
Definition: association.cpp:595
UMLAssociation::getRoleDoc
QString getRoleDoc(Uml::RoleType::Enum role) const
Definition: association.cpp:586
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:431
UMLObject::init
void init()
Definition: umlobject.cpp:122
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Definition: umlobject.cpp:462
UMLRole
Definition: umlrole.h:20
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:92
Uml::AssociationType::Unknown
@ Unknown
Definition: basictypes.h:116
Uml::Changeability::Enum
Enum
Definition: basictypes.h:202
Uml::ID::Type
std::string Type
Definition: basictypes.h:371
Uml::RoleType::Enum
Enum
Definition: basictypes.h:236
Uml::Visibility::Enum
Enum
Definition: basictypes.h:45
umlobject.h