umbrello: umbrello/codegenerators/classifiercodedocument.h Source File

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

classifiercodedocument.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3
4 SPDX-FileCopyrightText: 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov>
5 SPDX-FileCopyrightText: 2004-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6*/
7
8#ifndef CLASSIFIERCODEDOCUMENT_H
9#define CLASSIFIERCODEDOCUMENT_H
10
11#include "classifier.h"
12#include "codeaccessormethod.h"
13#include "codedocument.h"
14#include "codeoperation.h"
15#include "codeclassfield.h"
16#include "codeclassfieldlist.h"
17#include "umlassociationlist.h"
18
19#include <QMap>
20#include <QList>
21#include <QString>
22
23
28 class ClassifierCodeDocument : public CodeDocument
29{
30 friend class HierarchicalCodeBlock;
31 Q_OBJECT
32public:
33
34 // Constructors/Destructors
35
36 explicit ClassifierCodeDocument(UMLClassifier * parent);
37 virtual ~ClassifierCodeDocument();
38
39 bool addCodeClassField(CodeClassField * add_object);
40
41 bool removeCodeClassField(CodeClassField * remove_object);
42
43 CodeClassFieldList* getCodeClassFieldList();
44
45 // some Utility methods
46
47 bool parentIsInterface() const;
48 bool parentIsClass() const;
49
50 bool hasAssociationClassFields() const;
51 bool hasAttributeClassFields() const;
52 bool hasObjectVectorClassFields() const;
53 bool hasClassFields() const;
54
55 QList<const CodeOperation*> getCodeOperations() const;
56
57 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType) const;
58 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType,
59 bool isStatic) const;
60 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType,
61 Uml::Visibility::Enum visibility) const;
62 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType,
63 bool isStatic, Uml::Visibility::Enum visibility) const;
64
65 CodeClassField * findCodeClassFieldFromParentID (Uml::ID::Type id, int role_id = -1);
66
67 UMLClassifier * getParentClassifier() const;
68
69 void addCodeClassFieldMethods(CodeClassFieldList &list);
70
71 virtual void initCodeClassFields();
72
73 virtual void synchronize();
74
78 virtual bool addCodeOperation(CodeOperation *opBlock) = 0;
79
80 virtual void updateContent() = 0;
81
82 virtual void saveToXMI(QXmlStreamWriter& writer);
83 virtual void loadFromXMI(QDomElement &root);
84
85protected:
86
87 void loadClassFieldsFromXMI(QDomElement &childElem);
88
89 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
90 virtual void setAttributesFromNode(QDomElement &element);
91
92 TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag);
93
94 void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent);
95
96 void syncClassFields();
97 void syncNamesToParent();
98
99private:
100
101 CodeClassFieldList m_classfieldVector;
102 UMLClassifier* m_parentclassifier;
103
104 void updateAssociationClassFields(UMLAssociationList &assocList);
105 void updateOperations();
106
111 QMap<UMLObject *, CodeClassField *> m_classFieldMap;
112
113 void init(UMLClassifier *classifier);
114
115public Q_SLOTS:
116
117 void addAttributeClassField(UMLClassifierListItem *at, bool syncToParentIfAdded = true);
118 void addAssociationClassField(UMLAssociation *assoc, bool syncToParentIfAdded = true);
119 void removeAttributeClassField(UMLClassifierListItem *at);
120 void removeAssociationClassField(UMLAssociation *assoc);
121 void addOperation(UMLClassifierListItem *obj);
122 void removeOperation(UMLClassifierListItem *obj);
123 void syncToParent();
124
125};
126
127#endif // CLASSIFIERCODEDOCUMENT_H
ClassifierCodeDocument::removeAssociationClassField
void removeAssociationClassField(UMLAssociation *assoc)
Definition classifiercodedocument.cpp:250
ClassifierCodeDocument::addAssociationClassField
void addAssociationClassField(UMLAssociation *assoc, bool syncToParentIfAdded=true)
Definition classifiercodedocument.cpp:577
ClassifierCodeDocument::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition classifiercodedocument.cpp:740
ClassifierCodeDocument::ClassifierCodeDocument
ClassifierCodeDocument(UMLClassifier *parent)
Definition classifiercodedocument.cpp:34
ClassifierCodeDocument::hasObjectVectorClassFields
bool hasObjectVectorClassFields() const
Definition classifiercodedocument.cpp:127
ClassifierCodeDocument::removeAttributeClassField
void removeAttributeClassField(UMLClassifierListItem *at)
Definition classifiercodedocument.cpp:243
ClassifierCodeDocument::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Definition classifiercodedocument.cpp:727
ClassifierCodeDocument::updateOperations
void updateOperations()
Definition classifiercodedocument.cpp:506
ClassifierCodeDocument::HierarchicalCodeBlock
friend class HierarchicalCodeBlock
Definition classifiercodedocument.h:30
ClassifierCodeDocument::parentIsClass
bool parentIsClass() const
Definition classifiercodedocument.cpp:413
ClassifierCodeDocument::getSpecificClassFields
CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType) const
Definition classifiercodedocument.cpp:52
ClassifierCodeDocument::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition classifiercodedocument.cpp:622
ClassifierCodeDocument::m_parentclassifier
UMLClassifier * m_parentclassifier
Definition classifiercodedocument.h:102
ClassifierCodeDocument::updateContent
virtual void updateContent()=0
ClassifierCodeDocument::syncToParent
void syncToParent()
Definition classifiercodedocument.cpp:533
ClassifierCodeDocument::addAttributeClassField
void addAttributeClassField(UMLClassifierListItem *at, bool syncToParentIfAdded=true)
Definition classifiercodedocument.cpp:202
ClassifierCodeDocument::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition classifiercodedocument.cpp:762
ClassifierCodeDocument::hasAssociationClassFields
bool hasAssociationClassFields() const
Definition classifiercodedocument.cpp:164
ClassifierCodeDocument::addCodeOperation
virtual bool addCodeOperation(CodeOperation *opBlock)=0
ClassifierCodeDocument::loadClassFieldsFromXMI
void loadClassFieldsFromXMI(QDomElement &childElem)
Definition classifiercodedocument.cpp:681
ClassifierCodeDocument::synchronize
virtual void synchronize()
Definition classifiercodedocument.cpp:482
ClassifierCodeDocument::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition classifiercodedocument.cpp:356
ClassifierCodeDocument::getCodeOperations
QList< const CodeOperation * > getCodeOperations() const
Definition classifiercodedocument.cpp:287
ClassifierCodeDocument::updateAssociationClassFields
void updateAssociationClassFields(UMLAssociationList &assocList)
Definition classifiercodedocument.cpp:571
ClassifierCodeDocument::getParentClassifier
UMLClassifier * getParentClassifier() const
Definition classifiercodedocument.cpp:278
ClassifierCodeDocument::findCodeClassFieldFromParentID
CodeClassField * findCodeClassFieldFromParentID(Uml::ID::Type id, int role_id=-1)
Definition classifiercodedocument.cpp:651
ClassifierCodeDocument::addOperation
void addOperation(UMLClassifierListItem *obj)
Definition classifiercodedocument.cpp:305
ClassifierCodeDocument::m_classFieldMap
QMap< UMLObject *, CodeClassField * > m_classFieldMap
Definition classifiercodedocument.h:111
ClassifierCodeDocument::syncNamesToParent
void syncNamesToParent()
Definition classifiercodedocument.cpp:468
ClassifierCodeDocument::m_classfieldVector
CodeClassFieldList m_classfieldVector
Definition classifiercodedocument.h:101
ClassifierCodeDocument::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition classifiercodedocument.cpp:715
ClassifierCodeDocument::getCodeClassFieldList
CodeClassFieldList * getCodeClassFieldList()
Definition classifiercodedocument.cpp:269
ClassifierCodeDocument::hasClassFields
bool hasClassFields() const
Definition classifiercodedocument.cpp:154
ClassifierCodeDocument::parentIsInterface
bool parentIsInterface() const
Definition classifiercodedocument.cpp:421
ClassifierCodeDocument::declareClassFields
void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent)
Definition classifiercodedocument.cpp:381
ClassifierCodeDocument::initCodeClassFields
virtual void initCodeClassFields()
Definition classifiercodedocument.cpp:542
ClassifierCodeDocument::addCodeClassField
bool addCodeClassField(CodeClassField *add_object)
Definition classifiercodedocument.cpp:185
ClassifierCodeDocument::removeCodeClassField
bool removeCodeClassField(CodeClassField *remove_object)
Definition classifiercodedocument.cpp:227
ClassifierCodeDocument::~ClassifierCodeDocument
virtual ~ClassifierCodeDocument()
Definition classifiercodedocument.cpp:42
ClassifierCodeDocument::syncClassFields
void syncClassFields()
Definition classifiercodedocument.cpp:495
ClassifierCodeDocument::hasAttributeClassFields
bool hasAttributeClassFields() const
Definition classifiercodedocument.cpp:173
ClassifierCodeDocument::removeOperation
void removeOperation(UMLClassifierListItem *obj)
Definition classifiercodedocument.cpp:334
ClassifierCodeDocument::init
void init(UMLClassifier *classifier)
Definition classifiercodedocument.cpp:430
CodeClassField
Definition codeclassfield.h:26
CodeClassField::ClassFieldType
ClassFieldType
Definition codeclassfield.h:30
CodeDocument::CodeDocument
CodeDocument()
Definition codedocument.cpp:26
CodeGenObjectWithTextBlocks::CodeGenObjectWithTextBlocks
CodeGenObjectWithTextBlocks(CodeDocument *parent)
Definition codegenobjectwithtextblocks.cpp:28
CodeOperation
Definition codeoperation.h:20
TextBlock
Definition textblock.h:23
UMLAssociation
Sets up association information.
Definition association.h:29
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition classifierlistitem.h:25
UMLClassifier
Information for a non-graphical Concept/Class.
Definition classifier.h:35
classifier.h
codeaccessormethod.h
codeclassfield.h
codeclassfieldlist.h
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition codeclassfieldlist.h:14
codedocument.h
codeoperation.h
Uml::ID::Type
std::string Type
Definition basictypes.h:371
Uml::Visibility::Enum
Enum
Definition basictypes.h:45
visibility
Definition visibility.py:1
umlassociationlist.h
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition umlassociationlist.h:14