1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3     SPDX-FileCopyrightText: 2003-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef UMLROLE_H
7 #define UMLROLE_H
8 
9 #include "umlobject.h"
10 
11 class UMLAssociation;
12 
13 /**
14  * This class contains the non-graphic representation of an association role.
15  *
16  * @author Brian Thomas <brian.thomas@gsfc.nasa.gov>
17  * @see UMLObject
18  */
19 class UMLRole : public UMLObject
20 {
21     Q_OBJECT
22 public:
23 
24     UMLRole(UMLAssociation * parent, UMLObject * parentUMLObject, Uml::RoleType::Enum role);
25     virtual ~UMLRole();
26 
27     bool operator==(const UMLRole & rhs) const;
28 
29     QString toString() const;
30 
31     void setObject(UMLObject *obj);
32     UMLObject* object() const;
33 
34     void setChangeability(Uml::Changeability::Enum value);
35     Uml::Changeability::Enum changeability() const;
36 
37     void setMultiplicity(const QString &multi);
38     QString multiplicity() const;
39 
40     UMLAssociation * parentAssociation() const;
41 
42     Uml::RoleType::Enum role() const;
43 
clone()44     UMLObject* clone() const { return 0; }
45 
46     void saveToXMI1(QXmlStreamWriter& writer);
47 
48     virtual bool showPropertiesDialog(QWidget *parent = 0);
49 
50 protected:
51 
52     bool load1(QDomElement& element);
53 
54 private:
55 
56     UMLAssociation *           m_pAssoc;
57     Uml::RoleType::Enum        m_role;
58     QString                    m_Multi;
59     Uml::Changeability::Enum   m_Changeability;
60 };
61 
62 #endif
63