umbrello 26.03.70-1a62d36 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

umlassociation.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
16 class UMLRole;
17
28 class UMLAssociation : public UMLObject
29{
30 Q_OBJECT
31 friend class AssociationWidget;
32
33 public:
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 nullptr; }
72
73 virtual bool resolveRef();
74
75 void saveToXMI(QXmlStreamWriter& writer);
76
77 virtual bool showPropertiesDialog(QWidget *parent = nullptr);
78
79 protected:
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
97 private:
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: umlassociation.h:29
UMLAssociation::clone
virtual UMLObject * clone() const
Definition: umlassociation.h:71
UMLAssociation::~UMLAssociation
virtual ~UMLAssociation()
Definition: umlassociation.cpp:65
UMLAssociation::setOldLoadMode
void setOldLoadMode(bool value=true)
Definition: umlassociation.cpp:603
UMLAssociation::getMultiplicity
QString getMultiplicity(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:567
UMLAssociation::m_Name
QString m_Name
Definition: umlassociation.h:94
UMLAssociation::resolveRef
virtual bool resolveRef()
Definition: umlassociation.cpp:123
UMLAssociation::m_bOldLoadMode
bool m_bOldLoadMode
Definition: umlassociation.h:95
UMLAssociation::getOldLoadMode
bool getOldLoadMode() const
Definition: umlassociation.cpp:611
UMLAssociation::setRoleDoc
void setRoleDoc(const QString &doc, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:691
UMLAssociation::operator==
bool operator==(const UMLAssociation &rhs) const
Definition: umlassociation.cpp:84
UMLAssociation::setVisibility
void setVisibility(Uml::Visibility::Enum value, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:649
UMLAssociation::isRealization
bool isRealization(UMLObject *objA, UMLObject *objB) const
Definition: umlassociation.cpp:703
UMLAssociation::setAssociationType
void setAssociationType(Uml::AssociationType::Enum assocType)
Definition: umlassociation.cpp:620
UMLAssociation::load1
bool load1(QDomElement &element)
Definition: umlassociation.cpp:215
UMLAssociation::getRoleName
QString getRoleName(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:576
UMLAssociation::getRoleId
Uml::ID::Type getRoleId(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:541
UMLAssociation::setObject
void setObject(UMLObject *obj, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:639
UMLAssociation::getObject
UMLObject * getObject(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:504
UMLAssociation::changeability
Uml::Changeability::Enum changeability(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:549
UMLAssociation::getAssocType
Uml::AssociationType::Enum getAssocType() const
Definition: umlassociation.cpp:100
UMLAssociation::toString
QString toString() const
Definition: umlassociation.cpp:108
UMLAssociation::m_AssocType
Uml::AssociationType::Enum m_AssocType
Definition: umlassociation.h:93
UMLAssociation::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: umlassociation.cpp:144
UMLAssociation::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=nullptr)
Definition: umlassociation.cpp:203
UMLAssociation::getObjectId
Uml::ID::Type getObjectId(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:516
UMLAssociation::m_pRole
UMLRole * m_pRole[2]
Definition: umlassociation.h:92
UMLAssociation::setMultiplicity
void setMultiplicity(const QString &multi, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:669
UMLAssociation::nrof_parent_widgets
int nrof_parent_widgets
Definition: umlassociation.h:88
UMLAssociation::setChangeability
void setChangeability(Uml::Changeability::Enum value, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:659
UMLAssociation::setRoleName
void setRoleName(const QString &roleName, Uml::RoleType::Enum role)
Definition: umlassociation.cpp:681
UMLAssociation::getUMLRole
UMLRole * getUMLRole(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:594
UMLAssociation::getRoleDoc
QString getRoleDoc(Uml::RoleType::Enum role) const
Definition: umlassociation.cpp:585
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