umbrello: umbrello/uml1model/classifier.h Source File

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

classifier.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) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10 #ifndef CLASSIFIER_H
11 #define CLASSIFIER_H
12
13 #include "package.h"
14 #include "umlattributelist.h"
15 #include "umloperationlist.h"
16 #include "umlclassifierlistitemlist.h"
17 #include "classifierlistitem.h"
18 #include "umltemplatelist.h"
19 #include "model_utils.h"
20
21 // forward declarations
22 class UMLAssociation;
23 class IDChangeLog;
24 class UMLClassifierSet;
25
39 class UMLClassifier : public UMLPackage
40 {
41 Q_OBJECT
42 public:
43
47 enum ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE };
48
49 explicit UMLClassifier(const QString & name = QString(), Uml::ID::Type id = Uml::ID::None);
50 virtual ~UMLClassifier();
51
52 virtual void copyInto(UMLObject *lhs) const;
53
54 UMLObject* clone() const;
55
56 virtual void setNameCmd(const QString &strName);
57
58 virtual UMLAttribute* createAttribute(const QString &name = QString(),
59 UMLObject *type = 0,
60 Uml::Visibility::Enum vis = Uml::Visibility::Private,
61 const QString &init = QString());
62
63 UMLAttribute* addAttribute(const QString &name, Uml::ID::Type id = Uml::ID::None);
64 UMLAttribute* addAttribute(const QString &name, UMLObject *type, Uml::Visibility::Enum scope);
65
66 bool addAttribute(UMLAttribute* att, IDChangeLog* log = 0,
67 int position = -1);
68
69 int removeAttribute(UMLAttribute *att);
70
71 UMLAttributeList getAttributeList() const;
72 UMLAttributeList getAttributeList(Uml::Visibility::Enum scope) const;
73 UMLAttributeList getAttributeListStatic(Uml::Visibility::Enum scope) const;
74
75 UMLOperation* createOperation(const QString &name = QString(),
76 bool *isExistingOp = 0,
77 Model_Utils::NameAndType_List *params = 0);
78
79 bool addOperation(UMLOperation* op, int position = -1);
80 bool addOperation(UMLOperation* op, IDChangeLog* log);
81
82 UMLOperation * checkOperationSignature(const QString& name,
83 UMLAttributeList opParams,
84 UMLOperation *exemptOp = 0);
85
86 int removeOperation(UMLOperation *op);
87
88 int operations();
89
90 UMLOperationList getOpList(bool includeInherited = false, UMLClassifierSet *alreadyTraversed = 0);
91
92 UMLObject* createTemplate(const QString& name = QString());
93
94 UMLTemplate* addTemplate(const QString &name, Uml::ID::Type id = Uml::ID::None);
95
96 bool addTemplate(UMLTemplate* newTemplate, IDChangeLog* log = 0);
97 bool addTemplate(UMLTemplate* templt, int position);
98
99 int removeTemplate(UMLTemplate* umltemplate);
100
101 UMLTemplate *findTemplate(const QString& name);
102
103 int templates();
104
105 UMLTemplateList getTemplateList() const;
106
107 int takeItem(UMLClassifierListItem* item);
108
109 virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const;
110
111 virtual bool resolveRef();
112
113 UMLOperationList findOperations(const QString &n);
114
115 virtual UMLObject* findChildObjectById(Uml::ID::Type id, bool considerAncestors = false);
116
117 UMLOperation* findOperation(const QString& name,
118 Model_Utils::NameAndType_List params);
119
120 UMLClassifierList findSuperClassConcepts(ClassifierType type = ALL);
121
122 UMLClassifierList findSubClassConcepts(ClassifierType type = ALL);
123
124 virtual bool acceptAssociationType(Uml::AssociationType::Enum type);
125
126 void setBaseType(UMLObject::ObjectType ot);
127
128 bool isInterface() const;
129
130 bool hasAbstractOps();
131 bool hasAssociations();
132 bool hasAttributes();
133 bool hasStaticAttributes();
134 bool hasMethods();
135 bool hasAccessorMethods();
136 bool hasOperationMethods();
137 bool hasVectorFields();
138
144 // UMLClassifierList getPlainAssocChildClassifierList();
145 // UMLClassifierList getAggregateChildClassifierList();
146 // UMLClassifierList getCompositionChildClassifierList();
147
148 virtual UMLClassifierListItem* makeChildObject(const QString& xmiTag);
149
150 virtual UMLAssociationList getUniAssociationToBeImplemented();
151
152 signals:
153
154 void operationAdded(UMLClassifierListItem *);
155 void operationRemoved(UMLClassifierListItem *);
156
157 void templateAdded(UMLClassifierListItem*);
158 void templateRemoved(UMLClassifierListItem*);
159
160 // only applies when (m_Type == ot_Class)
161 void attributeAdded(UMLClassifierListItem*);
162 void attributeRemoved(UMLClassifierListItem*);
163
164 private:
165
166 UMLAssociation *m_pClassAssoc;
167
174 // UMLClassifierList findAssocClassifierObjsInRoles (UMLAssociationList * list);
175
176 protected:
177
178 void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
179
180 virtual bool load1(QDomElement& element);
181
182 };
183
184 #endif // CLASSIFIER_H
IDChangeLog
Definition: idchangelog.h:27
UMLAssociation
Sets up association information.
Definition: association.h:33
UMLAttributeList
Definition: umlattributelist.h:27
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:27
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLClassifierSet
holds set of classifiers for recursive loop detection
Definition: classifier.cpp:50
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
UMLClassifier::addAttribute
UMLAttribute * addAttribute(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: classifier.cpp:810
UMLClassifier::hasOperationMethods
bool hasOperationMethods()
Definition: classifier.cpp:1297
UMLClassifier::clone
UMLObject * clone() const
Definition: classifier.cpp:657
UMLClassifier::hasVectorFields
bool hasVectorFields()
Definition: classifier.cpp:1317
UMLClassifier::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: classifier.cpp:1361
UMLClassifier::takeItem
int takeItem(UMLClassifierListItem *item)
Definition: classifier.cpp:1168
UMLClassifier::addTemplate
UMLTemplate * addTemplate(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: classifier.cpp:1024
UMLClassifier::findChildObjectById
virtual UMLObject * findChildObjectById(Uml::ID::Type id, bool considerAncestors=false)
Definition: classifier.cpp:546
UMLClassifier::templates
int templates()
Definition: classifier.cpp:1135
UMLClassifier::resolveRef
virtual bool resolveRef()
Definition: classifier.cpp:691
UMLClassifier::isInterface
bool isInterface() const
Definition: classifier.cpp:118
UMLClassifier::operationRemoved
void operationRemoved(UMLClassifierListItem *)
UMLClassifier::load1
virtual bool load1(QDomElement &element)
Definition: classifier.cpp:1468
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: classifier.cpp:436
UMLClassifier::operations
int operations()
Definition: classifier.cpp:926
UMLClassifier::makeChildObject
virtual UMLClassifierListItem * makeChildObject(const QString &xmiTag)
Definition: classifier.cpp:1444
UMLClassifier::getTemplateList
UMLTemplateList getTemplateList() const
Definition: classifier.cpp:1148
UMLClassifier::createOperation
UMLOperation * createOperation(const QString &name=QString(), bool *isExistingOp=0, Model_Utils::NameAndType_List *params=0)
Definition: classifier.cpp:236
UMLClassifier::addOperation
bool addOperation(UMLOperation *op, int position=-1)
Definition: classifier.cpp:310
UMLClassifier::m_pClassAssoc
UMLAssociation * m_pClassAssoc
Definition: classifier.h:166
UMLClassifier::setNameCmd
virtual void setNameCmd(const QString &strName)
Definition: classifier.cpp:668
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:609
UMLClassifier::UMLClassifier
UMLClassifier(const QString &name=QString(), Uml::ID::Type id=Uml::ID::None)
Definition: classifier.cpp:64
UMLClassifier::operationAdded
void operationAdded(UMLClassifierListItem *)
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Definition: classifier.cpp:939
UMLClassifier::createTemplate
UMLObject * createTemplate(const QString &name=QString())
Definition: classifier.cpp:393
UMLClassifier::hasStaticAttributes
bool hasStaticAttributes()
Definition: classifier.cpp:1279
UMLClassifier::hasAttributes
bool hasAttributes()
Definition: classifier.cpp:1266
UMLClassifier::~UMLClassifier
virtual ~UMLClassifier()
Definition: classifier.cpp:74
UMLClassifier::createAttribute
virtual UMLAttribute * createAttribute(const QString &name=QString(), UMLObject *type=0, Uml::Visibility::Enum vis=Uml::Visibility::Private, const QString &init=QString())
Definition: classifier.cpp:756
UMLClassifier::hasAccessorMethods
bool hasAccessorMethods()
Definition: classifier.cpp:1289
UMLClassifier::removeTemplate
int removeTemplate(UMLTemplate *umltemplate)
Definition: classifier.cpp:1102
UMLClassifier::setBaseType
void setBaseType(UMLObject::ObjectType ot)
Definition: classifier.cpp:83
UMLClassifier::hasAssociations
bool hasAssociations()
Definition: classifier.cpp:1255
UMLClassifier::removeAttribute
int removeAttribute(UMLAttribute *att)
Definition: classifier.cpp:893
UMLClassifier::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: classifier.cpp:642
UMLClassifier::acceptAssociationType
virtual bool acceptAssociationType(Uml::AssociationType::Enum type)
Definition: classifier.cpp:726
UMLClassifier::getAttributeListStatic
UMLAttributeList getAttributeListStatic(Uml::Visibility::Enum scope) const
Definition: classifier.cpp:487
UMLClassifier::findSubClassConcepts
UMLClassifierList findSubClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:570
UMLClassifier::attributeAdded
void attributeAdded(UMLClassifierListItem *)
UMLClassifier::hasAbstractOps
bool hasAbstractOps()
Definition: classifier.cpp:909
UMLClassifier::ClassifierType
ClassifierType
Definition: classifier.h:47
UMLClassifier::ALL
@ ALL
Definition: classifier.h:47
UMLClassifier::DATATYPE
@ DATATYPE
Definition: classifier.h:47
UMLClassifier::INTERFACE
@ INTERFACE
Definition: classifier.h:47
UMLClassifier::CLASS
@ CLASS
Definition: classifier.h:47
UMLClassifier::findOperation
UMLOperation * findOperation(const QString &name, Model_Utils::NameAndType_List params)
Definition: classifier.cpp:179
UMLClassifier::hasMethods
bool hasMethods()
Definition: classifier.cpp:1305
UMLClassifier::checkOperationSignature
UMLOperation * checkOperationSignature(const QString &name, UMLAttributeList opParams, UMLOperation *exemptOp=0)
Definition: classifier.cpp:134
UMLClassifier::removeOperation
int removeOperation(UMLOperation *op)
Definition: classifier.cpp:370
UMLClassifier::templateAdded
void templateAdded(UMLClassifierListItem *)
UMLClassifier::templateRemoved
void templateRemoved(UMLClassifierListItem *)
UMLClassifier::findOperations
UMLOperationList findOperations(const QString &n)
Definition: classifier.cpp:522
UMLClassifier::attributeRemoved
void attributeRemoved(UMLClassifierListItem *)
UMLClassifier::getUniAssociationToBeImplemented
virtual UMLAssociationList getUniAssociationToBeImplemented()
Definition: classifier.cpp:1325
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: classifier.cpp:998
UMLClassifier::findTemplate
UMLTemplate * findTemplate(const QString &name)
Definition: classifier.cpp:1119
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:80
UMLObject::init
void init()
Definition: umlobject.cpp:126
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
UMLOperation
Definition: operation.h:25
UMLPackage
Non-graphical information for a Package.
Definition: package.h:33
UMLTemplate
Sets up template information.
Definition: template.h:27
classifierlistitem.h
model_utils.h
Model_Utils::NameAndType_List
QLinkedList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:126
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:106
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59
Uml::Visibility::Private
@ Private
Definition: basictypes.h:61
package.h
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:18
umlattributelist.h
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
umlclassifierlistitemlist.h
umloperationlist.h
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:18
umltemplatelist.h
UMLTemplateList
QList< UMLTemplate * > UMLTemplateList
Definition: umltemplatelist.h:18