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

umlclassifier.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5#ifndef CLASSIFIER_H
6#define CLASSIFIER_H
7
8#include "umlpackage.h"
9#include "umlattributelist.h"
10#include "umloperationlist.h"
11#include "umlclassifierlistitemlist.h"
12#include "umlclassifierlistitem.h"
13#include "umltemplatelist.h"
14#include "model_utils.h"
15
16// forward declarations
17 class UMLAssociation;
18 class IDChangeLog;
19 class UMLClassifierSet;
20
34 class UMLClassifier : public UMLPackage
35{
36 Q_OBJECT
37 public:
38
42 enum ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE };
43
44 explicit UMLClassifier(const QString & name = QString(), Uml::ID::Type id = Uml::ID::None);
45 virtual ~UMLClassifier();
46
47 virtual void copyInto(UMLObject *lhs) const;
48
49 UMLObject* clone() const;
50
51 virtual void setNameCmd(const QString &strName);
52
53 virtual UMLAttribute* createAttribute(const QString &name = QString(),
54 UMLObject *type = nullptr,
55 Uml::Visibility::Enum vis = Uml::Visibility::Private,
56 const QString &init = QString());
57
58 UMLAttribute* addAttribute(const QString &name, Uml::ID::Type id = Uml::ID::None);
59 UMLAttribute* addAttribute(const QString &name, UMLObject *type, Uml::Visibility::Enum scope);
60
61 bool addAttribute(UMLAttribute *att, IDChangeLog *log = nullptr,
62 int position = -1);
63
64 int removeAttribute(UMLAttribute *att);
65
66 UMLAttributeList getAttributeList() const;
67 UMLAttributeList getAttributeList(Uml::Visibility::Enum scope) const;
68 UMLAttributeList getAttributeListStatic(Uml::Visibility::Enum scope) const;
69
70 UMLOperation* createOperation(const QString &name = QString(),
71 bool *isExistingOp = nullptr,
72 Model_Utils::NameAndType_List *params = nullptr);
73
74 bool addOperation(UMLOperation* op, int position = -1);
75 bool addOperation(UMLOperation* op, IDChangeLog* log);
76
77 UMLOperation * checkOperationSignature(const QString& name,
78 UMLAttributeList opParams,
79 UMLOperation *exemptOp = nullptr) const;
80
81 int removeOperation(UMLOperation *op);
82
83 int operations() const;
84
85 UMLOperationList getOperationsList(bool includeInherited = false, UMLClassifierSet *alreadyTraversed = nullptr) const;
86
87 UMLObject* createTemplate(const QString& name = QString());
88
89 UMLTemplate* addTemplate(const QString &name, Uml::ID::Type id = Uml::ID::None);
90
91 bool addTemplate(UMLTemplate *newTemplate, IDChangeLog *log = nullptr);
92 bool addTemplate(UMLTemplate* templt, int position);
93
94 int removeTemplate(UMLTemplate* umltemplate);
95
96 UMLTemplate *findTemplate(const QString& name) const;
97
98 int templates() const;
99
100 UMLTemplateList getTemplateList() const;
101
102 int takeItem(UMLClassifierListItem* item);
103
104 virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const;
105
106 virtual bool resolveRef();
107
108 UMLOperationList findOperations(const QString &n) const;
109
110 virtual UMLObject* findChildObjectById(Uml::ID::Type id,
111 bool considerAncestors = false) const;
112
113 UMLOperation* findOperation(const QString& name,
114 Model_Utils::NameAndType_List params) const;
115
116 UMLClassifierList findSuperClassConcepts(ClassifierType type = ALL) const;
117
118 UMLClassifierList findSubClassConcepts(ClassifierType type = ALL) const;
119
120 virtual bool acceptAssociationType(Uml::AssociationType::Enum type) const;
121
122 void setBaseType(UMLObject::ObjectType ot);
123
124 bool isInterface() const;
125
126 bool hasAbstractOps() const;
127 bool hasAssociations() const;
128 bool hasAttributes() const;
129 bool hasStaticAttributes() const;
130 bool hasMethods() const;
131 bool hasAccessorMethods() const;
132 bool hasOperationMethods() const;
133 bool hasVectorFields() const;
134
140// UMLClassifierList getPlainAssocChildClassifierList();
141// UMLClassifierList getAggregateChildClassifierList();
142// UMLClassifierList getCompositionChildClassifierList();
143
144 virtual UMLClassifierListItem* makeChildObject(const QString& xmiTag);
145
146 void removeObject(UMLObject *pObject);
147
148 virtual UMLAssociationList getUniAssociationToBeImplemented() const;
149
150Q_SIGNALS:
151
152 void operationAdded(UMLClassifierListItem *);
153 void operationRemoved(UMLClassifierListItem *);
154
155 void templateAdded(UMLClassifierListItem*);
156 void templateRemoved(UMLClassifierListItem*);
157
158 // only applies when (m_Type == ot_Class)
159 void attributeAdded(UMLClassifierListItem*);
160 void attributeRemoved(UMLClassifierListItem*);
161
162 private:
163
164 UMLAssociation *m_pClassAssoc;
165
172// UMLClassifierList findAssocClassifierObjsInRoles (UMLAssociationList * list);
173
174 protected:
175
176 void saveToXMI(QXmlStreamWriter& writer);
177
178 virtual bool load1(QDomElement& element);
179
180};
181
182#endif // CLASSIFIER_H
IDChangeLog
Definition: idchangelog.h:22
UMLAssociation
Sets up association information.
Definition: umlassociation.h:29
UMLAttribute
Sets up attribute information.
Definition: umlattribute.h:23
UMLAttributeList
Definition: umlattributelist.h:21
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: umlclassifier.h:35
UMLClassifier::hasVectorFields
bool hasVectorFields() const
Definition: umlclassifier.cpp:1311
UMLClassifier::addAttribute
UMLAttribute * addAttribute(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: umlclassifier.cpp:811
UMLClassifier::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: umlclassifier.cpp:1355
UMLClassifier::clone
UMLObject * clone() const
Definition: umlclassifier.cpp:658
UMLClassifier::removeObject
void removeObject(UMLObject *pObject)
Definition: umlclassifier.cpp:1489
UMLClassifier::takeItem
int takeItem(UMLClassifierListItem *item)
Definition: umlclassifier.cpp:1170
UMLClassifier::addTemplate
UMLTemplate * addTemplate(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: umlclassifier.cpp:1026
UMLClassifier::resolveRef
virtual bool resolveRef()
Definition: umlclassifier.cpp:692
UMLClassifier::isInterface
bool isInterface() const
Definition: umlclassifier.cpp:116
UMLClassifier::operationRemoved
void operationRemoved(UMLClassifierListItem *)
UMLClassifier::load1
virtual bool load1(QDomElement &element)
Definition: umlclassifier.cpp:1514
UMLClassifier::hasAbstractOps
bool hasAbstractOps() const
Definition: umlclassifier.cpp:910
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: umlclassifier.cpp:435
UMLClassifier::hasAssociations
bool hasAssociations() const
Definition: umlclassifier.cpp:1249
UMLClassifier::hasMethods
bool hasMethods() const
Definition: umlclassifier.cpp:1299
UMLClassifier::templates
int templates() const
Definition: umlclassifier.cpp:1137
UMLClassifier::makeChildObject
virtual UMLClassifierListItem * makeChildObject(const QString &xmiTag)
Definition: umlclassifier.cpp:1462
UMLClassifier::getTemplateList
UMLTemplateList getTemplateList() const
Definition: umlclassifier.cpp:1150
UMLClassifier::addOperation
bool addOperation(UMLOperation *op, int position=-1)
Definition: umlclassifier.cpp:308
UMLClassifier::m_pClassAssoc
UMLAssociation * m_pClassAssoc
Definition: umlclassifier.h:164
UMLClassifier::setNameCmd
virtual void setNameCmd(const QString &strName)
Definition: umlclassifier.cpp:669
UMLClassifier::hasStaticAttributes
bool hasStaticAttributes() const
Definition: umlclassifier.cpp:1273
UMLClassifier::operationAdded
void operationAdded(UMLClassifierListItem *)
UMLClassifier::findChildObjectById
virtual UMLObject * findChildObjectById(Uml::ID::Type id, bool considerAncestors=false) const
Definition: umlclassifier.cpp:545
UMLClassifier::acceptAssociationType
virtual bool acceptAssociationType(Uml::AssociationType::Enum type) const
Definition: umlclassifier.cpp:727
UMLClassifier::createTemplate
UMLObject * createTemplate(const QString &name=QString())
Definition: umlclassifier.cpp:392
UMLClassifier::~UMLClassifier
virtual ~UMLClassifier()
Definition: umlclassifier.cpp:72
UMLClassifier::removeTemplate
int removeTemplate(UMLTemplate *umltemplate)
Definition: umlclassifier.cpp:1104
UMLClassifier::setBaseType
void setBaseType(UMLObject::ObjectType ot)
Definition: umlclassifier.cpp:81
UMLClassifier::findSubClassConcepts
UMLClassifierList findSubClassConcepts(ClassifierType type=ALL) const
Definition: umlclassifier.cpp:570
UMLClassifier::removeAttribute
int removeAttribute(UMLAttribute *att)
Definition: umlclassifier.cpp:894
UMLClassifier::hasOperationMethods
bool hasOperationMethods() const
Definition: umlclassifier.cpp:1291
UMLClassifier::findTemplate
UMLTemplate * findTemplate(const QString &name) const
Definition: umlclassifier.cpp:1121
UMLClassifier::hasAttributes
bool hasAttributes() const
Definition: umlclassifier.cpp:1260
UMLClassifier::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: umlclassifier.cpp:642
UMLClassifier::operations
int operations() const
Definition: umlclassifier.cpp:927
UMLClassifier::getAttributeListStatic
UMLAttributeList getAttributeListStatic(Uml::Visibility::Enum scope) const
Definition: umlclassifier.cpp:486
UMLClassifier::attributeAdded
void attributeAdded(UMLClassifierListItem *)
UMLClassifier::getOperationsList
UMLOperationList getOperationsList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=nullptr) const
Definition: umlclassifier.cpp:940
UMLClassifier::ClassifierType
ClassifierType
Definition: umlclassifier.h:42
UMLClassifier::ALL
@ ALL
Definition: umlclassifier.h:42
UMLClassifier::DATATYPE
@ DATATYPE
Definition: umlclassifier.h:42
UMLClassifier::INTERFACE
@ INTERFACE
Definition: umlclassifier.h:42
UMLClassifier::CLASS
@ CLASS
Definition: umlclassifier.h:42
UMLClassifier::getUniAssociationToBeImplemented
virtual UMLAssociationList getUniAssociationToBeImplemented() const
Definition: umlclassifier.cpp:1319
UMLClassifier::findOperation
UMLOperation * findOperation(const QString &name, Model_Utils::NameAndType_List params) const
Definition: umlclassifier.cpp:177
UMLClassifier::findOperations
UMLOperationList findOperations(const QString &n) const
Definition: umlclassifier.cpp:521
UMLClassifier::removeOperation
int removeOperation(UMLOperation *op)
Definition: umlclassifier.cpp:369
UMLClassifier::templateAdded
void templateAdded(UMLClassifierListItem *)
UMLClassifier::templateRemoved
void templateRemoved(UMLClassifierListItem *)
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL) const
Definition: umlclassifier.cpp:609
UMLClassifier::createAttribute
virtual UMLAttribute * createAttribute(const QString &name=QString(), UMLObject *type=nullptr, Uml::Visibility::Enum vis=Uml::Visibility::Private, const QString &init=QString())
Definition: umlclassifier.cpp:757
UMLClassifier::attributeRemoved
void attributeRemoved(UMLClassifierListItem *)
UMLClassifier::hasAccessorMethods
bool hasAccessorMethods() const
Definition: umlclassifier.cpp:1283
UMLClassifier::checkOperationSignature
UMLOperation * checkOperationSignature(const QString &name, UMLAttributeList opParams, UMLOperation *exemptOp=nullptr) const
Definition: umlclassifier.cpp:132
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: umlclassifier.cpp:1000
UMLClassifier::createOperation
UMLOperation * createOperation(const QString &name=QString(), bool *isExistingOp=nullptr, Model_Utils::NameAndType_List *params=nullptr)
Definition: umlclassifier.cpp:234
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: umlclassifierlistitem.h:25
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:22
UMLClassifierSet
holds set of classifiers for recursive loop detection
Definition: umlclassifier.cpp:48
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:76
UMLObject::init
void init()
Definition: umlobject.cpp:122
UMLObject::name
QString name() const
Definition: umlobject.cpp:207
UMLOperation
Definition: umloperation.h:20
UMLPackage
Non-graphical information for a Package.
Definition: umlpackage.h:28
UMLTemplate
Sets up template information.
Definition: umltemplate.h:22
model_utils.h
Model_Utils::NameAndType_List
QList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:124
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:92
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:373
Uml::ID::Type
std::string Type
Definition: basictypes.h:371
Uml::Visibility::Enum
Enum
Definition: basictypes.h:45
Uml::Visibility::Private
@ Private
Definition: basictypes.h:47
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:14
umlattributelist.h
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:14
umlclassifierlistitem.h
umlclassifierlistitemlist.h
umloperationlist.h
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:14
umlpackage.h
umltemplatelist.h
UMLTemplateList
QList< UMLTemplate * > UMLTemplateList
Definition: umltemplatelist.h:15